Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.40
+Version: 0.4.41
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
ThrowMsg(UnknownException, "Fail to get rotpath");
}
- std::string sharedURI = TIZENAPIS_APP_FILE_SCHEME + std::string(root_path) + TIZENAPIS_APP_SLASH + TIZENAPIS_APP_SHARED;
+ std::string sharedURI = TIZENAPIS_APP_FILE_SCHEME + std::string(root_path) + TIZENAPIS_APP_SLASH + TIZENAPIS_APP_SHARED + TIZENAPIS_APP_SLASH;
free(pkg_name);
pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_h);
#include <download.h>
#include <Logger.h>
+#include <TimeTracer.h>
#include <FilesystemUtils.h>
#include "DownloadState.h"
#include "DownloadNetworkType.h"
#include "DownloadManager.h"
+#ifdef ENABLE_TIME_TRACER
+#define _P(T, x) \
+ (TIME_TRACER_ITEM_BEGIN("DOWNLOAD_" #T "_PLATFORM", 0), x); \
+ TIME_TRACER_ITEM_END("DOWNLOAD_" #T "_PLATFORM", 0);
+#else
+#define _P(T, x) x
+#endif
+
namespace DeviceAPI {
namespace Download {
static std::string _get_download_error(int err)
{
bool success = false;
- std::string msg = "";
-
- switch (err) {
- case DOWNLOAD_ERROR_INVALID_PARAMETER:
- msg = "Invalid parameter";
- break;
- case DOWNLOAD_ERROR_OUT_OF_MEMORY:
- msg = "Out of memory";
- break;
- case DOWNLOAD_ERROR_NETWORK_UNREACHABLE:
- msg = "Network is unreachable";
- break;
- case DOWNLOAD_ERROR_CONNECTION_TIMED_OUT:
- msg = "Http session time-out";
- break;
- case DOWNLOAD_ERROR_NO_SPACE:
- msg = "No space left on device";
- break;
- case DOWNLOAD_ERROR_FIELD_NOT_FOUND:
- msg = "Specified field not found";
- break;
- case DOWNLOAD_ERROR_INVALID_STATE:
- msg = "Invalid state";
- break;
- case DOWNLOAD_ERROR_CONNECTION_FAILED:
- msg = "Connection failed";
- break;
- case DOWNLOAD_ERROR_INVALID_URL:
- msg = "Invalid URL";
- break;
- case DOWNLOAD_ERROR_INVALID_DESTINATION:
- msg = "Invalid destination";
- break;
- case DOWNLOAD_ERROR_TOO_MANY_DOWNLOADS:
- msg = "Full of available simultaneous downloads";
- break;
- case DOWNLOAD_ERROR_QUEUE_FULL:
- msg = "Full of available downloading items from server";
- break;
- case DOWNLOAD_ERROR_ALREADY_COMPLETED:
- msg = "The download is already completed";
- break;
- case DOWNLOAD_ERROR_FILE_ALREADY_EXISTS:
- msg = "It is failed to rename the downloaded file";
- break;
- case DOWNLOAD_ERROR_CANNOT_RESUME:
- msg = "It cannot resume";
- break;
- case DOWNLOAD_ERROR_TOO_MANY_REDIRECTS:
- msg = "In case of too may redirects from http response header";
- break;
- case DOWNLOAD_ERROR_UNHANDLED_HTTP_CODE:
- msg = "The download cannot handle the http status value";
- break;
- case DOWNLOAD_ERROR_REQUEST_TIMEOUT:
- msg = "There are no action after client create a download id";
- break;
- case DOWNLOAD_ERROR_RESPONSE_TIMEOUT:
- msg = "It does not call start API in some time although the download is created";
- break;
- case DOWNLOAD_ERROR_SYSTEM_DOWN:
- msg = "There are no response from client after rebooting download daemon";
- break;
- case DOWNLOAD_ERROR_ID_NOT_FOUND:
- msg = "The download id is not existed in download service module";
- break;
- case DOWNLOAD_ERROR_NO_DATA:
- msg = "No data because the set API is not called";
- break;
- case DOWNLOAD_ERROR_IO_ERROR:
- msg = "Internal I/O error";
- break;
- case DOWNLOAD_ERROR_NONE:
- success = true;
- break;
- default:
- msg = "Unknown error";
- }
-
- if (!success) {
- LOGE("Platform error %d <%s>", err, msg.c_str());
- }
-
- return msg;
+ std::string msg = "";
+
+ switch (err) {
+ case DOWNLOAD_ERROR_INVALID_PARAMETER:
+ msg = "Invalid parameter";
+ break;
+ case DOWNLOAD_ERROR_OUT_OF_MEMORY:
+ msg = "Out of memory";
+ break;
+ case DOWNLOAD_ERROR_NETWORK_UNREACHABLE:
+ msg = "Network is unreachable";
+ break;
+ case DOWNLOAD_ERROR_CONNECTION_TIMED_OUT:
+ msg = "Http session time-out";
+ break;
+ case DOWNLOAD_ERROR_NO_SPACE:
+ msg = "No space left on device";
+ break;
+ case DOWNLOAD_ERROR_FIELD_NOT_FOUND:
+ msg = "Specified field not found";
+ break;
+ case DOWNLOAD_ERROR_INVALID_STATE:
+ msg = "Invalid state";
+ break;
+ case DOWNLOAD_ERROR_CONNECTION_FAILED:
+ msg = "Connection failed";
+ break;
+ case DOWNLOAD_ERROR_INVALID_URL:
+ msg = "Invalid URL";
+ break;
+ case DOWNLOAD_ERROR_INVALID_DESTINATION:
+ msg = "Invalid destination";
+ break;
+ case DOWNLOAD_ERROR_TOO_MANY_DOWNLOADS:
+ msg = "Full of available simultaneous downloads";
+ break;
+ case DOWNLOAD_ERROR_QUEUE_FULL:
+ msg = "Full of available downloading items from server";
+ break;
+ case DOWNLOAD_ERROR_ALREADY_COMPLETED:
+ msg = "The download is already completed";
+ break;
+ case DOWNLOAD_ERROR_FILE_ALREADY_EXISTS:
+ msg = "It is failed to rename the downloaded file";
+ break;
+ case DOWNLOAD_ERROR_CANNOT_RESUME:
+ msg = "It cannot resume";
+ break;
+ case DOWNLOAD_ERROR_TOO_MANY_REDIRECTS:
+ msg = "In case of too may redirects from http response header";
+ break;
+ case DOWNLOAD_ERROR_UNHANDLED_HTTP_CODE:
+ msg = "The download cannot handle the http status value";
+ break;
+ case DOWNLOAD_ERROR_REQUEST_TIMEOUT:
+ msg = "There are no action after client create a download id";
+ break;
+ case DOWNLOAD_ERROR_RESPONSE_TIMEOUT:
+ msg = "It does not call start API in some time although the download is created";
+ break;
+ case DOWNLOAD_ERROR_SYSTEM_DOWN:
+ msg = "There are no response from client after rebooting download daemon";
+ break;
+ case DOWNLOAD_ERROR_ID_NOT_FOUND:
+ msg = "The download id is not existed in download service module";
+ break;
+ case DOWNLOAD_ERROR_NO_DATA:
+ msg = "No data because the set API is not called";
+ break;
+ case DOWNLOAD_ERROR_IO_ERROR:
+ msg = "Internal I/O error";
+ break;
+ case DOWNLOAD_ERROR_NONE:
+ success = true;
+ break;
+ default:
+ msg = "Unknown error";
+ }
+
+ if (!success) {
+ LOGE("Platform error %d <%s>", err, msg.c_str());
+ }
+
+ return msg;
}
typedef struct {
throw InvalidValuesException("Invalid DownloadRequest.url.");
}
- ret = download_create(&downloadId);
+ ret = _P(start_download_create, download_create(&downloadId));
if (ret != DOWNLOAD_ERROR_NONE) {
throw UnknownException(("Platform error while creating download. " + _get_download_error(ret)).c_str());
}
- ret = download_set_url(downloadId, url.c_str());
+ // set url
+ ret = _P(start_download_set_url, download_set_url(downloadId, url.c_str()));
if (ret != DOWNLOAD_ERROR_NONE) {
throw UnknownException(("Platform error while setting url. " + _get_download_error(ret)).c_str());
}
+ // set destination
if (!destination.empty()) {
std::string fullPath;
try {
LOGW("Converting virtual path is failed. [%s]", destination.c_str());
fullPath = destination;
}
- ret = download_set_destination(downloadId, fullPath.c_str());
+ ret = _P(start_download_set_destination, download_set_destination(downloadId, fullPath.c_str()));
if (ret != DOWNLOAD_ERROR_NONE) {
throw UnknownException(("Platform error while setting destination. " + _get_download_error(ret)).c_str());
}
}
+ // set fileName
if (!fileName.empty()) {
- ret = download_set_file_name(downloadId, fileName.c_str());
+ ret = _P(start_download_set_file_name, download_set_file_name(downloadId, fileName.c_str()));
if (ret != DOWNLOAD_ERROR_NONE) {
throw UnknownException(("Platform error while setting fileName. " + _get_download_error(ret)).c_str());
}
}
- ret = download_set_state_changed_cb(downloadId, download_state_changed_cb, this);
- if (ret != DOWNLOAD_ERROR_NONE) {
- throw UnknownException(("Platform error while setting state changed callback. " + _get_download_error(ret)).c_str());
- }
-
- ret = download_set_progress_cb(downloadId, download_progress_cb, this);
- if (ret != DOWNLOAD_ERROR_NONE) {
- throw UnknownException(("Platform error while setting progress callback. " + _get_download_error(ret)).c_str());
- }
-
+ // set networkType
if (!networkType.empty() && networkType != TIZEN_ENUM_DOWNLOAD_NETWORK_TYPE_ALL) {
ret = DOWNLOAD_ERROR_NONE;
if (networkType == TIZEN_ENUM_DOWNLOAD_NETWORK_TYPE_CELLULAR) {
- ret = download_set_network_type(downloadId, DOWNLOAD_NETWORK_DATA_NETWORK);
+ ret = _P(start_download_set_network_type, download_set_network_type(downloadId, DOWNLOAD_NETWORK_DATA_NETWORK));
} else if (networkType == TIZEN_ENUM_DOWNLOAD_NETWORK_TYPE_WIFI) {
- ret = download_set_network_type(downloadId, DOWNLOAD_NETWORK_WIFI);
+ ret = _P(start_download_set_network_type, download_set_network_type(downloadId, DOWNLOAD_NETWORK_WIFI));
} else {
throw TypeMismatchException("Wrong DownloadNetworkType.");
}
}
}
+ // set httpHeaders
std::map<std::string, std::string>::const_iterator iter;
for (iter = httpHeader.begin(); iter != httpHeader.end(); ++iter) {
- ret = download_add_http_header_field(downloadId, iter->first.c_str(), iter->second.c_str());
+ ret = _P(start_download_add_http_header_field, download_add_http_header_field(downloadId, iter->first.c_str(), iter->second.c_str()));
if (ret != DOWNLOAD_ERROR_NONE) {
throw UnknownException(("Platform error while setting http header fields. " + _get_download_error(ret)).c_str());
}
}
- ret = download_start(downloadId);
+ // set listeners
+ ret = _P(start_download_set_state_changed_cb, download_set_state_changed_cb(downloadId, download_state_changed_cb, this));
+ if (ret != DOWNLOAD_ERROR_NONE) {
+ throw UnknownException(("Platform error while setting state changed callback. " + _get_download_error(ret)).c_str());
+ }
+
+ ret = _P(start_download_set_progress_cb, download_set_progress_cb(downloadId, download_progress_cb, this));
+ if (ret != DOWNLOAD_ERROR_NONE) {
+ throw UnknownException(("Platform error while setting progress callback. " + _get_download_error(ret)).c_str());
+ }
+
+ ret = _P(start_download_start, download_start(downloadId));
if (ret != DOWNLOAD_ERROR_NONE) {
throw UnknownException(("Platform error while starting download. " + _get_download_error(ret)).c_str());
}
{
int ret;
- ret = download_cancel(downloadId);
+ ret = _P(cancel, download_cancel(downloadId));
if (ret != DOWNLOAD_ERROR_NONE) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
{
int ret;
- ret = download_pause(downloadId);
+ ret = _P(pause, download_pause(downloadId));
if (ret != DOWNLOAD_ERROR_NONE) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
{
int ret;
- ret = download_start(downloadId);
+ ret = _P(resume, download_start(downloadId));
if (ret != DOWNLOAD_ERROR_NONE) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
download_state_e state;
std::string result;
- ret = download_get_state(downloadId, &state);
+ ret = _P(getState, download_get_state(downloadId, &state));
if (ret != DOWNLOAD_ERROR_NONE) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
char *fieldValue = NULL;
int fieldLength = 0;
- ret = download_get_url(downloadId, &url);
+ ret = _P(getDownloadRequest, download_get_url(downloadId, &url));
if (ret != DOWNLOAD_ERROR_NONE) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
throw UnknownException(("Platform error while getting url. " + _get_download_error(ret)).c_str());
}
- ret = download_get_destination(downloadId, &destination);
+ ret = _P(getDownloadRequest, download_get_destination(downloadId, &destination));
if (ret != DOWNLOAD_ERROR_NONE && ret != DOWNLOAD_ERROR_NO_DATA) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
throw UnknownException(("Platform error while getting destination. " + _get_download_error(ret)).c_str());
}
- ret = download_get_file_name(downloadId, &fileName);
+ ret = _P(getDownloadRequest, download_get_file_name(downloadId, &fileName));
if (ret != DOWNLOAD_ERROR_NONE && ret != DOWNLOAD_ERROR_NO_DATA) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
throw UnknownException(("Platform error while getting fileName. " + _get_download_error(ret)).c_str());
}
- ret = download_get_network_type(downloadId, &networkTypeValue);
+ ret = _P(getDownloadRequest, download_get_network_type(downloadId, &networkTypeValue));
if (ret != DOWNLOAD_ERROR_NONE && ret != DOWNLOAD_ERROR_NO_DATA) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
throw UnknownException(("Platform error while getting network type. " + _get_download_error(ret)).c_str());
}
- ret = download_get_http_header_field_list(downloadId, &fieldNames, &fieldLength);
+ ret = _P(getDownloadRequest, download_get_http_header_field_list(downloadId, &fieldNames, &fieldLength));
if (ret != DOWNLOAD_ERROR_NONE && ret != DOWNLOAD_ERROR_NO_DATA) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
std::map<std::string, std::string> httpHeader;
for (i = 0; i < fieldLength; i++) {
- ret = download_get_http_header_field(downloadId, fieldNames[i], &fieldValue);
+ ret = _P(getDownloadRequest, download_get_http_header_field(downloadId, fieldNames[i], &fieldValue));
if (ret != DOWNLOAD_ERROR_NONE) {
LOGW("Platform error while getting http header field. %s", _get_download_error(ret).c_str());
}
char *mimeType = NULL;
std::string result("");
- ret = download_get_mime_type(downloadId, &mimeType);
+ ret = _P(getMIMEType, download_get_mime_type(downloadId, &mimeType));
if (ret != DOWNLOAD_ERROR_NONE) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
{
int ret;
- ret = download_set_state_changed_cb(downloadId, download_state_changed_cb, this);
+ ret = _P(setListener, download_set_state_changed_cb(downloadId, download_state_changed_cb, this));
if (ret != DOWNLOAD_ERROR_NONE) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
throw UnknownException(("Platform error while setting state changed callback. " + _get_download_error(ret)).c_str());
}
- ret = download_set_progress_cb(downloadId, download_progress_cb, this);
+ ret = _P(setListener, download_set_progress_cb(downloadId, download_progress_cb, this));
if (ret != DOWNLOAD_ERROR_NONE) {
if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
throw NotFoundException("download id could not found.");
JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
// Access Check
+ TIME_TRACER_ITEM_BEGIN("DOWNLOAD_start_ACE", 0);
AceSecurityStatus status = DOWNLOAD_CHECK_ACCESS(DOWNLOAD_FUNCTION_API_START);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIME_TRACER_ITEM_END("DOWNLOAD_start_ACE", 0);
try {
// Private Object
ReThrowMsg(Commons::ConversionException, "Not a valid path.");
}
}
+std::string Converter::checkPercentSign(std::string& arg)
+{
+ size_t pos = 0;
+
+ pos = arg.find("%");
+
+ if (pos == std::string::npos)
+ {
+ return arg;
+ }
+ else if (arg[arg.size() - 1] == '%')
+ {
+ arg[arg.size() - 1] = ')';
+
+ if (arg[0] == '%')
+ {
+ arg[0] = '(';
+ }
+ else
+ {
+ arg.insert(0, "^");
+ arg.insert(1, "(");
+ }
+
+ return arg;
+ }
+ ThrowMsg(Commons::ConversionException, "Invalid Filter");
+}
NodeFilterPtr Converter::toNodeFilter(const JSValueRef& arg)
{
JSValueRef prop = NULL;
prop = JSUtils::getJSProperty(m_context, filter, PROPERTY_FILEFILTER_NAME);
if (prop) {
- result->setName(toString(prop));
+ std::string nameFilter = toString(prop);
+ result->setName(checkPercentSign(nameFilter));
}
prop = JSUtils::getJSProperty(m_context, filter, PROPERTY_FILEFILTER_START_CREATED);
JSValueRef toStorageType(const short type);
JSValueRef toStorageState(const short state);
+ std::string checkPercentSign(std::string& arg);
JSValueRef toJSValueRef(
const StoragePropertiesPtr &arg,
JSContextRef context);
const char* PATH_SOUNDS = "/opt/usr/media/Sounds";
const char* PATH_IMAGES = "/opt/usr/media/Images";
const char* PATH_VIDEOS = "/opt/usr/media/Videos";
-const char* PATH_RINGTONE = "/opt/share/settings/Ringtones/";
+const char* PATH_RINGTONE = "/opt/usr/share/settings/Ringtones";
}
using namespace WrtDeviceApis;
return true;
}
+
bool NodeFilterMatcher::matchString(const std::string& value,
const OptionalString& filter)
{
if (!filter.IsNull()) {
- return pcrecpp::RE(*filter).PartialMatch(value);
+ pcrecpp::RE_Options reoption;
+ reoption.set_caseless(true);
+ return pcrecpp::RE(*filter, reoption).PartialMatch(value);
}
return true;
}
// this is msgInternalTypes
#define MAX_THREAD_DATA_LEN 128
-using namespace DPL;
+
namespace DeviceAPI {
namespace Messaging {
namespace DeviceAPI {
namespace Messaging {
- const std::string ConversationQueryGenerator::QUERY_PREFIX_SMS = "WHERE B.SMS_CNT > 0 AND A.CONV_ID = B.CONV_ID AND (";
- const std::string ConversationQueryGenerator::QUERY_PREFIX_MMS = "WHERE B.MMS_CNT > 0 AND A.CONV_ID = B.CONV_ID AND (";
+ const std::string ConversationQueryGenerator::QUERY_PREFIX_SMS = "WHERE B.SMS_CNT > 0 AND (A.CONV_ID = B.CONV_ID) AND (B.CONV_ID = C.CONV_ID) AND (";
+ const std::string ConversationQueryGenerator::QUERY_PREFIX_MMS = "WHERE B.MMS_CNT > 0 AND (A.CONV_ID = B.CONV_ID) AND (B.CONV_ID = C.CONV_ID) AND (";
const std::string ConversationQueryGenerator::QUERY_PREFIX_EMAIL = "WHERE ";
const std::string ConversationQueryGenerator::QUERY_SUFFIX_SMS_MMS = ") ";
const std::string ConversationQueryGenerator::QUERY_SUFFIX_EMAIL = "";
- const std::string ConversationQueryGenerator::STRING_DIRECTION = "B.MSG_DIRECTION";
+ const std::string ConversationQueryGenerator::STRING_DIRECTION = "C.MSG_DIRECTION";
ConversationQueryGenerator::ConversationQueryGenerator():MessageQueryGenerator() {
}
attributeMap.insert(
std::pair<std::string, std::string>(
- ConversationFilterValidatorFactory::ATTRIBUTE_ID, "A.ADDRESS_ID"));
+ ConversationFilterValidatorFactory::ATTRIBUTE_ID, "B.CONV_ID"));
if(getMode() == MODE_SMS)
{
attributeMap.insert(
{
fwrite(getHtmlBody().c_str(), strlen(getHtmlBody().c_str()), 1, f);
}
+ else if(strlen(getBodyRef().c_str()) > 0)
+ {
+ // htmlbody is empty and plainBody exist. copy plainBody to htmlBody
+ fwrite(getBodyRef().c_str(), strlen(getBodyRef().c_str()), 1, f);
+ }
else
{
// htmlBody is empty.
using namespace std;
-using namespace DPL;
+
using namespace DeviceAPI::Messaging;
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis::CommonsJavaScript;
#include "ConverterMessage.h"
using namespace std;
-using namespace DPL;
+
using namespace DeviceAPI::Messaging;
using namespace DeviceAPI::Common;
using namespace WrtDeviceApis::Commons;
#include "plugin_config.h"
using namespace std;
-using namespace DPL;
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis::CommonsJavaScript;
#include "MessagingErrorMsg.h"
using namespace std;
-using namespace DPL;
+
using namespace DeviceAPI::Messaging;
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis::CommonsJavaScript;
IMessagingServiceManagerPtr messagingServiceManager(priv->getObject());
- event->setPrivateData(StaticPointerCast<IEventPrivateData> (callbackManager)); //callback manager
+ event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData> (callbackManager)); //callback manager
event->setForAsynchronousCall(&MessagingController::getInstance());
event->setEventType(EventGetMessagingService::MESSAGING_SERVICE_MANAGER_EVENT_TYPE_ALL);
using namespace std;
-using namespace DPL;
+
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis::CommonsJavaScript;
using namespace DeviceAPI::Tizen;
NetworkStatusPtr msg(new NetworkStatus(event.GetArg0()));
int mailId = msg->getMailId();
LoggerD("status : " << msg->getStatus() << " mailId : " << mailId);
- int handle = 0;
+ int handle = -1;
if ( msg->getStatus() == NOTI_SEND_FINISH || msg->getStatus() == NOTI_SEND_FAIL)
{
- //find handle
- SendRequestsIterator it = m_requests.begin();
- for (; it != m_requests.end() ; it++)
- {
- if ( it->second.mail->getUID() == mailId)
- {
- handle = it->first;
- LoggerD("handle : " << handle);
- break;
- }
- }
+ handle = getHandle(mailId);
if (msg->getStatus() == NOTI_SEND_FAIL)
{
}
mail->setMessageStatus(MESSAGE_STATUS_SENT);
- LoggerI("E-mail sent: " << mailId);
- m_requests.erase(mailId);
+ LoggerD("E-mail sent handle: " << handle << " mailid: " << mailId);
+ m_requests.erase(handle);
break;
}
}
mail->setMessageStatus(MESSAGE_STATUS_FAILED);
- LoggerI("Sending e-mail: " << mailId <<
+ LoggerD("Sending e-mail: " << mailId <<
" failed with error: " << msg->getErrorCode());
- m_requests.erase(mailId);
+ LoggerD("E-mail error handle: " << handle);
+ m_requests.erase(handle);
break;
}
}
+ } else {
+ LoggerW("Can't find handle " << handle);
}
}
if (EMAIL_ERROR_NONE != error) {
LoggerD("Send Fail error = " << error );
- m_requests.erase(mailId);
mail->setMessageStatus(MESSAGE_STATUS_SENDING);
ThrowMsg(WrtDeviceApis::Commons::PlatformException,
"Failed to initialize send request. [" << error << "]");
}
else
{
- m_requests.insert(std::make_pair(email_handle, SendRequestData(email_handle, mail)));
+ LoggerD("m_requests.insert(" << email_handle << ")");
+ m_requests.insert(std::make_pair(email_handle,
+ SendRequestData(email_handle, mail)));
}
- LoggerD("emf Handle : " << email_handle
+ LoggerD("emf Handle : " << email_handle
<< "requests size :" << m_requests.size() );
return email_handle;
data.mail->getIdRef());
}
- m_requests.erase(data.handle);
+ LoggerD("m_requests.erase(" << data.handle << ")");
+ m_requests.erase( data.handle );
+}
+
+
+int MailSender::getHandle(int mailId)
+{
+ //find handle
+ int handle = -1;
+ SendRequestsIterator it = m_requests.begin();
+ for (; it != m_requests.end() ; it++)
+ {
+ if ( it->second.mail->getUID() == mailId)
+ {
+ handle = it->first;
+ LoggerD("handle : " << handle);
+ break;
+ }
+ }
+ return handle;
}
+
}
}
int sendInternal(const IEmailPtr& data);
void cancelInternal(const SendRequestData& data);
+ int getHandle(int mailId);
- private:
DPL::ScopedPtr<DPL::Thread> m_dbusThread;
DBus::ConnectionPtr m_dbus;
SendRequests m_requests;
#include <msg_transport.h>
}
-using namespace DPL;
+
namespace DeviceAPI {
namespace Messaging {
}
}else if(m_mode == MODE_SMS || m_mode == MODE_MMS ){
if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_FROM)==0){
- retClause = "("+emfAttributeName + " ='"+ valueString + "' AND " + getMessageDirectionString() + "=1)";
+ retClause = "(("+emfAttributeName + " ='"+ valueString + "') AND " + getMessageDirectionString() + "=1)";
break;
}else if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_TO)==0){
- retClause = "("+emfAttributeName + " ='"+ valueString + "' AND " + getMessageDirectionString() + "=0)";
+ retClause = "(("+emfAttributeName + " ='"+ valueString + "') AND " + getMessageDirectionString() + "=0)";
break;
}else if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_TIMESTAMP)==0){
retClause = emfAttributeName + "=" + createDateTimeTypeForSmsMms(value); //TODO need to check
else if(storageChangeType == MSG_STORAGE_CHANGE_UPDATE)
{
LoggerD("MSG_STORAGE_CHANGE_UPDATE");
- event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+ event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
}
this_->m_onMessageReceived.emit(event);
}
- if((this_->m_onConversationReceived.size() > 0) && (storageChangeType == MSG_STORAGE_CHANGE_INSERT)){
- if(conversation->getMessageCount() == 1)
+ if(this_->m_onConversationReceived.size() > 0){
+ int emitCheck = 0;
+ LoggerD("Message Status = " << message->getMessageStatus());
+ if((conversation->getMessageCount() == 1) && (storageChangeType == MSG_STORAGE_CHANGE_INSERT))
{
+ emitCheck = 1;
LoggerD("MSG_STORAGE_CHANGE_INSERT");
event->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+ this_->m_onConversationReceived.emit(event);
}
- if(conversation->getMessageCount() > 1)
+ if(emitCheck == 0 && (message->getMessageStatus()!=MESSAGE_STATUS_SENT))
{
- LoggerD("MSG_STORAGE_CHANGE_INSERT but Conversation Count > 1");
+ LoggerD("MSG_STORAGE_CHANGE_INSERT, Conversation Count > 1 or MSG_STORAGE_CHANGE_UPDATE");
event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+ this_->m_onConversationReceived.emit(event);
}
- this_->m_onConversationReceived.emit(event);
}
}
else
if(msgType != MSG_TYPE_MMS_NOTI)
{
int msgId = 0;
+ int mmsDirection = 0;
msg_get_int_value(msg, MSG_MESSAGE_ID_INT, &msgId);
+ msg_get_int_value(msg, MSG_MESSAGE_DIRECTION_INT, &mmsDirection);
IMessagePtr message = MessageFactory::createMessage(
MMS,
msgId,
else if(storageChangeType == MSG_STORAGE_CHANGE_UPDATE)
{
LoggerD("MSG_STORAGE_CHANGE_UPDATE");
- event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+ if(mmsDirection == 1) // check incomming mms
+ {
+ LoggerD("mmsDirection == 1");
+ event->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+ }
+ else
+ {
+ event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+ }
}
this_->m_onMessageReceived.emit(event);
}
- if((this_->m_onConversationReceived.size() > 0) && (storageChangeType == MSG_STORAGE_CHANGE_INSERT)){
- if(conversation->getMessageCount() == 1)
+ if(this_->m_onConversationReceived.size() > 0){
+ int emitCheck = 0;
+ LoggerD("Message Status = " << message->getMessageStatus());
+ if((conversation->getMessageCount() == 1) && (storageChangeType == MSG_STORAGE_CHANGE_INSERT))
{
+ emitCheck = 1;
LoggerD("MSG_STORAGE_CHANGE_INSERT");
event->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+ this_->m_onConversationReceived.emit(event);
}
- if(conversation->getMessageCount() > 1)
+ if(emitCheck == 0 && (message->getMessageStatus()!=MESSAGE_STATUS_SENT))
{
- LoggerD("MSG_STORAGE_CHANGE_INSERT but Conversation Count > 1");
+ LoggerD("MSG_STORAGE_CHANGE_INSERT, Conversation Count > 1 or MSG_STORAGE_CHANGE_UPDATE");
event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+ this_->m_onConversationReceived.emit(event);
}
- this_->m_onConversationReceived.emit(event);
}
}
else
#include <email-api.h>
#include <Logger.h>
-using namespace DPL;
+
using namespace std;
namespace DeviceAPI {
#include <PlatformException.h>
using namespace std;
-using namespace DPL;
using namespace DeviceAPI::Common;
namespace DeviceAPI {
// LOGD("<<< whereClause:[%s]",whereClause.c_str());
if(whereClause.length()==0){
// 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 ");
+ tmpWhereClause.append("WHERE (B.SMS_CNT > 0 OR B.MMS_CNT > 0) AND (A.CONV_ID = B.CONV_ID) AND (B.CONV_ID = C.CONV_ID) ");
// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
}else{
// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
// LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
}
- oStream << "SELECT B.CONV_ID, B.UNREAD_CNT, B.SMS_CNT, B.MMS_CNT, \
+ oStream << "SELECT distinct(B.CONV_ID), B.UNREAD_CNT, B.SMS_CNT, B.MMS_CNT, \
B.MAIN_TYPE, B.SUB_TYPE, B.MSG_DIRECTION, B.DISPLAY_TIME, B.DISPLAY_NAME, B.MSG_TEXT \
-FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, " << MSGFW_CONVERSATION_TABLE_NAME << " B ";
+FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, " << MSGFW_CONVERSATION_TABLE_NAME << " B, " << MSGFW_MESSAGE_TABLE_NAME " C ";
oStream << tmpWhereClause;
stringSqlQuery = oStream.str();
JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+ TIME_TRACER_ITEM_BEGIN("PUSH_registerService_ACE", 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_REGISTER_SERVICE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIME_TRACER_ITEM_END("PUSH_registerService_ACE", 0);
try {
// Private Object
JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+ TIME_TRACER_ITEM_BEGIN("PUSH_unregisterService_ACE", 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_UNREGISTER_SERVICE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIME_TRACER_ITEM_END("PUSH_unregisterService_ACE", 0);
try {
// Private Object
JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+ TIME_TRACER_ITEM_BEGIN("PUSH_connectService_ACE", 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_CONNECT_SERVICE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIME_TRACER_ITEM_END("PUSH_connectService_ACE", 0);
try {
// Private Object
JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+ TIME_TRACER_ITEM_BEGIN("PUSH_disconnectService_ACE", 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_DISCONNECT_SERVICE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIME_TRACER_ITEM_END("PUSH_disconnectService_ACE", 0);
try {
// Private Object
JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+ TIME_TRACER_ITEM_BEGIN("PUSH_getRegistrationId_ACE", 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_GET_REGISTRATION_ID);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIME_TRACER_ITEM_END("PUSH_getRegistrationId_ACE", 0);
try {
// Private Object
#include "PushManager.h"
#include <Logger.h>
+#include <TimeTracer.h>
+
+#ifdef ENABLE_TIME_TRACER
+#define _P(T, x) \
+ (TIME_TRACER_ITEM_BEGIN("PUSH_" #T "_PLATFORM", 0), x); \
+ TIME_TRACER_ITEM_END("PUSH_" #T "_PLATFORM", 0);
+#else
+#define _P(T, x) x
+#endif
using namespace DeviceAPI::Common;
int ret;
service_h service;
- ret = service_create(&service);
+ ret = _P(registerService, service_create(&service));
if (ret != SERVICE_ERROR_NONE) {
throw UnknownException(("Platform error while creating service. " + _get_internal_error(ret)).c_str());
}
if (appControl->getOperation().compare("") != 0) {
- ret = service_set_operation(service, appControl->getOperation().c_str());
+ ret = _P(registerService, service_set_operation(service, appControl->getOperation().c_str()));
if (ret != SERVICE_ERROR_NONE) {
throw UnknownException(("Platform error while setting operation to appControl. " + _get_internal_error(ret)).c_str());
}
}
if (appControl->getUri().compare("") != 0) {
- ret = service_set_uri(service, appControl->getUri().c_str());
+ ret = _P(registerService, service_set_uri(service, appControl->getUri().c_str()));
if (ret != SERVICE_ERROR_NONE) {
LOGW("Platform error while setting uri to appControl. %s", _get_internal_error(ret).c_str());
}
}
if (appControl->getMime().compare("") != 0) {
- ret = service_set_mime(service, appControl->getMime().c_str());
+ ret = _P(registerService, service_set_mime(service, appControl->getMime().c_str()));
if (ret != SERVICE_ERROR_NONE) {
LOGW("Platform error while setting mime to appControl. %s", _get_internal_error(ret).c_str());
}
}
- ret = service_set_app_id(service, m_appId.c_str());
+ ret = _P(registerService, service_set_app_id(service, m_appId.c_str()));
if (ret != SERVICE_ERROR_NONE) {
throw UnknownException(("Platform error while setting appId to appControl. " + _get_internal_error(ret)).c_str());
}
}
if (size == 1) {
- ret = service_add_extra_data(service, (const char*)key.c_str(), arr[0]);
+ ret = _P(registerService, service_add_extra_data(service, (const char*)key.c_str(), arr[0]));
if (ret != SERVICE_ERROR_NONE) {
LOGW("Platform error while adding extra data to appControl. %s", _get_internal_error(ret).c_str());
}
} else {
- ret = service_add_extra_data_array(service, (const char*)key.c_str(), arr, size);
+ ret = _P(registerService, service_add_extra_data_array(service, (const char*)key.c_str(), arr, size));
if (ret != SERVICE_ERROR_NONE) {
LOGW("Platform error while adding extra data array to appControl. %s", _get_internal_error(ret).c_str());
}
m_registrationCallback = callback;
- ret = push_register(m_connectionHandle, service, push_registration_result_cb, this);
+ ret = _P(registerService, push_register(m_connectionHandle, service, push_registration_result_cb, this));
if (ret != PUSH_ERROR_NONE) {
- service_destroy(service);
+ _P(registerService, service_destroy(service));
throw UnknownException(("Platform error while registering the application to the push service. " + _get_internal_error(ret)).c_str());
}
- service_destroy(service);
+ _P(registerService, service_destroy(service));
}
void PushManager::unregisterService(MultiCallbackUserDataPtr callback)
m_unregistrationCallback = callback;
- ret = push_deregister(m_connectionHandle, push_unregistration_result_cb, this);
+ ret = _P(unregisterService, push_deregister(m_connectionHandle, push_unregistration_result_cb, this));
if (ret != PUSH_ERROR_NONE) {
throw UnknownException(("Platform error while unregistering the application from the push service. " + _get_internal_error(ret)).c_str());
}
char *regId = NULL;
std::string str = "";
- ret = push_get_registration_id(m_connectionHandle, ®Id);
+ ret = _P(getRegistrationId, push_get_registration_id(m_connectionHandle, ®Id));
if (ret != PUSH_ERROR_NONE) {
LOGW("Platform error while getting registration id. %s", _get_internal_error(ret).c_str());
} else {
#include <Commons/plugin_initializer_def.h>
#include <Commons/WrtAccess/WrtAccess.h>
#include "JSSEService.h"
+#include "SEAsyncCallbackManager.h"
+#include "SEListenerManager.h"
#include <Logger.h>
namespace DeviceAPI {
}
}
+void on_frame_load_callback(const void * context)
+{
+ LoggerD("[Tizen\\SE] on_frame_load_callback (" << context << ")");
+}
+
+void on_frame_unload_callback(const void * context)
+{
+ LoggerD("[Tizen\\SE] on_frame_unload_callback (" << context << ")");
+ SEAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
+ SEListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
+}
+
PLUGIN_ON_WIDGET_START(on_widget_start_callback)
PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
+PLUGIN_ON_FRAME_LOAD(on_frame_load_callback)
+PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback)
PLUGIN_CLASS_MAP_BEGIN
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "seService", (js_class_template_getter)DeviceAPI::SecureElement::JSSEService::getClassRef, NULL)