Move the mailbox@ string to a MailboxAccount constant.
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 3 Sep 2018 00:47:34 +0000 (20:47 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 3 Sep 2018 00:47:34 +0000 (20:47 -0400)
config.go
pop3.go

index a825cd22d69ca1d3e97c69a3cc1c2f58ec27b724..1ed9d5a00c3becd3ce31e89fbb11fc02aad16fbc 100644 (file)
--- a/config.go
+++ b/config.go
@@ -14,6 +14,8 @@ type Config struct {
        Servers []Server
 }
 
+const MailboxAccount = "mailbox@"
+
 type Server struct {
        // Domain is the second component of a mail address: <local-part@domain.com>.
        Domain string
diff --git a/pop3.go b/pop3.go
index 01b753cbbcb5b157ba27c742f10e8e0cffd4adab..ba5fd36aa7879b419de42e490639fb4fb2628914 100644 (file)
--- a/pop3.go
+++ b/pop3.go
@@ -98,7 +98,7 @@ func (server *pop3Server) Name() string {
 
 func (server *pop3Server) OpenMailbox(user, pass string) (pop3.Mailbox, error) {
        for _, s := range server.config.Servers {
-               if user == "mailbox@"+s.Domain && pass == s.MailboxPassword {
+               if user == MailboxAccount+s.Domain && pass == s.MailboxPassword {
                        return server.openMailbox(s.MaildropPath)
                }
        }