Update change log and spec for wrt-plugins-tizen_0.4.62
authorDongjin Choi <milkelf.choi@samsung.com>
Thu, 22 Aug 2013 07:31:56 +0000 (16:31 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Thu, 22 Aug 2013 07:31:56 +0000 (16:31 +0900)
[model] REDWOOD
[binary_type] PDA
[customer] OPEN

[Issue] N/A
[Problem] set null to url
[Cause] url set to null object
[Solution] url set to null string

[Issue#] P130814-01522
[Problem] Wrong profiles number returned.
[Cause] Debug level "D" removed.
[Solution] Move meaningful codes inside the dlog to the outer level.

[Issue] N/A
[Problem] syncStop on email service bug fix
[Cause] syncStop on email service bug fix
[Solution] syncStop on email service bug fix

[Issue] N/A
[Problem] email attachment filePath initialize as empty string
[Cause] email attachment filePath initialize as empty string
[Solution] email attachment filePath set as Null

[Issue#] N/A
[Problem] The callback profileId is not matched with the returned value from add api.
[Cause] Mix-use of different profileId types from platform.
[Solution] Convert the string type profileId to the number type.

[Issue#] N_SE-49123
[Problem] Force close occurs
[Cause] display sms body data crash
[Solution] remove crash log

[Issue] N/A
[Problem] email send error always Unkwons
[Cause] send error status is not checked
[Solution] return network error for error status

[Issue#] TCT
[Problem] Bonding fail.
[Cause] code bug.
[Solution] fix bug.

[Issue#] TCT
[Problem] Setting property failed.
[Cause] Variables is not initialized
[Solution] Use JSUtil::JSValueToObject instead of using JSVAlueToObject in JSValueRef.h directly

[Issue#] TCT
[Problem] Setting property failed.
[Cause] Variables is not initialized
[Solution] Use JSUtil::JSValueToObject instead of using JSVAlueToObject in JSValueRef.h directly

[Issue] N/A
[Problem] mms conversation subject bug fix
[Cause] mms conversation subject bug fix
[Solution] mms conversation subject bug fix

[Issue#] security TCT
[Problem] NotFoundError raise.
[Cause] comparison with invalid pointer.
[Solution] comparison with valid pointer.

[team] WebAPI
[request] N/A
[horizontal_expansion] N/A

UnitTC passed.

20 files changed:
packaging/wrt-plugins-tizen.spec
src/Bluetooth/BluetoothAdapter.cpp
src/Bluetooth/JSBluetoothHealthApplication.cpp
src/Bluetooth/JSBluetoothServiceHandler.cpp
src/Bluetooth/JSBluetoothSocket.cpp
src/DataSync/DataSyncManager.cpp
src/DataSync/DataSyncResponseDispatcher.cpp
src/DataSync/JSDataSyncManager.cpp
src/Download/JSDownloadRequest.cpp
src/Messaging/Conversation.cpp
src/Messaging/Email.cpp
src/Messaging/JSMessageAttachment.cpp
src/Messaging/JSMessagingService.cpp
src/Messaging/MailSender.cpp
src/Messaging/MailSync.cpp
src/Messaging/Messaging.cpp
src/Messaging/MessagingController.cpp
src/Messaging/MessagingService.cpp
src/Messaging/ReqReceiverMessage.cpp
src/Messaging/Sms.cpp

index e928e2f..5a65e11 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.61
+Version:    0.4.62
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 026120c..ba9a1a5 100644 (file)
@@ -402,7 +402,7 @@ void BluetoothAdapter::onBondCreatedCB(int result, bt_device_info_s *deviceInfo,
                 callback->invokeCallback("success", deviceObj);
             }
         }
-        if(result == BT_ERROR_REMOTE_DEVICE_NOT_FOUND) {
+       else if(result == BT_ERROR_REMOTE_DEVICE_NOT_FOUND) {
             if(callback) {
                 LoggerE("Not found");
                 JSContextRef context = callback->getContext();
index 21d6987..a12226a 100644 (file)
@@ -166,11 +166,7 @@ bool JSBluetoothHealthApplication::setProperty(JSContextRef context,
                     throw TypeMismatchException("Value is not Object");
                 }
 
-                JSValueRef ex = NULL;
-                onconnectObj = JSValueToObject(context, value, &ex);
-                if(ex){
-                    throw TypeMismatchException("Can't convert to Object");
-                }                
+                onconnectObj = JSUtil::JSValueToObject(context, value);
 
                 if(!JSObjectIsFunction(context, onconnectObj)) {
                     throw TypeMismatchException("Not function");
index bf207f6..828d35b 100644 (file)
@@ -152,11 +152,7 @@ bool JSBluetoothServiceHandler::setProperty(JSContextRef context,
                     throw TypeMismatchException("Value is not Object");
                 }
 
-                JSValueRef ex = NULL;
-                object = JSValueToObject(context, value, &ex);
-                if(ex){
-                    throw TypeMismatchException("Can't convert to Object");
-                }                
+                object = JSUtil::JSValueToObject(context, value);
 
                 if(!JSObjectIsFunction(context, object)) {
                     throw TypeMismatchException("Not function");
index 4f93a48..6bfb9ef 100644 (file)
@@ -160,6 +160,8 @@ bool JSBluetoothSocket::setProperty(JSContextRef context,
         JSValueRef value,
         JSValueRef* exception)
 {
+    LoggerD("Enter");
+    
     try {
         BluetoothSocketPtr priv = static_cast<BluetoothSocketPtr>(JSObjectGetPrivate(object));
         if (!priv) {
@@ -173,11 +175,7 @@ bool JSBluetoothSocket::setProperty(JSContextRef context,
                     throw TypeMismatchException("Value is not Object");
                 }
 
-                JSValueRef ex;
-                object = JSValueToObject(context, value, &ex);
-                if(ex){
-                    throw TypeMismatchException("Can't convert to Object");
-                }                
+                object = JSUtil::JSValueToObject(context, value);
 
                 if(!JSObjectIsFunction(context, object)) {
                     throw TypeMismatchException("Not function");
@@ -196,11 +194,7 @@ bool JSBluetoothSocket::setProperty(JSContextRef context,
                     throw TypeMismatchException("Value is not Object");
                 }
 
-                JSValueRef ex;
-                object = JSValueToObject(context, value, &ex);
-                if(ex){
-                    throw TypeMismatchException("Can't convert to Object");
-                }                
+                object = JSUtil::JSValueToObject(context, value);
 
                 if(!JSObjectIsFunction(context, object)) {
                     throw TypeMismatchException("Not function");
@@ -219,11 +213,7 @@ bool JSBluetoothSocket::setProperty(JSContextRef context,
                     throw TypeMismatchException("Value is not Object");
                 }
 
-                JSValueRef ex;
-                object = JSValueToObject(context, value, &ex);
-                if(ex){
-                    throw TypeMismatchException("Can't convert to Object");
-                }                
+                object = JSUtil::JSValueToObject(context, value);
 
                 if(!JSObjectIsFunction(context, object)) {
                     throw TypeMismatchException("Not function");
index 86bcaf7..112449a 100755 (executable)
@@ -78,24 +78,27 @@ static int datasync_state_changed_cb(sync_agent_event_data_s* request, void *use
                sync_agent_get_event_data_param(request, &progress);
                sync_agent_get_event_data_param(request, &error);
 
-               LoggerD("profileDirName: "<<profileDirName<<", sync_type: "<<sync_type<<", progress: "<<progress<<", error: "<<error);
+               LoggerI("profileDirName: "<<profileDirName<<", sync_type: "<<sync_type<<", progress: "<<progress<<", error: "<<error);
 
                if(profileDirName) {
                eventPtr->setProfileId(profileDirName);
+                       if(4<strnlen(profileDirName, 5)) {
+                       eventPtr->setProfileId(eventPtr->getProfileId().substr(4));
+                       }
                }
 
                if(NULL==progress) {
                        LoggerW("Null status.");
                        eventPtr->setSessionStatus(OnDataSyncStateChanged::UNDEFINED_STATUS);
-               } else if(0==strcmp(progress, "DONE")) {
+               } else if(0==strncmp(progress, "DONE", 4)) {
                        eventPtr->setSessionStatus(OnDataSyncStateChanged::COMPLETE_STATUS);
-               } else if(0==strcmp(progress, "CANCEL")) {
+               } else if(0==strncmp(progress, "CANCEL", 6)) {
                        eventPtr->setSessionStatus(OnDataSyncStateChanged::STOP_STATUS);
-               } else if(0==strcmp(progress, "ERROR")) {
+               } else if(0==strncmp(progress, "ERROR", 5)) {
                        // Error cases should be redefined and transferred based on the error value.
                        eventPtr->setSessionStatus(OnDataSyncStateChanged::FAIL_STATUS);
                } else {
-                       LoggerW("Wrong status.");
+                       LoggerI("Undefined status: "<<progress);
                        eventPtr->setSessionStatus(OnDataSyncStateChanged::UNDEFINED_STATUS);
                }
 
@@ -156,7 +159,7 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat
                sync_agent_get_event_data_param(request, &progressStatus);
                sync_agent_get_event_data_param(request, &operationType);
 
-               LoggerD("profileDirName: "<<profileDirName<<", syncType: "<<syncType<<", uri: "<<uri<<", progressStatus: "<<progressStatus<<", operationType "<<operationType);
+               LoggerI("profileDirName: "<<profileDirName<<", syncType: "<<syncType<<", uri: "<<uri<<", progressStatus: "<<progressStatus<<", operationType "<<operationType);
 
                sync_agent_get_event_data_param(request, &isFromServer);
                sync_agent_get_event_data_param(request, &totalPerOperation);
@@ -164,10 +167,13 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat
                sync_agent_get_event_data_param(request, &totalPerDb);
                sync_agent_get_event_data_param(request, &syncedPerDb);
 
-               LoggerD("isFromServer: "<<isFromServer<<", totalPerOperation: "<<totalPerOperation<<", syncedPerOperation: "<<syncedPerOperation<<", totalPerDb: "<<totalPerDb<<", syncedPerDb "<<syncedPerDb);
+               LoggerI("isFromServer: "<<isFromServer<<", totalPerOperation: "<<totalPerOperation<<", syncedPerOperation: "<<syncedPerOperation<<", totalPerDb: "<<totalPerDb<<", syncedPerDb "<<syncedPerDb);
 
                if(profileDirName) {
                eventPtr->setProfileId(profileDirName);
+                       if(4<strnlen(profileDirName, 5)) {
+                       eventPtr->setProfileId(eventPtr->getProfileId().substr(4));
+                       }
                }
 
                eventPtr->setSessionStatus(OnDataSyncStateChanged::PROGRESS_STATUS);
@@ -385,13 +391,13 @@ static sync_agent_ds_src_uri_e convertToPlatformSourceUri(SyncServiceInfo::SyncS
 
 static SyncStatistics::SyncStatus convertToSyncStatus(char* status)
 {
-       if(0==strcmp(status, "success")) {
+       if(0==strncmp(status, "success", 7)) {
                return SyncStatistics::SUCCESS_STATUS;
-       } else if(0==strcmp(status, "stop")) {
+       } else if(0==strncmp(status, "stop", 4)) {
                return SyncStatistics::STOP_STATUS;
-       } else if(0==strcmp(status, "fail")) {
+       } else if(0==strncmp(status, "fail", 4)) {
                return SyncStatistics::FAIL_STATUS;
-       } else if(0==strcmp(status, "No")) {
+       } else if(0==strncmp(status, "No", 2)) {
                return SyncStatistics::NONE_STATUS;
        } else {
                LoggerW("Error while converting a sync status.");
@@ -695,7 +701,8 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilesNumPtr &event)
                int numProfiles=0;
                for (iter = profile_list; iter != NULL; iter = g_list_next(iter)) {
                   sync_agent_ds_free_profile_info((ds_profile_h) iter->data);
-                  LoggerD("Free sync_agent_ds_profile_info for index: "<<numProfiles++);
+                  numProfiles++;
+                  LoggerD("Free sync_agent_ds_profile_info for index: "<<numProfiles);
                }
 
                LoggerD("numProfiles: "<<numProfiles);
index c6d0fcb..d87c446 100755 (executable)
@@ -93,7 +93,7 @@ void DataSyncResponseDispatcher::onAnswerReceived(const OnDataSyncStateChangedPt
                 JSValueRef objParam[2] = {profileId, errorObject};
                 multiCallbacks->getOnFailed()->callOnSuccess(objParam, 2);
             } else {
-                LoggerW("Wrong sync session state.");
+                LoggerI("Undefined sync session state. Skip this.");
             }
         } else {
             LoggerW("Failed result received.");
index edb3727..25fb68f 100755 (executable)
@@ -443,7 +443,7 @@ JSValueRef JSDataSyncManager::getProfilesNum(JSContextRef context,
             LoggerD("Number of profiles: "<<dplEvent->getNumProfiles());
             return converter.toJSValueRef(dplEvent->getNumProfiles());
         } else {
-                       ThrowMsg(UnknownException, "Get the number of profiles failed by unknown reason.");
+                       ThrowMsg(UnknownException, "Getting the number of profiles failed by unknown reason.");
         }
     }
     Catch(UnsupportedException)
index b04bf63..42c080e 100644 (file)
@@ -99,7 +99,14 @@ bool JSDownloadRequest::setProperty(JSContextRef context, JSObjectRef object,
     try {
         // check url
         if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_DOWNLOAD_REQUEST_URL)) {
-            JSUtil::JSValueToString(context, value);
+            if(JSValueIsNull(context, value))
+            {
+                JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_URL, JSUtil::toJSValueRef(context, JSUtil::JSValueToString(context, value)), kJSPropertyAttributeNone);
+                return true;
+            }else
+            {
+                JSUtil::JSValueToString(context, value);
+            }
         }
 
         // check destination
index b399316..072efa0 100644 (file)
@@ -594,19 +594,19 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg
                //      get thread message count
 //             lastMsgIndex = convViewList.nCount - 1;
 //             m_messageCount = convViewList.nCount;
-               lastMsgIndex = msgList.nCount - 1;
+//             lastMsgIndex = msgList.nCount - 1;              //  on msg_get_conversation_view_list last is recent message but msg_get_message_list first is recent message
                m_messageCount = msgList.nCount;
                LoggerD("m_messageCount : " << m_messageCount);
 
                //      get thread read status
 //             msg_get_bool_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_READ_BOOL, &tempBool);
-               msg_get_bool_value(msgList.msg_struct_info[lastMsgIndex], MSG_MESSAGE_READ_BOOL, &tempBool);
+               msg_get_bool_value(msgList.msg_struct_info[0], MSG_MESSAGE_READ_BOOL, &tempBool);
                m_read = tempBool;
                LoggerD("m_read : " << m_read);
 
                //      get thread last message Id
 //             msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_ID_INT, &tempInt);
-               msg_get_int_value(msgList.msg_struct_info[lastMsgIndex], MSG_MESSAGE_ID_INT, &tempInt);
+               msg_get_int_value(msgList.msg_struct_info[0], MSG_MESSAGE_ID_INT, &tempInt);
                m_lastMessageId = tempInt;
                LoggerD("m_lastMessageId : " << m_lastMessageId);
 
@@ -617,7 +617,7 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg
                }
 
 //             msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_DIRECTION_INT, &tempInt);
-               msg_get_int_value(msgList.msg_struct_info[lastMsgIndex], MSG_MESSAGE_DIRECTION_INT, &tempInt);
+               msg_get_int_value(msgList.msg_struct_info[0], MSG_MESSAGE_DIRECTION_INT, &tempInt);
                int type = tempInt;
                LoggerD("direction : " << type);
                m_direction = type;
index d8b7210..5ac4d15 100644 (file)
@@ -631,7 +631,7 @@ void Email::readBody() {
                                        LoggerD(" setNth(i+1) : " << i+1);
                                        if(attachment[i].inline_content_status == 0)
                                        {
-                                       appendAttachment(tmpAtt);
+                                               appendAttachment(tmpAtt);
                                        }
                                        else
                                        {
index f5cb33a..635173e 100644 (file)
@@ -595,6 +595,10 @@ JSValueRef JSMessageAttachment::getProperty(JSContextRef context,
                else if(JSStringIsEqualToUTF8CString(propertyName, FILEPATH))
                {
                        std::string fullPath = attachment->getFullPath();
+                       if(fullPath.size() == 0)
+                       {
+                               return JSValueMakeNull(context);
+                       }
                        std::string filePath = DeviceAPI::Filesystem::Utils::toVirtualPath(globalContext, fullPath);
                        return converter->toJSValueRef(filePath);
                }
index 87bc9c8..7c0d3e7 100644 (file)
@@ -452,13 +452,8 @@ JSValueRef JSMessagingService::sendMessage(JSContextRef context,
             throw DeviceAPI::Common::TypeMismatchException(str.str().c_str());
         }
 
-        // argu 2. Success callback (optional)
+        // argu 2. Success callback (optional & nullable)
         JSObjectRef successcb = validator.toFunction(1, true);
-        // cannot be nullable
-        if (( argumentCount > 1 ) && (NULL == successcb))
-        {
-            throw DeviceAPI::Common::TypeMismatchException("Invalid success callback.");
-        }
         callbackManager->setOnSuccess(successcb);
 
         // argu 3. error callback (optional & nullable)
@@ -1063,14 +1058,16 @@ JSValueRef JSMessagingService::stopSync(JSContextRef context, JSObjectRef functi
         {
             LoggerD("get callback Manager");
             EventMessagingServicePrivateDataPtr privateData =
-                DPL::StaticPointerCast<EventMessagingServicePrivateData>(event->getPrivateData());
+            DPL::StaticPointerCast<EventMessagingServicePrivateData>(event->getPrivateData());
 
             WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = privateData->getCallbackManager(); //get callback manager
             JSContextRef globalContext = callbackManager->getContext();
             if (callbackManager)
             {
+                JSValueRef error = NULL;
                 LoggerD("call error callback.");
-                callbackManager->callOnError(JSDOMExceptionFactory::AbortException.make(globalContext, JSMESSAGING_EXCEPTION_MSG_ABORT_ERROR));
+                error = JSWebAPIErrorFactory::makeErrorObject(globalContext, JSWebAPIErrorFactory::ABORT_ERROR, JSMESSAGING_EXCEPTION_MSG_ABORT_ERROR);
+                callbackManager->callOnError(error);
             }
         }
 
index 59172e0..34df021 100644 (file)
@@ -188,17 +188,30 @@ void MailSender::OnEventReceived(const DBus::MessageEvent& event)
                 }
                 emitter->emit(event);
             } else if (requestReceiver) {
-                //EventSendMessagePtr event = mail->getSendMessageEvent();
-                       EventMessagingServicePtr event = mail->getMessagingServiceEvent();
-                event->setExceptionCode(
-                    WrtDeviceApis::Commons::ExceptionCodes::UnknownException
-                    );
+                EventMessagingServicePtr event = mail->getMessagingServiceEvent();
+                LoggerD("msg->getErrorCode() : " << msg->getErrorCode());
+                switch (msg->getErrorCode()) {
+                case EMAIL_ERROR_NO_SIM_INSERTED:
+                case EMAIL_ERROR_FLIGHT_MODE:
+                case EMAIL_ERROR_SMTP_SEND_FAILURE:
+                case EMAIL_ERROR_CONNECTION_FAILURE:
+                case EMAIL_ERROR_CONNECTION_BROKEN:
+                case EMAIL_ERROR_NO_SUCH_HOST:
+                case EMAIL_ERROR_NETWORK_NOT_AVAILABLE:
+                case EMAIL_ERROR_INVALID_SERVER:
+                case EMAIL_ERROR_NO_RESPONSE:
+                case EMAIL_ERROR_CANCELLED:
+                    event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::PlatformWrongStateException);
+                    break;
+
+                default:
+                    event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
+                }
                 requestReceiver->ManualAnswer(event);
             }
-                mail->setMessageStatus(MESSAGE_STATUS_FAILED);
+            mail->setMessageStatus(MESSAGE_STATUS_FAILED);
                 
-            LoggerD("Sending e-mail: " << mailId <<
-                    " failed with error: " << msg->getErrorCode());
+            LoggerD("Sending e-mail: " << mailId << " failed with error: " << msg->getErrorCode());
             LoggerD("E-mail error handle: " << handle);
             m_requests.erase(handle);
             break;
index 20236a4..7ea7535 100644 (file)
@@ -443,8 +443,9 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
        int mailId = syncNetworkStatus->getMailId();    //if email body download mode.
        int status = syncNetworkStatus->getStatus();
        int handle = syncNetworkStatus->getHandle();
+       int errCode = syncNetworkStatus->getErrorCode();
 
-       LoggerD("mailId : " << mailId << " status : " << status << " handle : " << handle);
+       LoggerD("mailId : " << mailId << " status : " << status << " handle : " << handle << " errCode : " << errCode);
        // if Attachment Load
        if ( status == NOTI_DOWNLOAD_ATTACH_FINISH ||status == NOTI_DOWNLOAD_ATTACH_FAIL )
        {
@@ -527,7 +528,7 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
        SyncRequestIterator it = m_SyncRequests.find(handle);
        if ( m_SyncRequests.end() != it)
        {
-               int syncType = it->second.syncType;
+               int syncType = it->second.syncType;
                LoggerD(" Sync ... handle : " << handle << " status : " << status << " SyncType: " << syncType);
 
                switch(syncType)
@@ -552,8 +553,15 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
                                                }
                                                else if ( status == NOTI_DOWNLOAD_FAIL )
                                                {
-                                                       LoggerD("Sync Fail");
-                                                       event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::UnknownException );
+                                                       LoggerD("Sync Fail : " << errCode);
+                                                       if(errCode == EMAIL_ERROR_CANCELLED)
+                                                       {
+                                                               event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::EventCancelledException );
+                                                       }
+                                                       else
+                                                       {
+                                                               event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::UnknownException );
+                                                       }
                                                        requestReceiver->ManualAnswer(event);
                                                        m_SyncRequests.erase( handle );
                                                }
@@ -584,8 +592,15 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
                                                }
                                                else if ( status == NOTI_DOWNLOAD_FAIL )
                                                {
-                                                       LoggerD("Sync Fail");
-                                               event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::UnknownException );
+                                                       LoggerD("Sync Fail : " << errCode);
+                                                       if(errCode == EMAIL_ERROR_CANCELLED)
+                                                       {
+                                                               event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::EventCancelledException );
+                                                       }
+                                                       else
+                                                       {
+                                                               event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::UnknownException );
+                                                       }
                                                        requestReceiver->ManualAnswer(event);
                                                        m_SyncRequests.erase( handle );
                                                }
@@ -605,7 +620,7 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
                                if (mail && requestReceiver) {
                                        EventMessagingServicePtr event = mail->getMessagingServiceEvent();
                        
-                                       if ( status == NOTI_DOWNLOAD_BODY_FINISH )
+                                       if ( status == NOTI_DOWNLOAD_BODY_FINISH || (status == NOTI_DOWNLOAD_BODY_FAIL && errCode == EMAIL_ERROR_MAIL_IS_ALREADY_DOWNLOADED))
                                        {
                                                event->m_message->readAllData();
 
index 89943f9..64554c8 100644 (file)
@@ -1618,6 +1618,7 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                         return;
                     }
                     int msgType = 0;
+
                     msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &msgType);
                     LoggerD("msgType : " << msgType);
                     if((msgType > MSG_TYPE_INVALID) && ( msgType <= MSG_TYPE_SMS_REJECT))
@@ -1639,17 +1640,19 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                             event->setMsg_Type(SMS);
 
                             if(this_->m_onMessageReceived.size() > 0){
-                                if(storageChangeType == MSG_STORAGE_CHANGE_INSERT)
+                                LoggerD("Message Status = " << message->getMessageStatus());
+                                if((storageChangeType == MSG_STORAGE_CHANGE_INSERT))
                                 {
                                     LoggerD("MSG_STORAGE_CHANGE_INSERT");
                                     event->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+                                    this_->m_onMessageReceived.emit(event);
                                 }
                                 else if(storageChangeType == MSG_STORAGE_CHANGE_UPDATE)
                                 {
                                     LoggerD("MSG_STORAGE_CHANGE_UPDATE");
                                     event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                    this_->m_onMessageReceived.emit(event);
                                 }
-                                this_->m_onMessageReceived.emit(event);
                             }
                             if(this_->m_onConversationReceived.size() > 0){
                                 int emitCheck = 0;
@@ -2609,6 +2612,7 @@ bool Messaging::deleteConversations(const std::vector<IConversationPtr>& convers
        {
                LoggerD("Enter-Email");
                int threadId = 0;
+               int err;
 
                for (std::size_t i = 0; i < conversations.size(); ++i) 
                {
@@ -2619,6 +2623,15 @@ bool Messaging::deleteConversations(const std::vector<IConversationPtr>& convers
                                return false;
                        }
                }
+
+               // email_delete_thread is asyncronous so check last deleted thread status check
+               do
+               {
+                       email_mail_list_item_t *thread_info = NULL;
+                       usleep(300 * 1000);
+                       err = email_get_thread_information_ex(threadId, &thread_info);
+                       LoggerD("err " << err);
+               }while(err != EMAIL_ERROR_MAIL_NOT_FOUND);
        }
        else
        {
index 17d32c4..36f7a72 100644 (file)
@@ -167,6 +167,30 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event
        {
                LoggerD(" Message load attachment");
                LoggerD("Operation ID : " << event->opId);
+
+               JSValueRef error = NULL;
+               if (ExceptionCodes::None != event->getExceptionCode()) {
+                       LoggerD("Report error");
+                       switch (event->getExceptionCode()) {
+                               case ExceptionCodes::InvalidArgumentException:
+                               case ExceptionCodes::PlatformException:
+                               case ExceptionCodes::ConversionException:
+                                       error = JSWebAPIErrorFactory::makeErrorObject(
+                                                               globalContext,
+                                                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR,
+                                                               JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT);
+                                       LoggerD("Report conversion error");
+                                       break;
+                               default:
+                                       error = JSWebAPIErrorFactory::makeErrorObject(
+                                                               globalContext,
+                                                               JSWebAPIErrorFactory::UNKNOWN_ERROR,
+                                                               JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
+                                       LoggerD("Report unknown error");
+                       }
+               }
+
+               
                if ( event->m_messagingService)
                        event->m_messagingService->deleteOpId(event->opId);
 
@@ -183,13 +207,43 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event
                }
                else
                {
-                       callbackManager->callOnError();
+                       callbackManager->callOnError(error);
                }
        }
        else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_SYNC)
        {       
                LoggerD(" Message Sync :");
                LoggerD("Operation ID : " << event->opId);
+
+               JSValueRef error = NULL;
+               if (ExceptionCodes::None != event->getExceptionCode()) {
+                       LoggerD("Report error");
+                       switch (event->getExceptionCode()) {
+                               case ExceptionCodes::EventCancelledException:
+                                       error = JSWebAPIErrorFactory::makeErrorObject(
+                                                               globalContext,
+                                                               JSWebAPIErrorFactory::ABORT_ERROR,
+                                                               JSMESSAGING_EXCEPTION_MSG_ABORT_ERROR);
+                                       LoggerD("Report abort error");
+                                       break;
+                               case ExceptionCodes::InvalidArgumentException:
+                               case ExceptionCodes::PlatformException:
+                               case ExceptionCodes::ConversionException:
+                                       error = JSWebAPIErrorFactory::makeErrorObject(
+                                                               globalContext,
+                                                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR,
+                                                               JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT);
+                                       LoggerD("Report conversion error");
+                                       break;
+                               default:
+                                       error = JSWebAPIErrorFactory::makeErrorObject(
+                                                               globalContext,
+                                                               JSWebAPIErrorFactory::UNKNOWN_ERROR,
+                                                               JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
+                                       LoggerD("Report unknown error");
+                       }
+               }
+
                if ( event->m_messagingService)
                        event->m_messagingService->deleteOpId(event->opId);
        
@@ -199,13 +253,43 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event
                }
                else
                {
-                       callbackManager->callOnError();
+                       callbackManager->callOnError(error);
                }
        }
        else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_SYNC_FOLDER)
        {       
                LoggerD(" Message Sync Folder");
                LoggerD("Operation ID : " << event->opId);
+
+               JSValueRef error = NULL;
+               if (ExceptionCodes::None != event->getExceptionCode()) {
+                       LoggerD("Report error");
+                       switch (event->getExceptionCode()) {
+                               case ExceptionCodes::EventCancelledException:
+                                       error = JSWebAPIErrorFactory::makeErrorObject(
+                                                               globalContext,
+                                                               JSWebAPIErrorFactory::ABORT_ERROR,
+                                                               JSMESSAGING_EXCEPTION_MSG_ABORT_ERROR);
+                                       LoggerD("Report abort error");
+                                       break;
+                               case ExceptionCodes::InvalidArgumentException:
+                               case ExceptionCodes::PlatformException:
+                               case ExceptionCodes::ConversionException:
+                                       error = JSWebAPIErrorFactory::makeErrorObject(
+                                                               globalContext,
+                                                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR,
+                                                               JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT);
+                                       LoggerD("Report conversion error");
+                                       break;
+                               default:
+                                       error = JSWebAPIErrorFactory::makeErrorObject(
+                                                               globalContext,
+                                                               JSWebAPIErrorFactory::UNKNOWN_ERROR,
+                                                               JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
+                                       LoggerD("Report unknown error");
+                       }
+               }
+
                if ( event->m_messagingService)
                        event->m_messagingService->deleteOpId(event->opId);
                if (event->getExceptionCode() == ExceptionCodes::None)
@@ -214,7 +298,7 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event
                }
                else
                {
-                       callbackManager->callOnError();
+                       callbackManager->callOnError(error);
                }
        }
        else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_SEND_MESSAGE)
@@ -287,7 +371,8 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event
        }
        else 
        {
-               callbackManager->callOnError(JSValueMakeUndefined(globalContext));
+//             callbackManager->callOnError(JSValueMakeUndefined(globalContext));
+               LoggerD( "ignore Event");
        }
        
 }
index b408fe6..89d8d4f 100644 (file)
@@ -172,16 +172,16 @@ int MessagingService::getHandleFromOpId(int opIdx)
         int retryCount = 0;
         if(it->second.checkSetHandle == false)
         {
-            while (retryCount < 2) {
+            while (retryCount < 4) {
                 LoggerW("Wait for handle");
-                usleep(200 * 1000);
+                usleep(250 * 1000);
                 if (it->second.checkSetHandle) {
                     break;
                 }
                 retryCount++;
             }
-            handle = it->second.handle;
         }
+        handle = it->second.handle;
     }
 
     LoggerD("handle " << handle);
index 5ca1a79..507ff01 100644 (file)
@@ -481,7 +481,7 @@ void ReqReceiverMessage::OnRequestReceived(const EventQueryConversationsPtr& eve
        }
        Catch(WrtDeviceApis::Commons::PlatformException)
        {
-               MsgLoggerE("platform exception");
+               MsgLoggerE("platform exception " << _rethrown_exception.GetMessage());
                event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
        }
        Catch(WrtDeviceApis::Commons::InvalidArgumentException)
index e3ac3c3..42bbdff 100644 (file)
@@ -975,15 +975,12 @@ void Sms::readRecipientList(msg_struct_t& messageData)
 
 void Sms::readBody(msg_struct_t& messageData)
 {
-    //set abstraction body value
     int tempInt;
     msg_get_int_value(messageData, MSG_MESSAGE_DATA_SIZE_INT, &tempInt);
-    LoggerE("body Size : " <<tempInt);
+    LoggerD("body Size : " <<tempInt);
     char msgText[tempInt+1];
     memset(msgText, 0, tempInt+1);
     msg_get_str_value(messageData, MSG_MESSAGE_SMS_DATA_STR, msgText, tempInt);
-//    setBody(msg_sms_get_message_body(messageData));
-    LoggerE("body : " <<msgText);
     setBody(msgText);
 }
 
@@ -991,7 +988,7 @@ void Sms::readFolder(msg_struct_t& messageData)
 {
     int tempInt = 0;
     msg_get_int_value(messageData, MSG_MESSAGE_FOLDER_ID_INT, &tempInt);
-    LoggerE("Folder : " <<tempInt);
+    LoggerD("Folder : " <<tempInt);
 
     switch (tempInt) {
     case MSG_INBOX_ID: