- 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)
- end
-
- user_parts = user.split('@')
- local_part = user_parts[0]
- domain_part = user_parts[1]
-
- begin
- domain_path = get_domain_path(domain_part)
- rescue NonexistentDomainError
- raise NonexistentUserError.new(user)
- end
-
- user_path = File.join(domain_path, local_part)
-
- return user_path if not existence_check
-
- if File.directory?(user_path)
- return user_path
- else
- raise NonexistentUserError.new(user)
- end
+ def get_user_path(user)
+ # Return the filesystem path of this user's mailbox.
+ domain_path = get_domain_path(user.domain())
+ return File.join(domain_path, user.localpart())