Update the livebox_service_provider_name function.
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 30 Jan 2013 07:42:29 +0000 (07:42 +0000)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 30 Jan 2013 07:42:29 +0000 (07:42 +0000)
Change-Id: Iaffea302a7a4b1e0f9bddc80487de122846c7cd7

packaging/liblivebox-service.spec
src/livebox-service.c

index 0b01175..abda310 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-service
 Summary: Service API for gathering installed livebox information.
-Version: 0.3.0
+Version: 0.3.1
 Release: 1
 Group: framework/livebox
 License: Flora License
index 5f638d0..85fc4c0 100644 (file)
@@ -1194,11 +1194,43 @@ EAPI char *livebox_service_pkgname(const char *appid)
 EAPI char *livebox_service_provider_name(const char *lbid)
 {
        char *ret;
+       int stage = 0;
+       int seq = 0;
+       int idx = 0;
+       char *str = "com.samsung.";
 
        if (!lbid)
                return NULL;
 
-       ret = strdup(lbid);
+       while (str[idx] && lbid[idx] && lbid[idx] == str[idx]) {
+               idx++;
+               if (seq < 2 && lbid[idx] == '.') {
+                       stage = idx;
+                       seq++;
+               }
+       }
+
+       if (!str[idx] && lbid[idx]) {
+               /* Inhouse */
+               return strdup(lbid);
+       } else if (seq < 2) {
+               while (seq < 2) {
+                       if (lbid[idx] == '.') {
+                               seq++;
+                       } else if (!lbid[idx]) {
+                               ErrPrint("Invalid lbid: %s\n", lbid);
+                               return NULL;
+                       }
+
+                       idx++;
+               }
+
+               stage = idx;
+       } else {
+               stage++;
+       }
+
+       ret = strdup(lbid + stage);
        if (!ret) {
                ErrPrint("Error: %s\n", strerror(errno));
                return NULL;