MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / veryShortDisplayStringForAddress

Method veryShortDisplayStringForAddress

src/core/renderer/MCAddressDisplay.cpp:54–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54String * AddressDisplay::veryShortDisplayStringForAddress(Address * address)
55{
56 if ((address->displayName() != NULL) && (address->displayName()->length() > 0)) {
57 Array * components;
58 String * senderName;
59
60 senderName = sanitizeDisplayName(address->displayName());
61 senderName = (String *) senderName->copy()->autorelease();
62
63 senderName->replaceOccurrencesOfString(MCSTR(","), MCSTR(" "));
64 senderName->replaceOccurrencesOfString(MCSTR("'"), MCSTR(" "));
65 senderName->replaceOccurrencesOfString(MCSTR("\""), MCSTR(" "));
66 components = senderName->componentsSeparatedByString(MCSTR(" "));
67 if (components->count() == 0) {
68 return MCLOCALIZEDSTRING(MCSTR("invalid"));
69 }
70 return (String *) components->objectAtIndex(0);
71 }
72 else if (address->mailbox()) {
73 Array * components = address->mailbox()->componentsSeparatedByString(MCSTR("@"));
74 if (components->count() == 0) {
75 return MCSTR("");
76 }
77 return (String *) components->objectAtIndex(0);
78 }
79 else {
80 return MCLOCALIZEDSTRING(MCSTR("invalid"));
81 }
82}
83
84String * AddressDisplay::displayStringForAddresses(Array * addresses)
85{

Callers

nothing calls this directly

Calls 9

objectAtIndexMethod · 0.80
displayNameMethod · 0.45
lengthMethod · 0.45
autoreleaseMethod · 0.45
copyMethod · 0.45
countMethod · 0.45
mailboxMethod · 0.45

Tested by

no test coverage detected