Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added IMPP to the SaveString function of ContactDataObject
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 3 Jul 2016 11:08:52 +0000 (12:08 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 3 Jul 2016 11:08:52 +0000 (12:08 +0100)
source/contacteditor/cdo/ContactDataObject-Save.cpp
source/contacteditor/cdo/ContactDataObject.h
source/tests/xestiaab_contactsave.h

index 9e14252..59b67ad 100644 (file)
@@ -355,10 +355,24 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &BusinessEmailListPref, &BusinessEmailListTokens, 
                SaveData, "work");
 
-       // TODO: Process IMPP.
-       
-       
+       // Process IMPP.
        
+       SaveIMPP(&GeneralIMList, &GeneralIMListAltID, 
+               &GeneralIMListPID, &GeneralIMListType,
+               &GeneralIMListTypeInfo, &GeneralIMListMediatype, 
+               &GeneralIMListPref, &GeneralIMListTokens,
+               SaveData, "");
+       SaveIMPP(&HomeIMList, &HomeIMListAltID, 
+               &HomeIMListPID, &HomeIMListType,
+               &HomeIMListTypeInfo, &HomeIMListMediatype, 
+               &HomeIMListPref, &HomeIMListTokens,
+               SaveData, "home");
+       SaveIMPP(&BusinessIMList, &BusinessIMListAltID, 
+               &BusinessIMListPID, &BusinessIMListType,
+               &BusinessIMListTypeInfo, &BusinessIMListMediatype, 
+               &BusinessIMListPref, &BusinessIMListTokens,
+               SaveData, "work");
+
        // TODO: Process TEL.
        
        
@@ -1303,6 +1317,88 @@ void ContactDataObject::SaveEmail(map<int, wxString> *EmailList, map<int, wxStri
                
 }
 
+void ContactDataObject::SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID, 
+       map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
+       map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype, 
+       map<int, int> *IMListPref, map<int, wxString> *IMListTokens, 
+       wxString *SaveData, wxString DataType){
+
+       wxString ProcessData = "";
+       
+       for (std::map<int, wxString>::iterator IMIter = IMList->begin();
+               IMIter != IMList->end(); IMIter++){
+
+               ProcessData.Append("IMPP");
+                       
+               // Check if there is a value for TYPE.
+               
+               if (DataType.size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append(DataType);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*IMListAltID)[IMIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*IMListAltID)[IMIter->first]);
+                       
+               }
+               
+               // Check if there is a value for MEDIATYPE.
+               
+               if ((*IMListMediatype)[IMIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*IMListMediatype)[IMIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*IMListPID)[IMIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*IMListPID)[IMIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*IMListPref)[IMIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*IMListPref)[IMIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*IMListTokens)[IMIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*IMListTokens)[IMIter->first]);
+                       
+               }
+
+               ProcessData.Append(":");
+               ProcessData.Append((*IMListTypeInfo)[IMIter->first]);
+               ProcessData.Append(":");
+               ProcessData.Append(IMIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+                       
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
+}
+
 void ContactDataObject::SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
        map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
        map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
index b6ef1ba..df84a2a 100644 (file)
@@ -130,6 +130,11 @@ class ContactDataObject{
                map<int, wxString> *EmailListPID, map<int, wxString> *EmailListType,
                map<int, int> *EmailListPref, map<int, wxString> *EmailListTokens, 
                wxString *SaveData, wxString DataType);
+       void SaveIMPP(map<int, wxString> *IMList, map<int, wxString> *IMListAltID, 
+               map<int, wxString> *IMListPID, map<int, wxString> *IMListType,
+               map<int, wxString> *IMListTypeInfo, map<int, wxString> *IMListMediatype, 
+               map<int, int> *IMListPref, map<int, wxString> *IMListTokens, 
+               wxString *SaveData, wxString DataType);
        void SaveLanguage(map<int, wxString> *LanguageList, map<int, wxString> *LanguageListAltID, 
                map<int, wxString> *LanguageListPID, map<int, wxString> *LanguageListType,
                map<int, int> *LangaugeListPref, map<int, wxString> *LanguageListTokens, 
index 8afffd6..f92659b 100644 (file)
@@ -113,6 +113,12 @@ TEST(ContactSave, ContactSaveTests){
        "EMAIL;ALTID=10;PID=20;PREF=40;WONDERFUL=Colour:moo@example.com\n"
        "EMAIL;TYPE=home;ALTID=5;PID=10;PREF=20;PEACE=quiet:moo.home@example.com\n"
        "EMAIL;TYPE=work;ALTID=1;PID=2;PREF=3;BUSINESS=Money:moo.business@example.com\n"
+       "IMPP;ALTID=10;MEDIATYPE=text/plain;PID=20;PREF=40;WONDERFUL=Colour:skype:moo@\n"
+       " example.com\n"
+       "IMPP;TYPE=home;ALTID=20;MEDIATYPE=text/reallyplain;PID=40;PREF=80;PEACE=quiet\n"
+       " :msn:moo.home@example.com\n"
+       "IMPP;TYPE=work;ALTID=98;MEDIATYPE=text/superplain;PID=99;PREF=50;BUSINESS=Mon\n"
+       " ey:xmpp:moo.business@example.com\n"
        "LANG;ALTID=20;PID=40;PREF=80;GELFORN=Great:kw\n"
        "LANG;TYPE=home;ALTID=22;PID=45;PREF=90;LANGUAGE=yes:en\n"
        "LANG;TYPE=work;ALTID=10;PID=15;PREF=20;FFENSTRI=ie:cy\n"
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy