Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.25
-Release: 1
+Version: 0.4.26
+Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
}
memset(&query_data, 0x00, sizeof(callhistory_query_s));
+ int validPersonId = 0;
if (ret == CONTACTS_ERROR_NONE) {
contacts_record_get_int(record, _contacts_phone_log.id, &(query_data.calllog_db_id));
contacts_record_get_int(record, _contacts_phone_log.log_type , &logType);
contacts_record_get_int(record, _contacts_phone_log.person_id, &(query_data.person_db_id));
contacts_record_get_str_p(record, _contacts_phone_log.address, &(query_data.phone_number));
+
+ validPersonId = 0;
+ validPersonId = updateValidPersonId(query_data.phone_number);
+ if(validPersonId != -1){
+ query_data.person_db_id = validPersonId;
+ }else{
+ LoggerD("Failed callhistory parser");
+ return false;
+ }
+
contacts_record_get_int(record, _contacts_phone_log.log_time, &time);
contacts_record_get_int(record, _contacts_phone_log.extra_data1, &(query_data.duration_sec));
query_data.calllog_type = static_cast<contacts_phone_log_type_e>(logType);
}
+int CallHistory::updateValidPersonId(char* phoneNum)
+{
+ contacts_query_h query = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_list_h recordList = NULL;
+ int ret = CONTACTS_ERROR_NONE;
+
+ contacts_query_create(_contacts_person_phone_log._uri, &query);
+ contacts_filter_create(_contacts_person_phone_log._uri, &filter);
+ contacts_filter_add_str(filter, _contacts_person_phone_log.address, CONTACTS_MATCH_EXACTLY, phoneNum);
+
+ contacts_query_set_filter(query, filter);
+
+ ret = contacts_query_set_sort(query, _contacts_person_phone_log.address, false);
+ if (ret != CONTACTS_ERROR_NONE) {
+ LoggerD("Invalid callhistory query [" << ret << "]");
+ }
+
+ ret = contacts_db_get_records_with_query(query, 0, 1, &recordList);
+ if (ret != CONTACTS_ERROR_NONE) {
+ contacts_list_destroy(recordList, true);
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+ LoggerD("Invalid callhistory query [" << ret << "]");
+ return -1;
+ }
+
+ unsigned int total = 0;
+ contacts_record_h record = NULL;
+ int validPersonId = 0;
+
+ contacts_list_get_count(recordList, &total);
+
+ for (int i = 0; i < total; i++) {
+ ret = contacts_list_get_current_record_p(recordList, &record);
+
+ if (record == NULL) {
+ ret = contacts_list_next(recordList);
+ if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) {
+ LoggerD("Failed contacts");
+ return -1;
+ } else {
+ continue;
+ }
+ }
+
+ if (ret == CONTACTS_ERROR_NONE) {
+ contacts_record_get_int(record, _contacts_person_phone_log.person_id, &validPersonId);
+ }
+
+ ret = contacts_list_next(recordList);
+ if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) {
+ LoggerD("Failed contacts");
+ return -1;
+ }
+ }
+
+ contacts_list_destroy(recordList, true);
+ contacts_query_destroy(query);
+ contacts_filter_destroy(filter);
+
+ return validPersonId;
+
+}
+
+
unsigned int CallHistory::convertAttrName(std::string &name)
{
std::string attrName("");
private:
bool convertCallHistory(callhistory_query_s *query_log, CallHistoryEntryListPtr &callEntries);
bool parseRecord(contacts_list_h *recordList, CallHistoryEntryListPtr &callEntries);
+ int updateValidPersonId(char* phoneNum);
unsigned int convertAttrName(std::string &name);
std::vector<EventRemoveBatchDataPtr> m_removeBatchEvent;
#include <aul/aul.h>
#include <sstream>
#include <package-manager.h>
+#include <app.h>
+// to get package name by appid
+#include <app_info.h>
+#include <app_manager.h>
+// To get ppid
+#include <unistd.h>
namespace DeviceAPI {
#define OSP_K_APPCONTROL_URI "__OSP_APPCONTROL_URI__"
#define OSP_K_DATACONTROL_PROVIDER "__OSP_DATACONTROL_PROVIDER__"
#define OSP_K_DATACONTROL_REQUEST_TYPE "__OSP_DATACONTROL_REQUEST_TYPE__"
-
#define RESULT_TRUE_FROM_OSP "1"
#define RESULT_FALSE_FROM_OSP "0"
+#define OSP_K_DATACONTROL_PROTOCOL_VERSION "__OSP_DATACONTROL_PROTOCOL_VERSION__"
+#define OSP_K_DATACONTROL_PROTOCOL_VERSION_VALUE "ver_2.1.0.2"
+
+#define DATACONTROL_PROTOCOL_DIR_PARENT "/tmp/osp"
+#define DATACONTROL_PROTOCOL_DIR "/tmp/osp/DataControlRequest"
delete pendingEvent;
}
}
-
}
+
SQLDataControlConsumer::SQLDataControlConsumer()
{
LoggerD("Enter");
m_type = "";;
m_dataId = "";
m_providerId = "";
-
-
+ m_currentAppId = getCurrentApplicationId();
+ createResultDir();
}
SQLDataControlConsumer::~SQLDataControlConsumer()
DPL::Mutex SQLDataControlConsumer::m_mutex;
+std::string SQLDataControlConsumer::getCurrentApplicationId()
+{
+ char *app_id = NULL;
+ std::string appId = "";
+ int parent_pid = getppid();
+ LoggerD("parent pid : " << parent_pid);
+ int ret = app_manager_get_app_id(parent_pid, &app_id);
+
+ if((ret != APP_ERROR_NONE) || (app_id == NULL))
+ {
+ LoggerE("Can not get app id from current pid (" << ret << ")");
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "could not get information about application");
+ }
+ appId = app_id;
+ free(app_id);
+ return appId;
+}
void SQLDataControlConsumer::setType(std::string& type)
{
}
+std::string SQLDataControlConsumer::generateFileName(unsigned int reqId)
+{
+ std::stringstream ssdata;
+ ssdata.str("");
+ ssdata << reqId;
+ std::string parent = DATACONTROL_PROTOCOL_DIR;
+ std::string filename = parent + "/" + m_currentAppId + ssdata.str();
+ return filename;
+}
+
+void SQLDataControlConsumer::saveArrayToFile(std::string filename, RowDataPtr &rowData)
+{
+ std::fstream insertUpdateFile;
+ std::map<std::string, std::string>::iterator it;
+ int strLength = 0;
+ insertUpdateFile.open(filename.c_str(), std::ios::out | std::ios::binary);
+
+ if (!insertUpdateFile.is_open())
+ {
+ LoggerD("fail open" << filename);
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "DataControl IPC Error");
+ }
+
+ for (it = rowData->m_Data.begin(); it != rowData->m_Data.end(); ++it)
+ {
+ strLength = it->first.size();
+ insertUpdateFile.write((const char*)&strLength, sizeof(int));
+ insertUpdateFile.write(it->first.c_str(), strLength);
+
+ strLength = it->second.size();
+ insertUpdateFile.write((const char*)&strLength, sizeof(int));
+ insertUpdateFile.write(it->second.c_str(), strLength);
+ }
+
+ insertUpdateFile.close();
+
+}
void SQLDataControlConsumer::addArrayToBundle(bundle* passData, std::vector<std::string>& array)
{
size_t arraySize = array.size();
WrtDeviceApis::Commons::EventRequestReceiver<EventUpdate>::PostRequest(event);
}
+void SQLDataControlConsumer::createResultDir()
+{
+ struct stat info;
+ memset(&info, 0, sizeof(struct stat));
+
+ int status = lstat(DATACONTROL_PROTOCOL_DIR_PARENT, &info);
+
+ if (status != 0 && errno == ENOENT)
+ {
+ if (mkdir(DATACONTROL_PROTOCOL_DIR_PARENT, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)
+ {
+ LoggerD("make error");
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "result dir could not be created.");
+ }
+ }
+
+ status = lstat(DATACONTROL_PROTOCOL_DIR, &info);
+
+ // already exist
+ if (status == 0)
+ {
+ LoggerD("already exist");
+ return;
+ }
+ else if (errno == ENOENT)
+ {
+ if (mkdir(DATACONTROL_PROTOCOL_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)
+ {
+ LoggerD("make error");
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "result dir could not be created.");
+ }
+ return;
+ }
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "result dir could be error during checking status");
+}
+
void SQLDataControlConsumer::OnRequestReceived(const EventInsertPtr& event)
{
LoggerD("Enter");
int columnSize = rowData->m_Data.size();
std::stringstream counts;
std::string countStr;
+ std::string ipcFilename = generateFileName(reqId);
if (checkReqIdUniqueness(reqId) == false)
{
bundle_add(passData, OSP_K_LAUNCH_TYPE, OSP_V_LAUNCH_TYPE_DATACONTROL);
bundle_add(passData, OSP_K_DATACONTROL_REQUEST_TYPE, reqtypestr.c_str());
bundle_add(passData, OSP_K_DATACONTROL_PROVIDER, m_providerId.c_str());
+ bundle_add(passData, OSP_K_DATACONTROL_PROTOCOL_VERSION, OSP_K_DATACONTROL_PROTOCOL_VERSION_VALUE); // version
queryItem.push_back(dataId); // dataid
- queryItem.push_back(countStr);
+ queryItem.push_back(countStr); // count
+ queryItem.push_back(ipcFilename); // filepath
- std::map<std::string, std::string>::iterator it;
+ //
+/* std::map<std::string, std::string>::iterator it;
for (it = rowData->m_Data.begin(); it != rowData->m_Data.end(); ++it)
{
queryItem.push_back(it->first);
queryItem.push_back(it->second);
- }
-
+ }*/
+
addArrayToBundle(passData, queryItem);
+ saveArrayToFile(ipcFilename, rowData);
+
// FIXEME
// reqid sholud be known
int columnSize = rowData->m_Data.size();
std::stringstream ss, ssreqtype;
std::string reqIdStr, reqtypestr;
+ std::string ipcFilename = generateFileName(reqId);
if (checkReqIdUniqueness(reqId) == false)
bundle_add(passData, OSP_K_LAUNCH_TYPE, OSP_V_LAUNCH_TYPE_DATACONTROL);
bundle_add(passData, OSP_K_DATACONTROL_REQUEST_TYPE, reqtypestr.c_str());
bundle_add(passData, OSP_K_DATACONTROL_PROVIDER, m_providerId.c_str());
+ bundle_add(passData, OSP_K_DATACONTROL_PROTOCOL_VERSION, OSP_K_DATACONTROL_PROTOCOL_VERSION_VALUE);
+
queryItem.push_back(dataId); // dataid
counts << columnSize;
countStr = counts.str();
- queryItem.push_back(countStr);
+ queryItem.push_back(countStr); // count
+ queryItem.push_back(ipcFilename); // filepath
- for (std::map<std::string, std::string>::iterator it= rowData->m_Data.begin();
+/* for (std::map<std::string, std::string>::iterator it= rowData->m_Data.begin();
it != rowData->m_Data.end(); ++it)
{
queryItem.push_back((*it).first); // key - column
queryItem.push_back((*it).second); // value
- }
+ }*/
+ saveArrayToFile(ipcFilename, rowData);
+
}
std::string m_appId;
std::string getApplicationId(const std::string& provId);
+ std::string getCurrentApplicationId();
void addArrayToBundle(bundle* passData, std::vector<std::string>& array);
std::vector<unsigned int> m_currentReqIds;
bool checkReqIdUniqueness(unsigned int reqId);
- void removeReqId(unsigned int reqId);
+ void removeReqId(unsigned int reqId);
+ std::string generateFileName(unsigned int reqId);
+ void saveArrayToFile(std::string filename, RowDataPtr &rowData);
+ void createResultDir();
static DPL::Mutex m_mutex;
protected:
virtual void OnRequestReceived(const EventDeletePtr& event);
virtual void OnRequestReceived(const EventSelectPtr& event);
virtual void OnRequestReceived(const EventUpdatePtr& event);
-
-
-
private:
+ std::string m_currentAppId;
};
if(JSStringIsEqualToUTF8CString(propertyName,m_property[index].name)) {
if(m_property[index].setProperty != NULL) {
if (JSStringIsEqualToUTF8CString(propertyName, MESSAGE_ATTRIBUTE_TO)){
- if (JSValueIsNull(context, value))
+ if (JSValueIsNull(context, value)||JSValueIsUndefined(context, value))
{
- throw TypeMismatchException("Value is null");
+ throw TypeMismatchException("Value is null or undefined");
}
JSUtil::JSArrayToStringVector(context, value);
}
if (JSStringIsEqualToUTF8CString(propertyName, MESSAGE_ATTRIBUTE_CC)){
- if (JSValueIsNull(context, value))
+ if (JSValueIsNull(context, value)||JSValueIsUndefined(context, value))
{
- throw TypeMismatchException("Value is null");
+ throw TypeMismatchException("Value is null or undefined");
}
JSUtil::JSArrayToStringVector(context, value);
}
if (JSStringIsEqualToUTF8CString(propertyName, MESSAGE_ATTRIBUTE_BCC)){
- if (JSValueIsNull(context, value))
+ if (JSValueIsNull(context, value)||JSValueIsUndefined(context, value))
{
- throw TypeMismatchException("Value is null");
+ throw TypeMismatchException("Value is null or undefined");
}
JSUtil::JSArrayToStringVector(context, value);
}
}
}
- //return
- JSClassRef jsClassRef = JSClassCreate(JSMessage::getClassInfo());
- LoggerD("jsClassRef success");
+
JSMessagePrivateObject* priv = new JSMessagePrivateObject(context, msg);
LoggerD("priv success");
- JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast<void*>(priv));
+ JSObjectRef jsObjRef = JSObjectMake(context, JSMessage::getClassRef(), static_cast<void*>(priv));
LoggerD("JSObjectMake success");
- JSClassRelease(jsClassRef);
if (NULL == jsObjRef) {
LoggerE("JSObject creation error");
throw DeviceAPI::Common::UnknownException("JSObject make error");
mimetype);
if (attachment)
{
- JSClassRef jsClassRef = JSClassCreate(getClassInfo());
- LoggerD("jsClassRef success");
JSMessageAttachmentPrivate* priv = new JSMessageAttachmentPrivate(context, attachment);
LoggerD("priv success");
- JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast<void*>(priv));
+ JSObjectRef jsObjRef = JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
LoggerD("JSObjectMake success");
- JSClassRelease(jsClassRef);
if (NULL == jsObjRef) {
LoggerE("object creation error");
throw DeviceAPI::Common::UnknownException("JSObject make error");
}else if(msgType == USERDEFINED_FOLDER){
return JSMessageFolder::FOLDER_NOTSTANDARD;
}else{
- return NULL;
+ return JSMessageFolder::FOLDER_NOTSTANDARD;
}
}
FOLDER_OUTBOX = 2,
FOLDER_DRAFTS = 3,
FOLDER_SENTBOX = 4,
- FOLDER_NOTSTANDARD = 7,
+ FOLDER_NOTSTANDARD = 10,
} MsgFolder_FolerType;
typedef enum
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
- LoggerD(">>> filterSql:[" << filterSql << "]");
+// LOGD(">>> filterSql:[%s]", filterSql.c_str());
return filterSql;
}
}
vector<IMessagePtr> Messaging::querySmsMmsMessages(const std::string& queryString){
- LoggerD("<<< queryString:[" << queryString <<"]");
+// LOGD("<<< queryString:[%s]" ,queryString.c_str());
vector<IMessagePtr> retVal;
std::string tempString = "";
}
vector<IMessagePtr> Messaging::querySmsMmsMessages(const std::string& queryString, const std::string& orderLimitString){
- LoggerD("<<< queryString:[" << queryString <<"]");
- LoggerD("<<< orderLimitString:[" << orderLimitString <<"]");
+// LOGD("<<< queryString:[%s]", queryString.c_str());
+// LOGD("<<< orderLimitString:[%s]", orderLimitString.c_str());
vector<IMessagePtr> retVal;
// MSG_LIST_S message_list = {0, NULL};
}
vector<IConversationPtr> Messaging::querySmsMmsConversation(const std::string& sqlWhereClause, const std::string& orderLimitString){
- LoggerD("sqlWhereClause:[" << sqlWhereClause << "]");
- LoggerD("<<< orderLimitString:[" << orderLimitString <<"]");
+// LOGD("sqlWhereClause:[%s]", sqlWhereClause.c_str());
+// LOGD("<<< orderLimitString:[%s]", orderLimitString.c_str());
std::vector<IConversationPtr> recVec;
// MSG_THREAD_VIEW_LIST_S threadViewList;
}
vector<IConversationPtr> Messaging::queryEmailConversation(const std::string& sqlWhereClause){
- LoggerD("sqlWhereClause:[" << sqlWhereClause << "]");
+// LOGD("sqlWhereClause:[%s]",sqlWhereClause.c_str());
std::vector<IConversationPtr> emailResultVector;
email_mail_list_item_t* mailList = NULL;
}
vector<IMessagePtr> Messaging::queryEmailMessage(const std::string& sqlWhereClause){
- LoggerD("sqlWhereClause:[" << sqlWhereClause << "]");
+// LOGD("sqlWhereClause:[%s]", sqlWhereClause.c_str());
vector<IMessagePtr> emailResultVector;
IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
int messageType = queryGenerator->getMessageType();
switch(messageType){
IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
int messageType = queryGenerator->getMessageType();
switch(messageType){
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
orderLimitSql = queryGenerator->getOrderLimit();
- LoggerD("filterSql:[" << filterSql <<"]");
- LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+// //LOGD("filterSql:[%s]", filterSql.c_str());
+// LOGD("filterSql:[%s]", filterSql.c_str());
+// LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
int messageType = queryGenerator->getMessageType();
if(messageType != -1)
case EMAIL:
LoggerD("message type is EMAIL:[" << messageType <<"]");
emailFilterSql = filterSql + orderLimitSql;
- LoggerD("filterSql:[" << emailFilterSql <<"]");
+// LOGD("filterSql:[%s]", emailFilterSql.c_str());
retVal = queryEmailMessage(emailFilterSql);
break;
if(filterSql.length() == 0)
{
filterSql.append(typeString);
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
}
else
{
filterSql.append(typeAndString);
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
}
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
LoggerD("orderLimitSql.length():[" << orderLimitSql.length() <<"]");
retVal = querySmsMmsMessages(filterSql, orderLimitSql);
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
break;
case MMS:
LoggerD("message type is MMS:[" << messageType <<"]");
if(filterSql.length() == 0)
{
filterSql.append(typeString);
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
}
else
{
filterSql.append(typeAndString);
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
}
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
LoggerD("orderLimitSql.length():[" << orderLimitSql.length() <<"]");
retVal = querySmsMmsMessages(filterSql, orderLimitSql);
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
break;
default:
IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
filter->travel(filterVisitor, 0);
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
int conversationType = queryGenerator->getMessageType();
switch(conversationType){
IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
- LoggerD("filterSql:[" << filterSql <<"]");
- LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
+// LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
result = querySmsMmsConversation(filterSql, orderLimitSql);
break;
}
IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
- LoggerD("filterSql:[" << filterSql <<"]");
- LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
+// LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
result = querySmsMmsConversation(filterSql, orderLimitSql);
break;
}
IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
filter->travel(filterVisitor, 0);
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
int conversationType = queryGenerator->getMessageType();
if(conversationType != -1)
{
queryGenerator->reset(MessageQueryGenerator::MODE_EMAIL);
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
- LoggerD("filterSql:[" << filterSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
result = queryEmailConversation(filterSql);
break;
}
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
orderLimitSql = queryGenerator->getOrderLimit();
- LoggerD("filterSql:[" << filterSql <<"]");
- LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
+// LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
result = querySmsMmsConversation(filterSql, orderLimitSql);
break;
}
filter->travel(filterVisitor, 0);
filterSql = queryGenerator->getQuery();
orderLimitSql = queryGenerator->getOrderLimit();
- LoggerD("filterSql:[" << filterSql <<"]");
- LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+// LOGD("filterSql:[%s]", filterSql.c_str());
+// LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
result = querySmsMmsConversation(filterSql, orderLimitSql);
break;
}
// MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList)
int MessageStorageReader::queryMessage(const std::string& whereClause, const std::string& orderLimit, /*out*/msg_struct_list_s *pMsgList){
- LoggerD("<<< whereClause:[" << whereClause << "]");
+// LOGD("<<< whereClause:[%s]", whereClause.c_str());
// Clear Out Parameter
pMsgList->nCount = 0;
if(orderLimit.length() == 0)
{
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
}
else
{
tmpWhereClause.append(orderLimit);
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
}
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
oStream << tmpWhereClause;
stringSqlQuery = oStream.str();
- LoggerD("stringSqlQuery:[" << stringSqlQuery << "]");
+// LOGD("stringSqlQuery:[%s]", stringSqlQuery.c_str());
msg_error_t err = dbHandle.getTable(stringSqlQuery.c_str(), &rowCnt);
if (err == MSG_ERR_DB_NORECORD) {
std::string stringSqlQuery;
std::string tmpWhereClause;
- LoggerD("<<< whereClause:[" << whereClause << "]");
+// LOGD("<<< whereClause:[%s]",whereClause.c_str());
if(whereClause.length()==0){
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
tmpWhereClause.append("WHERE (B.SMS_CNT > 0 OR B.MMS_CNT > 0) AND A.CONV_ID = B.CONV_ID ");
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
}else{
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
tmpWhereClause.append(whereClause);
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
}
if(orderLimit.length() == 0)
{
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
}
else
{
tmpWhereClause.append(orderLimit);
- LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
}
oStream << "SELECT B.CONV_ID, B.UNREAD_CNT, B.SMS_CNT, B.MMS_CNT, \
oStream << tmpWhereClause;
stringSqlQuery = oStream.str();
- LoggerD("stringSqlQuery:[" << stringSqlQuery << "]");
+// LOGD("stringSqlQuery:[%s]", stringSqlQuery.c_str());
msg_error_t err = dbHandle.getTable(stringSqlQuery.c_str(), &rowCnt);
dbHandle.freeTable();
return MSG_SUCCESS;
} else if (err != MSG_SUCCESS) {
- LoggerD("stringSqlQuery:[" << stringSqlQuery << "]");
+// LOGD("stringSqlQuery:[%s]", stringSqlQuery.c_str());
dbHandle.freeTable();
return err;
}
namespace Options{
-class_definition_options_t TizenOptions =
+class_definition_options_t MessagingOptions =
{
JS_CLASS,
CREATE_INSTANCE,
PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback)
PLUGIN_CLASS_MAP_BEGIN
- PLUGIN_CLASS_MAP_ADD_CLASS(
- WRT_JS_EXTENSION_OBJECT_TIZEN,
- "messaging",
- (js_class_template_getter)DeviceAPI::Messaging::JSMessagingServiceManager::getClassRef,
- NULL)
+ PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
+ "messaging",
+ (js_class_template_getter)DeviceAPI::Messaging::JSMessagingServiceManager::getClassRef,
+ &Options::MessagingOptions)
PLUGIN_CLASS_MAP_ADD_INTERFACE(WRT_JS_EXTENSION_OBJECT_TIZEN,
"Message",
}
+static string ltrim(const string s)
+{
+ string str = s;
+ string::iterator i;
+ for (i = str.begin(); i != str.end(); i++) {
+ if (!isspace(*i)) {
+ break;
+ }
+ }
+ if (i == str.end()) {
+ str.clear();
+ } else {
+ str.erase(str.begin(), i);
+ }
+ return str;
+}
+
+
+static string convertUriToPath(const string str)
+{
+ string result;
+ string schema ("file://");
+ string _str = ltrim(str);
+
+ string _schema = _str.substr(0,schema.size());
+ if(_schema == schema) {
+ result = _str.substr(schema.size());
+ } else {
+ result = _str;
+ }
+ return result;
+}
+
+
void PackageManager::install(string pkgPath, PackageInstallEventCallback* callback)
{
int ret = 0;
return;
}
- ret = package_manager_request_install(request_h, pkgPath.c_str(), &id);
+ ret = package_manager_request_install(request_h, convertUriToPath(pkgPath).c_str(), &id);
if (ret != PACKAGE_MANAGER_ERROR_NONE) {
if (errCallback) {
JSValueRef error =