From: Steve Brokenshire Date: Sat, 2 Jul 2016 23:25:48 +0000 (+0100) Subject: Added MEMBER to the SaveString function of ContactDataObject X-Git-Tag: release-0.14~24 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=d0c91f73517437d0d9c1ba23e469e1e10e05fc58;p=xestiaab%2F.git Added MEMBER to the SaveString function of ContactDataObject --- diff --git a/source/contacteditor/cdo/ContactDataObject-Save.cpp b/source/contacteditor/cdo/ContactDataObject-Save.cpp index b78bdc0..191355f 100644 --- a/source/contacteditor/cdo/ContactDataObject-Save.cpp +++ b/source/contacteditor/cdo/ContactDataObject-Save.cpp @@ -113,6 +113,17 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ &SourceListMediatype, &SourceListPref, &SourceListTokens, SaveData); + // Process MEMBER (if contact kind is CONTACTKIND_GROUP). + + if (ContactKind == CONTACTKIND_GROUP){ + + SaveMember(&GroupsList, &GroupsListAltID, + &GroupsListPID, &GroupsListType, + &GroupsListMediaType, &GroupsListPref, + &GroupsListTokens, SaveData); + + } + // Process CLIENTPIDMAP. for (std::map::iterator CPIDIter = ClientPIDList.begin(); @@ -799,6 +810,85 @@ void ContactDataObject::SaveSource(map *SourceList, map *GroupsList, std::map *GroupsListAltID, + std::map *GroupsListPID, std::map *GroupsListType, + std::map *GroupsListMediaType, std::map *GroupsListPref, + std::map *GroupsListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::iterator GroupsIter = GroupsList->begin(); + GroupsIter != GroupsList->end(); GroupsIter++){ + + ProcessData.Append("MEMBER"); + + // Check if there is a value for TYPE. + + if ((*GroupsListType)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append((*GroupsListType)[GroupsIter->first]); + + } + + // Check if there is a value for ALTID. + + if ((*GroupsListAltID)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*GroupsListAltID)[GroupsIter->first]); + + } + + // Check if there is a value for MEDIATYPE. + + if ((*GroupsListMediaType)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";MEDIATYPE="); + ProcessData.Append((*GroupsListMediaType)[GroupsIter->first]); + + } + + // Check if there is a value for PID. + + if ((*GroupsListPID)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*GroupsListPID)[GroupsIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*GroupsListPref)[GroupsIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*GroupsListPref)[GroupsIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*GroupsListTokens)[GroupsIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*GroupsListTokens)[GroupsIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(GroupsIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + +} + void ContactDataObject::SaveNickname(map *NicknameList, map *NicknameListAltID, map *NicknameListPID, map *NicknameListType, map *NicknameListLanguage, map *NicknameListPref, diff --git a/source/contacteditor/cdo/ContactDataObject.h b/source/contacteditor/cdo/ContactDataObject.h index 24451f1..b6ef1ba 100644 --- a/source/contacteditor/cdo/ContactDataObject.h +++ b/source/contacteditor/cdo/ContactDataObject.h @@ -106,6 +106,10 @@ class ContactDataObject{ map *SourceListPID, map *SourceListType, map *SourceListMediatype, map *SourceListPref, map *SourceListTokens, wxString *SaveData); + void SaveMember(std::map *GroupsList, std::map *GroupsListAltID, + std::map *GroupsListPID, std::map *GroupsListType, + std::map *GroupsListMediatype, std::map *GroupsListPref, + std::map *GroupsListTokens, wxString *SaveData); void SaveNickname(map *NicknameList, map *NicknameListAltID, map *NicknameListPID, map *NicknameListType, map *NicknameListLanguage, map *NicknameListPref,