// DBus::Proxy::DBUS_PATH_NETWORK_STATUS,
// DBus::Proxy::DBUS_IFACE_NETWORK_STATUS);
// if (!m_proxy_load_body) {
-// LOGE("Load body proxy is null");
+// LoggerE("Load body proxy is null");
// throw Common::UnknownException("Load body proxy is null");
// }
// m_proxy_load_body->signalSubscribe();
// DBus::Proxy::DBUS_PATH_NETWORK_STATUS,
// DBus::Proxy::DBUS_IFACE_NETWORK_STATUS);
// if (!m_proxy_load_attachment) {
-// LOGE("Load attachment proxy is null");
+// LoggerE("Load attachment proxy is null");
// throw Common::UnknownException("Load attachment proxy is null");
// }
// m_proxy_load_attachment->signalSubscribe();
//
// m_proxy_messageStorage = std::make_shared<DBus::MessageProxy>();
// if (!m_proxy_messageStorage) {
-// LOGE("Message proxy is null");
+// LoggerE("Message proxy is null");
// throw Common::UnknownException("Message proxy is null");
// }
// m_proxy_messageStorage->signalSubscribe();
//
// m_proxy_send = std::make_shared<DBus::SendProxy>();
// if (!m_proxy_send) {
-// LOGE("Send proxy is null");
+// LoggerE("Send proxy is null");
// throw Common::UnknownException("Send proxy is null");
// }
// m_proxy_send->signalSubscribe();
LoggerD("Entered");
}
-//void EmailManager::addDraftMessagePlatform(int account_id,
-// std::shared_ptr<Message> message)
-//{
-// addMessagePlatform(account_id, message, EMAIL_MAILBOX_TYPE_DRAFT);
-//}
+void EmailManager::addDraftMessagePlatform(int account_id,
+ std::shared_ptr<Message> message)
+{
+ LoggerD("Entered");
+ addMessagePlatform(account_id, message, EMAIL_MAILBOX_TYPE_DRAFT);
+}
//
//void EmailManager::addOutboxMessagePlatform(int account_id,
// std::shared_ptr<Message> message)
// addMessagePlatform(account_id, message, EMAIL_MAILBOX_TYPE_OUTBOX);
//}
//
-//void EmailManager::addMessagePlatform(int account_id,
-// std::shared_ptr<Message> message, email_mailbox_type_e mailbox_type)
-//{
-// email_mail_data_t* mail_data = NULL;
-// email_mail_data_t* mail_data_final = NULL;
-// int err = EMAIL_ERROR_NONE;
-//
-// mail_data = Message::convertPlatformEmail(message);
-//
-// mail_data->account_id = account_id;
-//
-// //Adding "from" email address
-// email_account_t* account = NULL;
-// err = email_get_account(account_id, EMAIL_ACC_GET_OPT_FULL_DATA, &account);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGE("email_get_account failed. [%d]\n",err);
-// err = email_free_mail_data(&mail_data,1);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to free mail data memory");
-// }
-// throw UnknownException("Cannot retrieve email account information");
-// }
-// LOGE("FROM %s", account->user_email_address);
-// std::stringstream ss;
-// ss << "<" << account->user_email_address << ">";
-// std::string address_from;
-// ss >> address_from;
-// mail_data->full_address_from = strdup(address_from.c_str());
-// LOGE("FROM %s", mail_data->full_address_from);
-// err = email_free_account(&account,1);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to free account data memory");
-// }
-// //Setting mailbox id
-// email_mailbox_t *mailbox_data = NULL;
-// err = email_get_mailbox_by_mailbox_type(account_id, mailbox_type,
-// &mailbox_data);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGD("email_get_mailbox_by_mailbox_type failed. [%d]\n",err);
-// err = email_free_mail_data(&mail_data,1);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to free mail data memory");
-// }
-// throw UnknownException("Cannot retrieve draft mailbox");
-// }
-// else {
-// LOGD("email_get_mailbox_by_mailbox_type success.\n");
-// mail_data->mailbox_id = mailbox_data->mailbox_id;
-// mail_data->mailbox_type = mailbox_data->mailbox_type;
-// }
-//
-// mail_data->report_status = EMAIL_MAIL_REPORT_NONE;
-// mail_data->save_status = EMAIL_MAIL_STATUS_SAVED;
-// mail_data->flags_draft_field = 1;
-//
-// //adding email without attachments
-// err = email_add_mail(mail_data, NULL, 0, NULL, 0);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGD("email_add_mail failed. [%d]\n",err);
-// err = email_free_mail_data(&mail_data,1);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to free mail data memory");
-// }
-// err = email_free_mailbox(&mailbox_data, 1);
-// if (EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to destroy mailbox");
-// }
-// throw UnknownException("Couldn't add message to draft mailbox");
-// }
-// else {
-// LOGD("email_add_mail success.\n");
-// }
-//
-// LOGD("saved mail without attachments id = [%d]\n", mail_data->mail_id);
-//
-// message->setId(mail_data->mail_id);
-// message->setMessageStatus(MessageStatus::STATUS_DRAFT);
-//
-// //Adding attachments
+void EmailManager::addMessagePlatform(int account_id,
+ std::shared_ptr<Message> message, email_mailbox_type_e mailbox_type)
+{
+ LoggerD("Entered");
+ email_mail_data_t* mail_data = NULL;
+ email_mail_data_t* mail_data_final = NULL;
+ int err = EMAIL_ERROR_NONE;
+
+ mail_data = Message::convertPlatformEmail(message);
+
+ mail_data->account_id = account_id;
+
+ //Adding "from" email address
+ email_account_t* account = NULL;
+ err = email_get_account(account_id, EMAIL_ACC_GET_OPT_FULL_DATA, &account);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerE("email_get_account failed. [%d]\n",err);
+ err = email_free_mail_data(&mail_data,1);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to free mail data memory");
+ }
+ throw common::UnknownException("Cannot retrieve email account information");
+ }
+ LoggerE("FROM %s", account->user_email_address);
+ std::stringstream ss;
+ ss << "<" << account->user_email_address << ">";
+ std::string address_from;
+ ss >> address_from;
+ mail_data->full_address_from = strdup(address_from.c_str());
+ LoggerE("FROM %s", mail_data->full_address_from);
+ err = email_free_account(&account,1);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to free account data memory");
+ }
+ //Setting mailbox id
+ email_mailbox_t *mailbox_data = NULL;
+ err = email_get_mailbox_by_mailbox_type(account_id, mailbox_type,
+ &mailbox_data);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerD("email_get_mailbox_by_mailbox_type failed. [%d]\n",err);
+ err = email_free_mail_data(&mail_data,1);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to free mail data memory");
+ }
+ throw common::UnknownException("Cannot retrieve draft mailbox");
+ }
+ else {
+ LoggerD("email_get_mailbox_by_mailbox_type success.\n");
+ mail_data->mailbox_id = mailbox_data->mailbox_id;
+ mail_data->mailbox_type = mailbox_data->mailbox_type;
+ }
+
+ mail_data->report_status = EMAIL_MAIL_REPORT_NONE;
+ mail_data->save_status = EMAIL_MAIL_STATUS_SAVED;
+ mail_data->flags_draft_field = 1;
+
+ //adding email without attachments
+ err = email_add_mail(mail_data, NULL, 0, NULL, 0);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerD("email_add_mail failed. [%d]\n",err);
+ err = email_free_mail_data(&mail_data,1);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to free mail data memory");
+ }
+ err = email_free_mailbox(&mailbox_data, 1);
+ if (EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to destroy mailbox");
+ }
+ throw common::UnknownException("Couldn't add message to draft mailbox");
+ }
+ else {
+ LoggerD("email_add_mail success.\n");
+ }
+
+ LoggerD("saved mail without attachments id = [%d]\n", mail_data->mail_id);
+
+ message->setId(mail_data->mail_id);
+ message->setMessageStatus(MessageStatus::STATUS_DRAFT);
+
+// TODO Adding attachments
// if (message->getHasAttachment()){
// Message::addEmailAttachments(message);
// }
-//
-// err = email_get_mail_data(message->getId(), &mail_data_final);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to retrieve added mail data");
-// throw UnknownException("Couldn't retrieve added mail data");
-// }
-//
-// message->updateEmailMessage(*mail_data_final);
-//
-// err = email_free_mail_data(&mail_data_final,1);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to free mail data final memory");
-// }
-//
-// err = email_free_mail_data(&mail_data,1);
-// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to free mail data memory");
-// }
-//
-// err = email_free_mailbox(&mailbox_data, 1);
-// if (EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to destroy mailbox");
-// }
-//}
-//
-//static gboolean addDraftMessageCompleteCB(void *data)
-//{
-// MessageCallbackUserData* callback =
-// static_cast<MessageCallbackUserData *>(data);
-// if (!callback) {
-// LOGE("Callback is null");
-// return false;
-// }
-// JSContextRef context = callback->getContext();
-// if (!GlobalContextManager::getInstance()->isAliveGlobalContext(context)) {
-// LOGE("context was closed");
-// delete callback;
-// callback = NULL;
-// return false;
-// }
-//
-// try {
-// if (callback->isError()) {
-// LOGD("Calling error callback");
-// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context,
-// callback->getErrorName(),
-// callback->getErrorMessage());
-// callback->callErrorCallback(errobj);
-// callback->getMessage()->setMessageStatus(MessageStatus::STATUS_FAILED);
-// } else {
-// LOGD("Calling success callback");
-// callback->callSuccessCallback();
-// }
-// } catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
-// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context, err);
-// callback->callErrorCallback(errobj);
-// } catch (...) {
-// LOGE("Message add draft failed");
-// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context,
-// JSWebAPIErrorFactory::UNKNOWN_ERROR, "Message add draft failed");
-// callback->callErrorCallback(errobj);
-// }
-//
-// delete callback;
-// callback = NULL;
-//
-// return false;
-//}
-//
-//void EmailManager::addDraftMessage(MessageCallbackUserData* callback)
-//{
-// LOGD("Entered");
-//
-// if(!callback){
-// LOGE("Callback is null");
-// return;
-// }
-//
-// try {
-// std::lock_guard<std::mutex> lock(m_mutex);
-// std::shared_ptr<Message> message = callback->getMessage();
-// addDraftMessagePlatform(callback->getAccountId(), message);
-// } catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
-// callback->setError(err.getName(), err.getMessage());
-// } catch (...) {
-// LOGE("Message add draft failed");
-// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR, "Message add draft failed");
-// }
-//
-// //Complete task
-// if (!g_idle_add(addDraftMessageCompleteCB, static_cast<void *>(callback))) {
-// LOGE("g_idle addition failed");
-// delete callback;
-// callback = NULL;
-// }
-//}
-//
-//
+
+ err = email_get_mail_data(message->getId(), &mail_data_final);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to retrieve added mail data");
+ throw common::UnknownException("Couldn't retrieve added mail data");
+ }
+
+ message->updateEmailMessage(*mail_data_final);
+
+ err = email_free_mail_data(&mail_data_final,1);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to free mail data final memory");
+ }
+
+ err = email_free_mail_data(&mail_data,1);
+ if(EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to free mail data memory");
+ }
+
+ err = email_free_mailbox(&mailbox_data, 1);
+ if (EMAIL_ERROR_NONE != err) {
+ LoggerE("Failed to destroy mailbox");
+ }
+}
+
+static gboolean addDraftMessageCompleteCB(void *data)
+{
+ MessageCallbackUserData* callback =
+ static_cast<MessageCallbackUserData *>(data);
+ if (!callback) {
+ LoggerE("Callback is null");
+ return false;
+ }
+
+ try {
+ if (callback->isError()) {
+ LoggerD("Calling error callback");
+ MessagingInstance::getInstance().PostMessage(callback->getJson()->serialize().c_str());
+ callback->getMessage()->setMessageStatus(MessageStatus::STATUS_FAILED);
+ } else {
+ LoggerD("Calling success callback");
+ auto json = callback->getJson();
+ picojson::object& obj = json->get<picojson::object>();
+ obj[JSON_ACTION] = picojson::value(JSON_CALLBACK_SUCCCESS);
+ MessagingInstance::getInstance().PostMessage(json->serialize().c_str());
+ }
+ } catch (const common::PlatformException& err) {
+ LoggerE("%s (%s)", (err.name()).c_str(), (err.message()).c_str());
+ callback->getMessage()->setMessageStatus(MessageStatus::STATUS_FAILED);
+ } catch (...) {
+ LoggerE("Message add draft failed");
+ callback->getMessage()->setMessageStatus(MessageStatus::STATUS_FAILED);
+ }
+
+ delete callback;
+ callback = NULL;
+
+ return false;
+}
+
+void EmailManager::addDraftMessage(MessageCallbackUserData* callback)
+{
+ LoggerD("Entered");
+
+ if(!callback){
+ LoggerE("Callback is null");
+ return;
+ }
+
+ try {
+ std::lock_guard<std::mutex> lock(m_mutex);
+ std::shared_ptr<Message> message = callback->getMessage();
+ addDraftMessagePlatform(callback->getAccountId(), message);
+ } catch (const common::PlatformException& err) {
+ LoggerE("%s (%s)", (err.name()).c_str(), (err.message()).c_str());
+ callback->setError(err.name(), err.message());
+ } catch (...) {
+ LoggerE("Message add draft failed");
+ callback->setError("UnknownError", "Message add draft failed");
+ }
+
+ //Complete task
+ if (!g_idle_add(addDraftMessageCompleteCB, static_cast<void *>(callback))) {
+ LoggerE("g_idle addition failed");
+ delete callback;
+ callback = NULL;
+ }
+}
+
////**** sending email ****
//static gboolean sendEmailCompleteCB(void* data)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
//
// MessageRecipientsCallbackData* callback =
// static_cast<MessageRecipientsCallbackData*>(data);
// if (!callback) {
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return false;
// }
//
// JSContextRef context = callback->getContext();
// if (!GlobalContextManager::getInstance()->isAliveGlobalContext(context)) {
-// LOGE("context was closed");
+// LoggerE("context was closed");
// delete callback;
// callback = NULL;
// return false;
// }
// }
// catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
+// LoggerE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
// }
// catch (...) {
-// LOGE("Unknown error when calling send message callback");
+// LoggerE("Unknown error when calling send message callback");
// }
//
// delete callback;
//
//void EmailManager::sendMessage(MessageRecipientsCallbackData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
// int err = EMAIL_ERROR_NONE;
// email_mail_data_t *mail_data = NULL;
//
// try{
// if(!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// throw UnknownException("Callback is null");
// }
//
// std::shared_ptr<Message> message = callback->getMessage();
// if(!message) {
-// LOGE("Message is null");
+// LoggerE("Message is null");
// throw UnknownException("Message is null");
// }
//
//
// err = email_get_mail_data(message->getId(),&mail_data);
// if(EMAIL_ERROR_NONE != err) {
-// LOGE("email_get_mail_data failed. [%d]\n",err);
+// LoggerE("email_get_mail_data failed. [%d]\n",err);
// throw UnknownException("Failed to get platform email structure");
// }
//
-// LOGD("email_get_mail_data success.\n");
+// LoggerD("email_get_mail_data success.\n");
//
// //Sending EMAIL
// mail_data->save_status = EMAIL_MAIL_STATUS_SENDING;
// int req_id = 0;
// err = email_send_mail(mail_data->mail_id, &req_id);
// if (EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to send message %d", err);
+// LoggerE("Failed to send message %d", err);
// throw UnknownException("Failed to send message");
// }
-// LOGD("req_id: %d", req_id);
+// LoggerD("req_id: %d", req_id);
// callback->getMessage()->setMessageStatus(MessageStatus::STATUS_SENDING);
// m_sendRequests[req_id] = callback;
//
// } catch (const BasePlatformException& ex) {
-// LOGE("%s (%s)", (ex.getName()).c_str(), (ex.getMessage()).c_str());
+// LoggerE("%s (%s)", (ex.getName()).c_str(), (ex.getMessage()).c_str());
// callback->setError(ex.getName(), ex.getMessage());
// if (!g_idle_add(sendEmailCompleteCB, static_cast<void*>(callback))) {
-// LOGE("g_idle addition failed");
+// LoggerE("g_idle addition failed");
// delete callback;
// callback = NULL;
// }
// }catch (...) {
-// LOGE("Message send failed");
+// LoggerE("Message send failed");
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR, "Message send failed");
// if (!g_idle_add(sendEmailCompleteCB, static_cast<void*>(callback))) {
-// LOGE("g_idle addition failed");
+// LoggerE("g_idle addition failed");
// delete callback;
// callback = NULL;
// }
//
// err = email_free_mail_data(&mail_data,1);
// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Failed to free mail data memory");
+// LoggerE("Failed to free mail data memory");
// }
//
// return;
// email_noti_on_network_event status,
// int error_code)
//{
-// LOGD("Enter");
+// LoggerD("Enter");
//
// std::lock_guard<std::mutex> lock(m_mutex);
// //find first request for this mail_id
// SendReqMapIterator it = getSendRequest(mail_id);
// if (it != m_sendRequests.end()) {
-// LOGD("Found request");
+// LoggerD("Found request");
// MessageRecipientsCallbackData* callback = it->second;
// m_sendRequests.erase(it);
//
// if (NOTI_SEND_FAIL == status) {
-// LOGD("Failed to send message, set proper error");
+// LoggerD("Failed to send message, set proper error");
// switch (error_code) {
// case EMAIL_ERROR_NO_SIM_INSERTED:
// case EMAIL_ERROR_SOCKET_FAILURE:
// case EMAIL_ERROR_NETWORK_NOT_AVAILABLE:
// case EMAIL_ERROR_INVALID_STREAM:
// case EMAIL_ERROR_NO_RESPONSE:
-// LOGE("Network error %d", error_code);
+// LoggerE("Network error %d", error_code);
// callback->setError(JSWebAPIErrorFactory::NETWORK_ERROR,
// "Failed to send message");
// break;
// default:
-// LOGE("Unknown error %d", error_code);
+// LoggerE("Unknown error %d", error_code);
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR,
// "Failed to send message");
// }
// } else if (NOTI_SEND_FINISH == status) {
-// LOGD("Message sent successfully");
+// LoggerD("Message sent successfully");
// }
//
// if (!g_idle_add(sendEmailCompleteCB, static_cast<void*>(callback))) {
-// LOGE("g_idle addition failed");
+// LoggerE("g_idle addition failed");
// delete callback;
// callback = NULL;
// }
// } else {
-// LOGW("No matching request found");
+// LoggerW("No matching request found");
// }
//}
//
// int err = EMAIL_ERROR_NONE;
// err = email_get_mail_data(msg_id, &mail_data);
// if (EMAIL_ERROR_NONE != err) {
-// LOGE("email_get_mail_data failed. [%d]", err);
+// LoggerE("email_get_mail_data failed. [%d]", err);
// } else {
-// LOGD("email_get_mail_data success.");
+// LoggerD("email_get_mail_data success.");
// }
// return mail_data;
//}
//
// int err = email_free_mail_data(&mail_data,1);
// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Could not free mail data!");
+// LoggerE("Could not free mail data!");
// }
//}
//
//void EmailManager::loadMessageBody(MessageBodyCallbackData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
// if(!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
// if(!callback->getMessage()) {
-// LOGE("Callback's message is null");
+// LoggerE("Callback's message is null");
// return;
// }
//
// int op_handle = -1;
// err = email_download_body(mailId, 0, &op_handle);
// if(EMAIL_ERROR_NONE != err){
-// LOGE("Email download body failed, %d", err);
+// LoggerE("Email download body failed, %d", err);
// m_proxy_load_body->removeCallback(callback);
// return;
// }
//
//void EmailManager::loadMessageAttachment(MessageAttachmentCallbackData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
// if(!callback) {
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// throw Common::InvalidValuesException("Callback is null");
// }
// if(!callback->getMessageAttachment()) {
-// LOGE("Callback's message attachment is null");
+// LoggerE("Callback's message attachment is null");
// throw Common::InvalidValuesException("Callback's message attachment is null");
// }
//
// std::shared_ptr<MessageAttachment> msgAttachment = callback->getMessageAttachment();
-// LOGD("attachmentId:%d mailId:%d", msgAttachment->getId(),
+// LoggerD("attachmentId:%d mailId:%d", msgAttachment->getId(),
// msgAttachment->getMessageId());
//
// struct ScopedEmailMailData {
// std::stringstream err_ss;
// err_ss << "Couldn't get email_mail_data_t for messageId:"
// << msgAttachment->getMessageId();
-// LOGE("%s",err_ss.str().c_str());
+// LoggerE("%s",err_ss.str().c_str());
// throw Common::UnknownException(err_ss.str().c_str());
// }
//
// AttachmentPtrVector attachments = Message::convertEmailToMessageAttachment(
// *mail_data_holder.data);
-// LOGD("Mail:%d contain:%d attachments", msgAttachment->getMessageId(),
+// LoggerD("Mail:%d contain:%d attachments", msgAttachment->getMessageId(),
// attachments.size());
//
// AttachmentPtrVector::iterator it = attachments.begin();
// if(attachmentIndex < 0) {
// std::stringstream err_ss;
// err_ss << "Attachment with id:" << msgAttachment->getId() << "not found";
-// LOGE("%s",err_ss.str().c_str());
+// LoggerE("%s",err_ss.str().c_str());
// throw Common::UnknownException(err_ss.str().c_str());
// }
//
-// LOGD("Attachment with id:%d is located at index:%d", msgAttachment->getId(),
+// LoggerD("Attachment with id:%d is located at index:%d", msgAttachment->getId(),
// attachmentIndex);
//
// int op_handle = -1;
// if (EMAIL_ERROR_NONE != err) {
// std::stringstream err_ss;
// err_ss << "Download email attachment failed with error: " << err;
-// LOGE("%s",err_ss.str().c_str());
+// LoggerE("%s",err_ss.str().c_str());
// throw Common::UnknownException(err_ss.str().c_str());
// } else {
-// LOGD("email_download_attachment returned handle:%d",op_handle);
+// LoggerD("email_download_attachment returned handle:%d",op_handle);
// callback->setOperationHandle(op_handle);
// m_proxy_load_attachment->addCallback(callback);
// }
//
//void EmailManager::syncFolder(SyncFolderCallbackData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
// if(!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
//
// if(!callback->getMessageFolder())
// {
-// LOGE("Callback's messageFolder is null");
+// LoggerE("Callback's messageFolder is null");
// m_proxy_sync->removeCallback(op_id);
// return;
// }
//
// err = email_get_mailbox_by_mailbox_id(folder_id, &mailbox);
// if (EMAIL_ERROR_NONE != err || NULL == mailbox) {
-// LOGE("Couldn't get mailbox, error code: %d", err);
+// LoggerE("Couldn't get mailbox, error code: %d", err);
// m_proxy_sync->removeCallback(op_id);
// return;
// }
//
// err = email_set_mail_slot_size(0, 0, slot_size);
// if(EMAIL_ERROR_NONE != err){
-// LOGE("Email set slot size failed, %d", err);
+// LoggerE("Email set slot size failed, %d", err);
// throw UnknownException("Email set slot size failed");
// }
//
// const int account_id = callback->getAccountId();
// err = email_sync_header(account_id, mailbox->mailbox_id, &op_handle);
// if(EMAIL_ERROR_NONE != err) {
-// LOGE("Email sync header failed, %d", err);
+// LoggerE("Email sync header failed, %d", err);
// m_proxy_sync->removeCallback(op_id);
// throw UnknownException("Email sync header failed");
// }
// callback->setOperationHandle(op_handle);
// }
// catch (const BasePlatformException& e) {
-// LOGE("Exception in syncFolder");
+// LoggerE("Exception in syncFolder");
// }
//
// if (NULL != mailbox)
// {
// err = email_free_mailbox(&mailbox , 1);
// if (EMAIL_ERROR_NONE != err) {
-// LOGD("Failed to email_free_mailbox - err:%d ", err);
+// LoggerD("Failed to email_free_mailbox - err:%d ", err);
// }
// mailbox = NULL;
// }
//
//void EmailManager::stopSync(long op_id)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
// SyncCallbackData* callback = NULL;
// try {
// callback = dynamic_cast<SyncCallbackData*>(
// m_proxy_sync->getCallback(op_id));
// }
// catch (const BasePlatformException& e) {
-// LOGE("Could not get callback");
+// LoggerE("Could not get callback");
// }
// if(!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
// err = email_cancel_job(callback->getAccountId(), callback->getOperationHandle(),
// EMAIL_CANCELED_BY_USER);
// if(EMAIL_ERROR_NONE != err){
-// LOGE("Email cancel job failed, %d", err);
+// LoggerE("Email cancel job failed, %d", err);
// }
// JSObjectRef err_obj =
// JSWebAPIErrorFactory::makeErrorObject(callback->getContext(),
//
//void removeEmailCompleteCB(MessagesCallbackUserData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
// if (!callback) {
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
// JSContextRef context = callback->getContext();
// if (!GlobalContextManager::getInstance()->isAliveGlobalContext(context)) {
-// LOGE("context was closed");
+// LoggerE("context was closed");
// delete callback;
// callback = NULL;
// return;
//
// try {
// if (callback->isError()) {
-// LOGD("Calling error callback");
+// LoggerD("Calling error callback");
// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context,
// callback->getErrorName(),
// callback->getErrorMessage());
// callback->callErrorCallback(errobj);
// } else {
-// LOGD("Calling success callback");
+// LoggerD("Calling success callback");
// callback->callSuccessCallback();
// }
// } catch (const BasePlatformException& err) {
-// LOGE("Error while calling removeEmail callback: %s (%s)",
+// LoggerE("Error while calling removeEmail callback: %s (%s)",
// (err.getName()).c_str(), (err.getMessage()).c_str());
// } catch (...) {
-// LOGE("Unknown error when calling removeEmail callback.");
+// LoggerE("Unknown error when calling removeEmail callback.");
// }
//
// delete callback;
//void EmailManager::removeStatusCallback(const std::vector<int> &ids,
// email_noti_on_storage_event status)
//{
-// LOGD("Enter");
+// LoggerD("Enter");
// std::lock_guard<std::mutex> lock(m_mutex);
// DeleteReqVector::iterator it = getDeleteRequest(ids);
// if (it != m_deleteRequests.end()) {
-// LOGD("Found request");
+// LoggerD("Found request");
// if (NOTI_MAIL_DELETE_FINISH == status) {
-// LOGD("Successfully removed %d mails", ids.size());
+// LoggerD("Successfully removed %d mails", ids.size());
// it->messagesDeleted += ids.size();
// }
// MessagesCallbackUserData* callback = it->callback;
// if (NOTI_MAIL_DELETE_FAIL == status) {
-// LOGD("Failed to remove mail");
+// LoggerD("Failed to remove mail");
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR, "Messages remove failed");
// }
// //if one of mails failed, call error callback
// // >= is used in case of duplicated dbus messages
// if (NOTI_MAIL_DELETE_FAIL == status ||
// static_cast<unsigned int>(it->messagesDeleted) >= it->callback->getMessages().size()) {
-// LOGD("Calling callback");
+// LoggerD("Calling callback");
// m_deleteRequests.erase(it);
// m_mutex.unlock();
// removeEmailCompleteCB(callback);
// } else {
-// LOGD("Not all messages are removed, waiting for next callback");
+// LoggerD("Not all messages are removed, waiting for next callback");
// }
// } else {
-// LOGD("Request not found, ignoring");
+// LoggerD("Request not found, ignoring");
// }
//}
//
//void EmailManager::removeMessages(MessagesCallbackUserData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
//
// if (!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
// MessageType type = callback->getMessageServiceType();
// for(auto it = messages.begin() ; it != messages.end(); ++it) {
// if((*it)->getType() != type) {
-// LOGE("Invalid message type");
+// LoggerE("Invalid message type");
// throw TypeMismatchException("Error while deleting email");
// }
// }
// for (auto it = messages.begin() ; it != messages.end(); ++it) {
// error = email_get_mail_data((*it)->getId(), &mail);
// if (EMAIL_ERROR_NONE != error) {
-// LOGE("Couldn't retrieve mail data");
+// LoggerE("Couldn't retrieve mail data");
// throw UnknownException("Error while deleting mail");
// }
//
// error = email_delete_mail(mail->mailbox_id, &mail->mail_id, 1, 0);
// if (EMAIL_ERROR_NONE != error) {
// email_free_mail_data(&mail, 1);
-// LOGE("Error while deleting mail");
+// LoggerE("Error while deleting mail");
// throw UnknownException("Error while deleting mail");
// }
// email_free_mail_data(&mail, 1);
// request.messagesDeleted = 0;
// m_deleteRequests.push_back(request);
// } catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
+// LoggerE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
// callback->setError(err.getName(), err.getMessage());
// removeEmailCompleteCB(callback);
// } catch (...) {
-// LOGE("Messages remove failed");
+// LoggerE("Messages remove failed");
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR, "Messages remove failed");
// removeEmailCompleteCB(callback);
// }
//
//void EmailManager::updateMessages(MessagesCallbackUserData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
//
// if (!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
// MessageType type = callback->getMessageServiceType();
// for (auto it = messages.begin() ; it != messages.end(); ++it) {
// if ((*it)->getType() != type) {
-// LOGE("Invalid message type");
+// LoggerE("Invalid message type");
// throw TypeMismatchException("Error while updating message");
// }
// }
//
// if((*it)->getHasAttachment())
// {
-// LOGD("Message has attachments. Workaround need to be used.");
+// LoggerD("Message has attachments. Workaround need to be used.");
// //Update of mail on server using function email_update_mail() is not possible.
// //Attachment is updated only locally (can't be later loaded from server),
// //so use of workaround is needed:
//
// //adding message again after changes
// addDraftMessagePlatform(mail->account_id, (*it));
-// LOGD("mail added - new id = [%d]\n", (*it)->getId());
+// LoggerD("mail added - new id = [%d]\n", (*it)->getId());
//
// //deleting old mail
-// LOGD("mail deleted = [%d]\n", mail->mail_id);
+// LoggerD("mail deleted = [%d]\n", mail->mail_id);
// error = email_delete_mail(mail->mailbox_id,&mail->mail_id,1,1);
// if (EMAIL_ERROR_NONE != error) {
// email_free_mail_data(&mail, 1);
-// LOGE("Error while deleting old mail on update: %d", error);
+// LoggerE("Error while deleting old mail on update: %d", error);
// throw Common::UnknownException("Error while deleting old mail on update");
// }
// } else {
-// LOGD("There are no attachments, updating only email data.");
+// LoggerD("There are no attachments, updating only email data.");
// error = email_update_mail(mail, NULL, 0, NULL, 0);
// if (EMAIL_ERROR_NONE != error) {
// email_free_mail_data(&mail, 1);
-// LOGE("Error while updating mail");
+// LoggerE("Error while updating mail");
// throw UnknownException("Error while updating mail");
// }
// }
// }
//
// } catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
+// LoggerE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
// callback->setError(err.getName(), err.getMessage());
// } catch (...) {
-// LOGE("Messages update failed");
+// LoggerE("Messages update failed");
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR, "Messages update failed");
// }
//
// //Complete task
// JSContextRef context = callback->getContext();
// if (!GlobalContextManager::getInstance()->isAliveGlobalContext(context)) {
-// LOGE("context was closed");
+// LoggerE("context was closed");
// delete callback;
// callback = NULL;
// return;
//
// try {
// if (callback->isError()) {
-// LOGD("Calling error callback");
+// LoggerD("Calling error callback");
// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context,
// callback->getErrorName(),
// callback->getErrorMessage());
// callback->callErrorCallback(errobj);
// } else {
-// LOGD("Calling success callback");
+// LoggerD("Calling success callback");
// callback->callSuccessCallback();
// }
// } catch (const BasePlatformException& err) {
-// LOGE("Error while calling updateEmail callback: %s (%s)",
+// LoggerE("Error while calling updateEmail callback: %s (%s)",
// (err.getName()).c_str(), (err.getMessage()).c_str());
// } catch (...) {
-// LOGE("Unknown error when calling updateEmail callback.");
+// LoggerE("Unknown error when calling updateEmail callback.");
// }
//
// delete callback;
//
//void EmailManager::findMessages(FindMsgCallbackUserData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
//
// if(!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
// std::pair<int, email_mail_data_t*> emails =
// MessagingDatabaseManager::getInstance().findEmails(callback);
// mailListCount = emails.first;
-// LOGD("Found %d mails", mailListCount);
+// LoggerD("Found %d mails", mailListCount);
//
// mailList = emails.second;
// email_mail_data_t* nth_email = mailList;
// nth_email++;
// }
// } catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
+// LoggerE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
// callback->setError(err.getName(), err.getMessage());
// } catch (...) {
-// LOGE("Message find failed");
+// LoggerE("Message find failed");
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR, "Message find failed");
// }
//
// if (mailListCount > 0 && mailList != NULL) {
// if (EMAIL_ERROR_NONE != email_free_mail_data(&mailList, mailListCount)) {
-// LOGW("Failed to free mailList");
+// LoggerW("Failed to free mailList");
// }
// }
//
// //Complete task
-// LOGD("callback: %p error:%d messages.size()=%d", callback, callback->isError(),
+// LoggerD("callback: %p error:%d messages.size()=%d", callback, callback->isError(),
// callback->getMessages().size());
//
// JSContextRef context = callback->getContext();
// if (!GlobalContextManager::getInstance()->isAliveGlobalContext(context)) {
-// LOGE("context was closed");
+// LoggerE("context was closed");
// delete callback;
// callback = NULL;
// return;
//
// try {
// if (callback->isError()) {
-// LOGD("Calling error callback");
+// LoggerD("Calling error callback");
// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context,
// callback->getErrorName(),
// callback->getErrorMessage());
// callback->callErrorCallback(errobj);
// } else {
-// LOGD("Calling success callback");
+// LoggerD("Calling success callback");
// callback->callSuccessCallback(JSMessage::messageVectorToJSObjectArray(context,
// callback->getMessages()));
// }
// } catch (const BasePlatformException& err) {
-// LOGE("Error while calling findMessages callback: %s (%s)",
+// LoggerE("Error while calling findMessages callback: %s (%s)",
// (err.getName()).c_str(), (err.getMessage()).c_str());
// } catch (...) {
-// LOGE("Failed to call findMessages callback.");
+// LoggerE("Failed to call findMessages callback.");
// }
//
// delete callback;
//
//void EmailManager::findConversations(ConversationCallbackData* callback)
//{
-// LOGE("Entered");
+// LoggerE("Entered");
//
// if(!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
// std::vector<EmailConversationInfo> conversationsInfo =
// MessagingDatabaseManager::getInstance().findEmailConversations(callback);
// convListCount = conversationsInfo.size();
-// LOGD("Found %d conversations", convListCount);
+// LoggerD("Found %d conversations", convListCount);
//
// for (int i = 0; i < convListCount; ++i) {
// std::shared_ptr<MessageConversation> conversation =
// callback->addConversation(conversation);
// }
// } catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
+// LoggerE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
// callback->setError(err.getName(), err.getMessage());
// } catch (...) {
-// LOGE("Conversation find failed");
+// LoggerE("Conversation find failed");
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR, "Conversation find failed");
// }
//
// //Complete task
-// LOGD("callback: %p error:%d conversations.size()=%d", callback, callback->isError(),
+// LoggerD("callback: %p error:%d conversations.size()=%d", callback, callback->isError(),
// callback->getConversations().size());
//
// JSContextRef context = callback->getContext();
// if (!GlobalContextManager::getInstance()->isAliveGlobalContext(context)) {
-// LOGE("context was closed");
+// LoggerE("context was closed");
// delete callback;
// callback = NULL;
// return;
//
// try {
// if (callback->isError()) {
-// LOGD("Calling error callback");
+// LoggerD("Calling error callback");
// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context,
// callback->getErrorName(),
// callback->getErrorMessage());
// callback->callErrorCallback(errobj);
// } else {
-// LOGD("Calling success callback");
+// LoggerD("Calling success callback");
// callback->callSuccessCallback(
// MessagingUtil::vectorToJSObjectArray<ConversationPtr,
// JSMessageConversation>(context,
// callback->getConversations()));
// }
// } catch (const BasePlatformException& err) {
-// LOGE("Error while calling findConversations callback: %s (%s)",
+// LoggerE("Error while calling findConversations callback: %s (%s)",
// (err.getName()).c_str(), (err.getMessage()).c_str());
// } catch (...) {
-// LOGE("Failed to call findConversations callback.");
+// LoggerE("Failed to call findConversations callback.");
// }
//
// delete callback;
//void EmailManager::findFolders(FoldersCallbackData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
//
// if (!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
//
// Tizen::AbstractFilterPtr filter = callback->getFilter();
// if (!filter) {
-// LOGE("Filter not provided");
+// LoggerE("Filter not provided");
// throw UnknownException("Filter not provided");
// }
//
// if(FIS_COMPOSITE_START == it.getState()) {
// CompositeFilterPtr cf = castToCompositeFilter((*it));
// if(cf && INTERSECTION != cf->getType()) {
-// LOGE("[ERROR] >>> invalid Filter type: %d", cf->getType());
+// LoggerE("[ERROR] >>> invalid Filter type: %d", cf->getType());
// throw TypeMismatchException("Invalid Filter Type");
// }
// }
// if (FIND_FOLDERS_ATTRIBUTE_ACCOUNTID_NAME == attr_name) {
// account_id = static_cast<int>(attrf->getMatchValue()->toLong());
// } else {
-// LOGE("The attribute name: %s is invalid", attr_name.c_str());
+// LoggerE("The attribute name: %s is invalid", attr_name.c_str());
// throw InvalidValuesException("The attribute name is invalid");
// }
// }
// }
// }
//
-// LOGD("Listing folders for account ID: %d", account_id);
+// LoggerD("Listing folders for account ID: %d", account_id);
// if (account_id > 0) {
// ret = email_get_mailbox_list(account_id,
// -1,
// &mailboxes,
// &mailboxes_count);
// if (EMAIL_ERROR_NONE != ret || !mailboxes) {
-// LOGE("Cannot get folders: %d", ret);
+// LoggerE("Cannot get folders: %d", ret);
// throw Common::UnknownException(
// "Platform error, cannot get folders");
// }
//
// if (mailboxes_count <= 0) {
-// LOGD("Empty mailboxes");
+// LoggerD("Empty mailboxes");
// }
// else {
-// LOGD("Founded mailboxes: %d", mailboxes_count);
+// LoggerD("Founded mailboxes: %d", mailboxes_count);
//
// nth_mailbox = mailboxes;
// for (int i = 0; i < mailboxes_count; ++i) {
// }
// }
// } catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
+// LoggerE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
// callback->setError(err.getName(), err.getMessage());
// } catch (...) {
-// LOGE("Messages update failed");
+// LoggerE("Messages update failed");
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR,
// "Messages update failed");
// }
// if (mailboxes != NULL) {
// if (EMAIL_ERROR_NONE != email_free_mailbox(&mailboxes,
// mailboxes_count)) {
-// LOGW("Free mailboxes failed: %d", ret);
+// LoggerW("Free mailboxes failed: %d", ret);
// }
// }
//
// //Complete task
-// LOGD("callback: %p error:%d folders.size()=%d", callback, callback->isError(),
+// LoggerD("callback: %p error:%d folders.size()=%d", callback, callback->isError(),
// callback->getFolders().size());
//
// JSContextRef context = callback->getContext();
// if (!GlobalContextManager::getInstance()->isAliveGlobalContext(context)) {
-// LOGE("context was closed");
+// LoggerE("context was closed");
// delete callback;
// callback = NULL;
// return;
//
// try {
// if (callback->isError()) {
-// LOGD("Calling error callback");
+// LoggerD("Calling error callback");
// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context,
// callback->getErrorName(),
// callback->getErrorMessage());
// callback->callErrorCallback(errobj);
// } else {
-// LOGD("Calling success callback");
+// LoggerD("Calling success callback");
// JSObjectRef js_obj = MessagingUtil::vectorToJSObjectArray<FolderPtr,
// JSMessageFolder>(context, callback->getFolders());
// callback->callSuccessCallback(js_obj);
// }
// } catch (const BasePlatformException& err) {
-// LOGE("Error while calling findFolders callback: %s (%s)",
+// LoggerE("Error while calling findFolders callback: %s (%s)",
// (err.getName()).c_str(), (err.getMessage()).c_str());
// } catch (...) {
-// LOGE("Unknown error when calling findFolders callback.");
+// LoggerE("Unknown error when calling findFolders callback.");
// }
//
// delete callback;
//
//void EmailManager::removeConversations(ConversationCallbackData* callback)
//{
-// LOGD("Entered");
+// LoggerD("Entered");
//
// if (!callback){
-// LOGE("Callback is null");
+// LoggerE("Callback is null");
// return;
// }
//
// int thread_id = 0;
// for(auto it = conversations.begin() ; it != conversations.end(); ++it) {
// if((*it)->getType() != type) {
-// LOGE("Invalid message type");
+// LoggerE("Invalid message type");
// throw TypeMismatchException("Error while deleting email conversation");
// }
// }
// thread_id = (*it)->getConversationId();
// error = email_delete_thread(thread_id, false);
// if (EMAIL_ERROR_NONE != error) {
-// LOGE("Couldn't delete conversation data");
+// LoggerE("Couldn't delete conversation data");
// throw UnknownException("Error while deleting mail conversation");
// }
//
// email_mail_data_t *thread_info = NULL;
// do {
// usleep(300 * 1000);
-// LOGD("Waiting to delete this email thread...");
+// LoggerD("Waiting to delete this email thread...");
// error = email_get_thread_information_by_thread_id(
// thread_id, &thread_info);
//
// } while (error != EMAIL_ERROR_MAIL_NOT_FOUND);
// }
// } catch (const BasePlatformException& err) {
-// LOGE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
+// LoggerE("%s (%s)", (err.getName()).c_str(), (err.getMessage()).c_str());
// callback->setError(err.getName(), err.getMessage());
// } catch (...) {
-// LOGE("Messages remove failed");
+// LoggerE("Messages remove failed");
// callback->setError(JSWebAPIErrorFactory::UNKNOWN_ERROR, "Messages remove failed");
// }
//
// JSContextRef context = callback->getContext();
// if (!GlobalContextManager::getInstance()->isAliveGlobalContext(context)) {
-// LOGE("context was closed");
+// LoggerE("context was closed");
// delete callback;
// callback = NULL;
// return;
//
// try {
// if (callback->isError()) {
-// LOGD("Calling error callback");
+// LoggerD("Calling error callback");
// JSObjectRef errobj = JSWebAPIErrorFactory::makeErrorObject(context,
// callback->getErrorName(),
// callback->getErrorMessage());
// callback->callErrorCallback(errobj);
// } else {
-// LOGD("Calling success callback");
+// LoggerD("Calling success callback");
// callback->callSuccessCallback();
// }
// } catch (const BasePlatformException& err) {
-// LOGE("Error while calling removeConversations callback: %s (%s)",
+// LoggerE("Error while calling removeConversations callback: %s (%s)",
// (err.getName()).c_str(), (err.getMessage()).c_str());
// } catch (...) {
-// LOGE("Unknown error when calling removeConversations callback.");
+// LoggerE("Unknown error when calling removeConversations callback.");
// }
//
// delete callback;
m_service_id_set(false), m_status(STATUS_UNDEFINED),
m_sim_index(TAPI_NETWORK_DEFAULT_DATA_SUBS_UNKNOWN)
{
- LOGD("Message constructor (%p)", this);
+ LoggerD("Message constructor (%p)", this);
}
Message::~Message()
{
- LOGD("Message destructor (%p)", this);
+ LoggerD("Message destructor (%p)", this);
}
// *** attribute getters
m_to = to;
if(m_to.empty()) {
- LOGD("Recipient's list cleared");
+ LoggerD("Recipient's list cleared");
return;
}
}
umask(old_mask);
if (NULL == file) {
- LOGE("Failed to create file");
+ LoggerE("Failed to create file");
throw common::UnknownException("Failed to create file");
}
if (fprintf(file, "%s", data.c_str()) < 0) {
- LOGE("Failed to write data into file");
+ LoggerE("Failed to write data into file");
throw common::UnknownException("Failed to write data into file");
}
fflush(file);
std::string copyFileToTemp(const std::string& sourcePath)
{
- LOGD("Entered");
+ LoggerD("Entered");
char buf[] = "XXXXXX";
std::string dirPath, fileName, attPath, tmpPath;
// fileName = attPath.substr(slashPos + 1);
// tmpPath = dirPath + "/" + fileName;
//
-// LOGD("attPath: %s, tmpPath: %s", attPath.c_str(), tmpPath.c_str());
+// LoggerD("attPath: %s, tmpPath: %s", attPath.c_str(), tmpPath.c_str());
// if(EINA_TRUE != ecore_file_mkdir(dirPath.c_str())) {
// throw common::UnknownException("Unknown error while creating temp directory.");
// }
email_mail_data_t* Message::convertPlatformEmail(std::shared_ptr<Message> message)
{
if(EMAIL != message->getType()) {
- LOGE("Invalid type");
+ LoggerE("Invalid type");
throw common::InvalidValuesException("Invalid type.");
}
mail_data->file_path_plain = strdup(body_file_path.c_str());
if(!mail_data->file_path_plain)
{
- LOGE("Plain Body file is NULL.");
+ LoggerE("Plain Body file is NULL.");
free(mail_data);
mail_data = NULL;
throw common::UnknownException("Plain Body file is NULL.");
mail_data->file_path_html = strdup(html_file_path.c_str());
if(!mail_data->file_path_html)
{
- LOGE("Html Body file is NULL.");
+ LoggerE("Html Body file is NULL.");
free(mail_data);
mail_data = NULL;
throw common::UnknownException("Html Body file is NULL.");
mail_data->file_path_html = strdup(html_file_path.c_str());
if(!mail_data->file_path_html)
{
- LOGE("Plain Body file is NULL.");
+ LoggerE("Plain Body file is NULL.");
free(mail_data);
mail_data = NULL;
throw common::UnknownException("Plain Body file is NULL.");
int id = message->getId();
int err = email_add_attachment(id, tmp);
if(EMAIL_ERROR_NONE != err) {
- LOGE("Error while adding attachment %d", err);
+ LoggerE("Error while adding attachment %d", err);
err = email_free_attachment_data(&tmp, 1);
if (EMAIL_ERROR_NONE != err) {
LOGW("Failed to free attachment data");
void Message::addEmailAttachments(std::shared_ptr<Message> message)
{
- LOGD("Entered");
+ LoggerD("Entered");
int attachment_data_count = 0, error;
email_mail_data_t *mail = NULL;
AttachmentPtrVector attachments = message->getMessageAttachments();
AttachmentPtrVector inlineAttachments = message->getBody()->getInlineAttachments();
- LOGD("Attachments size: %d", attachments.size());
- LOGD("Inline attachments size: %d", inlineAttachments.size());
- LOGD("Adding attachments for mail id = [%d]\n", message->getId());
+ LoggerD("Attachments size: %d", attachments.size());
+ LoggerD("Inline attachments size: %d", inlineAttachments.size());
+ LoggerD("Adding attachments for mail id = [%d]\n", message->getId());
for (auto it = attachments.begin(); it != attachments.end(); ++it) {
addSingleEmailAttachment(message, *it, AttachmentType::EXTERNAL);
}
if (EMAIL_ERROR_NONE != error) {
email_free_mail_data(&mail, 1);
email_free_attachment_data(&attachment_data_list,attachment_data_count);
- LOGE("Error while adding attachments. Failed to get attachment list.");
+ LoggerE("Error while adding attachments. Failed to get attachment list.");
throw common::UnknownException("Error while adding attachments. Failed to get attachment list.");
}
if (EMAIL_ERROR_NONE != error) {
email_free_mail_data(&mail, 1);
email_free_attachment_data(&attachment_data_list,attachment_data_count);
- LOGE("Error while re-adding mail: %d", error);
+ LoggerE("Error while re-adding mail: %d", error);
throw common::UnknownException("Error while re-adding mail");
}
- LOGD("mail added - new id = [%d]\n", mail->mail_id);
+ LoggerD("mail added - new id = [%d]\n", mail->mail_id);
//refresh message object
message->setId(mail->mail_id);
error = email_delete_mail(mail->mailbox_id,&tmp_id,1,1);
if (EMAIL_ERROR_NONE != error) {
email_free_mail_data(&mail, 1);
- LOGE("Error while deleting mail from server: %d", error);
+ LoggerE("Error while deleting mail from server: %d", error);
throw common::UnknownException("Error while deleting mail from server");
}
email_free_mail_data(&mail, 1);
for (unsigned int i = 0; i < size; ++i) {
char *address = const_cast<char *>(recipients.at(i).c_str());
- LOGD("[%d] address:[%s]", i, address);
+ LoggerD("[%d] address:[%s]", i, address);
msg_struct_t tmpAddr = NULL;
if (MSG_SUCCESS
== msg_list_add_item(msg, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr)) {
address, strlen(address));
}
else {
- LOGE("failed to add address[%d] %s", i, address);
+ LoggerE("failed to add address[%d] %s", i, address);
throw common::UnknownException("failed to add address");
}
}
}
char *address = const_cast<char *>(recipients.at(i).c_str());
- LOGD("[%d] address:[%s] address_type:%d type:%d", i, address, address_type, type);
+ LoggerD("[%d] address:[%s] address_type:%d type:%d", i, address, address_type, type);
int error = msg_list_add_item(msg, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr);
if (MSG_SUCCESS == error) {
address, strlen(address));
}
else {
- LOGE("[%d] failed to add address: [%s], error: %d", i, address, error);
+ LoggerE("[%d] failed to add address: [%s], error: %d", i, address, error);
throw common::UnknownException("failed to add address");
}
}
//void Message::addMMSBodyAndAttachmentsToStruct(const AttachmentPtrVector attach,
// msg_struct_t &mms_struct, Message* message)
//{
-// LOGD("Entered with %d attachments", attach.size());
+// LoggerD("Entered with %d attachments", attach.size());
//
// int size = attach.size();
// for (int i = 0; i < size; i++) {
// // set file path, file name, file size
// if (attach.at(i)->isFilePathSet()) {
// std::string filepath = attach.at(i)->getFilePath();
-// LOGD("att[%d]: org filepath: %s", i, filepath.c_str());
+// LoggerD("att[%d]: org filepath: %s", i, filepath.c_str());
// if(Filesystem::External::isVirtualPath(filepath)) {
// // TODO
// // When introducing below line fromVirtualPath() function
// // context pointer. If it appears to need a real context
// // it will need a fix here.
// filepath = Filesystem::External::fromVirtualPath(filepath);
-// LOGD("att[%d]: org virtual filepath: %s", i, filepath.c_str());
+// LoggerD("att[%d]: org virtual filepath: %s", i, filepath.c_str());
// }
// msg_set_str_value(tmpAtt, MSG_MMS_ATTACH_FILEPATH_STR,
// const_cast<char*>(filepath.c_str()), filepath.size());
// filepath.erase(0, last_slash_idx + 1);
// }
//
-// LOGD("att[%d] filename: %s", i, filepath.c_str());
+// LoggerD("att[%d] filename: %s", i, filepath.c_str());
// msg_set_str_value(tmpAtt, MSG_MMS_ATTACH_FILENAME_STR,
// const_cast<char*>(filepath.c_str()), filepath.size());
// struct stat st;
// if (stat(const_cast<char*>(filepath.c_str()), &st)) {
-// LOGE("Stat error");
+// LoggerE("Stat error");
// }
// const int fsize = st.st_size;
// msg_set_int_value(tmpAtt, MSG_MMS_ATTACH_FILESIZE_INT, fsize);
-// LOGD("att[%d]: filesize: %d", i,fsize);
+// LoggerD("att[%d]: filesize: %d", i,fsize);
// }
//
// //-------------------------------------------------------------------------
// MSG_MSG_ID_LEN);
//
//
-// LOGD("att[%d]: setting mime type:0x%x (orignal:%s)", i, type,
+// LoggerD("att[%d]: setting mime type:0x%x (orignal:%s)", i, type,
// attach.at(i)->getMimeType().c_str());
// }
// } else {
-// LOGE("att[%d]: failed to add attachment");
+// LoggerE("att[%d]: failed to add attachment");
// throw common::UnknownException("failed to add attachment");
// }
// }
msg_struct_t Message::convertPlatformShortMessageToStruct(Message* message,
msg_handle_t handle)
{
- LOGD("Entered");
+ LoggerD("Entered");
if (message->getType() != SMS && message->getType() != MMS) {
- LOGD("Invalid type");
+ LoggerD("Invalid type");
throw common::InvalidValuesException("Invalid type");
}
if (err != MSG_SUCCESS) {
msg_release_struct(&sendOpt);
msg_release_struct(&msg);
- LOGD("msg_get_message() Fail [%d]", err);
+ LoggerD("msg_get_message() Fail [%d]", err);
throw common::UnknownException("msg_get_message() Fail");
}
- LOGD("Using existing msg for id: %d", id);
+ LoggerD("Using existing msg for id: %d", id);
} else { // id is not set - the message does not exist in database
MessageType msgType = message->getType();
if (msgType == MessageType::SMS) {
!= msg_set_int_value(msg, MSG_MESSAGE_TYPE_INT, MSG_TYPE_SMS)) {
msg_release_struct(&sendOpt);
msg_release_struct(&msg);
- LOGE("Set SMS type error");
+ LoggerE("Set SMS type error");
throw common::UnknownException("Set SMS type error");
}
} else {
!= msg_set_int_value(msg, MSG_MESSAGE_TYPE_INT, MSG_TYPE_MMS)) {
msg_release_struct(&sendOpt);
msg_release_struct(&msg);
- LOGE("Set MMS type error");
+ LoggerE("Set MMS type error");
throw common::UnknownException("Set MMS type error");
}
}
int type;
msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &type);
- LOGD("Message(%p): MSG_MESSAGE_TYPE = %d", message, type);
+ LoggerD("Message(%p): MSG_MESSAGE_TYPE = %d", message, type);
if (type == MSG_TYPE_SMS) {
// Set SMS message body text
// Reset SMS recipients
int error = msg_list_clear(msg, MSG_MESSAGE_ADDR_LIST_HND);
if( MSG_SUCCESS != error) {
- LOGE("Failed to clear address list, error: %d", error);
+ LoggerE("Failed to clear address list, error: %d", error);
throw common::UnknownException("Failed to clear address list");
}
// Set message type to MMS
if (MSG_SUCCESS
!= msg_set_int_value(msg, MSG_MESSAGE_TYPE_INT, MSG_TYPE_MMS)) {
- LOGE("Message(%p): Set MMS type error", message);
+ LoggerE("Message(%p): Set MMS type error", message);
throw common::UnknownException("Set MMS type error");
}
// Create MMS data
msg_struct_t mms_data = msg_create_struct(MSG_STRUCT_MMS);
if (mms_data == NULL) {
- LOGE("Message(%p): Set MMS data error", message);
+ LoggerE("Message(%p): Set MMS data error", message);
throw common::UnknownException("Set MMS data error");
}
// Set MMS message subject
int r = msg_set_str_value(msg, MSG_MESSAGE_SUBJECT_STR,
const_cast<char*>(subject.c_str()), subject.size());
if (r != MSG_SUCCESS) {
- LOGE("Message(%p): Set MMS subject error: %d", message, r);
+ LoggerE("Message(%p): Set MMS subject error: %d", message, r);
throw common::UnknownException("Set MMS subject error");
}
}
// std::shared_ptr<MessageBody> body;
// body = message->getBody();
// if (!body->getPlainBody().empty()) {
-// LOGD("Message(%p): PlainBody is NOT empty", message);
+// LoggerD("Message(%p): PlainBody is NOT empty", message);
//
// static const int ROOT_LAYOUT_WIDTH = 100;
// static const int ROOT_LAYOUT_HEIGHT = 100;
// const_cast<char*>(body_file_path.c_str()),
// body_file_path.size());
// if (error != MSG_SUCCESS) {
-// LOGE("Message(%p): Failed to set mms body filepath", message);
+// LoggerE("Message(%p): Failed to set mms body filepath", message);
// throw common::UnknownException("Failed to set mms body filepath");
// }
// msg_set_str_value(media, MSG_MMS_MEDIA_CONTENT_TYPE_STR,
// MMS_SMIL_FONT_SIZE_NORMAL);
// msg_set_bool_value(smil_text, MSG_MMS_SMIL_TEXT_BOLD_BOOL, true);
// } else {
-// LOGD("Message(%p): PlainBody is EMPTY", message);
+// LoggerD("Message(%p): PlainBody is EMPTY", message);
// }
// // Set MMS attachments
// AttachmentPtrVector attach_list = message->getMessageAttachments();
-// LOGD("Message(%p): id:%d subject:[%s] plainBody:[%s] contains %d attachments",
+// LoggerD("Message(%p): id:%d subject:[%s] plainBody:[%s] contains %d attachments",
// message, message->getId(), message->getSubject().c_str(),
// message->getBody()->getPlainBody().c_str(), attach_list.size());
//
// Set MMS body
int r = msg_set_mms_struct(msg, mms_data);
if (r != MSG_SUCCESS) {
- LOGE("Message(%p): Set MMS body error: %d", message, r);
+ LoggerE("Message(%p): Set MMS body error: %d", message, r);
throw common::UnknownException("Set MMS body error");
}
msg_release_struct(&mms_data);
}
else {
msg_release_struct(&msg);
- LOGE("Message(%p): Invalid message type", message);
+ LoggerE("Message(%p): Invalid message type", message);
throw common::InvalidValuesException("Invalid message type");
}
int error =
msg_set_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, sim_index+1);
if ( MSG_SUCCESS != error) {
- LOGE("Failed to set sim index, error: %d", error);
+ LoggerE("Failed to set sim index, error: %d", error);
throw common::UnknownException("Failed to set sim index");
}
}
// Set message if is read
msg_set_bool_value(msg, MSG_MESSAGE_READ_BOOL, message->getIsRead());
- LOGD("End");
+ LoggerD("End");
return msg;
}
char str_phone_number[MAX_ADDRESS_VAL_LEN];
const int count = msg_list_length(addr_list);
- LOGD("Number of addresses: %d", count);
+ LoggerD("Number of addresses: %d", count);
for (int i = 0; i < count; ++i)
{
msg_get_str_value(cur_addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR,
str_phone_number, MAX_ADDRESS_VAL_LEN);
- LOGD("[%d/%d] is TYPE_MT, phone number is: %s", i, count, str_phone_number);
+ LoggerD("[%d/%d] is TYPE_MT, phone number is: %s", i, count, str_phone_number);
if(0 != str_phone_number[0]) {
return std::string(str_phone_number);
}
} else {
- LOGD("[%d/%d] is NOT of TYPE_MT skipping, is:%d", i, count, type);
+ LoggerD("[%d/%d] is NOT of TYPE_MT skipping, is:%d", i, count, type);
}
}
address.push_back(std::string(infoStr));
}
} else {
- LOGE("failed to get recipients");
+ LoggerE("failed to get recipients");
throw common::UnknownException("failed to add recipients");
}
return address;
}
}
} else {
- LOGE("failed to get recipients");
+ LoggerE("failed to get recipients");
throw common::UnknownException("failed to add recipients");
}
return address;
void Message::setMMSBodyAndAttachmentsFromStruct(Message* message,
msg_struct_t &msg)
{
- LOGD("Entered message(%p)", message);
+ LoggerD("Entered message(%p)", message);
int tempInt = 0;
char infoStr[MSG_FILEPATH_LEN_MAX + 1];
msg_struct_t mms_struct = msg_create_struct(MSG_STRUCT_MMS);
int error = msg_get_mms_struct(msg, mms_struct);
if (MSG_SUCCESS != error) {
- LOGE("Cannot get mms struct, error:%d", error);
+ LoggerE("Cannot get mms struct, error:%d", error);
msg_release_struct(&mms_struct);
throw common::UnknownException("cannot get mms struct");
}
error = msg_get_list_handle(mms_struct, MSG_MMS_PAGE_LIST_HND, (void **) &page_list);
if (MSG_SUCCESS == error) {
int pageLen = msg_list_length(page_list);
- LOGD("MSG_MMS_PAGE_LIST length:%d", pageLen);
+ LoggerD("MSG_MMS_PAGE_LIST length:%d", pageLen);
for (int p = 0; p < pageLen; ++p) {
msg_struct_t page = (msg_struct_t) msg_list_nth_data(page_list, p);
if (!page) {
- LOGE("returned page is null, continue");
+ LoggerE("returned page is null, continue");
continue;
}
(void **) &media_list);
if (MSG_SUCCESS == error) {
int mediaLen = msg_list_length(media_list);
- LOGD("[p:%d] MSG_MMS_PAGE_MEDIA_LIST length:%d", p, mediaLen);
+ LoggerD("[p:%d] MSG_MMS_PAGE_MEDIA_LIST length:%d", p, mediaLen);
for (int m = 0; m < mediaLen; ++m) {
msg_struct_t media = (msg_struct_t) msg_list_nth_data(media_list, m);
if (NULL == media) {
- LOGE("returned media is null, continue");
+ LoggerE("returned media is null, continue");
continue;
}
// add media from pages to attachments vector
memset(infoStr, 0, MSG_FILEPATH_LEN_MAX + 1);
msg_get_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, infoStr,
MSG_FILEPATH_LEN_MAX);
- LOGD("[p:%d, m:%d] attachment file path:%s", p, m, infoStr);
+ LoggerD("[p:%d, m:%d] attachment file path:%s", p, m, infoStr);
msg_get_int_value(media, MSG_MMS_MEDIA_TYPE_INT, &tempInt);
const int msg_media_type = tempInt;
std::string msg_media_type_str =
MessageAttachment::MIMETypeEnumToString(msg_media_type);
- LOGD("[p:%d, m:%d] MSG_MMS_MEDIA_TYPE: %d (%s)", p, m, msg_media_type,
+ LoggerD("[p:%d, m:%d] MSG_MMS_MEDIA_TYPE: %d (%s)", p, m, msg_media_type,
msg_media_type_str.c_str());
//According to old implementation
// "text value on first page goes to body attribute"
if ((0 == p) && (MMS_SMIL_MEDIA_TEXT == msg_media_type)) {
- LOGD("Loading body from file: %s ", infoStr);
+ LoggerD("Loading body from file: %s ", infoStr);
try {
message->getBody()->setPlainBody(
MessagingUtil::loadFileContentToString(infoStr));
body_has_been_set = true;
- LOGD("Loaded body: %s",
+ LoggerD("Loaded body: %s",
message->getBody()->getPlainBody().c_str());
} catch(const common::PlatformException& exception) {
- LOGE("Unhandled exception: %s (%s)!",
+ LoggerE("Unhandled exception: %s (%s)!",
(exception.name()).c_str(),
(exception.message()).c_str());
- LOGD("[p:%d, m:%d] body is not set", p, m);
+ LoggerD("[p:%d, m:%d] body is not set", p, m);
}
catch (...) {
- LOGE("Unknown exception occured during plain body loading");
- LOGD("[p:%d, m:%d] body is not set", p, m);
+ LoggerE("Unknown exception occured during plain body loading");
+ LoggerD("[p:%d, m:%d] body is not set", p, m);
}
} else {
ma->setMimeType(msg_media_type_str);
MessageAttachment* att = ma.get();
- LOGD("[p:%d, m:%d] added attachment: %p "
+ LoggerD("[p:%d, m:%d] added attachment: %p "
"(mime:0x%x mime:%s messageId:%d)", p, m, att,
msg_media_type, msg_media_type_str.c_str(),
ma->getMessageId());
}
} else {
msg_release_struct(&mms_struct);
- LOGE("failed to get attachment");
+ LoggerE("failed to get attachment");
throw common::UnknownException("failed to get attachment");
}
msg_release_struct(&page);
}
} else {
msg_release_struct(&mms_struct);
- LOGE("failed to get attachment");
+ LoggerE("failed to get attachment");
throw common::UnknownException("failed to get attachment");
}
LOGW("Warning: body has not been set!");
}
- LOGD("after MSG_MMS_PAGE_LIST attachments count is:%d",
+ LoggerD("after MSG_MMS_PAGE_LIST attachments count is:%d",
message->m_attachments.size());
// if there are some other attachments add it to attachments vector
if (MSG_SUCCESS == error) {
unsigned size = msg_list_length(attach_list);
- LOGD("MSG_MMS_ATTACH_LIST length:%d", size);
+ LoggerD("MSG_MMS_ATTACH_LIST length:%d", size);
for (unsigned int i = 0; i < size; i++) {
msg_struct_t attach_info = NULL;
ma->setMimeType(type);
MessageAttachment* att = ma.get();
- LOGD("[att:%d] added attachement: %p (mime:0x%x mime:%s path:%s id:%d)",
+ LoggerD("[att:%d] added attachement: %p (mime:0x%x mime:%s path:%s id:%d)",
i, att, tempInt, type.c_str(), infoStr, ma->getId());
message->m_attachments.push_back(ma);
}
} else {
msg_release_struct(&mms_struct);
- LOGE("failed to get attachment");
+ LoggerE("failed to get attachment");
throw common::UnknownException("failed to add attachment");
}
-// LOGD("after MSG_MMS_ATTACH_LIST attachments count is:%d",
+// LoggerD("after MSG_MMS_ATTACH_LIST attachments count is:%d",
// message->m_attachments.size());
msg_release_struct(&mms_struct);
}
// int error = msg_get_str_value(msg, MSG_MESSAGE_MMS_TEXT_STR,
// mms_body_str.get(), mms_body_length);
// if(MSG_SUCCESS != error) {
-// LOGE("Error:%d occured during: "
+// LoggerE("Error:%d occured during: "
// "msg_get_str_value(...,MSG_MESSAGE_MMS_TEXT_STR,...)", error);
// } else {
// //Check if fetched string is not empty
// if((mms_body_str.get())[0] != 0) {
-// LOGD("Fetched plain body (with MSG_MESSAGE_MMS_TEXT_STR):"
+// LoggerD("Fetched plain body (with MSG_MESSAGE_MMS_TEXT_STR):"
// "[%s] length:%d", mms_body_str.get(), mms_body_length);
//
// std::shared_ptr<MessageBody> body (new MessageBody());
// "despite reported length is:%d!", mms_body_length);
// }
//
-// LOGD("Set plain body: [%s]", message->getBody()->getPlainBody().c_str());
+// LoggerD("Set plain body: [%s]", message->getBody()->getPlainBody().c_str());
// }
// } else {
// LOGW("Warning: mms plain body length is 0!");
// //set attachments
// setMMSBodyAndAttachmentsFromStruct(message, msg);
} else {
- LOGE("Invalid Message type: %d", infoInt);
+ LoggerE("Invalid Message type: %d", infoInt);
throw common::InvalidValuesException("Invalid Message type");
}
// get from
const std::string& from = Message::getShortMsgSenderFromStruct(msg);
message->setFrom(from);
- LOGD("Message(%p) from is: %s", message, message->getFrom().c_str());
+ LoggerD("Message(%p) from is: %s", message, message->getFrom().c_str());
// get if is in response
msg_get_int_value(msg, MSG_MESSAGE_DIRECTION_INT, &infoInt);
- LOGD("Message(%p) direction is: %d", message, infoInt);
+ LoggerD("Message(%p) direction is: %d", message, infoInt);
message->setInResponseTo(infoInt);
// get is read
msg_get_bool_value(msg, MSG_MESSAGE_READ_BOOL, &infoBool);
}
message->setMessageStatus(msg_status);
- LOGD("MSG_MESSAGE_FOLDER_ID:%d -> messageStatus:%s", infoInt,
+ LoggerD("MSG_MESSAGE_FOLDER_ID:%d -> messageStatus:%s", infoInt,
MessagingUtil::messageStatusToString(msg_status).c_str());
}
else
{
- LOGE("Couldn't get MSG_MESSAGE_FOLDER_ID_INT, error:%d", error);
+ LoggerE("Couldn't get MSG_MESSAGE_FOLDER_ID_INT, error:%d", error);
error = msg_get_int_value(msg, MSG_SENT_STATUS_NETWORK_STATUS_INT, &infoInt);
if(MSG_SUCCESS == error) {
}
message->setMessageStatus(msg_status);
- LOGD("MSG_SENT_STATUS_NETWORK_STATUS:%d MessageStatus:%s", infoInt,
+ LoggerD("MSG_SENT_STATUS_NETWORK_STATUS:%d MessageStatus:%s", infoInt,
MessagingUtil::messageStatusToString(msg_status).c_str());
} else {
- LOGE("Couldn't get MSG_SENT_STATUS_NETWORK_STATUS_INT, error:%d", error);
+ LoggerE("Couldn't get MSG_SENT_STATUS_NETWORK_STATUS_INT, error:%d", error);
if(0 == message->getId()) {
LOGW("Both MSG_SENT_STATUS_NETWORK_STATUS_INT and "
}
}
- LOGD("End");
+ LoggerD("End");
return message;
}
std::shared_ptr<MessageBody> Message::convertEmailToMessageBody(
email_mail_data_t& mail)
{
- LOGD("Enter");
+ LoggerD("Enter");
std::shared_ptr<MessageBody> body (new MessageBody());
body->updateBody(mail);
return body;
AttachmentPtrVector Message::convertEmailToMessageAttachment(email_mail_data_t& mail)
{
- LOGD("Enter");
+ LoggerD("Enter");
email_attachment_data_t* attachment = NULL;
int attachmentCount = 0;
std::shared_ptr<Message> Message::convertPlatformEmailToObject(
email_mail_data_t& mail)
{
- LOGD("Enter");
+ LoggerD("Enter");
std::shared_ptr<Message> message(new MessageEmail());
message->updateEmailMessage(mail);
return message;
// const FilterMatchFlag match_flag,
// AnyPtr match_value) const
//{
-// LOGD("Entered");
+// LoggerD("Entered");
// auto key = match_value->toString();
-// LOGD("attribute_name:%s match_flag:%d matchValue:%s", attribute_name.c_str(),
+// LoggerD("attribute_name:%s match_flag:%d matchValue:%s", attribute_name.c_str(),
// match_flag, key.c_str());
//
// using namespace MESSAGE_FILTER_ATTRIBUTE;
// return FilterUtils::isStringMatching(key, getSubject(), match_flag);
// }
// else {
-// LOGD("attribute:%s is NOT SUPPORTED", attribute_name.c_str());
+// LoggerD("attribute:%s is NOT SUPPORTED", attribute_name.c_str());
// }
//
// return false;
// AnyPtr initial_value,
// AnyPtr end_value) const
//{
-// LOGD("Entered attribute_name: %s", attribute_name.c_str());
+// LoggerD("Entered attribute_name: %s", attribute_name.c_str());
//
// using namespace MESSAGE_FILTER_ATTRIBUTE;
// if(TIMESTAMP == attribute_name) {
// end_value);
// }
// else {
-// LOGD("attribute:%s is NOT SUPPORTED", attribute_name.c_str());
+// LoggerD("attribute:%s is NOT SUPPORTED", attribute_name.c_str());
// }
//
// return false;