| 68 | } |
| 69 | |
| 70 | Address * Address::addressWithIMAPAddress(struct mailimap_address * imap_addr) |
| 71 | { |
| 72 | char * dsp_name; |
| 73 | Address * address; |
| 74 | String * mailbox; |
| 75 | |
| 76 | if (imap_addr->ad_personal_name == NULL) |
| 77 | dsp_name = NULL; |
| 78 | else { |
| 79 | dsp_name = imap_addr->ad_personal_name; |
| 80 | } |
| 81 | |
| 82 | if (imap_addr->ad_host_name == NULL) { |
| 83 | const char * addr; |
| 84 | |
| 85 | if (imap_addr->ad_mailbox_name == NULL) { |
| 86 | addr = ""; |
| 87 | } |
| 88 | else { |
| 89 | addr = imap_addr->ad_mailbox_name; |
| 90 | } |
| 91 | mailbox = String::stringByDecodingMIMEHeaderValue(addr); |
| 92 | if (mailbox == NULL) { |
| 93 | mailbox = MCSTR(""); |
| 94 | } |
| 95 | } |
| 96 | else if (imap_addr->ad_mailbox_name == NULL) { |
| 97 | // fix by Gabor Cselle, (http://gaborcselle.com/), reported 8/16/2009 |
| 98 | mailbox = String::stringWithUTF8Format("@%s", imap_addr->ad_host_name); |
| 99 | } |
| 100 | else { |
| 101 | mailbox = String::stringWithUTF8Format("%s@%s", imap_addr->ad_mailbox_name, imap_addr->ad_host_name); |
| 102 | } |
| 103 | |
| 104 | address = new Address(); |
| 105 | if (dsp_name != NULL) { |
| 106 | address->setDisplayName(String::stringByDecodingMIMEHeaderValue(dsp_name)); |
| 107 | } |
| 108 | address->setMailbox(mailbox); |
| 109 | |
| 110 | return (Address *) address->autorelease(); |
| 111 | } |
| 112 | |
| 113 | Address * Address::addressWithRFC822String(String * RFC822String) |
| 114 | { |
nothing calls this directly
no test coverage detected