Set mime type for bundle in case of mmsto, sms
authorJihoon Chung <jihoon.chung@samsung.com>
Wed, 26 Dec 2012 00:52:05 +0000 (09:52 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Wed, 26 Dec 2012 02:25:15 +0000 (11:25 +0900)
[Issue#] JIRA (#TDIS-987)
[Problem] mmsto, sms aren't working correctly
[Cause] Way to call sms and mms is changed
[Solution] Remove uri field in case of sms and mms
[SCMRequest] N/A

Change-Id: If3cdaf581a724b7fcca321733921fda59eb50f3b

src/view/common/scheme_action_map.cpp

index b205b50..2d2a46a 100644 (file)
@@ -98,6 +98,7 @@ struct AppSvcConversion {
  */
 struct AppSvcOperation {
     const char* operation;
+    bool needUri;
     std::list<AppSvcConversion> conversions;
 };
 
@@ -106,6 +107,9 @@ typedef std::map<Scheme::Type, AppSvcOperation> AppSvcOperationMap;
 // Regular expressions used to extract appsvc data from scheme
 // TODO what about multiple recipients?
 char const * const REGEX_BODY =         ".*[?&]body=([^&]+).*";
+char const * const REGEX_SMS =           "sms:([^&]+).*";
+char const * const REGEX_MMSTO =        "mmsto:([^&]+).*";
+char const * const REGEX_MAILTO =       "mailto:([^&]+).*";
 char const * const REGEX_TO =           ".*[?&]to=([^&]+).*";
 char const * const REGEX_CC =           ".*[?&]cc=([^&]+).*";
 char const * const REGEX_BCC =          ".*[?&]bcc=([^&]+).*";
@@ -119,6 +123,7 @@ AppSvcOperationMap initializeAppSvcOperations()
     // FILE, HTTP & HTTPS
     AppSvcOperation viewOp;
     viewOp.operation = APPSVC_OPERATION_VIEW;
+    viewOp.needUri = true;
     // no additional data
     ret.insert(std::make_pair(Scheme::FILE, viewOp));
     ret.insert(std::make_pair(Scheme::HTTP, viewOp));
@@ -127,13 +132,17 @@ AppSvcOperationMap initializeAppSvcOperations()
     // SMS
     AppSvcOperation smsOp;
     smsOp.operation = APPSVC_OPERATION_SEND_TEXT;
+    smsOp.needUri = false;
+    smsOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_SMS));
     smsOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TEXT, REGEX_BODY));
     ret.insert(std::make_pair(Scheme::SMS, smsOp));
 
     // MMSTO & MAILTO
     AppSvcOperation sendOp;
     sendOp.operation = APPSVC_OPERATION_SEND;
-    sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_TO));
+    sendOp.needUri = false;
+    sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_MMSTO));
+    sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_MAILTO));
     sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_CC, REGEX_CC));
     sendOp.conversions.push_back(
             AppSvcConversion(APPSVC_DATA_BCC, REGEX_BCC));
@@ -149,6 +158,7 @@ AppSvcOperationMap initializeAppSvcOperations()
     // TEL
     AppSvcOperation telOp;
     telOp.operation = APPSVC_OPERATION_CALL;
+    telOp.needUri = false;
     //telOp.conversions.push_back(
     //      AppSvcConversion(APPSVC_DATA_CONTEXT, REGEX_DATA_CONTEXT)); //TODO
     ret.insert(std::make_pair(Scheme::TEL, telOp));
@@ -222,7 +232,9 @@ bool HandleUri(const char* uri,
         bundle* bundleData = bundle_create();
         LogDebug("appsvc operation " << it->second.operation);
         appsvc_set_operation(bundleData, it->second.operation);
-        appsvc_set_uri(bundleData, uri);
+        if (it->second.needUri) {
+            appsvc_set_uri(bundleData, uri);
+        }
 
         // this is safe as there are no other threads
         CURL* curl = curl_easy_init();