1 #ifndef AUTO_CONFIG_H 2 #define AUTO_CONFIG_H 3 4 5 #include <List.h> 6 #include <Node.h> 7 #include <String.h> 8 9 #define INFO_DIR "Mail/ProviderInfo" 10 11 #define ATTR_NAME_POPSERVER "POP Server" 12 #define ATTR_NAME_IMAPSERVER "IMAP Server" 13 #define ATTR_NAME_SMTPSERVER "SMTP Server" 14 #define ATTR_NAME_AUTHPOP "POP Authentication" 15 #define ATTR_NAME_AUTHSMTP "SMTP Authentication" 16 #define ATTR_NAME_POPSSL "POP SSL" 17 #define ATTR_NAME_IMAPSSL "IMAP SSL" 18 #define ATTR_NAME_SMTPSSL "SMTP SSL" 19 #define ATTR_NAME_USERNAME "Username Pattern" 20 21 22 /* 23 ATTR_NAME_AUTHPOP: 24 0 plain text 25 1 APOP 26 27 ATTR_NAME_AUTHSMTP: 28 0 none 29 1 ESMTP 30 2 POP3 before SMTP 31 32 ATTR_NAME_USERNAME: 33 0 username is the email address (default) 34 1 username is the local-part of the email address local-part@domain.net 35 2 no username is proposed 36 */ 37 38 39 40 struct provider_info 41 { 42 BString provider; 43 44 BString pop_server; 45 BString imap_server; 46 BString smtp_server; 47 48 int32 authentification_pop; 49 int32 authentification_smtp; 50 51 int32 ssl_pop; 52 int32 ssl_imap; 53 int32 ssl_smtp; 54 55 int32 username_pattern; 56 }; 57 58 59 class AutoConfig 60 { 61 public: 62 status_t GetInfoFromMailAddress(const char* email, 63 provider_info *info); 64 65 // for debug 66 void PrintProviderInfo(provider_info* pInfo); 67 68 private: 69 status_t GetMXRecord(const char* provider, provider_info *info); 70 status_t GuessServerName(const char* provider, 71 provider_info *info); 72 73 BString ExtractProvider(const char* email); 74 status_t LoadProviderInfo(const BString &provider, provider_info* info); 75 bool ReadProviderInfo(BNode *node, provider_info* info); 76 77 }; 78 79 80 81 #endif 82