]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/common/dovecot_plugin.rb
Replace 'account' with 'user' everywhere.
[mailshears.git] / lib / common / dovecot_plugin.rb
index ab5a40930400af057229ded188d40516cc88b866..02e92957cf6994df0e01ebc1a67fa4d07ffbe591 100644 (file)
@@ -19,11 +19,11 @@ module DovecotPlugin
     end
   end
 
     end
   end
 
-  def describe_account(account)
+  def describe_user(user)
     begin
     begin
-      account_path = get_account_path(account)
-      return account_path
-    rescue NonexistentAccountError => e
+      user_path = get_user_path(user)
+      return user_path
+    rescue NonexistentUserError => e
       return "Doesn't exist: #{e.to_s}"
     end
   end
       return "Doesn't exist: #{e.to_s}"
     end
   end
@@ -45,30 +45,30 @@ module DovecotPlugin
   end
 
 
   end
 
 
-  def get_account_path(account)
-    # Return the filesystem path of this account's mailbox.
-    # Only works if the account exists!
-    if not account.include?('@')
-      msg = "#{account}: Accounts must contain an '@' symbol."
-      raise InvalidAccountError.new(msg)
+  def get_user_path(user)
+    # Return the filesystem path of this user's mailbox.
+    # Only works if the user exists!
+    if not user.include?('@')
+      msg = "#{user}: Users must contain an '@' symbol."
+      raise InvalidUserError.new(msg)
     end
 
     end
 
-    account_parts = account.split('@')
-    user_part = account_parts[0]
-    domain_part = account_parts[1]
+    user_parts = user.split('@')
+    local_part = user_parts[0]
+    domain_part = user_parts[1]
 
     begin
       domain_path = get_domain_path(domain_part)
     rescue NonexistentDomainError
 
     begin
       domain_path = get_domain_path(domain_part)
     rescue NonexistentDomainError
-      raise NonexistentAccountError.new(account)
+      raise NonexistentUserError.new(user)
     end
 
     end
 
-    account_path = File.join(domain_path, user_part)
+    user_path = File.join(domain_path, local_part)
 
 
-    if File.directory?(account_path)
-      return account_path
+    if File.directory?(user_path)
+      return user_path
     else
     else
-      raise NonexistentAccountError.new(account)
+      raise NonexistentUserError.new(user)
     end
   end
 
     end
   end
 
@@ -78,25 +78,25 @@ module DovecotPlugin
   end
 
   def list_domains_users(domains)
   end
 
   def list_domains_users(domains)
-    accounts = []
+    users = []
 
     domains.each do |domain|
       begin
         # Throws a NonexistentDomainError if the domain's path
         # doesn't exist on the filesystem. In this case, we want
 
     domains.each do |domain|
       begin
         # Throws a NonexistentDomainError if the domain's path
         # doesn't exist on the filesystem. In this case, we want
-        # to report zero accounts.
+        # to report zero users.
         domain_path = get_domain_path(domain)
         usernames = Filesystem.get_subdirs(domain_path)
 
         usernames.each do |username|
         domain_path = get_domain_path(domain)
         usernames = Filesystem.get_subdirs(domain_path)
 
         usernames.each do |username|
-          accounts << "#{username}@#{domain}"
+          users << "#{username}@#{domain}"
         end
       rescue NonexistentDomainError
         # Party hard.
       end
     end
 
         end
       rescue NonexistentDomainError
         # Party hard.
       end
     end
 
-    return accounts
+    return users
   end
 
 
   end