*/
struct AppSvcOperation {
const char* operation;
+ bool needUri;
std::list<AppSvcConversion> conversions;
};
// 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=([^&]+).*";
// 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));
// 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));
// 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));
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();