summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorChangseok Oh <seok.oh@samsung.com>2013-01-09 22:03:18 +0900
committerChangseok Oh <seok.oh@samsung.com>2013-01-09 22:03:18 +0900
commit8e11a02348eb5effb6b84ac587dcb8b3ca905828 (patch)
treed109f455e4703478a764a749b69c3c490c12f350 /plugin
parenta429a331a6abf58f74b9ef86fbdb6777e9c59180 (diff)
downloadmsg-service-8e11a02348eb5effb6b84ac587dcb8b3ca905828.tar.gz
msg-service-8e11a02348eb5effb6b84ac587dcb8b3ca905828.tar.bz2
msg-service-8e11a02348eb5effb6b84ac587dcb8b3ca905828.zip
fix prevent issue
Diffstat (limited to 'plugin')
-rwxr-xr-xplugin/mms_plugin/CMakeLists.txt2
-rwxr-xr-xplugin/mms_plugin/MmsPluginCodecCommon.cpp192
-rwxr-xr-xplugin/mms_plugin/MmsPluginDecode.cpp348
-rwxr-xr-xplugin/mms_plugin/MmsPluginInternal.cpp10
-rwxr-xr-xplugin/mms_plugin/MmsPluginSmil.cpp39
-rwxr-xr-xplugin/mms_plugin/MmsPluginStorage.cpp100
-rwxr-xr-xplugin/mms_plugin/MmsPluginUserAgent.cpp4
-rwxr-xr-xplugin/mms_plugin/MmsPluginUtil.cpp39
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginCodecCommon.h4
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginDecode.h3
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginUtil.h4
-rwxr-xr-xplugin/sms_plugin/SmsPluginCallback.cpp31
-rwxr-xr-xplugin/sms_plugin/SmsPluginConcatHandler.cpp3
-rwxr-xr-xplugin/sms_plugin/SmsPluginEventHandler.cpp17
-rwxr-xr-xplugin/sms_plugin/SmsPluginMain.cpp4
-rwxr-xr-xplugin/sms_plugin/SmsPluginParamCodec.cpp4
-rwxr-xr-xplugin/sms_plugin/SmsPluginSetting.cpp15
-rwxr-xr-xplugin/sms_plugin/SmsPluginSimMsg.cpp6
-rwxr-xr-xplugin/sms_plugin/SmsPluginStorage.cpp47
-rwxr-xr-xplugin/sms_plugin/SmsPluginTpduCodec.cpp35
-rwxr-xr-xplugin/sms_plugin/SmsPluginTransport.cpp93
-rwxr-xr-xplugin/sms_plugin/SmsPluginWapPushHandler.cpp6
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginStorage.h2
23 files changed, 460 insertions, 548 deletions
diff --git a/plugin/mms_plugin/CMakeLists.txt b/plugin/mms_plugin/CMakeLists.txt
index 047d7b5..a9a0742 100755
--- a/plugin/mms_plugin/CMakeLists.txt
+++ b/plugin/mms_plugin/CMakeLists.txt
@@ -38,7 +38,7 @@ SET(MMS-PLUGIN-SRCS
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include/common
${CMAKE_SOURCE_DIR}/include/framework
- ${CMAKE_SOURCE_DIR}/include/msg_helper
+ #${CMAKE_SOURCE_DIR}/include/msg_helper
${CMAKE_SOURCE_DIR}/include/utils
${CMAKE_SOURCE_DIR}/include/mapi
${CMAKE_CURRENT_SOURCE_DIR}/include
diff --git a/plugin/mms_plugin/MmsPluginCodecCommon.cpp b/plugin/mms_plugin/MmsPluginCodecCommon.cpp
index 86878c4..d3b565b 100755
--- a/plugin/mms_plugin/MmsPluginCodecCommon.cpp
+++ b/plugin/mms_plugin/MmsPluginCodecCommon.cpp
@@ -903,7 +903,6 @@ char *MsgDecodeText(char *pOri)
int nCharset = MSG_CHARSET_UTF8;
int nTemp = 0;
char *pReturnStr = NULL;
- char *pConvertedStr = NULL;
char szTempBuf[MSG_LOCAL_TEMP_BUF_SIZE] = {0};
@@ -946,6 +945,8 @@ char *MsgDecodeText(char *pOri)
*pDecQ = '\0';
nCharset = _MsgGetCode(MSG_CHARSET, pDecStart + 2);
+ if(nCharset < 0)
+ goto __CATCH;
*pDecQ = MSG_CH_QUESTION;
}
@@ -1090,11 +1091,6 @@ __RETURN:
pTemp = NULL;
}
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
if(pRe) {
free(pRe);
pRe = NULL;
@@ -1109,11 +1105,6 @@ __RETURN:
__CATCH:
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
if(pRe) {
free(pRe);
pRe = NULL;
@@ -1801,4 +1792,183 @@ bool MmsInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo)
return true;
}
+
+void MmsReleaseMsgDRMInfo(MsgDRMInfo *pDrmInfo)
+{
+ MSG_DEBUG("_MsgFreeDRMInfo: S T A R T !!! \n");
+
+ if (pDrmInfo == NULL) {
+ MSG_DEBUG("pDrmInfo is NULL");
+ return;
+ }
+
+ if (pDrmInfo->szContentDescription) {
+ free(pDrmInfo->szContentDescription);
+ pDrmInfo->szContentDescription = NULL;
+ }
+
+ if (pDrmInfo->szContentVendor) {
+ free(pDrmInfo->szContentVendor);
+ pDrmInfo->szContentVendor = NULL;
+ }
+
+ if (pDrmInfo->szContentName) {
+ free(pDrmInfo->szContentName);
+ pDrmInfo->szContentName = NULL;
+ }
+
+ if (pDrmInfo->szContentURI) {
+ free(pDrmInfo->szContentURI);
+ pDrmInfo->szContentURI = NULL;
+ }
+
+ if (pDrmInfo->szRightIssuer) {
+ free(pDrmInfo->szRightIssuer);
+ pDrmInfo->szRightIssuer = NULL;
+ }
+
+ if (pDrmInfo->szDrm2FullPath) {
+ free(pDrmInfo->szDrm2FullPath);
+ pDrmInfo->szDrm2FullPath = NULL;
+ }
+
+ pDrmInfo->contentType = MIME_UNKNOWN;
+ pDrmInfo->drmType = MSG_DRM_TYPE_NONE;
+}
+
#endif
+
+bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib)
+{
+ MSG_BEGIN();
+
+ if (pAttrib == NULL) {
+ MSG_DEBUG("pAttrib is NULL");
+ return false;
+ }
+
+ if (pAttrib->szTo) {
+ free(pAttrib->szTo);
+ pAttrib->szTo = NULL;
+ }
+
+ if (pAttrib->szCc) {
+ free(pAttrib->szCc);
+ pAttrib->szCc = NULL;
+ }
+
+ if (pAttrib->szBcc) {
+ free(pAttrib->szBcc);
+ pAttrib->szBcc = NULL;
+ }
+
+ //check if pMultiStatus should be freed or not, because pMultiStatus is not allocated
+ if (pAttrib->pMultiStatus) {
+ MmsMsgMultiStatus *pMultiStatus = pAttrib->pMultiStatus;
+ MmsMsgMultiStatus *pCurStatus = NULL;
+
+ while (pMultiStatus != NULL ) {
+ pCurStatus = pMultiStatus;
+ pMultiStatus = pMultiStatus->pNext;
+
+ if (pCurStatus) {
+ free(pCurStatus);
+ pCurStatus = NULL;
+ }
+ }
+
+ pAttrib->pMultiStatus = NULL;
+ }
+
+
+ MSG_END();
+
+ return true;
+}
+
+bool MmsReleaseMsgBody(MsgBody *pBody, int type)
+{
+ MSG_BEGIN();
+
+ if (pBody == NULL) {
+ MSG_DEBUG("pBody == NULL \n" );
+ MSG_END();
+
+ return false;
+ }
+
+ switch (type) {
+ case MIME_MULTIPART_REPORT:
+ case MIME_APPLICATION_VND_OMA_DRM_MESSAGE:
+ case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED:
+ case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED:
+ case MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC:
+ case MIME_MULTIPART_MIXED:
+ case MIME_MULTIPART_RELATED:
+ case MIME_MULTIPART_ALTERNATIVE:
+ case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE:
+ {
+ MsgMultipart *pMulti = pBody->body.pMultipart;
+ MsgMultipart *pCurrPart = NULL;
+ MsgBody *pPresentation = pBody->pPresentationBody;
+ while (pMulti != NULL) {
+ pCurrPart = pMulti;
+
+ pMulti = pMulti->pNext;
+
+ if (pCurrPart) {
+#ifdef __SUPPORT_DRM__
+ MmsReleaseMsgDRMInfo(&pCurrPart->type.drmInfo);
+#endif
+
+ if (pCurrPart->pBody) {
+ if (pCurrPart->pBody->body.pBinary) {
+ free(pCurrPart->pBody->body.pBinary);
+ pCurrPart->pBody->body.pBinary = NULL;
+ }
+ free(pCurrPart->pBody);
+ pCurrPart->pBody = NULL;
+ }
+ free(pCurrPart);
+ pCurrPart = NULL;
+ }
+ }
+
+ pBody->body.pMultipart = NULL;
+
+ if (pPresentation) {
+ if (pPresentation->body.pText) {
+ free(pPresentation->body.pText);
+ pPresentation->body.pText = NULL;
+ }
+ free(pPresentation);
+ pBody->pPresentationBody = NULL;
+ }
+
+ MmsInitMsgType(&pBody->presentationType);
+
+ break;
+ }
+
+ default:
+ /* Any single part */
+ if (pBody->body.pBinary) {
+ free(pBody->body.pBinary);
+ pBody->body.pBinary = NULL;
+ }
+
+ break;
+ }
+
+ MSG_END();
+ return true;
+}
+
+void MmsReleaseMmsMsg(MmsMsg *pMmsMsg)
+{
+ if (pMmsMsg) {
+ MmsReleaseMsgBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
+ MmsReleaseMmsAttrib(&pMmsMsg->mmsAttrib);
+ bzero(pMmsMsg, sizeof(MmsMsg));
+ }
+}
diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp
index 3a1c39a..decd4d7 100755
--- a/plugin/mms_plugin/MmsPluginDecode.cpp
+++ b/plugin/mms_plugin/MmsPluginDecode.cpp
@@ -79,9 +79,6 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota
static bool __MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength);
#endif
-static bool __MsgInitMsgBody(MsgBody *pMsgBody);
-static bool __MsgInitMsgType(MsgType *pMsgType);
-
//util funcion
static void __MsgRemoveFilePath(char *pSrc);
static bool __MsgChangeSpace(char *pOrg, char **ppNew);
@@ -108,7 +105,6 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody);
static bool __MsgIsHexChar(char *pSrc);
static char __MsgConvertHexValue(char *pSrc);
static int __MsgConvertCharToInt(char ch);
-static bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam);
static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2);
static bool __MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2);
static bool __MsgIsMultipartMixed(int type);
@@ -2461,7 +2457,8 @@ __RETURN:
__CATCH:
if (isFileCreated)
- remove(szTempFilePath);
+ if(remove(szTempFilePath) != 0)
+ MSG_DEBUG("remove fail");
if (pRawData) {
free(pRawData);
@@ -2818,13 +2815,10 @@ bool MmsDrm2ConvertMsgBody(char *szOriginFilePath)
pszMmsLoadTempBuf = NULL;
}
- if (pszOrgData) {
- free(pszOrgData);
- pszOrgData = NULL;
- }
-
- remove(szTempFile);
- remove(szTempFilePath);
+ if(remove(szTempFile) != 0)
+ MSG_DEBUG("remove fail");
+ if(remove(szTempFilePath) != 0)
+ MSG_DEBUG("remove fail");
return true;
@@ -2886,9 +2880,9 @@ bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTemp
MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg);
MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMmsMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMmsMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
+ MmsReleaseMsgBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
if (MmsReadMsgBody(pMsg->msgId, bSavePartsAsTempFiles, bRetrieved, retrievedPath) == false) {
MSG_DEBUG("MmsDrm2ReadMsgConvertedBody: _MmsReadMsgBody with converted file is failed\n");
@@ -3876,9 +3870,6 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen
int charSetLen = 0;
int nTemp = 0;
char *pData = NULL;
- char *pTempData = NULL;
- unsigned short *mszTempStr = NULL;
- char *pConvertedStr = NULL;
MSG_DEBUG("__MmsBinaryDecodeEncodedString: decode string..\n");
@@ -3946,6 +3937,10 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen
const char *pFromCharSet = MmsPluginTextConvertGetCharSet(charset_code);
if (pFromCharSet == NULL || !strcmp(pFromCharSet, pToCharSet)) {
+ if (pData) {
+ free(pData);
+ pData = NULL;
+ }
return true;
}
@@ -3968,22 +3963,6 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen
pData = NULL;
}
- if (pTempData) {
- free(pTempData);
- pTempData = NULL;
- }
-
- if (mszTempStr) {
- free(mszTempStr);
- mszTempStr = NULL;
- }
-
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
-
return true;
__CATCH:
@@ -3993,21 +3972,6 @@ __CATCH:
pData = NULL;
}
- if (pTempData) {
- free(pTempData);
- pTempData = NULL;
- }
-
- if (mszTempStr) {
- free(mszTempStr);
- mszTempStr = NULL;
- }
-
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
return false;
}
@@ -4363,7 +4327,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
if ((mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED)||(mmsHeader.msgType.type == MIME_MULTIPART_MIXED)) {
if ((pMsg->nPartCount >= attachmax)&&(pMultipart->pNext != NULL)) {
- MsgFreeBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type);
+ MmsReleaseMsgBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type);
free(pMultipart->pNext->pBody);
pMultipart->pNext->pBody= NULL;
@@ -4455,10 +4419,10 @@ __CATCH:
}
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_DEBUG("_MmsReadMsgBody: E N D (fail) ******************** \n");
return false;
@@ -5075,8 +5039,8 @@ static MsgMultipart *__MsgAllocMultipart(void)
goto __CATCH;
}
- __MsgInitMsgType(&pMultipart->type);
- __MsgInitMsgBody(pMultipart->pBody);
+ MmsInitMsgType(&pMultipart->type);
+ MmsInitMsgBody(pMultipart->pBody);
pMultipart->pNext = NULL;
@@ -5097,70 +5061,6 @@ __CATCH:
return NULL;
}
-static bool __MsgInitMsgType(MsgType *pMsgType)
-{
- pMsgType->offset = 0;
- pMsgType->size = 0;
- pMsgType->contentSize = 0;
- pMsgType->disposition = 0;
- pMsgType->encoding = 0;
- pMsgType->type = MIME_UNKNOWN;
-#ifdef FEATURE_JAVA_MMS_MIME
- pMsgType->szMimeString[0] ='\0';
-#endif
- pMsgType->section = 0;
-
- pMsgType->szOrgFilePath[0] = '\0';
- pMsgType->szContentID[0] = '\0';
- pMsgType->szContentLocation[0] = '\0';
-
- pMsgType->szContentRepPos[0] = '\0';
- pMsgType->szContentRepSize[0] = '\0';
- pMsgType->szContentRepIndex[0] = '\0';
-
- __MsgInitMsgContentParam(&pMsgType->param);
-#ifdef __SUPPORT_DRM__
- MmsInitMsgDRMInfo(&pMsgType->drmInfo);
-#endif
-
- return true;
-}
-
-static bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam)
-{
- pMsgContentParam->charset = MSG_CHARSET_UNKNOWN;
- pMsgContentParam->type = MIME_UNKNOWN;
- pMsgContentParam->szBoundary[0] = '\0';
- pMsgContentParam->szFileName[0] = '\0';
- pMsgContentParam->szName[0] = '\0';
-#ifdef FEATURE_JAVA_MMS
- pMsgContentParam->szApplicationID = NULL;
- pMsgContentParam->szReplyToApplicationID = NULL;
-#endif
- pMsgContentParam->szStart[0] = '\0';
- pMsgContentParam->szStartInfo[0] = '\0';
- pMsgContentParam->pPresentation = NULL;
-
- pMsgContentParam->reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; // add only used as parameter of Content-Type: multipart/report; report-type
-
- return true;
-}
-
-static bool __MsgInitMsgBody(MsgBody *pMsgBody)
-{
- pMsgBody->offset = 0;
- pMsgBody->size = 0;
- pMsgBody->body.pText = NULL;
- pMsgBody->szOrgFilePath[0] = '\0';
-
- __MsgInitMsgType(&pMsgBody->presentationType);
- pMsgBody->pPresentationBody = NULL;
-
- memset(pMsgBody->szOrgFilePath, 0, MSG_FILEPATH_LEN_MAX);
-
- return true;
-}
-
static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char* szStart, MimeType typeParam)
{
char szTmpStart[MSG_MSG_ID_LEN + 3] = { 0, };
@@ -5254,7 +5154,7 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size;
if (pPresentationInfo->pCurPresentation) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pPresentationInfo->pCurPresentation->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pPresentationInfo->pCurPresentation->type.drmInfo);
#endif
free(pPresentationInfo->pCurPresentation);
pPresentationInfo->pCurPresentation = NULL;
@@ -5287,7 +5187,7 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
pNextPart = pNextPart->pNext;
if (pRemovePart->pBody) {
- MsgFreeBody(pRemovePart->pBody, pRemovePart->type.type);
+ MmsReleaseMsgBody(pRemovePart->pBody, pRemovePart->type.type);
free(pRemovePart->pBody);
pRemovePart->pBody = NULL;
}
@@ -5297,9 +5197,9 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
}
} else {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsgBody->presentationType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsgBody->presentationType.drmInfo);
#endif
- __MsgInitMsgType(&pMsgBody->presentationType);
+ MmsInitMsgType(&pMsgBody->presentationType);
pMsgBody->pPresentationBody = NULL;
}
}
@@ -5325,48 +5225,6 @@ static bool __MsgIsPresentablePart(int type)
}
#ifdef __SUPPORT_DRM__
-void MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo)
-{
- MSG_DEBUG("_MsgFreeDRMInfo: S T A R T !!! \n");
-
- if (pDrmInfo == NULL) {
- MSG_DEBUG("pDrmInfo is NULL");
- return;
- }
-
- if (pDrmInfo->szContentDescription) {
- free(pDrmInfo->szContentDescription);
- pDrmInfo->szContentDescription = NULL;
- }
-
- if (pDrmInfo->szContentVendor) {
- free(pDrmInfo->szContentVendor);
- pDrmInfo->szContentVendor = NULL;
- }
-
- if (pDrmInfo->szContentName) {
- free(pDrmInfo->szContentName);
- pDrmInfo->szContentName = NULL;
- }
-
- if (pDrmInfo->szContentURI) {
- free(pDrmInfo->szContentURI);
- pDrmInfo->szContentURI = NULL;
- }
-
- if (pDrmInfo->szRightIssuer) {
- free(pDrmInfo->szRightIssuer);
- pDrmInfo->szRightIssuer = NULL;
- }
-
- if (pDrmInfo->szDrm2FullPath) {
- free(pDrmInfo->szDrm2FullPath);
- pDrmInfo->szDrm2FullPath = NULL;
- }
-
- pDrmInfo->contentType = MIME_UNKNOWN;
- pDrmInfo->drmType = MSG_DRM_TYPE_NONE;
-}
bool MsgCopyDrmInfo(MsgType *pPartType)
{
@@ -5428,134 +5286,7 @@ static bool __MsgIsText(int type)
}
}
-bool MsgFreeAttrib(MmsAttrib *pAttrib)
-{
- MSG_BEGIN();
-
- if (pAttrib == NULL) {
- MSG_DEBUG("pAttrib is NULL");
- return false;
- }
-
- if (pAttrib->szTo) {
- free(pAttrib->szTo);
- pAttrib->szTo = NULL;
- }
-
- if (pAttrib->szCc) {
- free(pAttrib->szCc);
- pAttrib->szCc = NULL;
- }
-
- if (pAttrib->szBcc) {
- free(pAttrib->szBcc);
- pAttrib->szBcc = NULL;
- }
-
- //check if pMultiStatus should be freed or not, because pMultiStatus is not allocated
- if (pAttrib->pMultiStatus) {
- MmsMsgMultiStatus *pMultiStatus = pAttrib->pMultiStatus;
- MmsMsgMultiStatus *pCurStatus = NULL;
-
- while (pMultiStatus != NULL ) {
- pCurStatus = pMultiStatus;
- pMultiStatus = pMultiStatus->pNext;
-
- if (pCurStatus) {
- free(pCurStatus);
- pCurStatus = NULL;
- }
- }
-
- pAttrib->pMultiStatus = NULL;
- }
-
-
- MSG_END();
-
- return true;
-}
-
-bool MsgFreeBody(MsgBody *pBody, int type)
-{
- MSG_DEBUG("_MsgFreeBody: S T A R T !!! \n") ;
-
- if (pBody == NULL) {
- MSG_DEBUG("_MsgFreeBody: pBody == NULL \n" );
- MSG_DEBUG("_MsgFreeBody: E N D (End)!!! \n") ;
-
- return false;
- }
-
- switch (type) {
- case MIME_MULTIPART_REPORT:
- case MIME_APPLICATION_VND_OMA_DRM_MESSAGE:
- case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED:
- case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED:
- case MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC:
- case MIME_MULTIPART_MIXED:
- case MIME_MULTIPART_RELATED:
- case MIME_MULTIPART_ALTERNATIVE:
- case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE:
- {
- MsgMultipart *pMulti = pBody->body.pMultipart;
- MsgMultipart *pCurrPart = NULL;
- MsgBody *pPresentation = pBody->pPresentationBody;
- while (pMulti != NULL) {
- pCurrPart = pMulti;
-
- pMulti = pMulti->pNext;
- if (pCurrPart) {
-#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pCurrPart->type.drmInfo);
-#endif
-
- if (pCurrPart->pBody) {
- if (pCurrPart->pBody->body.pBinary) {
- free(pCurrPart->pBody->body.pBinary);
- pCurrPart->pBody->body.pBinary = NULL;
- }
- free(pCurrPart->pBody);
- pCurrPart->pBody = NULL;
- }
- free(pCurrPart);
- pCurrPart = NULL;
- }
- }
-
- pBody->body.pMultipart = NULL;
-
- if (pPresentation) {
- if (pPresentation->body.pText) {
- free(pPresentation->body.pText);
- pPresentation->body.pText = NULL;
- }
- free(pPresentation);
- pBody->pPresentationBody = NULL;
- }
-
- __MsgInitMsgType(&pBody->presentationType);
-
- break;
- }
-
- default:
- /* Any single part */
-
- if (pBody->body.pBinary) {
- free(pBody->body.pBinary);
- pBody->body.pBinary = NULL;
- }
-
- break;
- }
-
- MSG_DEBUG("_MsgFreeBody: E N D (Successfully) !!! \n") ;
-
- return true;
-
-}
static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
{
@@ -5622,9 +5353,9 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
if (pRemoveList) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pRemoveList->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pRemoveList->type.drmInfo);
#endif
- MsgFreeBody(pRemoveList->pBody, pRemoveList->type.type);
+ MmsReleaseMsgBody(pRemoveList->pBody, pRemoveList->type.type);
free(pRemoveList->pBody);
free(pRemoveList);
@@ -5640,7 +5371,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
if (pSelectedPart != NULL) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo);
#endif
if (pSelectedPart->pBody != NULL) {
@@ -5696,7 +5427,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
if (pSelectedPart) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo);
#endif
free(pSelectedPart->pBody);
free(pSelectedPart);
@@ -5704,7 +5435,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
pSelectedPart = pTmpMultipart;
} else if (__MsgIsMultipartRelated(pSelectedPart->type.type) && pPrevPart != NULL) {
pPrevPart->pNext = pTmpMultipart = pSelectedPart->pNext;
- MsgFreeBody(pSelectedPart->pBody, pSelectedPart->type.type);
+ MmsReleaseMsgBody(pSelectedPart->pBody, pSelectedPart->type.type);
free(pSelectedPart->pBody);
free(pSelectedPart);
@@ -5769,7 +5500,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
pPartType->type = pSelectedPart->type.type;
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo);
#endif
free(pSelectedPart->pBody);
free(pSelectedPart);
@@ -5830,9 +5561,9 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
while (pTmpMultipart) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pTmpMultipart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pTmpMultipart->type.drmInfo);
#endif
- MsgFreeBody(pTmpMultipart->pBody, pTmpMultipart->type.type);
+ MmsReleaseMsgBody(pTmpMultipart->pBody, pTmpMultipart->type.type);
pNextRemovePart = pTmpMultipart->pNext;
free(pTmpMultipart->pBody);
@@ -5850,7 +5581,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
if (pSelectedPart != NULL) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo);
#endif
if (pSelectedPart->pBody != NULL) {
free(pSelectedPart->pBody);
@@ -6028,6 +5759,9 @@ static int __MsgConvertCharToInt(char ch)
static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2)
{
+ if(!pMsgType1 || !pMsgType2)
+ return false;
+
if (pMsgType1->section == INVALID_HOBJ)
pMsgType1->section = pMsgType2->section;
@@ -7069,7 +6803,6 @@ __CATCH:
static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave)
{
FILE *pFile = NULL;
-// char *pExt = NULL;
char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; // file name of temp file
char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; // full absolute path of temp file.
@@ -7538,13 +7271,14 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
strncpy(szText, szTempFileName, pExt+1 - szFileName);
}
} else {
- if (strrchr(szTempFileName, '.'))
+ pExt = strrchr(szTempFileName, '.');
+ if (pExt == NULL) {
+ memset(szText, 0, MSG_FILENAME_LEN_MAX+1);
+ strncpy(szText, szTempFileName, MSG_FILENAME_LEN_MAX - 1);
+ strcat(szText, ".");
+ } else {
return true;
-
- memset(szText, 0, MSG_FILENAME_LEN_MAX+1);
- strncpy(szText, szTempFileName, MSG_FILENAME_LEN_MAX - 1);
- //temporary commented to save file as original name.
- pExt = strrchr(szFileName, '.');
+ }
}
} else {
if (nUntitleIndex >= 1) {
@@ -7645,7 +7379,7 @@ bool MmsGetMediaPartHeader(int index, MsgType *pHeader)
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
- __MsgInitMsgType(pHeader);
+ MmsInitMsgType(pHeader);
/* Requires header of non-presentation */
diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp
index 2c0bfa8..ac797e5 100755
--- a/plugin/mms_plugin/MmsPluginInternal.cpp
+++ b/plugin/mms_plugin/MmsPluginInternal.cpp
@@ -378,9 +378,9 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
MmsInitHeader();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_END();
@@ -536,7 +536,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
}
if (partHeader.contentSize > 0) {
- char szBuf[MSG_FILEPATH_LEN_MAX];
+ char szBuf[MSG_FILEPATH_LEN_MAX + 1];
strcpy((char *)szBuf, partHeader.param.szFileName);
sprintf(partHeader.param.szFileName, MSG_DATA_PATH"%s", szBuf);
@@ -580,9 +580,9 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
pStorage->getMmsMessage(&pMsg);
MmsInitHeader();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_END();
}
diff --git a/plugin/mms_plugin/MmsPluginSmil.cpp b/plugin/mms_plugin/MmsPluginSmil.cpp
index 16ef186..3011fdc 100755
--- a/plugin/mms_plugin/MmsPluginSmil.cpp
+++ b/plugin/mms_plugin/MmsPluginSmil.cpp
@@ -819,37 +819,16 @@ int MmsSmilGetMediaSrcForNormalMsg(char *szOutbuf, char *szInBuf, MsgMultipart *
if (strcasecmp(szContentID, szInBuf) == 0) {
strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("match with szContentID.");
+ MSG_DEBUG("match with szContentID");
+ goto RETURN;
+ } else if (strcasecmp(szContentLI, szInBuf) == 0) {
+ strcpy(szOutbuf, pPart->type.param.szFileName);
+ MSG_DEBUG("match with szContentLocation");
+ goto RETURN;
+ } else if (strcasecmp(pPart->type.param.szName, szInBuf) == 0) {
+ strcpy(szOutbuf, pPart->type.param.szFileName);
+ MSG_DEBUG("match with Parameter Name");
goto RETURN;
- } else {
- char *szInFileName = strrchr(szInBuf, '/');
-
- if (szInFileName == NULL) {
- szInFileName = szInBuf;
- } else
- szInFileName++;
-
- if (strcasecmp(szContentLI, szInFileName) == 0) {
- strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("match with szContentLI.");
- goto RETURN;
- } else if (strcasecmp(pPart->type.param.szName, szInBuf) == 0) {
- strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("match with pPart->type.param.szName.");
- goto RETURN;
- } else if (strlen(szContentID) > 4) {
- if (strcasecmp(strtok(szContentID, "."), strtok(szInBuf, ".")) == 0) {
- strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("only name is match with szContentID.");
- goto RETURN;
- }
- } else if (strlen(szContentLI) > 4) {
- if (strcasecmp(strtok(szContentLI, "."), strtok(szInBuf, ".")) == 0) {
- strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("only name is match with szContentLI.");
- goto RETURN;
- }
- }
}
nPart++;
diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp
index 7c56c97..45f0c86 100755
--- a/plugin/mms_plugin/MmsPluginStorage.cpp
+++ b/plugin/mms_plugin/MmsPluginStorage.cpp
@@ -92,9 +92,9 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MMS_MESSAGE_DATA_S mmsMsgData;
bzero(&mmsMsgData,sizeof(MMS_MESSAGE_DATA_S));
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Message Compose Error");
@@ -109,8 +109,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
snprintf((char *)pMsgInfo->msgData, MAX_MSG_DATA_LEN+1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo, _MsgMmsGetAttachCount(&mmsMsgData)) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
@@ -122,15 +122,15 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
pFile = MsgOpenMMSFile(fileName);
if (!pFile) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS File open Error");
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
@@ -138,8 +138,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
@@ -159,8 +159,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
pMsgInfo->dataSize = size;
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
} else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) {
@@ -170,7 +170,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
//Need to store mms specific data (contents location, TrID, ExpiryTime, Delivery Report, message ID)
if (addMmsMsgToDB(&mmsMsg, pMsgInfo) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
}
} else if (pMsgInfo->msgType.subType == MSG_SENDCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS) {
@@ -217,14 +217,14 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (addMmsMsgToDB(pMsg, pMsgInfo) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
}
memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1);
strcpy((char *)pMsgInfo->msgData,szTemp);
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
} else if (pMsgInfo->msgType.subType == MSG_READREPLY_MMS || pMsgInfo->msgType.subType == MSG_READRECIND_MMS) {
MSG_DEBUG("######## MmsPlgAddMessage -> MSG_READREPLY_MMS || MSG_READRECIND_MMS ###########");
@@ -246,8 +246,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MmsComposeReadReportMessage(&mmsMsg, pMsgInfo, selectedMsgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
}
@@ -255,8 +255,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
snprintf(filePath, MAX_FULL_PATH_SIZE+1, MSG_DATA_PATH"%d", mmsMsg.msgID);
pFile = MsgOpenMMSFile(filePath);
if (!pFile) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
@@ -264,8 +264,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
@@ -275,7 +275,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
if (version == 0x90) {
MSG_DEBUG("### version 1.0 ###");
if (MmsEncodeReadReport10(pFile, &mmsMsg, readStatus) != true) {
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
@@ -284,7 +284,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
} else {
MSG_DEBUG("### version 1.1 ###");
if (MmsEncodeReadReport11(pFile, &mmsMsg, readStatus) != true) {
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
@@ -296,9 +296,9 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MsgCloseFile(pFile);
pFile = NULL;
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
} else if (pMsgInfo->msgType.subType == MSG_FORWARD_MMS) {
MSG_DEBUG("######## MmsPlgAddMessage -> MSG_FORWARD_MMS ###########");
@@ -309,8 +309,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MMS_MESSAGE_DATA_S mmsMsgData;
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Message Compose Error");
@@ -321,8 +321,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
snprintf((char *)pMsgInfo->msgData, MAX_MSG_DATA_LEN + 1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo, _MsgMmsGetAttachCount(&mmsMsgData)) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
@@ -334,8 +334,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
pFile = MsgOpenMMSFile(filePath);
if (!pFile) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
pFile = NULL;
@@ -344,8 +344,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
pFile = NULL;
@@ -354,8 +354,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
pFile = NULL;
@@ -366,8 +366,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MsgCloseFile(pFile);
pFile = NULL;
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
}
@@ -460,7 +460,7 @@ msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
MsgType partHeader;
MmsAttrib pMmsAttrib;
- char szBuf[MSG_FILEPATH_LEN_MAX] = {0, };
+ char szBuf[MSG_FILEPATH_LEN_MAX + 1] = {0, };
bool bMultipartRelated = false;
if (pSendOptInfo != NULL) {
@@ -576,9 +576,9 @@ msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
if (partHeader.contentSize > 0) {
if (!strcasecmp(partHeader.param.szFileName, "cid:")) {
- strncpy((char *)szBuf, &partHeader.param.szFileName[4], MSG_FILEPATH_LEN_MAX - 1);
+ strncpy((char *)szBuf, &partHeader.param.szFileName[4], MSG_FILEPATH_LEN_MAX);
} else {
- strcpy((char *)szBuf, partHeader.param.szFileName);
+ strncpy((char *)szBuf, partHeader.param.szFileName, MSG_FILEPATH_LEN_MAX);
}
sprintf(partHeader.param.szFileName, MSG_DATA_PATH"%s", szBuf);
@@ -613,9 +613,9 @@ msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
MmsInitHeader();
MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pStoMmsMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pStoMmsMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
+ MmsReleaseMsgBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
pMsg->dataSize = nSize;
@@ -638,9 +638,9 @@ L_CATCH:
MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
return MSG_ERR_STORAGE_ERROR;
}
@@ -673,8 +673,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
MMS_MESSAGE_DATA_S mmsMsgData;
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Message Compose Error");
@@ -685,8 +685,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
pFile = MsgOpenMMSFile(filePath);
if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
@@ -695,8 +695,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
MsgCloseFile(pFile);
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
diff --git a/plugin/mms_plugin/MmsPluginUserAgent.cpp b/plugin/mms_plugin/MmsPluginUserAgent.cpp
index d3889c4..5c64475 100755
--- a/plugin/mms_plugin/MmsPluginUserAgent.cpp
+++ b/plugin/mms_plugin/MmsPluginUserAgent.cpp
@@ -657,9 +657,9 @@ ERR_MMS_UA_PROCESS_CONF:
MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
return false;
}
diff --git a/plugin/mms_plugin/MmsPluginUtil.cpp b/plugin/mms_plugin/MmsPluginUtil.cpp
index f23605c..12b1858 100755
--- a/plugin/mms_plugin/MmsPluginUtil.cpp
+++ b/plugin/mms_plugin/MmsPluginUtil.cpp
@@ -19,6 +19,8 @@
#include <mm_util_imgp.h>
#include <media-thumbnail.h>
#include <ctype.h>
+#include <errno.h>
+#include <sys/stat.h>
#include "MsgUtilFile.h"
#include "MmsPluginDebug.h"
#include "MmsPluginUtil.h"
@@ -337,7 +339,7 @@ char *MsgStrNCopy(const char *string, int length)
if (string) {
pDst = (char *)malloc(1 + length);
if (pDst == NULL) {
- MSG_DEBUG("MsgStrNCopy: pDst MemAlloc Fail \n");
+ MSG_DEBUG("pDst MemAlloc Fail \n");
return NULL;
}
@@ -368,3 +370,38 @@ bool MsgConvertCharToHex(char pSrc, char *pDest)
return true;
}
+
+
+FILE *MmsFileOpen(char *pFileName)
+{
+ int len;
+ mode_t file_mode = (S_IRUSR | S_IWUSR);
+
+ if (!pFileName) {
+ MSG_DEBUG("pFileName NULL: %s", strerror(errno));
+ return NULL;
+ }
+
+ MSG_DEBUG("pFileName = %s", pFileName);
+
+ FILE *pFile = MsgOpenFile(pFileName, "wb+");
+
+ if (pFile == NULL) {
+ MSG_FATAL("File Open Error: %s", strerror(errno));
+ return NULL;
+ }
+
+ if (MsgFseek(pFile, 0L, SEEK_CUR) < 0) {
+ MsgCloseFile(pFile);
+ MSG_DEBUG("File Read Error: %s", strerror(errno));
+ return NULL;
+ }
+
+ if (fchmod(fileno(pFile), file_mode) < 0) {
+ MsgCloseFile(pFile);
+ MSG_DEBUG("File chmod Error: %s", strerror(errno));
+ return NULL;
+ }
+
+ return pFile;
+}
diff --git a/plugin/mms_plugin/include/MmsPluginCodecCommon.h b/plugin/mms_plugin/include/MmsPluginCodecCommon.h
index 75037eb..4137ddd 100755
--- a/plugin/mms_plugin/include/MmsPluginCodecCommon.h
+++ b/plugin/mms_plugin/include/MmsPluginCodecCommon.h
@@ -50,7 +50,11 @@ bool MmsInitMsgAttrib(MmsAttrib *pAttrib);
#ifdef __SUPPORT_DRM__
bool MmsInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo);
+void MmsReleaseMsgDRMInfo(MsgDRMInfo *pDrmInfo);
#endif//__SUPPORT_DRM__
+bool MmsReleaseMsgBody(MsgBody *pBody, int type);
+bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib);
+void MmsReleaseMmsMsg(MmsMsg *pMmsMsg);
#endif //MMS_PLUGIN_CODEC_COMMON_H
diff --git a/plugin/mms_plugin/include/MmsPluginDecode.h b/plugin/mms_plugin/include/MmsPluginDecode.h
index 0e37b5a..ee8a3e4 100755
--- a/plugin/mms_plugin/include/MmsPluginDecode.h
+++ b/plugin/mms_plugin/include/MmsPluginDecode.h
@@ -107,8 +107,6 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength);
bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength);
bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
-bool MsgFreeBody(MsgBody *pBody, int type);
-bool MsgFreeAttrib(MmsAttrib *pAttrib);
char *MsgChangeHexString(char *pOrg);
char *MsgResolveContentURI(char *szSrc);
@@ -124,7 +122,6 @@ bool MmsGetMediaPartHeader(int index, MsgType *pHeader);
bool MmsGetMsgAttrib(MmsMsgID msgID, MmsAttrib *pAttrib);
#ifdef __SUPPORT_DRM__
-void MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo);
bool MsgCopyDrmInfo(MsgType *pPartType);
bool MmsDrm2ConvertMsgBody(char *szOriginFilePath);
bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
diff --git a/plugin/mms_plugin/include/MmsPluginUtil.h b/plugin/mms_plugin/include/MmsPluginUtil.h
index d7348d6..b1ac716 100755
--- a/plugin/mms_plugin/include/MmsPluginUtil.h
+++ b/plugin/mms_plugin/include/MmsPluginUtil.h
@@ -17,6 +17,8 @@
#ifndef MMS_PLUGIN_UTIL_H
#define MMS_PLUGIN_UTIL_H
+#include <stdio.h>
+
bool makeImageThumbnail(char *srcPath, char *dstPath);
bool makeVideoThumbnail(char *srcPath, char *dstPath);
@@ -29,5 +31,5 @@ char *MsgStrCopy(const char *string);
char *MsgStrNCopy(const char *string, int length);
int MsgStrlen(char *pStr);
bool MsgConvertCharToHex(char pSrc, char *pDest);
-
+FILE *MmsFileOpen(char *pFileName);
#endif //MMS_PLUGIN_UTIL_H
diff --git a/plugin/sms_plugin/SmsPluginCallback.cpp b/plugin/sms_plugin/SmsPluginCallback.cpp
index c7e0b0f..1d1f7c8 100755
--- a/plugin/sms_plugin/SmsPluginCallback.cpp
+++ b/plugin/sms_plugin/SmsPluginCallback.cpp
@@ -114,6 +114,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_DEBUG("tpdu.data.deliver.dcs.msgClass : %d", tpdu.data.deliver.dcs.msgClass);
MSG_DEBUG("tpdu.data.deliver.dcs.codingScheme : %d", tpdu.data.deliver.dcs.codingScheme);
MSG_DEBUG("tpdu.data.deliver.dcs.codingGroup : %d", tpdu.data.deliver.dcs.codingGroup);
+ MSG_DEBUG("tpdu.data.deliver.dcs.bIndActive : %d", tpdu.data.deliver.dcs.bIndActive);
MSG_DEBUG("tpdu.data.deliver.originAddress.address : %s", tpdu.data.deliver.originAddress.address);
MSG_DEBUG("tpdu.data.deliver.timeStamp.time : %d/%d/%d %d:%d:%d ", tpdu.data.deliver.timeStamp.time.absolute.year, tpdu.data.deliver.timeStamp.time.absolute.month, tpdu.data.deliver.timeStamp.time.absolute.day,
tpdu.data.deliver.timeStamp.time.absolute.hour, tpdu.data.deliver.timeStamp.time.absolute.minute, tpdu.data.deliver.timeStamp.time.absolute.second);
@@ -155,21 +156,14 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
SmsPluginSimMsg::instance()->setSmsData((const char*)pDataPackage->Sca, (const char *)pDataPackage->szData, pDataPackage->MsgLength);
}
- if (tpdu.data.deliver.dcs.codingGroup == SMS_GROUP_DISCARD) {
- if (tpdu.data.deliver.dcs.bIndActive == false) {
- SmsPluginSetting::instance()->setMwiInfo(tpdu.data.deliver.dcs.indType + MSG_MWI_VOICE_SMS, 0);
- }
- SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
- } else {
- if (SmsPluginConcatHandler::instance()->IsConcatMsg(&(tpdu.data.deliver.userData)) == true ||
- SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true)
- {
- SmsPluginConcatHandler::instance()->handleConcatMsg(&tpdu); // Call Concat Msg Handler
- }
- else
- {
- SmsPluginEventHandler::instance()->handleMsgIncoming(&tpdu); // Call Event Handler
- }
+ if (SmsPluginConcatHandler::instance()->IsConcatMsg(&(tpdu.data.deliver.userData)) == true ||
+ SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true)
+ {
+ SmsPluginConcatHandler::instance()->handleConcatMsg(&tpdu); // Call Concat Msg Handler
+ }
+ else
+ {
+ SmsPluginEventHandler::instance()->handleMsgIncoming(&tpdu); // Call Event Handler
}
}
else if (tpdu.tpduType == SMS_TPDU_STATUS_REP)
@@ -779,13 +773,6 @@ void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *u
void TapiEventSetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("TapiEventSetMwiInfo is called. result = [%d]", result);
-
- bool bRet = true;
-
- if (result != TAPI_SIM_ACCESS_SUCCESS)
- bRet = false;
-
- SmsPluginSetting::instance()->setResultFromSim(bRet);
}
void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
diff --git a/plugin/sms_plugin/SmsPluginConcatHandler.cpp b/plugin/sms_plugin/SmsPluginConcatHandler.cpp
index 7be928e..18521ad 100755
--- a/plugin/sms_plugin/SmsPluginConcatHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginConcatHandler.cpp
@@ -608,7 +608,8 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
}
}
- int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
+ //int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
+ int bufSize = (DataSize*4) + 1; // For UTF8
char tmpBuf[bufSize];
memset(tmpBuf, 0x00, sizeof(tmpBuf));
diff --git a/plugin/sms_plugin/SmsPluginEventHandler.cpp b/plugin/sms_plugin/SmsPluginEventHandler.cpp
index e28bd2c..b529f30 100755
--- a/plugin/sms_plugin/SmsPluginEventHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginEventHandler.cpp
@@ -29,6 +29,7 @@
#include "SmsPluginConcatHandler.h"
#include "SmsPluginEventHandler.h"
+
/*==================================================================================================
IMPLEMENTATION OF SmsPluginEventHandler - Member Functions
==================================================================================================*/
@@ -119,6 +120,15 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
}
}
+ /** check discard & indicator inactive message **/
+ if (pTpdu->data.deliver.dcs.bMWI == true &&
+ pTpdu->data.deliver.dcs.bIndActive == false &&
+ pTpdu->data.deliver.dcs.codingGroup == SMS_GROUP_DISCARD) {
+ MSG_DEBUG("Discard and no-indication message!!");
+ SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
+ return;
+ }
+
/** convert to msgInfo */
convertTpduToMsginfo(pTpdu, &msgInfo);
@@ -527,6 +537,9 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
msgInfo->msgType.subType = (pTpdu->userData.header[i].udh.specialInd.msgInd+MSG_MWI_VOICE_SMS);
msgInfo->bStore = pTpdu->userData.header[i].udh.specialInd.bStore;
+ if (pTpdu->dcs.codingGroup == SMS_GROUP_DISCARD)
+ msgInfo->bStore = false;
+
MSG_DEBUG("Message waiting number : [%d]", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
SmsPluginSetting::instance()->setMwiInfo(msgInfo->msgType.subType, pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
@@ -819,12 +832,10 @@ bool SmsPluginEventHandler::getDeviceStatus()
ret = cv.timedwait(mx.pMutex(), 16);
- mx.unlock();
-
if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: DEVICE STATUS TIME-OUT");
devStatus = false;
}
-
+ mx.unlock();
return devStatus;
}
diff --git a/plugin/sms_plugin/SmsPluginMain.cpp b/plugin/sms_plugin/SmsPluginMain.cpp
index 1eda548..3737d24 100755
--- a/plugin/sms_plugin/SmsPluginMain.cpp
+++ b/plugin/sms_plugin/SmsPluginMain.cpp
@@ -327,6 +327,10 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
MSG_DEBUG("######## addMessage Fail !!");
return MSG_ERR_PLUGIN_STORAGE;
}
+ if (SmsPluginStorage::instance()->addSmsSendOption(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo)) != MSG_SUCCESS) {
+ MSG_DEBUG("######## addSmsSendOption Fail !!");
+ return MSG_ERR_PLUGIN_STORAGE;
+ }
}
}
diff --git a/plugin/sms_plugin/SmsPluginParamCodec.cpp b/plugin/sms_plugin/SmsPluginParamCodec.cpp
index 8b4ecf4..4ac73e9 100755
--- a/plugin/sms_plugin/SmsPluginParamCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginParamCodec.cpp
@@ -393,7 +393,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->msgClass = SMS_MSG_CLASS_NONE;
pDCS->bMWI = true;
- pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? false:true;
+ pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
}
else if (((dcs & 0xF0) >> 4) == 0x0D)
@@ -404,7 +404,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->msgClass = SMS_MSG_CLASS_NONE;
pDCS->bMWI = true;
- pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? false:true;
+ pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
}
else if (((dcs & 0xF0) >> 4) == 0x0E)
diff --git a/plugin/sms_plugin/SmsPluginSetting.cpp b/plugin/sms_plugin/SmsPluginSetting.cpp
index 32df04f..ef9c71b 100755
--- a/plugin/sms_plugin/SmsPluginSetting.cpp
+++ b/plugin/sms_plugin/SmsPluginSetting.cpp
@@ -768,12 +768,6 @@ void SmsPluginSetting::setMwiInfo(MSG_SUB_TYPE_T type, int count)
MSG_DEBUG("######## tel_set_sim_messagewaiting_info() Fail !!! return : %d #######", ret);
}
- if (getResultFromSim() == true) {
- MSG_DEBUG("######## Set message waiting info Success !!! #######");
- } else {
- MSG_DEBUG("######## Set message waiting info fail !!! #######");
- }
-
return;
}
@@ -878,10 +872,9 @@ bool SmsPluginSetting::getParamEvent(MSG_SMSC_DATA_S *pSmscData)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
@@ -925,10 +918,9 @@ bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
@@ -995,10 +987,9 @@ bool SmsPluginSetting::getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
diff --git a/plugin/sms_plugin/SmsPluginSimMsg.cpp b/plugin/sms_plugin/SmsPluginSimMsg.cpp
index 0c502f3..a6d3a78 100755
--- a/plugin/sms_plugin/SmsPluginSimMsg.cpp
+++ b/plugin/sms_plugin/SmsPluginSimMsg.cpp
@@ -584,10 +584,9 @@ bool SmsPluginSimMsg::getSimMsgEvent(MSG_MESSAGE_INFO_S *pMsgInfo)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
@@ -699,10 +698,9 @@ bool SmsPluginSimMsg::getSimEvent(msg_sim_id_t *pSimId)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
diff --git a/plugin/sms_plugin/SmsPluginStorage.cpp b/plugin/sms_plugin/SmsPluginStorage.cpp
index 9c02b33..7189e38 100755
--- a/plugin/sms_plugin/SmsPluginStorage.cpp
+++ b/plugin/sms_plugin/SmsPluginStorage.cpp
@@ -380,9 +380,6 @@ msg_error_t SmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
}
break;
}
- } else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) {
- MSG_DEBUG("Add Status Report");
- err = addSmsMessage(pMsgInfo);
}
if (err == MSG_SUCCESS) {
@@ -441,6 +438,47 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
return MSG_SUCCESS;
}
+msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+
+ if (pSendOptInfo->bSetting == false) {
+ MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq);
+ MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath);
+
+ if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
+ pSendOptInfo->bSetting = true;
+ MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
+ }
+ }
+
+ if (pSendOptInfo->bSetting == true) {
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ dbHandle.beginTrans();
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d);",
+ MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId, pSendOptInfo->bDeliverReq,
+ pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath);
+
+ MSG_DEBUG("Query = [%s]", sqlQuery);
+
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ err = MSG_ERR_DB_EXEC;
+ } else {
+ dbHandle.endTrans(true);
+ }
+ }
+
+ MSG_END();
+
+ return err;
+}
+
msg_error_t SmsPluginStorage::updateSmsMessage(MSG_MESSAGE_INFO_S *pMsg)
{
@@ -643,8 +681,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE);
MsgSettingHandleNewMsg(smsCnt, mmsCnt);
-// MsgDeleteNotiByMsgId(msgId);
- MsgRefreshNoti();
+ MsgRefreshNoti(false);
return MSG_SUCCESS;
}
diff --git a/plugin/sms_plugin/SmsPluginTpduCodec.cpp b/plugin/sms_plugin/SmsPluginTpduCodec.cpp
index daa2dd6..1398ecd 100755
--- a/plugin/sms_plugin/SmsPluginTpduCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginTpduCodec.cpp
@@ -21,7 +21,6 @@
#include "MsgCppTypes.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
-#include "MsgUtilFile.h"
#include "SmsPluginTpduCodec.h"
#include "SmsPluginParamCodec.h"
@@ -471,36 +470,16 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
{
int offset = 0, udLen = 0;
-#if 1
- char temp[2048];
- char tempcat[100];
- memset(temp, 0x00, sizeof(temp));
- memset(tempcat, 0x00, sizeof(tempcat));
- time_t rawtime;
- time ( &rawtime );
-
- sprintf(temp, "[MT] %s", ctime(&rawtime));
-
- for (int i = 0; i < TpduLen; i++)
- {
- sprintf(tempcat, "[%02x]\n", pTpdu[i]);
- strncat(temp, tempcat, sizeof(temp)-strlen(temp)-1);
- memset(tempcat, 0x00, sizeof(tempcat));
- }
-
-
- sprintf(tempcat, "\n\n\n");
- strncat(temp, tempcat, sizeof(temp)-strlen(temp)-1);
+ char tpduTmp[(TpduLen*2)+1];
+ memset(tpduTmp, 0x00, sizeof(tpduTmp));
+ for (int i = 0; i < TpduLen; i++) {
+ snprintf(tpduTmp+(i*2), sizeof(tpduTmp)-(i*2), "%02X", pTpdu[i]);
+ }
+ MSG_DEBUG("Deliver TPDU.");
+ MSG_DEBUG("[%s]", tpduTmp);
- //MsgOpenCreateAndOverwriteFile(TPDU_LOG_FILE, temp, strlen(temp));
- FILE* pFile=NULL ;
- pFile = MsgOpenFile(TPDU_LOG_FILE, "a");
- MsgWriteFile(temp, sizeof(char), strlen(temp), pFile);
- MsgFflush(pFile);
- MsgCloseFile(pFile);
-#endif
// TP-MMS
if (pTpdu[offset] & 0x04)
pDeliver->bMoreMsg = false;
diff --git a/plugin/sms_plugin/SmsPluginTransport.cpp b/plugin/sms_plugin/SmsPluginTransport.cpp
index 0ce2043..e71f897 100755
--- a/plugin/sms_plugin/SmsPluginTransport.cpp
+++ b/plugin/sms_plugin/SmsPluginTransport.cpp
@@ -21,8 +21,8 @@
#include "MsgCppTypes.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
-#include "MsgNotificationWrapper.h"
#include "MsgUtilFile.h"
+#include "MsgNotificationWrapper.h"
#include "SmsPluginParamCodec.h"
#include "SmsPluginTpduCodec.h"
#include "SmsPluginEventHandler.h"
@@ -35,7 +35,6 @@ extern "C"
#include <ITapiNetText.h>
}
-#define MSG_DEBUG_BY_FILE
extern struct tapi_handle *pTapiHandle;
@@ -72,7 +71,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
{
MSG_BEGIN();
- SMS_TPDU_S tpdu;
+ SMS_TPDU_S tpdu = {0,};
tpdu.tpduType = SMS_TPDU_SUBMIT;
@@ -94,6 +93,16 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
MSG_DEBUG("DCS is changed by application : [%d]", tpdu.data.submit.dcs.codingScheme);
}
+#ifdef MSG_SMS_REPORT
+ // Update Msg Ref into Report Table
+ if (tpdu.data.submit.bStatusReport == true)
+ {
+ MSG_DEBUG("Update Msg Ref [%d] in Report Table", tpdu.data.submit.msgRef);
+
+ SmsPluginStorage::instance()->updateMsgRef(pReqInfo->msgInfo.msgId, tpdu.data.submit.msgRef);
+ }
+#endif
+
// Set SMSC Options
SMS_ADDRESS_S smsc;
setSmscOptions(&smsc);
@@ -114,12 +123,17 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
int smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
- if (smscLen <= 0) return;
+ if (smscLen <= 0) {
+ MSG_DEBUG("smscLen <= 0");
+ return;
+ }
- for (j = 0; j < smscLen; j++)
- {
- MSG_DEBUG("pSCAInfo [%02x]", smscAddr[j]);
+ char smscAddrTmp[(smscLen*2)+1];
+ memset(smscAddrTmp, 0x00, sizeof(smscAddrTmp));
+ for (j = 0; j < smscLen; j++) {
+ snprintf(smscAddrTmp+(j*2), sizeof(smscAddrTmp)-(j*2), "%02X", smscAddr[j]);
}
+ MSG_DEBUG("pSCAInfo [%s]", smscAddrTmp);
int bufLen = 0;
@@ -138,11 +152,9 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
}
-#ifdef MSG_FOR_DEBUG
MSG_DEBUG("ton [%d]", tpdu.data.submit.destAddress.ton);
MSG_DEBUG("npi [%d]", tpdu.data.submit.destAddress.npi);
MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
-#endif
bool bStatusReport = false;
@@ -184,55 +196,17 @@ MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
pkgInfo.Sca[smscLen] = '\0';
-#ifdef MSG_FOR_DEBUG
- MSG_DEBUG("[submitRequest] TPDU.");
- for (j = 0; j < pkgInfo.MsgLength; j++)
- {
- MSG_DEBUG("[%02x]", pkgInfo.szData[j]);
+ char pkgInfoTmp[(pkgInfo.MsgLength*2)+1];
+ memset(pkgInfoTmp, 0x00, sizeof(pkgInfoTmp));
+ for (j = 0; j < pkgInfo.MsgLength; j++) {
+ snprintf(pkgInfoTmp+(j*2), sizeof(pkgInfoTmp)-(j*2), "%02X", pkgInfo.szData[j]);
}
+ MSG_DEBUG("Submit Request TPDU.");
+ MSG_DEBUG("[%s]", pkgInfoTmp);
- for (j = 0; j < smscLen; j++)
- {
- MSG_DEBUG("pkgInfo.pSCA [%02x]", pkgInfo.Sca[j]);
- }
-#endif
-
-#ifdef MSG_DEBUG_BY_FILE
- char temp[2048];
- char tempcat[100];
- memset(temp, 0x00, sizeof(temp));
- memset(tempcat, 0x00, sizeof(tempcat));
-
- time_t rawtime;
- time(&rawtime);
-
- snprintf(temp, sizeof(temp), "[MO] %s", ctime(&rawtime));
-
- for (j = 0; j < pkgInfo.MsgLength; j++)
- {
- snprintf(tempcat, sizeof(tempcat), "[%02x]\n", pkgInfo.szData[j]);
- strncat(temp, tempcat, sizeof(temp)-strlen(temp)-1);
- memset(tempcat, 0x00, sizeof(tempcat));
- }
-
-
- snprintf(tempcat, sizeof(tempcat), "\n\n\n");
- strncat(temp, tempcat, sizeof(temp)-strlen(temp)-1);
-
- //MSG_DEBUG("temp [%s], length [%d]", temp, strlen(temp));
-
- //MsgOpenCreateAndOverwriteFile(TPDU_LOG_FILE, temp, strlen(temp));
- FILE* pFile=NULL ;
- pFile = MsgOpenFile(TPDU_LOG_FILE, "a");
- MsgWriteFile(temp, sizeof(char), strlen(temp), pFile);
-
- MsgFflush(pFile);
- MsgCloseFile(pFile);
-
-#endif
-
- SMS_SENT_INFO_S sentInfo = {};
+ SMS_SENT_INFO_S sentInfo;
+ memset(&sentInfo, 0x00, sizeof(SMS_SENT_INFO_S));
bool bMoreMsg = FALSE;
@@ -262,13 +236,13 @@ MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
if (tapiRet == TAPI_API_SUCCESS)
{
- MSG_DEBUG("######## TelTapiSmsSend Success !!! return : [%d] #######", tapiRet);
+ MSG_DEBUG("######## tel_send_sms Success !!! return : [%d] #######", tapiRet);
}
else
{
SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
- THROW(MsgException::SMS_PLG_ERROR, "######## TelTapiSmsSend Fail !!! return : [%d] #######", tapiRet);
+ THROW(MsgException::SMS_PLG_ERROR, "######## tel_send_sms Fail !!! return : [%d] #######", tapiRet);
}
// Tizen Validation System
@@ -747,7 +721,7 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
// Read Message Data from File
if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false)
- THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
+ THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
MSG_DEBUG("file size : [%d] file data : [%s]", fileSize, pFileData);
@@ -771,7 +745,8 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
}
// Delete File
- MsgDeleteFile(pMsgInfo->msgData);
+ if (pMsgInfo->nAddressCnt == (addrIndex + 1))
+ MsgDeleteFile(pMsgInfo->msgData);
}
MSG_DEBUG("decode length : [%d]", decodeLen);
diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
index 1e03364..de5fe46 100755
--- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
@@ -24,6 +24,7 @@
#include "SmsPluginEventHandler.h"
#include "SmsPluginWapPushHandler.h"
+
#include <drm_client.h>
#include <dbus/dbus-glib.h>
@@ -1074,6 +1075,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
MSG_END();
}
#else
+
static void launchProcessByAppcode(int appcode)
{
MSG_BEGIN();
@@ -1129,6 +1131,7 @@ static void launchProcessByAppcode(int appcode)
MSG_END();
}
+
void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen)
{
MSG_BEGIN();
@@ -1260,13 +1263,14 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
MSG_DEBUG("Received DRM V2");
// TODO: DRM V2
break;
-
+#if 0
case SMS_WAP_APPLICATION_PUSH_EMAIL:
case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
MSG_DEBUG("Received Email");
// TODO: Email
break;
+#endif
case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
MSG_DEBUG("Received IMPS CIR");
diff --git a/plugin/sms_plugin/include/SmsPluginStorage.h b/plugin/sms_plugin/include/SmsPluginStorage.h
index 94608c4..b573064 100755
--- a/plugin/sms_plugin/include/SmsPluginStorage.h
+++ b/plugin/sms_plugin/include/SmsPluginStorage.h
@@ -52,6 +52,8 @@ public:
msg_error_t addMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
msg_error_t addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
+ msg_error_t addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
+
msg_error_t deleteSmsMessage(msg_message_id_t MsgId);
msg_error_t getRegisteredPushEvent(char* pPushHeader, int *count, char *app_id, char *content_type);