Apply MMS emulator send success, fail mode.
authorKeebum Kim <keebum.kim@samsung.com>
Thu, 21 Mar 2013 06:05:37 +0000 (15:05 +0900)
committerKeebum Kim <keebum.kim@samsung.com>
Thu, 21 Mar 2013 06:05:37 +0000 (15:05 +0900)
Change-Id: Ic84f047a1ad1d2c9e112a48c8bd2a5ab9f93ef9e

plugin/mms_plugin/MmsPluginEventHandler.cpp
plugin/mms_plugin/MmsPluginUserAgent.cpp

index d4e3265..922b1b9 100755 (executable)
@@ -68,8 +68,10 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char
                listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
 
                //MsgDeleteFile(pRetrievedFilePath + strlen(MSG_DATA_PATH)); // not ipc
-               if (remove(pRetrievedFilePath) != 0)
-                       MSG_DEBUG("remove fail");
+               if (pRetrievedFilePath) {
+                       if (remove(pRetrievedFilePath) != 0)
+                               MSG_DEBUG("remove fail");
+               }
                break;
 
        // received data is retrieve-conf
@@ -86,8 +88,10 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char
                break;
 
        case eMMS_READREPORT_CONF:
-               if (remove(pRetrievedFilePath) != 0)
-                       MSG_DEBUG("remove fail");
+               if (pRetrievedFilePath) {
+                       if (remove(pRetrievedFilePath) != 0)
+                               MSG_DEBUG("remove fail");
+               }
                break;
        default:
                break;
index 32fa3c5..9b8e4e8 100755 (executable)
@@ -14,6 +14,8 @@
 * limitations under the License.
 */
 
+#include <sys/utsname.h>
+
 #include "MsgException.h"
 #include "MsgUtilFile.h"
 #include "MsgGconfWrapper.h"
@@ -295,6 +297,62 @@ void MmsPluginUaManager::run()
                        unlock();
                }
 
+
+               { // Check is it emulator or not.
+                       struct utsname buf;
+                       int ret = uname(&buf);
+
+                       if (ret == 0) {
+                               MSG_DEBUG("System runs on [%s].", buf.machine);
+                               if (strncmp(buf.machine, "i686", 4) == 0) {
+                                       MSG_DEBUG("Running on Emulator mode.");
+
+                                       int mmsResult = MsgSettingGetInt(VCONFKEY_TELEPHONY_MMS_SENT_STATUS);
+
+                                       MSG_DEBUG("MMS result has to be [%d]", mmsResult);
+
+                                       while (!mmsTranQ.empty()) {
+                                               MSG_DEBUG("###### mmsTranQ.size [%d]", mmsTranQ.size());
+
+                                               mmsTranQEntity reqEntity;
+                                               memset(&reqEntity, 0, sizeof(mmsTranQEntity));
+
+                                               mmsTranQ.front(&reqEntity);
+
+                                               if (mmsResult > 0) {
+                                                       // For MMS send fail.
+                                                       MmsPluginEventHandler::instance()->handleMmsError(&reqEntity);
+                                                       mmsTranQ.pop_front();
+                                               } else {
+                                                       // For MMS send success.
+                                                       MSG_DEBUG("conf received successfully");
+
+                                                       reqEntity.eMmsPduType = eMMS_SEND_CONF;
+
+                                                       try {
+                                                               MmsPluginEventHandler::instance()->handleMmsReceivedData(&reqEntity, NULL);
+                                                       } catch (MsgException& e) {
+                                                               MSG_FATAL("%s", e.what());
+                                                               break;
+                                                       } catch (exception& e) {
+                                                               MSG_FATAL("%s", e.what());
+                                                               break;
+                                                       }
+
+                                                       mmsTranQ.pop_front();
+                                               }
+                                       }
+
+                                       mmsTranQ.clear();
+                                       MutexLocker locker(mx);
+                                       running = false;
+
+                                       return;
+                               }
+                       }
+               }
+
+
                // Request CM Open
                if (!(cmAgent->open())) {
                        MSG_DEBUG("Cm Open Failed");