Fixed a bug where it doesn't handle multiple addresses 43/27543/1 accepted/tizen/ivi/20140915.195444 submit/tizen_ivi/20140915.181831
authorJimmy Huang <jimmy.huang@intel.com>
Mon, 15 Sep 2014 18:08:38 +0000 (11:08 -0700)
committerJimmy Huang <jimmy.huang@intel.com>
Mon, 15 Sep 2014 18:12:48 +0000 (11:12 -0700)
When there's more than 1 address in the contact, it didn't construct
the json string properly by appending delimiter, thus the json parser
fails to parse the contact object string.

Change-Id: Idaa152e5692d51e5e9ac8d165ed82e42955977d5
Signed-off-by: Jimmy Huang <jimmy.huang@intel.com>
packaging/phoned.changes
src/obex.cpp

index 59ea458..7944db3 100644 (file)
@@ -1,3 +1,10 @@
+* Mon Sep 15 2014 Jimmy Huang <jimmy.huang@intel.com> accepted/tizen/ivi/20140908.201319-5-g84a14e0
+- Fix FTBFS for x86_64
+- Fixed a bug where it doesn't handle multiple addresses
+
+* Mon Sep 15 2014 Jimmy Huang <jimmy.huang@intel.com> accepted/tizen/ivi/20140908.201319-5-g84a14e0
+- Fixed a bug where it doesn't handle multiple addresses
+
 * Mon Sep 08 2014 Jimmy Huang <jimmy.huang@intel.com> submit/tizen_ivi/20140908.173512-2-ge0fa798
 - Remove underscores in MAC address
 
index 7c0a966..cab83b7 100644 (file)
@@ -554,11 +554,16 @@ void Obex::parseEContactToJsonTizenContact(EContact *econtact, std::string &cont
        contact += "}";
 
        // addresses:
+       bool firstAddress = true;
        contact += ",\"addresses\":[";
        for(int id=E_CONTACT_ADDRESS_HOME; id<=E_CONTACT_ADDRESS_OTHER; id++) {
            EContactAddress *address = (EContactAddress*)e_contact_get(econtact, (EContactField)id);
            if(address) {
-               contact += "{";
+               if (firstAddress)
+                   contact += "{";
+               else
+                   contact += ",{";
+               firstAddress = false;
                contact += "\"isDefault\":\"false\"";
                if(address->country && strcmp(address->country,"")) {
                    contact += ",\"country\":\"";