X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fcommon%2Fdovecot_plugin.rb;h=dfd87494c797642d68614ad3ca8e0a0f5a6169ad;hp=02e92957cf6994df0e01ebc1a67fa4d07ffbe591;hb=203803100b7c270d561e274f7b366c703774a193;hpb=8610295a5340a82a6c95f68fe983fe0ce5a2e382 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