| 74 | } |
| 75 | |
| 76 | void MailProvider::fillWithInfo(HashMap * info) |
| 77 | { |
| 78 | Array * imapInfos; |
| 79 | Array * smtpInfos; |
| 80 | Array * popInfos; |
| 81 | HashMap * serverInfo; |
| 82 | |
| 83 | MC_SAFE_RELEASE(mDomainMatch); |
| 84 | if (info->objectForKey(MCSTR("domain-match")) != NULL) { |
| 85 | mDomainMatch = (Array *) info->objectForKey(MCSTR("domain-match"))->retain(); |
| 86 | } |
| 87 | MC_SAFE_RELEASE(mDomainExclude); |
| 88 | if (info->objectForKey(MCSTR("domain-exclude")) != NULL) { |
| 89 | mDomainExclude = (Array *) info->objectForKey(MCSTR("domain-exclude"))->retain(); |
| 90 | } |
| 91 | MC_SAFE_RELEASE(mMailboxPaths); |
| 92 | if (info->objectForKey(MCSTR("mailboxes")) != NULL) { |
| 93 | mMailboxPaths = (HashMap *) info->objectForKey(MCSTR("mailboxes"))->retain(); |
| 94 | } |
| 95 | MC_SAFE_RELEASE(mMxMatch); |
| 96 | if (info->objectForKey(MCSTR("mx-match")) != NULL) { |
| 97 | mMxMatch = (Array *) info->objectForKey(MCSTR("mx-match"))->retain(); |
| 98 | } |
| 99 | |
| 100 | serverInfo = (HashMap *) info->objectForKey(MCSTR("servers")); |
| 101 | if (serverInfo == NULL) { |
| 102 | MCLog("servers key missing from provider %s", MCUTF8DESC(info)); |
| 103 | } |
| 104 | MCAssert(serverInfo != NULL); |
| 105 | imapInfos = (Array *) serverInfo->objectForKey(MCSTR("imap")); |
| 106 | smtpInfos = (Array *) serverInfo->objectForKey(MCSTR("smtp")); |
| 107 | popInfos = (Array *) serverInfo->objectForKey(MCSTR("pop")); |
| 108 | |
| 109 | mImapServices->removeAllObjects(); |
| 110 | mc_foreacharray(HashMap, imapInfo, imapInfos) { |
| 111 | NetService * service = NetService::serviceWithInfo(imapInfo); |
| 112 | mImapServices->addObject(service); |
| 113 | } |
| 114 | |
| 115 | mSmtpServices->removeAllObjects(); |
| 116 | mc_foreacharray(HashMap, smtpInfo, smtpInfos) { |
| 117 | NetService * service = NetService::serviceWithInfo(smtpInfo); |
| 118 | mSmtpServices->addObject(service); |
| 119 | } |
| 120 | |
| 121 | mPopServices->removeAllObjects(); |
| 122 | mc_foreacharray(HashMap, popInfo, popInfos) { |
| 123 | NetService * service = NetService::serviceWithInfo(popInfo); |
| 124 | mPopServices->addObject(service); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | void MailProvider::setIdentifier(String * identifier) |
| 129 | { |
no test coverage detected