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

Method recipientWithReplyAll

src/core/abstract/MCMessageHeader.cpp:984–1147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982}
983
984Array * MessageHeader::recipientWithReplyAll(bool replyAll, bool includeTo, bool includeCc, Array * senderEmails)
985{
986 bool hasCc;
987 bool hasTo;
988 Set * addedAddresses;
989 Array * toField;
990 Array * ccField;
991 bool containsSender;
992 Array * senderEmailsMailboxes;
993
994 toField = NULL;
995 ccField = NULL;
996
997 hasTo = false;
998 hasCc = false;
999 addedAddresses = new Set();
1000 senderEmailsMailboxes = Array::array();
1001
1002 containsSender = false;
1003 if (senderEmails != NULL) {
1004 mc_foreacharray(Address, address, senderEmails) {
1005 senderEmailsMailboxes->addObject(address->mailbox()->lowercaseString());
1006 }
1007 if (from() != NULL) {
1008 if (senderEmailsMailboxes->containsObject(from()->mailbox()->lowercaseString())) {
1009 containsSender = true;
1010 }
1011 }
1012 if (sender() != NULL) {
1013 if (senderEmailsMailboxes->containsObject(sender()->mailbox()->lowercaseString())) {
1014 containsSender = true;
1015 }
1016 }
1017 }
1018
1019 if (containsSender) {
1020 Array * recipient;
1021
1022 recipient = new Array();
1023 if (to() != NULL) {
1024 for(unsigned int i = 0 ; i < to()->count() ; i ++) {
1025 Address * address = (Address *) to()->objectAtIndex(i);
1026 if (addedAddresses->containsObject(address->mailbox()->lowercaseString())) {
1027 continue;
1028 }
1029 if ((from() != NULL) && address->mailbox()->isEqualCaseInsensitive(from()->mailbox())) {
1030 recipient->addObjectsFromArray(replyTo());
1031 if (replyTo() != NULL) {
1032 for(unsigned int j = 0 ; j < replyTo()->count() ; j ++) {
1033 Address * rtAddress = (Address *) replyTo()->objectAtIndex(j);
1034 if (addedAddresses->containsObject(rtAddress->mailbox()->lowercaseString())) {
1035 continue;
1036 }
1037 addedAddresses->addObject(rtAddress->mailbox()->lowercaseString());
1038 }
1039 }
1040 }
1041 else {

Callers

nothing calls this directly

Calls 11

lowercaseStringMethod · 0.80
objectAtIndexMethod · 0.80
retainMethod · 0.80
releaseMethod · 0.80
containsObjectMethod · 0.45
mailboxMethod · 0.45
countMethod · 0.45
addObjectsFromArrayMethod · 0.45
addObjectMethod · 0.45
autoreleaseMethod · 0.45

Tested by

no test coverage detected