summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-01-30 07:42:29 +0000
committerSung-jae Park <nicesj.park@samsung.com>2013-01-30 07:42:29 +0000
commit6a23ebdd3f54a76f449ed9b3b5b6e389db97ef61 (patch)
treeb233b90e21b7eebb9da036a28ee34714acda961d
parent716f2669118fd879b79e1521bd1cf2878e79e37a (diff)
downloadlivebox-service-6a23ebdd3f54a76f449ed9b3b5b6e389db97ef61.tar.gz
livebox-service-6a23ebdd3f54a76f449ed9b3b5b6e389db97ef61.tar.bz2
livebox-service-6a23ebdd3f54a76f449ed9b3b5b6e389db97ef61.zip
Update the livebox_service_provider_name function.
Change-Id: Iaffea302a7a4b1e0f9bddc80487de122846c7cd7
-rw-r--r--packaging/liblivebox-service.spec2
-rw-r--r--src/livebox-service.c34
2 files changed, 34 insertions, 2 deletions
diff --git a/packaging/liblivebox-service.spec b/packaging/liblivebox-service.spec
index 0b01175..abda310 100644
--- a/packaging/liblivebox-service.spec
+++ b/packaging/liblivebox-service.spec
@@ -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
diff --git a/src/livebox-service.c b/src/livebox-service.c
index 5f638d0..85fc4c0 100644
--- a/src/livebox-service.c
+++ b/src/livebox-service.c
@@ -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;