From: Michael Orlitzky Date: Fri, 30 Oct 2015 00:57:44 +0000 (-0400) Subject: Allow the getting of a dovecot user path even if it doesn't exist. X-Git-Tag: 0.0.1~52 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=203803100b7c270d561e274f7b366c703774a193;p=mailshears.git Allow the getting of a dovecot user path even if it doesn't exist. --- diff --git a/lib/common/dovecot_plugin.rb b/lib/common/dovecot_plugin.rb index 02e9295..dfd8749 100644 --- a/lib/common/dovecot_plugin.rb +++ b/lib/common/dovecot_plugin.rb @@ -45,9 +45,10 @@ module DovecotPlugin end - def get_user_path(user) - # Return the filesystem path of this user's mailbox. - # Only works if the user exists! + def get_user_path(user, existence_check = true) + # Return the filesystem path of this user's mailbox. With + # existence_check = true, it only works if the user exists! + # We always require that the domain exists. if not user.include?('@') msg = "#{user}: Users must contain an '@' symbol." raise InvalidUserError.new(msg) @@ -65,6 +66,8 @@ module DovecotPlugin user_path = File.join(domain_path, local_part) + return user_path if not existence_check + if File.directory?(user_path) return user_path else