MmsSmilText sText; /**< Indicates the text attributes */
MmsSmilAVI sAVI; /**< Indicates the video attributes */
} sMedia;
+
+ char szContentType[MSG_MSG_ID_LEN + 1];
+ char szContentLocation[MSG_MSG_ID_LEN + 1];
+
}MMS_MEDIA_S;
/**
int fileSize; /**< Indicates the size of the file */
MsgDrmType drmType; /**< Indicates the drm type. see enum MsgDrmType */
char szDrm2FullPath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the fullpath of the DRM */
+ char szContentType[MSG_MSG_ID_LEN + 1];
+
}MMS_ATTACH_S;
/**
MMS_LENGTH nTop; /**< Indicates the top co-ordinate of the region */
MMS_LENGTH width; /**< Indicates the width of the region */
MMS_LENGTH height; /**< Indicates the width of the region */ // '%' rate should be supported
+ bool bBgColor; /**< Indicates the background color set in the region */
int bgColor; /**< Indicates the background color of the region */
REGION_FIT_TYPE_T fit; /**< Indicates the fit type. see enum REGION_FIT_TYPE_T */
{
MMS_LENGTH width; /**< Indicates the width of the root layout */
MMS_LENGTH height; /**< Indicates the height of the root layout */ // '%' rate should be supported
+ bool bBgColor; /**< Indicates the background color set in the root layout */
int bgColor; /**< Indicates the background color of the root layout */
}MMS_SMIL_ROOTLAYOUT;
MMS_APPID_INFO_S msgAppId;
}MMS_RECV_DATA_S;
+typedef struct _MMS_HEADER_DATA_S
+{
+ char messageID[MSG_MSG_ID_LEN + 1];
+ char trID[MSG_MSG_ID_LEN + 1];
+ char contentLocation[MSG_MSG_ID_LEN + 1];
+ char szContentType[MSG_MSG_ID_LEN + 1];//string : ex) application/vnd.wap.multipart.related
+ int contentType;//MimeType : ex) application/vnd.wap.multipart.related
+ int messageType;//MmsMsgType : ex) sendreq
+ int mmsVersion;//1.0 1.3
+ int messageClass;//Personal | Advertisement | Informational | Auto
+ int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich
+ int mmsPriority;//_MSG_PRIORITY_TYPE_E : Low | Normal | High
+} MMS_HEADER_DATA_S;
+
+typedef struct
+{
+ MimeType type; /**< Indicates the multipart mime type. see enum MimeType */
+ char szContentType[MSG_MSG_ID_LEN + 1]; /**< Indicates the content type */
+ char szFileName[MSG_FILENAME_LEN_MAX + 1]; /**< Indicates the file name */
+ char szFilePath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the file path */
+ char szContentID[MSG_MSG_ID_LEN + 1]; /**< Indicates the content id */
+ char szContentLocation[MSG_MSG_ID_LEN + 1]; /**< Indicates the content Location */
+} MMS_MULTIPART_DATA_S;
/**
* @brief Represents MMS message data.
*/
typedef struct _MMS_MESSAGE_DATA_S
{
+ int backup_type; //normal = 0|| backup = 1;
char szSmilFilePath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the SMIL file path */
int pageCnt; /**< The count of the SMIL pages */
GList *pagelist; /**< The pointer to SMIL pages list */
GList *metalist; /**< The pointer to SMIL meta list */
MMS_SMIL_ROOTLAYOUT rootlayout; /**< Indicates the root layout information */
MMS_APPID_INFO_S msgAppId;
-}MMS_MESSAGE_DATA_S;
-
-/**
- * @}
- */
-
-
+ MMS_HEADER_DATA_S header;
+ MMS_MULTIPART_DATA_S smil;
+} MMS_MESSAGE_DATA_S;
#endif
-
MSG_MMS_ROOTLAYOUT_HEIGHT_INT, /**< Indicates the height of the root layout */
MSG_MMS_ROOTLAYOUT_HEIGHT_PERCENT_BOOL, /**< Indicates the length is in percentage(%) or not */
MSG_MMS_ROOTLAYOUT_BGCOLOR_INT, /**< Indicates the background color of the root layout */
+ MSG_MMS_ROOTLAYOUT_BGCOLOR_BOOL, /**< Indicates the background color is set in the root layout */
};
//MSG_MMS_PAGE
MSG_MMS_REGION_LENGTH_HEIGHT_PERCENT_BOOL, /**< Indicates the length is in percentage(%) or not */
MSG_MMS_REGION_BGCOLOR_INT, /**< Indicates the background color of the region */
MSG_MMS_REGION_FIT_TYPE_INT, /**< Indicates the fit type. see enum REGION_FIT_TYPE_T */
+ MSG_MMS_REGION_BGCOLOR_BOOL, /**< Indicates the background color is set in the region */
};
enum MSG_MMS_META_INFO_E {
#include "MsgTypes.h"
#include "MsgMmsTypes.h"
-int msg_verify_number(const char *raw, char *trimmed);
-int msg_verify_email(const char *raw);
msg_error_t _MsgMmsAddPage(MMS_MESSAGE_DATA_S *pMsgData, MMS_PAGE_S *pPage);
msg_error_t _MsgMmsAddMedia(MMS_PAGE_S *pPage, MMS_MEDIA_S *pMedia);
-msg_error_t _MsgMmsAddSmilDoc(char *pSmil, MMS_MESSAGE_DATA_S *pMsgData);
msg_error_t _MsgMmsAddAttachment(MMS_MESSAGE_DATA_S *pMsgData, MMS_ATTACH_S *pMedia);
msg_error_t _MsgMmsAddRegion(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_REGION * pRegion);
msg_error_t _MsgMmsAddTransition(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_TRANSITION *pTransition);
msg_error_t _MsgMmsAddMeta(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_META *pMeta);
-bool _MsgMmsFindMatchedMedia(MMS_MESSAGE_DATA_S *pMsgData, char *pszFilePath);
-
MMS_PAGE_S *_MsgMmsGetPage(MMS_MESSAGE_DATA_S *pMsgData, int pageIdx);
MMS_SMIL_REGION *_MsgMmsGetSmilRegion(MMS_MESSAGE_DATA_S *pMsgData, int regionIdx);
MMS_MEDIA_S *_MsgMmsGetMedia(MMS_PAGE_S *pPage, int mediaIdx);
MMS_ATTACH_S *_MsgMmsGetAttachment(MMS_MESSAGE_DATA_S *pMsgData, int attachIdx);
MMS_SMIL_TRANSITION *_MsgMmsGetTransition(MMS_MESSAGE_DATA_S *pMsgData, int transitionIdx);
MMS_SMIL_META *_MsgMmsGetMeta(MMS_MESSAGE_DATA_S *pMsgData, int metaIdx);
+
int _MsgMmsGetPageCount(MMS_MESSAGE_DATA_S *pMsgData);
int _MsgMmsGetAttachCount(MMS_MESSAGE_DATA_S *pMsgData);
int _MsgMmsGetTransitionCount(MMS_MESSAGE_DATA_S *pMsgData);
int _MsgMmsGetMetaCount(MMS_MESSAGE_DATA_S *pMsgData);
-msg_error_t _MsgMmsReleasePageList(MMS_MESSAGE_DATA_S *pMsgData);
-msg_error_t _MsgMmsReleaseRegionList(MMS_MESSAGE_DATA_S *pMsgData);
-msg_error_t _MsgMmsReleaseAttachList(MMS_MESSAGE_DATA_S *pMsgData);
-msg_error_t _MsgMmsReleaseMetaList(MMS_MESSAGE_DATA_S *pMsgData);
-msg_error_t _MsgMmsReleaseTransitionList(MMS_MESSAGE_DATA_S *pMsgData);
+void MsgMmsReleaseMmsLists(MMS_MESSAGE_DATA_S *pMsgData);
char *_MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, size_t *pSize);
-bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pBody, char *pFileData);
-bool _MsgMmsSetRootLayout(MMS_MESSAGE_DATA_S *pMmsMsg, MMS_SMIL_ROOTLAYOUT *pRootlayout);
+bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pData);
+
+bool _MsgMmsSetRootLayout(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_ROOTLAYOUT *pRootlayout);
#endif // MSG_MMS_MESSAGE_H
convert_from_mmsdata(tmp_mms_data, mms_struct);
- _MsgMmsReleasePageList(tmp_mms_data);
- _MsgMmsReleaseRegionList(tmp_mms_data);
- _MsgMmsReleaseAttachList(tmp_mms_data);
- _MsgMmsReleaseTransitionList(tmp_mms_data);
- _MsgMmsReleaseMetaList(tmp_mms_data);
+ MsgMmsReleaseMmsLists(tmp_mms_data);
+
free(tmp_mms_data);
return ret;
msg_data->pMmsData = _MsgMmsSerializeMessageData(tmp_mms_data, &(msg_data->mmsDataSize));
- _MsgMmsReleasePageList(tmp_mms_data);
- _MsgMmsReleaseRegionList(tmp_mms_data);
- _MsgMmsReleaseAttachList(tmp_mms_data);
- _MsgMmsReleaseTransitionList(tmp_mms_data);
- _MsgMmsReleaseMetaList(tmp_mms_data);
+ MsgMmsReleaseMmsLists(tmp_mms_data);
+
free(tmp_mms_data);
return ret;
}
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
+static void __removeLessGreaterMark(const char *szSrcID, char *szDest, int destSize)
+{
+ char szBuf[MSG_MSG_ID_LEN + 1] = {0, };
+ int cLen = strlen(szSrcID);
+
+ if (cLen == 0)
+ return;
+
+ if (cLen > 1 && szSrcID[0] == '<' && szSrcID[cLen - 1] == '>') {
+ strncpy(szBuf, &szSrcID[1], cLen - 2);
+ szBuf[cLen - 2] = '\0';
+ } else if (cLen > 1 && szSrcID[0] == '"' && szSrcID[cLen-1] == '"') {
+ strncpy(szBuf, &szSrcID[1], cLen - 2);
+ szBuf[cLen - 2] = '\0';
+ } else {
+ strncpy(szBuf, szSrcID, cLen);
+ szBuf[cLen] = '\0';
+ }
+
+ snprintf(szDest, destSize, "%s", szBuf);
+}
+
static inline void *get_msg_struct_data(msg_struct_s *msg_struct)
{
if (msg_struct == NULL)
strncpy(value, mms_media_data->szFileName, size);
else if (field == MSG_MMS_MEDIA_FILEPATH_STR)
strncpy(value, mms_media_data->szFilePath, size);
- else if (field == MSG_MMS_MEDIA_CONTENT_ID_STR)
- strncpy(value, mms_media_data->szContentID, size);
- else if (field == MSG_MMS_MEDIA_REGION_ID_STR)
+ else if (field == MSG_MMS_MEDIA_CONTENT_ID_STR) {
+ if (strlen(mms_media_data->szContentID) > 0)
+ snprintf(value, size, "<%s>", mms_media_data->szContentID);
+ }else if (field == MSG_MMS_MEDIA_REGION_ID_STR)
strncpy(value, mms_media_data->regionId, size);
else if (field == MSG_MMS_MEDIA_ALTERNATIVE_STR)
strncpy(value, mms_media_data->szAlt, size);
*value = mms_data->rootlayout.width.bUnitPercent;
else if (field == MSG_MMS_ROOTLAYOUT_HEIGHT_PERCENT_BOOL)
*value = mms_data->rootlayout.height.bUnitPercent;
+ else if (field == MSG_MMS_ROOTLAYOUT_BGCOLOR_BOOL)
+ *value = mms_data->rootlayout.bBgColor;
else
err = MSG_ERR_INVALID_PARAMETER;
}
*value = mms_region_data->width.bUnitPercent;
else if (field == MSG_MMS_REGION_LENGTH_HEIGHT_PERCENT_BOOL)
*value = mms_region_data->height.bUnitPercent;
+ else if (field == MSG_MMS_REGION_BGCOLOR_BOOL)
+ *value = mms_region_data->bBgColor;
else
err = MSG_ERR_INVALID_PARAMETER;
}
mms_data->rootlayout.width.value = value;
else if (field == MSG_MMS_ROOTLAYOUT_HEIGHT_INT)
mms_data->rootlayout.height.value = value;
- else if (field == MSG_MMS_ROOTLAYOUT_BGCOLOR_INT)
+ else if (field == MSG_MMS_ROOTLAYOUT_BGCOLOR_INT) {
+ mms_data->rootlayout.bBgColor = true;
mms_data->rootlayout.bgColor = value;
+ }
else
err = MSG_ERR_INVALID_PARAMETER;
}
mms_region_data->width.value = value;
else if (field == MSG_MMS_REGION_LENGTH_HEIGHT_INT)
mms_region_data->height.value = value;
- else if (field == MSG_MMS_REGION_BGCOLOR_INT)
+ else if (field == MSG_MMS_REGION_BGCOLOR_INT) {
+ mms_region_data->bBgColor = true;
mms_region_data->bgColor = value;
- else if (field == MSG_MMS_REGION_FIT_TYPE_INT)
+ } else if (field == MSG_MMS_REGION_FIT_TYPE_INT)
mms_region_data->fit = (REGION_FIT_TYPE_T)value;
else
err = MSG_ERR_INVALID_PARAMETER;
err = MSG_ERR_INVALID_PARAMETER;
}
} else if (field == MSG_MMS_MEDIA_CONTENT_ID_STR)
- strncpy(mms_media_data->szContentID, value, MSG_MSG_ID_LEN);
- else if (field == MSG_MMS_MEDIA_REGION_ID_STR)
+ __removeLessGreaterMark(value, mms_media_data->szContentID, MSG_MSG_ID_LEN);
+ else if (field == MSG_MMS_MEDIA_REGION_ID_STR)
strncpy(mms_media_data->regionId, value, MAX_SMIL_REGION_ID);
else if (field == MSG_MMS_MEDIA_ALTERNATIVE_STR)
strncpy(mms_media_data->szAlt, value, MAX_SMIL_ALT_LEN);
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
##########################################################
# Define MMS Plugin
##########################################################
static char *MmsDebugPrintUnknownValue(int value)
{
- printf(gszDebugStringBuf, "unknown value(%d)", value);
+ snprintf(gszDebugStringBuf, sizeof(gszDebugStringBuf), "unknown value(%d)", value);
return gszDebugStringBuf;
}
if (proxyAddrLength > 0) {
char *pPort = strchr(mmsProfile.ProfileInfo.Pdp.net_info.ProxyAddr, ':') + 1;
- if (pPort)
- return atoi(pPort);
- else
- return -1;
+ /* pPort cannot be NULL */
+ return atoi(pPort);
}
return -1;
__MmsDecodeInitialize();
}
+void MmsReleaseHeader(MmsHeader *mms)
+{
+ __MsgFreeHeaderAddress(mms->pFrom);
+ __MsgFreeHeaderAddress(mms->pTo);
+ __MsgFreeHeaderAddress(mms->pCc);
+ __MsgFreeHeaderAddress(mms->pBcc);
+
+ mmsHeader.pFrom = NULL;
+ mmsHeader.pTo = NULL;
+ mmsHeader.pCc = NULL;
+ mmsHeader.pBcc = NULL;
+
+}
+
static void __MmsCleanDecodeBuff(void)
{
memset(gpMmsDecodeBuf1, 0, gMmsDecodeMaxLen + 1);
goto __CATCH;
}
+ // range 197 to 223 as it does to the value 192 (Error-transient-failure).
+ // range 236 to 255 as it does to the value 224 (Error-permanent-failure).
+ if (fieldValue >= 0x0045 && fieldValue <= 0x005F) {
+ fieldValue = 0x0040;
+ } else if (fieldValue >= 0x006A && fieldValue <= 0x007F) {
+ fieldValue = 0x0060;
+ }
+
+ MSG_DEBUG("response status code = 0x%02x", oneByte);
+
fieldValue = MmsGetBinaryType(MmsCodeResponseStatus, (UINT16)(oneByte & 0x7F));
if (fieldValue == 0xFFFF) {
goto __CATCH;
}
- if (fieldValue >= 0x0044 && fieldValue <= 0x005F) {
- fieldValue = 0x0040;
- } else if (fieldValue >= 0x006A && fieldValue <= 0x007F) {
- fieldValue = 0x0060;
- }
-
mmsHeader.responseStatus = (MmsResponseStatus)fieldValue;
- MSG_DEBUG("response status = %s\n", MmsDebugGetResponseStatus(mmsHeader.responseStatus));
+ MSG_DEBUG("response status text = %s\n", MmsDebugGetResponseStatus(mmsHeader.responseStatus));
break;
goto __CATCH;
}
+ MSG_DEBUG("retrieve status code = 0x%02x", oneByte);
+
fieldValue = MmsGetBinaryType(MmsCodeRetrieveStatus, (UINT16)(oneByte & 0x7F));
if (fieldValue == 0xFFFF) {
mmsHeader.retrieveStatus = (MmsRetrieveStatus)fieldValue;
- MSG_DEBUG("retrieve status = %s\n",
- MmsDebugGetRetrieveStatus(mmsHeader.retrieveStatus));
+ MSG_DEBUG("retrieve status = %s\n", MmsDebugGetRetrieveStatus(mmsHeader.retrieveStatus));
break;
goto __CATCH;
}
- MSG_DEBUG("retrieve text = %s\n", mmsHeader.szResponseText);
+ MSG_DEBUG("retrieve text = %s\n", mmsHeader.szRetrieveText);
break;
case MMS_CODE_MSGID:
break;
case 0x40: // Content-ID
+ {
+ char szContentID[MMS_CONTENT_ID_LEN + 1];
pLatinBuff = (char *)malloc(MMS_CONTENT_ID_LEN + 1);
if (pLatinBuff == NULL)
}
textLength = strlen(pLatinBuff);
- if (__MsgLatin2UTF ((unsigned char*)pMsgType->szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) {
+ if (__MsgLatin2UTF ((unsigned char*)szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) {
MSG_DEBUG("MsgLatin2UTF fail \n");
goto __CATCH;
}
free(pLatinBuff);
pLatinBuff = NULL;
+ removeLessGreaterMark(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >"
+
if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false)
goto __RETURN;
-
+ }
break;
case 0x2E: // Content-Disposition
break;
case MMS_BODYHDR_CONTENTID: // Content-ID
+ {
+ char szContentID[MMS_CONTENT_ID_LEN + 1];
pLatinBuff = (char *)malloc(MMS_CONTENT_ID_LEN + 1);
if (pLatinBuff == NULL)
strncpy(pLatinBuff, pValue, MMS_MSG_ID_LEN);
length = strlen(pLatinBuff);
- if (__MsgLatin2UTF ((unsigned char*)pMsgType->szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0)
+ if (__MsgLatin2UTF ((unsigned char*)szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0)
{
MSG_DEBUG("MsgLatin2UTF fail \n");
goto __CATCH;
}
+ removeLessGreaterMark(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >"
+
free(pLatinBuff);
pLatinBuff = NULL;
break;
-
+ }
case MMS_BODYHDR_CONTENTLOCATION: // Content-Location
pLatinBuff = (char *)malloc(MMS_CONTENT_ID_LEN + 1);
} //while
__RETURN:
-
+/* DEADCODE
if (pLatinBuff) {
free(pLatinBuff);
pLatinBuff = NULL;
}
-
+*/
if (szTemp) {
free(szTemp);
szTemp = NULL;
goto __CATCH;
}
- if (pMsgBody->body.pMultipart != NULL)
+ if (pMsgBody->body.pMultipart != NULL) {
pLastMultipart = pMsgBody->body.pMultipart;
+ MSG_DEBUG("pMsgBody->body.pMultipart exist \n");
+ } else {
+ MSG_DEBUG("pMsgBody->body.pMultipart == NULL\n");
+ }
while (nEntries) {
MSG_DEBUG("decoding %dth multipart\n", index);
presentationInfo.pCurPresentation = pMultipart;
}
+ /* first multipart */
if (pLastMultipart == NULL) {
- /* first multipart */
pMsgBody->body.pMultipart = pMultipart;
pLastMultipart = pMultipart;
pPreMultipart = NULL;
char szTempMediaDir[MSG_FILEPATH_LEN_MAX] = {0, };
int attachmax = MSG_ATTACH_MAX;
- MSG_DEBUG("_MmsReadMsgBody: start read msg(msgID=%d)\n", msgID);
+ MSG_BEGIN();
+ MSG_DEBUG("msg id : %d", msgID);
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
memset(pMsg, 0, sizeof(MmsMsg));
/* Set mmsHeader.msgType & msgBody to pMsg ----------- */
- pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type;
-
memcpy(&(pMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType));
memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody));
+{//attribute convert mmsHeader -> mmsAttribute
+
+ pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type;
+
+ pMsg->mmsAttrib.date = mmsHeader.date;
+
+ if (mmsHeader.deliveryReport == MMS_REPORT_YES) {
+ pMsg->mmsAttrib.bAskDeliveryReport = true;
+ }
+
+ memcpy(&pMsg->mmsAttrib.deliveryTime, &mmsHeader.deliveryTime, sizeof(MmsTimeStruct));
+
+ memcpy(&pMsg->mmsAttrib.expiryTime, &mmsHeader.expiryTime, sizeof(MmsTimeStruct));
+
+ pMsg->mmsAttrib.msgClass = mmsHeader.msgClass;
+
+ snprintf(pMsg->szMsgID, sizeof(pMsg->szMsgID), "%s", mmsHeader.szMsgID);
+
+ pMsg->mmsAttrib.msgType = mmsHeader.type;
+
+ pMsg->mmsAttrib.version = mmsHeader.version;
+
+ pMsg->mmsAttrib.msgSize = mmsHeader.msgSize;
+
+ pMsg->mmsAttrib.priority = mmsHeader.priority;
+
+ if (mmsHeader.readReply == MMS_REPORT_YES) {
+ pMsg->mmsAttrib.bAskReadReply = true;
+ }
+
+ snprintf(pMsg->mmsAttrib.szSubject, sizeof(pMsg->mmsAttrib.szSubject), "%s", mmsHeader.szSubject);
+
+ snprintf(pMsg->szTrID, sizeof(pMsg->szTrID), "%s", mmsHeader.szTrID);
+
+ pMsg->mmsAttrib.retrieveStatus = mmsHeader.retrieveStatus;
+
+ //FIXME:: mmsHeader will release after delete global mmsHeader
+ //memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody));//After copy to MmsMsg
+}
if (pMsg->msgBody.pPresentationBody) {
if(MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
goto __CATCH;
}
}
+ if (pMsg->msgBody.pPresentationBody) {
+ if (__MmsMultipartSaveAsTempFile(&pMsg->msgBody.presentationType, pMsg->msgBody.pPresentationBody,
+ (char*)MSG_DATA_PATH, pMsg->szFileName, 0, bSavePartsAsTempFiles) == false)
+ goto __CATCH;
+ }
+
while (pMultipart) {
if (__MmsMultipartSaveAsTempFile(&pMultipart->type, pMultipart->pBody,
}
}while (s1++);
+ /* DEADCODE
return NULL;
+ */
}
static char *__MsgConvertLatin2UTF8FileName(char *pSrc)
pRemovePart = NULL;
}
} else {
+
#ifdef __SUPPORT_DRM__
MmsReleaseMsgDRMInfo(&pMsgBody->presentationType.drmInfo);
#endif
if (!pPartType) {
MSG_DEBUG("pPartType is NULL\n");
- return true; // why true value is retured ??? ; false;
+ return false;
}
- if (pPartType->param.szName[0] == '\0' && pPartType->param.szFileName[0] == '\0')
- snprintf(pPartType->param.szName, sizeof(pPartType->param.szName), "%s", pPartType->param.szFileName);
-
- if (pPartType->param.szName[0] != '\0') {
- snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szName);
+ if (pPartType->type == MIME_APPLICATION_SMIL) {
+ snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", "smil.txt");
} else {
- snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%lu", (unsigned long)index);
+ if (pPartType->param.szName[0] != '\0') {
+ snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szName);
+ } else if (pPartType->param.szFileName[0] != '\0') {
+ snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szFileName);
+ } else {
+ snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%lu", (unsigned long)index);
+ }
}
snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName); // get absolute path of each temp file of each part
- snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName); // store relative path of each temp file of each part including sub folder.
+ snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName);// store relative path of each temp file of each part including sub folder.
+
+ if (pPartType->param.szName[0] == '\0') {
+ snprintf(pPartType->param.szName, MSG_LOCALE_FILENAME_LEN_MAX+1, "%s", szFileName);
+ MSG_DEBUG("Set Name : %s", pPartType->param.szName);
+ }
if (pPartType->type == MIME_APPLICATION_OCTET_STREAM)
MsgGetTypeByFileName(&pPartType->type, szFullPath);
MsgCloseFile(pFile);
pFile = NULL;
+
+ snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath);
+ pPartBody->offset = 0;
+ pPartBody->size = MsgGetFileSize(pPartBody->szOrgFilePath);
+
+ MSG_DEBUG("Save Temp File to [%s]", pPartBody->szOrgFilePath);
+
if (pPartType->drmInfo.drmType != MSG_DRM_TYPE_NONE) {
MsgDrmRegisterFile(MSG_MODE_FILE, szFullPath, strlen(szFullPath));
char szMimeType[DRM_MAX_LEN_MIME + 1];
char szContentID[DRM_MAX_LEN_CID + 1];
MSG_DRM_TYPE drmType = MSG_DRM_NONE;
+ int ret = 0;
MsgDrmGetDrmType(szFilePath, &drmType);
MsgDrmGetMimeTypeEx(szFilePath, szMimeType, sizeof(szMimeType));
drm_content_info_s dcfHdrInfo;
bzero(&dcfHdrInfo, sizeof(drm_content_info_s));
- drm_get_content_info(szFilePath, &dcfHdrInfo);
+ ret = drm_get_content_info(szFilePath, &dcfHdrInfo);
+ MSG_DEBUG("drm_get_content_info is failed, ret=[%d]", ret);
drm_file_info_s fileInfo;
bzero(&fileInfo, sizeof(drm_file_info_s));
- drm_get_file_info(szFilePath,&fileInfo);
+ ret = drm_get_file_info(szFilePath, &fileInfo);
+ MSG_DEBUG("drm_get_file_info is failed, ret=[%d]", ret);
if (fileInfo.oma_info.version == DRM_OMA_DRMV1_RIGHTS) {
pMsgType->drmInfo.szContentName = MsgRemoveQuoteFromFilename(dcfHdrInfo.title);
listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
//MsgDeleteFile(pRetrievedFilePath + strlen(MSG_DATA_PATH)); // not ipc
- if (pRetrievedFilePath) {
- if (remove(pRetrievedFilePath) != 0)
- MSG_DEBUG("remove fail");
- }
+ if (remove(pRetrievedFilePath) != 0)
+ MSG_DEBUG("remove fail");
break;
// received data is retrieve-conf
break;
case eMMS_READREPORT_CONF:
- if (pRetrievedFilePath) {
- if (remove(pRetrievedFilePath) != 0)
- MSG_DEBUG("remove fail");
- }
+ if (remove(pRetrievedFilePath) != 0)
+ MSG_DEBUG("remove fail");
break;
default:
break;
msg_error_t err = MSG_SUCCESS;
- MSG_MESSAGE_INFO_S msgInfo = {};
+ MSG_MESSAGE_INFO_S msgInfo;
+ memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
MSG_DEBUG("pRequest->msgId [%d]", pRequest->msgId);
#include "MmsPluginInternal.h"
#include "MmsPluginStorage.h"
#include "MmsPluginSmil.h"
-
/*==================================================================================================
IMPLEMENTATION OF MmsPluginInternal - Member Functions
==================================================================================================*/
strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
- int tmpId = (msg_message_id_t)MmsSearchMsgId(mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
+ int tmpId = (msg_message_id_t)MmsPluginStorage::instance()->searchMsgId(mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
if (tmpId > 0) {
MSG_DEBUG("Found MSG_ID = %d", tmpId);
MSG_DEBUG("read Status = %s", pMsgInfo->msgData);
strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pFrom->szAddr, MAX_ADDRESS_VAL_LEN);
- int tmpId = MmsSearchMsgId(mmsHeader.pFrom->szAddr, mmsHeader.szMsgID);
+ int tmpId = MmsPluginStorage::instance()->searchMsgId(mmsHeader.pFrom->szAddr, mmsHeader.szMsgID);
if (tmpId > 0) {
pMsgInfo->msgId = (msg_message_id_t)tmpId;
pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
pMsgInfo->folderId = MSG_INBOX_ID;
// If failed MMS Retrieve, then saved as MMS Noti Ind Message.
- pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS;
+ // It will changed in MsgHandleMmsConfIncomingMsg
+ //pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS;
}
char *msisdn = NULL;
err = pStorage->updateMmsAttachCount(pMsgInfo->msgId, attachCount);
if (bMultipartRelated) {
- _MsgMmsReleasePageList(&msgData);
- _MsgMmsReleaseRegionList(&msgData);
- _MsgMmsReleaseAttachList(&msgData);
- _MsgMmsReleaseTransitionList(&msgData);
- _MsgMmsReleaseMetaList(&msgData);
+ MsgMmsReleaseMmsLists(&msgData);
}
MmsMsg *pMsg = NULL;
msg_error_t err = MSG_SUCCESS;
try {
- err = MmsPluginStorage::instance()->plgGetMmsMessage(pMsg, pSendOptInfo, pMmsMsg, pDestMsg);
+ err = MmsPluginStorage::instance()->plgGetMmsMessage(pMsg, pSendOptInfo, pDestMsg);
} catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
return MSG_SUCCESS;
}
+msg_error_t MmsDeleteMessage(msg_message_id_t msgId)
+{
+ MSG_BEGIN();
+
+ try {
+ MmsPluginStorage::instance()->deleteMmsMessage(msgId);
+ } catch (MsgException& e) {
+ MSG_FATAL("%s", e.what());
+ return MSG_ERR_PLUGIN_STORAGE;
+ } catch (exception& e) {
+ MSG_FATAL("%s", e.what());
+ return MSG_ERR_PLUGIN_STORAGE;
+ }
+
+ MSG_END();
+ return MSG_SUCCESS;
+}
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <errno.h>
+#include <sys/stat.h>
#include "MsgCppTypes.h"
#include "MsgStorageTypes.h"
#include "MmsPluginAvCodec.h"
#include "MmsPluginStorage.h"
#include "MmsPluginSMILValidate.h"
+#include "MmsPluginSmil.h"
#include "MmsPluginUtil.h"
+#define PRINT_KEY_VAL_STR(key, val)\
+if (val) {\
+MSG_DEBUG("%-20s: %s", key, val);\
+}\
+
+#define PRINT_KEY_VAL_INT(key, val)\
+if (val) {\
+MSG_DEBUG("%-20s: %d", key, val);\
+}\
+
+static MsgMultipart *MmsGetNthMultipart(MmsMsg *pMsg, int index);
+static bool MmsSetMsgAddressList(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S *pMsgInfo);
+static char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType);
+static bool MmsGetSmilRawData(MMS_MESSAGE_DATA_S *pMsgBody, char *pRawData, int *nSize);
+static bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, const char *content_id, char *pData, int size);
+static bool MmsInsertPartFromFile(MmsMsg *pMsg, char *szTitleName, char *szOrgFilePath, char *szContentID);
+static bool MmsInsertPartFromMultipart(MmsMsg *pMsg, MMS_MULTIPART_DATA_S *pNewMultipart);
+static bool MmsGetTypeByFileName(int *type, char *szFileName);
+static bool MmsInsertPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pMultipart);
+
bool MmsSetMsgAddressList(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S * pMsgInfo)
{
MSG_DEBUG("MmsSetMsgAddressList");
return true;
}
-int MmsGetSmilRawData(MMS_MESSAGE_DATA_S *pMsgBody, char **pRawdata)
+bool MmsGetSmilRawData(MMS_MESSAGE_DATA_S *pMsgBody, char **pRawdata)
{
MSG_BEGIN();
return true;
}
-
-bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, char *pData, int size)
+bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, const char *content_id, char *pData, int size)
{
- MSG_DEBUG("MmsInsertPresentation");
+ MSG_BEGIN();
if (pMsg == NULL) {
MSG_DEBUG("pMsg is NULL");
pMsg->msgBody.pPresentationBody->size = size;
pMsg->msgBody.presentationType.type = mimeType;
pMsg->msgBody.presentationType.param.charset = MSG_CHARSET_UTF8;
- snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>");
+
+ if (content_id && strlen(content_id) > 0) {
+ snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "%s", content_id);
+ } else {
+ snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>");//default
+ }
snprintf(pMsg->msgType.param.szStart, MSG_MSG_ID_LEN + 1, "%s", pMsg->msgBody.presentationType.szContentID);
+
pMsg->msgType.param.type = mimeType;
memset(pMsg->msgBody.pPresentationBody->body.pText, 0, size + 1);
strncpy(pMsg->msgBody.pPresentationBody->body.pText, pData, size);
+ MSG_END();
return true;
__CATCH:
return false;
}
-
bool MmsInsertPartFromFile(MmsMsg *pMsg, char *szTitleName, char *szOrgFilePath, char *szContentID)
{
MSG_DEBUG("MmsInsertPartFromFile");
}
}
+ MSG_DEBUG("MmsInsertPartFromFile: type = %d, name = %s, filepath = %s, cid = %s", mimeType, szTitleName, szOrgFilePath, szContentID);
+
if (mimeType == MIME_UNKNOWN)
mimeType = MIME_APPLICATION_OCTET_STREAM;
goto __CATCH;
}
- pMultipart = MmsMakeMultipart(mimeType, szTitleName, szOrgFilePath, NULL, 0, nFileSize, szContentID);
+ pMultipart = MmsMakeMultipart(mimeType, szTitleName, szOrgFilePath, szContentID, NULL);
if (pMultipart == NULL)
goto __CATCH;
return NULL;
}
-
-
-MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, void *pData, int offset, int size, char *szContentID)
+MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, char *szContentID, char *szContentLocation)
{
MsgMultipart *pMultipart = NULL;
if (szContentID && szContentID[0]) {
memset(pMultipart->type.szContentID, 0, MSG_MSG_ID_LEN + 1);
snprintf(pMultipart->type.szContentID, MSG_MSG_ID_LEN + 1, "<%s>", szContentID);
+ }
+ if (szContentLocation && szContentLocation[0]) {
memset(pMultipart->type.szContentLocation, 0, MSG_MSG_ID_LEN + 1);
- snprintf(pMultipart->type.szContentLocation, MSG_MSG_ID_LEN + 1, "%s", szContentID);
+ snprintf(pMultipart->type.szContentLocation, MSG_MSG_ID_LEN + 1, "%s", szContentLocation);
}
if (MmsIsText(mimeType) == true) {
pMultipart->type.encoding = MSG_ENCODING_BINARY;
}
- if (szOrgFilePath == NULL) {
- if (pData != NULL) {
- if (MmsIsText(mimeType) == true) {
- pMultipart->pBody->body.pText = (char *)malloc(size + 1);
- if (pMultipart->pBody->body.pText == NULL)
- goto __CATCH;
-
- memset(pMultipart->pBody->body.pText, 0, size + 1);
- } else {
- pMultipart->pBody->body.pBinary = malloc(size);
- if (pMultipart->pBody->body.pBinary == NULL)
- goto __CATCH;
-
- memset(pMultipart->pBody->body.pBinary, 0, size);
- }
-
- memcpy(pMultipart->pBody->body.pBinary, pData, size);
- pMultipart->pBody->size = size;
- }
- } else {
- if (szOrgFilePath)
- strncpy(pMultipart->pBody->szOrgFilePath, szOrgFilePath, MSG_FILEPATH_LEN_MAX - 1);
-
- pMultipart->pBody->offset = offset;
- pMultipart->pBody->size = size;
+ if (szOrgFilePath) {
+ strncpy(pMultipart->pBody->szOrgFilePath, szOrgFilePath, MSG_FILEPATH_LEN_MAX - 1);
+ pMultipart->pBody->offset = 0;
+ pMultipart->pBody->size = MsgGetFileSize(szOrgFilePath);
}
-
return pMultipart;
__CATCH:
return NULL;
}
-
bool MmsGetTypeByFileName(int *type, char *szFileName)
{
char *pExt = NULL;
}
MSG_DEBUG("%s", pRawData);
if (pRawData)
- MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, pRawData, strlen(pRawData));
+ MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, NULL, pRawData, strlen(pRawData));
pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED;
pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED;
strncpy(pMmsMsg->mmsAttrib.szFrom, pMmsMsg->mmsAttrib.szTo, strlen(pMmsMsg->mmsAttrib.szTo));
}
-int MmsSearchMsgId(char *toNumber, char *szMsgID)
+bool MmsFindMatchedMedia(MMS_MESSAGE_DATA_S *pMsgData, char *pszFilePath)
{
- MSG_BEGIN();
-
- int msgId;
-
- msgId = MmsPluginStorage::instance()->searchMsgId(toNumber, szMsgID);
+ if (pMsgData == NULL || pszFilePath == NULL)
+ return false;
- if (msgId < 0)
- return 0;
+ if (pMsgData->pagelist) {
+ for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) {
+ MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx);
- MSG_END();
+ if (page && page->medialist) {
+ for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) {
+ MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx);
+ if (media) {
+ if (strcmp(pszFilePath, media->szFilePath) == 0)
+ return true;
+ }
+ }
+ }
+ }
+ }
- return msgId;
+ return false;
}
bool MmsCheckAdditionalMedia(MMS_MESSAGE_DATA_S *pMsgData, MsgType *partHeader)
{
- if (_MsgMmsFindMatchedMedia(pMsgData, partHeader->param.szFileName))
+ if (MmsFindMatchedMedia(pMsgData, partHeader->param.szFileName))
return false;
else
return true;
MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath);
}
} else {
- if (makeVideoThumbnail(pMedia->szFilePath, thumbPath) == true) {;
+ if (makeImageThumbnail(pMedia->szFilePath, thumbPath) == true) {
MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_VIDEO, thumbPath);
} else {
MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath);
}
}
}
+
+MMS_MEDIA_S *MmsFindMediaWithCID(MMS_MESSAGE_DATA_S *pMsgData, const char *szContentID)
+{
+
+ if (pMsgData == NULL || szContentID == NULL || strlen(szContentID) == 0) {
+ MSG_DEBUG("Invalid Parameter pMsgData = %p, szContentID = %p", pMsgData, szContentID);
+ return NULL;
+ }
+
+ if (pMsgData->pagelist) {
+ for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) {
+
+ MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx);
+
+ if (page && page->medialist) {
+
+ for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) {
+
+ MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx);
+
+ if (media) {
+ if (strcmp(media->szContentID, szContentID) == 0) {
+ MSG_DEBUG("Find media with Content ID [%s] from pMsgData", szContentID);
+ return media;
+ }
+
+ } else {
+ MSG_DEBUG("Error media NULL");
+ return NULL;
+ }
+ } //end for media list
+ }
+ } //end for page list
+ }
+
+ MSG_DEBUG("Not exist Matched media with [%s]", szContentID);
+ return NULL;
+}
+
+MsgMultipart *MmsGetNthMultipart(MmsMsg *pMsg, int index)
+{
+ MsgMultipart *pPart = NULL;
+
+ if (MsgIsMultipart(pMsg->msgType.type) == true) {
+
+ pPart = pMsg->msgBody.body.pMultipart;
+
+ while (pPart && index--) {
+ pPart = pPart->pNext;
+ }
+
+ if (pPart == NULL) {
+ MSG_DEBUG("There is no such Multipart [index = %d].", index);
+ return NULL;
+ } else {
+ return pPart;
+ }
+ } else {
+ MSG_DEBUG("This Msg is not Multipart");
+ }
+
+ return NULL;
+}
+
+bool MmsInsertPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pMultipart)
+{
+ MMS_MEDIA_S * match_media = NULL;
+ bool isPimsFile = false;
+ int tempType;//MimeType
+
+ if (pMsgData == NULL || pMultipart == NULL) {
+ return false;
+ }
+
+ //for pims file add to attach
+ MsgGetTypeByFileName(&tempType, pMultipart->szFilePath);
+ if (tempType == MIME_TEXT_X_VCALENDAR || tempType == MIME_TEXT_X_VCARD) {
+ MSG_DEBUG("Pims File");
+ isPimsFile = true;
+ } else {
+
+ if (strlen(pMultipart->szContentID) > 0) {
+ char szTempContentID[MSG_MSG_ID_LEN + 1] = {0,};
+ removeLessGreaterMark(pMultipart->szContentID, szTempContentID, sizeof(szTempContentID));
+ match_media = MmsFindMediaWithCID(pMsgData, szTempContentID);
+
+ if (match_media == NULL && strlen(pMultipart->szContentLocation) > 0 ) {
+ match_media = MmsFindMediaWithCID(pMsgData, pMultipart->szContentLocation);
+ }
+
+ } else {
+ MSG_DEBUG("ContentID is NULL");
+ match_media = NULL;
+ }
+
+ }
+
+ if (match_media && isPimsFile == false) { // set file path
+ snprintf(match_media->szFilePath, sizeof(match_media->szFilePath), "%s", pMultipart->szFilePath);
+ snprintf(match_media->szFileName, sizeof(match_media->szFileName), "%s", pMultipart->szFileName);
+ snprintf(match_media->szContentID, sizeof(match_media->szContentID), "%s", pMultipart->szContentID);
+ snprintf(match_media->szContentLocation, sizeof(match_media->szContentLocation), "%s", pMultipart->szContentLocation);
+ snprintf(match_media->szContentType, sizeof(match_media->szContentType), "%s", pMultipart->szContentType);
+ } else { // add attach
+
+ MMS_ATTACH_S *attachment = NULL;
+ attachment = (MMS_ATTACH_S *)calloc(sizeof(MMS_ATTACH_S), 1);
+
+ attachment->mediatype = (MimeType)tempType;
+ snprintf(attachment->szContentType, sizeof(attachment->szContentType), "%s", pMultipart->szContentType);
+ snprintf(attachment->szFilePath, sizeof(attachment->szFilePath), "%s", pMultipart->szFilePath);
+ snprintf(attachment->szFileName, sizeof(attachment->szFileName), "%s", pMultipart->szFileName);
+ attachment->fileSize = MsgGetFileSize(attachment->szFilePath);
+
+ if (_MsgMmsAddAttachment(pMsgData, attachment) != MSG_SUCCESS) {
+ g_free(attachment);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool MmsEncodeMmsMessage(MmsMsg *pMmsMsg, const char *raw_filepath)
+{
+ bool encode_ret = false;
+ mode_t file_mode = (S_IRUSR | S_IWUSR);
+
+ if (pMmsMsg == NULL || raw_filepath == NULL) {
+ MSG_DEBUG("Invalid Parameter pMmsMsg = %p , raw_filepath = %p", pMmsMsg, raw_filepath);
+ return false;
+ }
+
+ FILE *pFile = MsgOpenFile(raw_filepath, "wb+");
+
+ if (pFile == NULL) {
+ MSG_FATAL("File Open Error: %s", strerror(errno));
+ goto __CATCH;
+ }
+
+ if (MsgFseek(pFile, 0L, SEEK_CUR) < 0) {
+ MSG_DEBUG("File Fseek Error: %s", strerror(errno));
+ goto __CATCH;
+ }
+
+ if (fchmod(fileno(pFile), file_mode) < 0) {
+ MSG_DEBUG("File chmod Error: %s", strerror(errno));
+ goto __CATCH;
+ }
+
+ switch(pMmsMsg->mmsAttrib.msgType)
+ {
+ case MMS_MSGTYPE_SEND_REQ:
+ case MMS_MSGTYPE_SEND_CONF:
+ encode_ret = MmsEncodeSendReq(pFile, pMmsMsg);
+ if (encode_ret == false) {
+ MSG_DEBUG("Fail to MmsEncodeSendReq");
+ goto __CATCH;
+ }
+ break;
+ default:
+ MSG_DEBUG("Not Support msg type : %d", pMmsMsg->mmsAttrib.msgType);
+ goto __CATCH;
+ break;
+ }
+
+ MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off
+ MsgCloseFile(pFile);
+
+ return true;
+
+__CATCH:
+ if (pFile) {
+ MsgCloseFile(pFile);
+ }
+
+ return false;
+}
+
+bool MmsInsertPartFromMultipart(MmsMsg *pMsg, MMS_MULTIPART_DATA_S *pNewMultipart)
+{
+ MsgMultipart *pMultipart = NULL;
+ MsgMultipart *pLastPart = NULL;
+
+ MimeType mimeType = MIME_UNKNOWN;
+ char *pExt = NULL;
+
+ pExt = strrchr(pNewMultipart->szFilePath, '.');
+
+ if (pExt == NULL || pExt[0] == '\0' || strrchr(pExt, '/')) {
+ //mimeType = MIME_UNKNOWN;
+ mimeType = MimeGetMimeIntFromMimeString(pNewMultipart->szContentType);
+ } else {
+ if (strcasecmp(pExt, ".dcf") == 0)
+ mimeType = MIME_APPLICATION_VND_OMA_DRM_CONTENT;
+ else {
+ if (MmsGetTypeByFileName((int *)&mimeType, pNewMultipart->szFilePath) == false)
+ goto __CATCH;
+ }
+ }
+
+ MSG_DEBUG("type = %d, name = %s, filepath = %s, cid = %s, cl = %s", mimeType, pNewMultipart->szFileName, pNewMultipart->szFilePath, pNewMultipart->szContentID, pNewMultipart->szContentLocation);
+
+ if (mimeType == MIME_UNKNOWN)
+ mimeType = MIME_APPLICATION_OCTET_STREAM;
+
+ if (MmsIsMultipart(pMsg->msgType.type) == true) {
+ /* Insert as a multipart */
+ pMultipart = MmsMakeMultipart(mimeType, pNewMultipart->szFileName, pNewMultipart->szFilePath, pNewMultipart->szContentID, pNewMultipart->szContentLocation);
+
+ if (pMultipart == NULL)
+ goto __CATCH;
+
+ if (pMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED ||
+ pMsg->mmsAttrib.contentType == MIME_MULTIPART_MIXED)
+ pMultipart->type.disposition = MSG_DISPOSITION_ATTACHMENT;
+
+ if (pMsg->msgBody.body.pMultipart == NULL) {
+ pMsg->msgBody.body.pMultipart = pMultipart;
+ } else {
+ pLastPart = pMsg->msgBody.body.pMultipart;
+ while (pLastPart->pNext) {
+ pLastPart = pLastPart->pNext;
+ }
+
+ pLastPart->pNext = pMultipart;
+ }
+
+ pMsg->msgBody.size += pMultipart->pBody->size;
+ pMsg->msgType.contentSize += pMultipart->pBody->size;
+ } else {
+ /* Single part - Insert as a message body */
+ if (pMsg->mmsAttrib.contentType != mimeType || pMsg->msgType.type != mimeType)
+ goto __CATCH;
+
+ strncpy(pMsg->msgType.param.szName, pNewMultipart->szFileName, MSG_LOCALE_FILENAME_LEN_MAX);
+
+ if (MmsIsText(pMsg->msgType.type) == true) {
+ pMsg->msgType.param.charset = MSG_CHARSET_UTF8;
+ }
+
+ strncpy(pMsg->msgBody.szOrgFilePath, pNewMultipart->szFilePath, MSG_FILEPATH_LEN_MAX - 1);
+ pMsg->msgBody.offset = 0;
+ pMsg->msgBody.size = MsgGetFileSize(pNewMultipart->szFilePath);
+ pMsg->msgType.contentSize = MsgGetFileSize(pNewMultipart->szFilePath);
+ }
+
+ pMsg->nPartCount++;
+
+ return true;
+
+__CATCH:
+ return false;
+
+}
+
+bool MmsMakeMmsData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg)
+{
+ MSG_BEGIN();
+
+ bzero(pMmsMsg, sizeof(pMmsMsg));
+ pMmsMsg->regionCnt = 0;
+ pMmsMsg->pageCnt = 0;
+ pMmsMsg->attachCnt = 0;
+ pMmsMsg->transitionCnt = 0;
+ pMmsMsg->metaCnt = 0;
+ memset(pMmsMsg->szSmilFilePath, 0, MSG_FILEPATH_LEN_MAX);
+
+ if (pMsg->mmsAttrib.contentType == MIME_MULTIPART_RELATED || pMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) {
+ char *pSmilDoc = NULL;
+
+ if (pMsg->msgBody.pPresentationBody) {
+ if (pMsg->msgBody.pPresentationBody->body.pText) {
+ pSmilDoc = pMsg->msgBody.pPresentationBody->body.pText;
+ if (pSmilDoc) {
+ MmsSmilParseSmilDocOnlyLayout(pMmsMsg, pSmilDoc);
+ }
+
+ pMmsMsg->smil.type = MIME_APPLICATION_SMIL;
+ snprintf(pMmsMsg->smil.szContentType, MSG_MSG_ID_LEN, "%s", MimeGetMimeStringFromMimeInt(pMsg->msgBody.presentationType.type));
+ snprintf(pMmsMsg->smil.szContentID, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentID);
+ snprintf(pMmsMsg->smil.szContentLocation, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentLocation);
+ snprintf(pMmsMsg->smil.szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsg->msgBody.presentationType.param.szName);
+ snprintf(pMmsMsg->smil.szFilePath, MSG_FILEPATH_LEN_MAX, MSG_DATA_PATH"%s", pMsg->msgBody.presentationType.param.szFileName);
+ }
+ } else {
+ MSG_DEBUG("Not Exist pPresentationBody");
+ }
+ }
+
+ int partCnt = pMsg->nPartCount;
+
+ for (int i = 0; i < partCnt; ++i) {
+
+ MsgMultipart *multipart = MmsGetNthMultipart(pMsg, i);
+ MMS_MULTIPART_DATA_S pMultipart;
+
+ if (multipart == NULL) {
+ MSG_DEBUG("multipart is NULL [%d]", i);
+ goto FREE_CATCH;
+ }
+
+ bzero(&pMultipart, sizeof(MMS_MULTIPART_DATA_S));
+ snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", multipart->type.szContentID);
+ snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", multipart->type.szContentLocation);
+ snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", multipart->type.param.szName);
+ snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", multipart->pBody->szOrgFilePath);
+ snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s",MimeGetMimeStringFromMimeInt(multipart->type.type));
+
+ if (MmsInsertPartToMmsData(pMmsMsg, &pMultipart) == false) {
+ MSG_DEBUG("Fail to MmsSetMultipartToMmsData");
+ goto FREE_CATCH;
+ }
+ }
+ MSG_END();
+ return true;
+FREE_CATCH:
+ return false;
+}
+
+void MmsPrintMmsMsg(const MmsMsg *pMmsMsg)
+{
+ MmsMsgType msgType = pMmsMsg->mmsAttrib.msgType;
+ if (msgType == MMS_MSGTYPE_SEND_REQ) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_SEND_REQ");
+ } else if (msgType == MMS_MSGTYPE_SEND_CONF) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_SEND_CONF");
+ } else if (msgType == MMS_MSGTYPE_NOTIFICATION_IND) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_NOTIFICATION_IND");
+ } else if (msgType == MMS_MSGTYPE_NOTIFYRESP_IND) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_NOTIFYRESP_IND");
+ } else if (msgType == MMS_MSGTYPE_RETRIEVE_CONF) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_RETRIEVE_CONF");
+ } else if (msgType == MMS_MSGTYPE_ACKNOWLEDGE_IND) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_ACKNOWLEDGE_IND");
+ } else if (msgType == MMS_MSGTYPE_DELIVERY_IND) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_DELIVERY_IND");
+ } else if (msgType == MMS_MSGTYPE_READREC_IND) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_READREC_IND");
+ } else if (msgType == MMS_MSGTYPE_READORG_IND) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_READORG_IND");
+ } else if (msgType == MMS_MSGTYPE_FORWARD_REQ) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_FORWARD_REQ");
+ } else if (msgType == MMS_MSGTYPE_FORWARD_CONF) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_FORWARD_CONF");
+ } else if (msgType == MMS_MSGTYPE_READ_REPLY) {
+ PRINT_KEY_VAL_STR("mms type", "MMS_MSGTYPE_READ_REPLY");
+ } else {
+ PRINT_KEY_VAL_STR("mms type", "Unknown");
+ }
+
+ PRINT_KEY_VAL_STR("mms ver", pMmsMsg->mmsAttrib.version);
+
+}
+
+bool MmsComposeSendReq(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMsgData)
+{
+ MSG_BEGIN();
+
+ char *pRawData = NULL;
+ AutoPtr<char> buf(&pRawData);
+ struct tm *timeInfo = NULL;
+ time_t RawTime = 0;
+ time_t nTimeInSecs = 0;
+
+ // Initialize mmsMsg structure
+ MmsInitMsgAttrib(&pMmsMsg->mmsAttrib);
+ MmsInitMsgType(&pMmsMsg->msgType);
+ MmsInitMsgBody(&pMmsMsg->msgBody);
+
+ // setting mmsMsg structure
+ pMmsMsg->mailbox = pMsgInfo->folderId;
+ pMmsMsg->msgID = pMsgInfo->msgId;
+
+ memset(pMmsMsg->szTrID, 0, MMS_TR_ID_LEN + 1);
+ memset(pMmsMsg->szContentLocation, 0, MMS_LOCATION_LEN + 1);
+ memset(pMmsMsg->szMsgID, 0, MMS_MSG_ID_LEN + 1);
+ memset(pMmsMsg->szForwardMsgID, 0, MMS_MSG_ID_LEN + 1);
+
+ pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT;
+ pMmsMsg->mmsAttrib.msgType = MMS_MSGTYPE_SEND_REQ;
+
+ if (pSendOptInfo->bSetting == false) {
+ unsigned int expiryTime;
+ MSG_MMS_DELIVERY_TIME_T deliveryTime;
+
+ pMmsMsg->mmsAttrib.priority = (MmsPriority)MsgSettingGetInt(MMS_SEND_PRIORITY);
+
+ MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &pMmsMsg->mmsAttrib.bAskDeliveryReport);
+ MsgSettingGetBool(MMS_SEND_READ_REPLY, &pMmsMsg->mmsAttrib.bAskReadReply);
+ MsgSettingGetBool(MSG_KEEP_COPY, &pMmsMsg->mmsAttrib.bLeaveCopy);
+
+ expiryTime = (unsigned int)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME);
+
+ if (expiryTime == 0)
+ pMmsMsg->mmsAttrib.expiryTime.type = MMS_TIMETYPE_NONE;
+ else {
+ pMmsMsg->mmsAttrib.expiryTime.type = MMS_TIMETYPE_RELATIVE;
+ pMmsMsg->mmsAttrib.expiryTime.time = expiryTime;
+ }
+
+ deliveryTime = (MSG_MMS_DELIVERY_TIME_T)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME);
+
+ if (deliveryTime == MSG_DELIVERY_TIME_CUSTOM) {
+ pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = true;
+
+ pMmsMsg->mmsAttrib.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
+ pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY);
+ } else {
+ pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = false;
+
+ pMmsMsg->mmsAttrib.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
+ pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)deliveryTime;
+ }
+ } else {
+ pMmsMsg->mmsAttrib.priority = (MmsPriority)pSendOptInfo->option.mmsSendOptInfo.priority;
+ pMmsMsg->mmsAttrib.bAskDeliveryReport = pSendOptInfo->bDeliverReq;
+ pMmsMsg->mmsAttrib.bAskReadReply = pSendOptInfo->option.mmsSendOptInfo.bReadReq;
+ pMmsMsg->mmsAttrib.expiryTime.type = pSendOptInfo->option.mmsSendOptInfo.expiryTime.type;
+ pMmsMsg->mmsAttrib.bLeaveCopy = pSendOptInfo->bKeepCopy;
+
+ if (pMmsMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE)
+ pMmsMsg->mmsAttrib.expiryTime.time = pSendOptInfo->option.mmsSendOptInfo.expiryTime.time;
+
+ pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = pSendOptInfo->option.mmsSendOptInfo.bUseDeliveryCustomTime;
+ pMmsMsg->mmsAttrib.deliveryTime.type = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.type;
+ pMmsMsg->mmsAttrib.deliveryTime.time = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time;
+ }
+
+ MSG_DEBUG("pSendOptInfo->bSetting = %d", pSendOptInfo->bSetting);
+ MSG_DEBUG("pMmsMsg->mmsAttrib.bLeaveCopy = %d", pMmsMsg->mmsAttrib.bLeaveCopy);
+
+ MSG_DEBUG("pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = %d", pMmsMsg->mmsAttrib.bUseDeliveryCustomTime);
+ MSG_DEBUG("pMmsMsg->mmsAttrib.deliveryTime.type = %d", pMmsMsg->mmsAttrib.deliveryTime.type);
+ MSG_DEBUG("pMmsMsg->mmsAttrib.deliveryTime.time = %d", pMmsMsg->mmsAttrib.deliveryTime.time);
+
+ MSG_DEBUG("pMmsMsg->mmsAttrib.priority = %d", pMmsMsg->mmsAttrib.priority);
+
+ MSG_DEBUG("pMmsMsg->mmsAttrib.bAskDeliveryReport = %d", pMmsMsg->mmsAttrib.bAskDeliveryReport);
+ MSG_DEBUG("pMmsMsg->mmsAttrib.bAskReadReply = %d", pMmsMsg->mmsAttrib.bAskReadReply);
+
+ MSG_DEBUG("pMmsMsg->mmsAttrib.expiryTime.type = %d", pMmsMsg->mmsAttrib.expiryTime.type);
+ MSG_DEBUG("pMmsMsg->mmsAttrib.expiryTime.time = %d", pMmsMsg->mmsAttrib.expiryTime.time);
+
+ /* MMS-1.3-con-739 */
+ pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)MsgSettingGetInt(MMS_SEND_MSG_CLASS);
+ /* MMS-1.3-con-739 */
+#ifdef MMS_13_CON_742_ENABLED
+ /* MMS-1.3-con-742 */
+ pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME);
+ /* MMS-1.3-con-742 */
+#endif
+
+ // setting date
+ time(&RawTime);
+ timeInfo = localtime(&RawTime);
+ nTimeInSecs = mktime(timeInfo);
+ pMmsMsg->mmsAttrib.date = nTimeInSecs; // todo: need to subtract timeline value to make GMT+0 time
+
+ //setting subject
+ strcpy(pMmsMsg->mmsAttrib.szSubject, pMsgInfo->subject);
+
+ //setting adddress
+ MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo);
+
+ //default type mixed
+ pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED;
+ pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED;
+
+ int pageCnt = _MsgMmsGetPageCount(pMsgData);
+
+ if (pageCnt > 0) { // Multipart related
+
+ int RawDataSize = 0;
+ time_t RawTime = 0;
+ time(&RawTime);
+
+ snprintf(pMsgData->szSmilFilePath, MSG_FILEPATH_LEN_MAX, "%lu", RawTime);
+
+ MsgMMSCreateSMIL(pMsgData);
+
+ RawDataSize = MmsGetSmilRawData(pMsgData, &pRawData);
+ if (RawDataSize < 0) {
+ MSG_DEBUG("Smil file size is less than 0");
+ return false;
+ }
+ MSG_DEBUG("%s", pRawData);
+ if (pRawData)
+ MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, NULL, pRawData, strlen(pRawData));
+
+ pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED;
+ pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED;
+
+ }
+
+ if (pMmsMsg->msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) {
+
+ int pageCnt = _MsgMmsGetPageCount(pMsgData);
+
+ for (int i = 0; i < pageCnt; ++i) {
+ MMS_PAGE_S *pPage = _MsgMmsGetPage(pMsgData, i);
+ int mediaCnt = pPage->mediaCnt;
+ MSG_DEBUG("PAGE %d's media Cnt: %d", i+1, mediaCnt);
+
+ for (int j = 0; j < mediaCnt; ++j) {
+ MMS_MEDIA_S *pMedia = _MsgMmsGetMedia(pPage, j);
+ if (pMedia->szFilePath[0] != 0) {
+ MMS_MULTIPART_DATA_S pMultipart;
+ bzero(&pMultipart, sizeof(MMS_MULTIPART_DATA_S));
+ snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", pMedia->szContentID);
+ snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", pMedia->szContentLocation);
+ snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", pMedia->szFileName);
+ snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", pMedia->szFilePath);
+ snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s", pMedia->szContentType);
+
+ if (!MmsInsertPartFromMultipart(pMmsMsg, &pMultipart))
+ return false;
+ }
+ }
+ }
+ }
+
+ //Processing Attachment List
+ for (int i = 0; i < _MsgMmsGetAttachCount(pMsgData); ++i) {
+ MMS_ATTACH_S *pMedia = _MsgMmsGetAttachment(pMsgData, i);
+ if (pMedia->szFilePath[0] != 0) {
+ MMS_MULTIPART_DATA_S pMultipart;
+ bzero(&pMultipart, sizeof(MMS_MULTIPART_DATA_S));
+ snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", pMedia->szFileName);
+ snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", pMedia->szFileName);
+ snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", pMedia->szFileName);
+ snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", pMedia->szFilePath);
+ snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s", pMedia->szContentType);
+
+ if (!MmsInsertPartFromMultipart(pMmsMsg, &pMultipart))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo)
+{
+ MSG_BEGIN();
+ MmsMsg *pMmsMsg;
+ MMS_MESSAGE_DATA_S msgData = {0,};
+
+ MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg);
+
+ MmsReleaseMmsMsg(pMmsMsg);
+
+ if (MmsReadMsgBody(pMsgInfo->msgId, true, false, NULL) == false) {
+ MSG_DEBUG("Fail to MmsReadMsgBody");
+ goto __CATCH;
+ }
+
+ if (MmsMakeMmsData(pMmsMsg, &msgData) == false) {
+ MSG_DEBUG("Fail to makeMmsMessageData");
+ goto __CATCH;
+ }
+
+ MmsMakePreviewInfo(pMsgInfo->msgId, &msgData);
+
+ MmsPluginStorage::instance()->getMsgText(&msgData, pMsgInfo->msgText);
+
+ MmsReleaseMmsMsg(pMmsMsg);
+ MsgMmsReleaseMmsLists(&msgData);
+
+ MSG_END();
+ return 0;
+
+__CATCH:
+ MmsReleaseMmsMsg(pMmsMsg);
+ MsgMmsReleaseMmsLists(&msgData);
+ return -1;
+}
break;
case ATTRIBUTE_BGCOLOR:
- if (cmd[ELEMENT_ROOTLAYOUT])
+ if (cmd[ELEMENT_ROOTLAYOUT]) {
+ rootlayout.bBgColor = true;
rootlayout.bgColor = MmsSmilGetColorValue(pAttr->children->content);
- else if (cmd[ELEMENT_REGION])
+ } else if (cmd[ELEMENT_REGION]) {
+ pRegion->bBgColor = true;
pRegion->bgColor = MmsSmilGetColorValue(pAttr->children->content);
- else if (cmd[ELEMENT_TEXT])
+ } else if (cmd[ELEMENT_TEXT])
pMedia->sMedia.sText.nBgColor = MmsSmilGetColorValue(pAttr->children->content);
else
pMedia->sMedia.sAVI.nBgColor = MmsSmilGetColorValue(pAttr->children->content);
return ATTRIBUTE_HEIGHT;
else if (!strcmp(pString, "fit"))
return ATTRIBUTE_FIT;
- else if (!strcmp(pString, "backgroundColor"))
+ else if (!strcmp(pString, "backgroundColor") || !strcmp(pString, "background-color"))
return ATTRIBUTE_BGCOLOR;
else if (!strcmp(pString, "dur"))
return ATTRIBUTE_DUR;
}
MSG_DEBUG("Root Layout Element Name = %s", (char *)pstRootLayout->name);
- if (pstSmilRootLayout->bgColor != SP_NO_COLOR_SET) { // Replace value later
+ if (pstSmilRootLayout->bBgColor == true) { // Replace value later
xmlSetProp(pstRootLayout, (const xmlChar *)"backgroundColor", (const xmlChar *)__MmsSmilFindColorValue(pstSmilRootLayout->bgColor));
}
+
MSG_DEBUG(" Set Width");
if (true == pstSmilRootLayout->width.bUnitPercent) {
snprintf(szBuf, MSG_STDSTR_SHORT, "%d%%", pstSmilRootLayout->width.value);
if (strlen(pstSmilRegion->szID) > 0) {
xmlSetProp(pstRegion, (const xmlChar *)"id", (const xmlChar *)pstSmilRegion->szID);
}
- MSG_DEBUG(" [Set Attribute] : BkGrd Color");
- // Default Color WHITE, always send
- if (pstSmilRegion->bgColor != SP_NO_COLOR_SET) {
+
+ if (pstSmilRegion->bBgColor == true) {
+ MSG_DEBUG(" [Set Attribute] : BkGrd Color");
xmlSetProp(pstRegion, (const xmlChar *)"backgroundColor", (const xmlChar *)__MmsSmilFindColorValue(pstSmilRegion->bgColor));
}
+
MSG_DEBUG(" [Set Attribute] : Width");
if (true == pstSmilRegion->width.bUnitPercent) {
return NULL;
}
+void MmsSmilGetElementOnlyLayout(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node)
+{
+ MSG_BEGIN();
+
+ int elementType;
+ int attrType;
+ MMS_SMIL_ROOTLAYOUT rootlayout = {};
+ static bool cmd[ELEMENT_MAX] = {false, };
+ static MMS_SMIL_REGION *pRegion;
+ static MMS_PAGE_S *pPage;
+ static MMS_MEDIA_S *pMedia;
+ static MMS_SMIL_TRANSITION *pTransition;
+ static MMS_SMIL_META *pMeta;
+
+ xmlNode *cur_node = NULL;
+
+ for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
+ MSG_DEBUG("******* node, name: %s ***\n", cur_node->name);
+
+ if (cur_node->type == XML_ELEMENT_NODE) {
+ // Get Smil Element =====================================================
+ MSG_DEBUG("*** node type: Element, name: %s ***\n", cur_node->name);
+
+ switch (elementType = MmsSmilGetElementID((char *)cur_node->name)) {
+ case ELEMENT_ROOTLAYOUT:
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_ROOTLAYOUT] = true;
+ break;
+
+ case ELEMENT_REGION:
+ pRegion = (MMS_SMIL_REGION *)calloc(1, sizeof(MMS_SMIL_REGION));
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_REGION] = true;
+ break;
+
+ case ELEMENT_TRANSITION:
+ pTransition = (MMS_SMIL_TRANSITION *)calloc(1, sizeof(MMS_SMIL_TRANSITION));
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_TRANSITION] = true;
+ break;
+
+ case ELEMENT_META:
+ pMeta = (MMS_SMIL_META *)calloc(1, sizeof(MMS_SMIL_META));
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_META] = true;
+ break;
+
+ case ELEMENT_PAR:
+ pPage = (MMS_PAGE_S *)calloc(1, sizeof(MMS_PAGE_S));
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_PAR] = true;
+ break;
+
+ case ELEMENT_PARAM: // Need to check the original element type
+ break;
+
+ case ELEMENT_TEXT:
+ pMedia = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S));
+ pMedia->mediatype = MMS_SMIL_MEDIA_TEXT;
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_TEXT] = true;
+ break;
+
+ case ELEMENT_IMG:
+ pMedia = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S));
+ pMedia->mediatype = MMS_SMIL_MEDIA_IMG;
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_IMG] = true;
+ break;
+
+ case ELEMENT_AUDIO:
+ pMedia = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S));
+ pMedia->mediatype = MMS_SMIL_MEDIA_AUDIO;
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_AUDIO] = true;
+ break;
+
+ case ELEMENT_VIDEO:
+ pMedia = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S));
+ pMedia->mediatype = MMS_SMIL_MEDIA_VIDEO;
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_VIDEO] = true;
+ break;
+
+ case ELEMENT_REF:
+ pMedia = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S));
+ pMedia->mediatype = MMS_SMIL_MEDIA_IMG_OR_VIDEO;
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_REF] = true;
+ break;
+
+ case ELEMENT_ANIMATE:
+ pMedia = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S));
+ pMedia->mediatype = MMS_SMIL_MEDIA_ANIMATE;
+ memset(cmd, 0, ELEMENT_MAX);
+ cmd[ELEMENT_ANIMATE] = true;
+ break;
+
+ default:
+ memset(cmd, 0, ELEMENT_MAX);
+ break;
+ }
+
+ //Get Smil Attribute =====================================================
+ xmlAttr *pAttr = cur_node->properties;
+ SMIL_ATTRIBUTE_T paramType = ATTRIBUTE_UNKNOWN;
+
+ for ( ; pAttr; pAttr = pAttr->next) {
+ MSG_DEBUG("AttributeType: (%s, %s) ", pAttr->name, pAttr->children->content);
+ switch (attrType = MmsSmilGetAttrID((char *)pAttr->name)) {
+ case ATTRIBUTE_ID:
+ {
+ if (cmd[ELEMENT_REGION]) {
+ strncpy(pRegion->szID, (char *)pAttr->children->content, MAX_SMIL_REGION_ID - 1);
+ } else if (cmd[ELEMENT_TRANSITION]) {
+ strncpy(pTransition->szID, (char *)pAttr->children->content, MAX_SMIL_TRANSITION_ID - 1);
+ } else if (cmd[ELEMENT_META]) {
+ strncpy(pMeta->szID, (char *)pAttr->children->content, MAX_SMIL_META_ID - 1);
+ }
+ }
+ break;
+
+ case ATTRIBUTE_TOP:
+ {
+ int bUnitPercent;
+ int value;
+
+ if (strchr((char *)pAttr->children->content, '%'))
+ bUnitPercent = true;
+ else
+ bUnitPercent = false;
+
+ value = atoi((char *)pAttr->children->content);
+
+ if (cmd[ELEMENT_REGION]) {
+ pRegion->nTop.bUnitPercent = bUnitPercent;
+ pRegion->nTop.value = value;
+ }
+ }
+ break;
+
+ case ATTRIBUTE_LEFT:
+ {
+ int bUnitPercent;
+ int value;
+
+ if (strchr((char *)pAttr->children->content, '%'))
+ bUnitPercent = true;
+ else
+ bUnitPercent = false;
+
+ value = atoi((char *)pAttr->children->content);
+
+ if (cmd[ELEMENT_REGION]) {
+ pRegion->nLeft.bUnitPercent = bUnitPercent;
+ pRegion->nLeft.value = value;
+ }
+ }
+ break;
+
+
+ case ATTRIBUTE_WIDTH:
+ {
+ int bUnitPercent;
+ int value;
+
+ if (strchr((char *)pAttr->children->content, '%'))
+ bUnitPercent = true;
+ else
+ bUnitPercent = false;
+
+ value = atoi((char *)pAttr->children->content);
+
+ if (cmd[ELEMENT_ROOTLAYOUT]) {
+ rootlayout.width.bUnitPercent = bUnitPercent;
+ rootlayout.width.value = value;
+ } else if (cmd[ELEMENT_REGION]) {
+ pRegion->width.bUnitPercent = bUnitPercent;
+ pRegion->width.value = value;
+ }
+ }
+ break;
+
+ case ATTRIBUTE_HEIGHT:
+ {
+ int bUnitPercent;
+ int value;
+
+ if (strchr((char *)pAttr->children->content, '%'))
+ bUnitPercent = true;
+ else
+ bUnitPercent = false;
+
+ value = atoi((char *)pAttr->children->content);
+
+ if (cmd[ELEMENT_ROOTLAYOUT]) {
+ rootlayout.height.bUnitPercent = bUnitPercent;
+ rootlayout.height.value = value;
+ } else if (cmd[ELEMENT_REGION]) {
+ pRegion->height.bUnitPercent = bUnitPercent;
+ pRegion->height.value = value;
+ }
+ }
+ break;
+
+ case ATTRIBUTE_FIT:
+ if (cmd[ELEMENT_REGION]) {
+ if (!strcmp((char *)pAttr->children->content, "meet")) {
+ pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET;
+ } else {
+ pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN;
+ }
+ }
+ break;
+
+ case ATTRIBUTE_BGCOLOR:
+ if (cmd[ELEMENT_ROOTLAYOUT]) {
+ rootlayout.bBgColor = true;
+ rootlayout.bgColor = MmsSmilGetColorValue(pAttr->children->content);
+ } else if (cmd[ELEMENT_REGION]) {
+ pRegion->bBgColor = true;
+ pRegion->bgColor = MmsSmilGetColorValue(pAttr->children->content);
+ } else if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nBgColor = MmsSmilGetColorValue(pAttr->children->content);
+ else
+ pMedia->sMedia.sAVI.nBgColor = MmsSmilGetColorValue(pAttr->children->content);
+
+ break;
+
+ case ATTRIBUTE_DUR:
+ if (cmd[ELEMENT_PAR])
+ pPage->nDur = MmsSmilGetTime((char *)pAttr->children->content);
+ else if (cmd[ELEMENT_TRANSITION])
+ pTransition->nDur = MmsSmilGetTime((char *)pAttr->children->content);
+ else if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nDurTime = MmsSmilGetTime((char *)pAttr->children->content);
+ else
+ pMedia->sMedia.sAVI.nDurTime = MmsSmilGetTime((char *)pAttr->children->content);
+
+#ifdef MMS_SMIL_ANIMATE
+ if (cmd[ELEMENT_ANIMATE])
+ pMedia->sMedia.sAVI.nDur = MmsSmilGetTime((char *)pAttr->children->content);
+#endif
+ break;
+
+ case ATTRIBUTE_SRC:
+ {
+ char *szSrc;
+ char szContentID[MSG_MSG_ID_LEN + 1] = {0,};
+ int cLen;
+
+ szSrc = MsgChangeHexString((char *)pAttr->children->content);
+ if (szSrc == NULL)
+ break;
+
+ snprintf(szContentID, sizeof(szContentID), "%s", szSrc);
+ free(szSrc);
+
+ cLen = strlen(szContentID);
+ if (!strncasecmp(szContentID, "cid:", 4)) {
+ strncpy(pMedia->szContentID, szContentID + 4, cLen - 4);
+ pMedia->szContentID[cLen - 4] = '\0';
+ } else {
+ strncpy(pMedia->szContentID, szContentID, cLen);
+ pMedia->szContentID[cLen] = '\0';
+ }
+ break;
+ }
+ case ATTRIBUTE_COLOR:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nColor = MmsSmilGetColorValue(pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_SIZE:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nSize = atoi((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_BOLD:
+ if (cmd[ELEMENT_TEXT]) {
+ pMedia->sMedia.sText.bBold = MmsSmilGetFontAttrib((char *)pAttr->children->content);
+ }
+ break;
+
+ case ATTRIBUTE_UNDERLINE:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.bUnderLine = MmsSmilGetFontAttrib((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_ITALIC:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.bItalic = MmsSmilGetFontAttrib((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_REVERSE:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.bReverse = MmsSmilGetFontAttrib((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_DIRECTION:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nDirection = MmsSmilGetFontDirection((char *)pAttr->children->content);
+ break;
+ case ATTRIBUTE_REGION:
+ strncpy(pMedia->regionId, (char *)pAttr->children->content, MAX_SMIL_REGION_ID - 1);
+ break;
+
+ case ATTRIBUTE_TRANSIN:
+ if (cmd[ELEMENT_TEXT])
+ strncpy(pMedia->sMedia.sText.szTransInId, (char *)pAttr->children->content, MAX_SMIL_TRANSIN_ID - 1);
+ else
+ strncpy(pMedia->sMedia.sAVI.szTransInId, (char *)pAttr->children->content, MAX_SMIL_TRANSIN_ID - 1);
+ break;
+
+ case ATTRIBUTE_TRANSOUT:
+ if (cmd[ELEMENT_TEXT])
+ strncpy(pMedia->sMedia.sText.szTransOutId, (char *)pAttr->children->content, MAX_SMIL_TRANSOUT_ID - 1);
+ else
+ strncpy(pMedia->sMedia.sAVI.szTransOutId, (char *)pAttr->children->content, MAX_SMIL_TRANSOUT_ID - 1);
+ break;
+
+ case ATTRIBUTE_BEGIN:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nBegin = MmsSmilGetTime((char *)pAttr->children->content);
+ else
+ pMedia->sMedia.sAVI.nBegin = MmsSmilGetTime((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_END:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nEnd = MmsSmilGetTime((char *)pAttr->children->content);
+ else
+ pMedia->sMedia.sAVI.nEnd = MmsSmilGetTime((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_REPEAT_COUNT:
+ if (cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nRepeat = atoi((char *)pAttr->children->content);
+ else
+ pMedia->sMedia.sAVI.nRepeat = atoi((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_NAME:
+ if (!strcmp((char *)pAttr->children->content, "foreground-color") || !strcmp((char *)pAttr->children->content, "foregroundcolor"))
+ paramType = ATTRIBUTE_FGCOLOR;
+ else if (!strcmp((char *)pAttr->children->content, "background-color") || !strcmp((char *)pAttr->children->content, "backgroundcolor"))
+ paramType = ATTRIBUTE_BGCOLOR;
+ else if (!strcmp((char *)pAttr->children->content, "textsize"))
+ paramType = ATTRIBUTE_SIZE;
+ else if (!strcmp((char *)pAttr->children->content, "textattribute"))
+ paramType = ATTRIBUTE_TEXTFORMAT;
+
+ if (cmd[ELEMENT_META])
+ strncpy(pMeta->szName, (char *)pAttr->children->content, MAX_SMIL_META_NAME - 1);
+ break;
+
+ case ATTRIBUTE_VALUE:
+ if (paramType == ATTRIBUTE_SIZE && cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nSize = MmsSmilGetFontSizeValue((char *)pAttr->children->content);
+ else if (paramType == ATTRIBUTE_FGCOLOR && cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nColor = MmsSmilGetColorValue(pAttr->children->content);
+ else if (paramType == ATTRIBUTE_BGCOLOR && cmd[ELEMENT_TEXT])
+ pMedia->sMedia.sText.nBgColor = MmsSmilGetColorValue(pAttr->children->content);
+ else if (paramType == ATTRIBUTE_TEXTFORMAT && cmd[ELEMENT_TEXT]) {
+ MmsSmilFontType fontType;
+
+ fontType = MmsSmilGetFontTypeValue((char *)pAttr->children->content);
+
+ if (fontType == MMS_SMIL_FONT_TYPE_BOLD)
+ pMedia->sMedia.sText.bBold = true;
+ else
+ pMedia->sMedia.sText.bBold = false;
+
+ if (fontType == MMS_SMIL_FONT_TYPE_ITALIC)
+ pMedia->sMedia.sText.bItalic = true;
+ else
+ pMedia->sMedia.sText.bItalic = false;
+
+ if (fontType == MMS_SMIL_FONT_TYPE_UNDERLINE)
+ pMedia->sMedia.sText.bUnderLine = true;
+ else
+ pMedia->sMedia.sText.bUnderLine = false;
+ }
+ break;
+
+ case ATTRIBUTE_ALT:
+ strncpy(pMedia->szAlt, (char *)pAttr->children->content, MAX_SMIL_ALT_LEN - 1);
+ break;
+
+ case ATTRIBUTE_TYPE:
+ pTransition->nType = (MmsSmilTransType)atoi((char *)pAttr->children->content);
+
+ switch (pTransition->nType) {
+ case MMS_SMIL_TRANS_SLIDEWIPE:
+ pTransition->nSubType = MMS_SMIL_TRANS_SUB_FROM_LEFT;
+ break;
+ case MMS_SMIL_TRANS_BARWIPE:
+ pTransition->nSubType = MMS_SMIL_TRANS_SUB_TOP_TO_BOTTOM;
+ break;
+ case MMS_SMIL_TRANS_BARNDOORWIPE:
+ pTransition->nSubType = MMS_SMIL_TRANS_SUB_HORIZONTAL;
+ break;
+ default:
+ pTransition->nSubType = MMS_SMIL_TRANS_SUB_NONE;
+ break;
+ }
+
+ break;
+
+ case ATTRIBUTE_SUBTYPE:
+ pTransition->nSubType = (MmsSmilTransSubType)atoi((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_CONTENT:
+ strncpy(pMeta->szContent, (char *)pAttr->children->content, MAX_SMIL_META_CONTENT - 1);
+ break;
+#ifdef MMS_SMIL_ANIMATE
+ case ATTRIBUTE_ATTRIBUTE_NAME:
+ strcpy(pMedia->sMedia.sAVI.nAttributeName, (char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_ATTRIBUTE_TYPE:
+ strcpy(pMedia->sMedia.sAVI.nAttributeType, (char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_TARGET_ELEMENT:
+ strcpy(pMedia->sMedia.sAVI.nTargetElement, (char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_FROM:
+ pMedia->sMedia.sAVI.nFrom = atoi((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_TO:
+ pMedia->sMedia.sAVI.nTo = atoi((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_BY:
+ pMedia->sMedia.sAVI.nBy = atoi((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_VALUES:
+ pMedia->sMedia.sAVI.nValues = atoi((char *)pAttr->children->content);
+ break;
+
+ case ATTRIBUTE_CALCMODE:
+ strcpy(pMedia->sMedia.sAVI.nCalcMode, (char *)pAttr->children->content);
+ break;
+#endif
+ default:
+ MSG_DEBUG("Undefined Attribute was found!!!!!");
+ }
+ }
+
+ if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_REGION]) {
+ // Insert a region to region list
+ _MsgMmsAddRegion(pMmsMsg, pRegion);
+ } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_PAR]) {
+ //Insert a page to page list
+ _MsgMmsAddPage(pMmsMsg, pPage);
+ } else if (paramType == ATTRIBUTE_UNKNOWN && (cmd[ELEMENT_TEXT] ||cmd[ELEMENT_IMG] ||cmd[ELEMENT_AUDIO] ||cmd[ELEMENT_VIDEO] ||cmd[ELEMENT_ANIMATE] || cmd[ELEMENT_REF])) {
+ //Insert a media to media list
+ _MsgMmsAddMedia(pPage, pMedia);
+ } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_ROOTLAYOUT]) {
+ _MsgMmsSetRootLayout(pMmsMsg, &rootlayout);
+ } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_TRANSITION]) {
+ //Insert a transition to transition list
+ _MsgMmsAddTransition(pMmsMsg, pTransition);
+ } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_META]) {
+ //Insert a meta to meta list
+ _MsgMmsAddMeta(pMmsMsg, pMeta);
+ }
+
+ paramType = ATTRIBUTE_UNKNOWN;
+ }
+
+ MmsSmilGetElementOnlyLayout(pMmsMsg, cur_node->children);
+ }
+
+ MSG_END();
+}
+
+bool MmsSmilParseSmilDocOnlyLayout(MMS_MESSAGE_DATA_S *pMmsMsg, char *pSmilDoc)
+{
+ xmlDocPtr doc;
+ xmlNodePtr cur;
+ MSG_DEBUG("%s", pSmilDoc);
+ doc = xmlParseMemory(pSmilDoc, strlen(pSmilDoc));
+
+ if (doc == NULL) {
+ MSG_DEBUG("Document not parsed successfully. \n");
+ return false;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+
+ if (cur == NULL) {
+ MSG_DEBUG("empty document\n");
+ xmlFreeDoc(doc);
+ return false;
+ }
+
+ if (xmlStrcmp(cur->name, (const xmlChar *) "smil")) {
+ MSG_DEBUG("document of the wrong type, root node != smil");
+ xmlFreeDoc(doc);
+ return false;
+ }
+
+ MmsSmilGetElementOnlyLayout(pMmsMsg, cur);
+
+ xmlFreeDoc(doc);
+
+ return true;
+}
#include "MmsPluginMessage.h"
#include "MmsPluginSmil.h"
#include "MmsPluginDrm.h"
-
-static void __MmsReleaseMmsLists(MMS_MESSAGE_DATA_S *mms_data)
-{
- _MsgMmsReleasePageList(mms_data);
- _MsgMmsReleaseRegionList(mms_data);
- _MsgMmsReleaseAttachList(mms_data);
- _MsgMmsReleaseTransitionList(mms_data);
- _MsgMmsReleaseMetaList(mms_data);
-}
-
+#include "MmsPluginMIME.h"
/*==================================================================================================
IMPLEMENTATION OF SmsPluginStorage - Member Functions
*pMmsMsg = &mmsMsg;
}
-
+#if 0 //Unused code
void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData)
{
MSG_BEGIN();
bzero(&mmsMsgData,sizeof(MMS_MESSAGE_DATA_S));
if (mmsHeader.msgType.type == MIME_MULTIPART_RELATED || mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) {
char *pSmilDoc;
- MmsMsg *pMsg = NULL;
char szFileName[MSG_FILENAME_LEN_MAX] = {0, };
mmsMsgData.regionCnt = 0;
memset(mmsMsgData.szSmilFilePath, 0, MSG_FILEPATH_LEN_MAX);
pSmilDoc = MmsSmilGetPresentationData(pMsgInfo->msgId);
- MmsSmilParseSmilDoc(&mmsMsgData, pSmilDoc);
- MmsPluginStorage::instance()->getMmsMessage(&pMsg);
- strcpy(szFileName, pMsg->szFileName);
+ if (pSmilDoc) {
+ MmsSmilParseSmilDoc(&mmsMsgData, pSmilDoc);
- err = pStorage->getMsgText(&mmsMsgData, pMsgInfo->msgText);
- MmsMakePreviewInfo(pMsgInfo->msgId, &mmsMsgData);
- __MmsReleaseMmsLists(&mmsMsgData);
+ MmsPluginStorage::instance()->getMmsMessage(&pMsg);
+ strcpy(szFileName, pMsg->szFileName);
+
+ err = pStorage->getMsgText(&mmsMsgData, pMsgInfo->msgText);
+ MmsMakePreviewInfo(pMsgInfo->msgId, &mmsMsgData);
+ }
+
+ MsgMmsReleaseMmsLists(&mmsMsgData);
}
if (addMmsMsgToDB(pMsg, pMsgInfo) != MSG_SUCCESS) {
MSG_END();
}
-
+#endif
void MmsPluginStorage::composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo)
{
return MSG_SUCCESS;
}
-msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg)
+msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_filepath)
{
MSG_BEGIN();
- msg_error_t err = MSG_SUCCESS;
+ char sqlQuery[MAX_QUERY_LEN + 1];
+ // Add Message
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d, %d, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);",
+ MMS_PLUGIN_MESSAGE_TABLE_NAME, pMmsMsg->msgID, pMmsMsg->szTrID, pMmsMsg->szMsgID, pMmsMsg->szForwardMsgID, pMmsMsg->szContentLocation,
+ raw_filepath, pMmsMsg->mmsAttrib.version, pMmsMsg->mmsAttrib.dataType, pMmsMsg->mmsAttrib.date, pMmsMsg->mmsAttrib.bHideAddress,
+ pMmsMsg->mmsAttrib.bAskDeliveryReport, pMmsMsg->mmsAttrib.bReportAllowed, pMmsMsg->mmsAttrib.readReportAllowedType,
+ pMmsMsg->mmsAttrib.bAskReadReply, pMmsMsg->mmsAttrib.bRead, pMmsMsg->mmsAttrib.readReportSendStatus, pMmsMsg->mmsAttrib.bReadReportSent,
+ pMmsMsg->mmsAttrib.priority, pMmsMsg->mmsAttrib.bLeaveCopy, pMmsMsg->mmsAttrib.msgSize, pMmsMsg->mmsAttrib.msgClass,
+ pMmsMsg->mmsAttrib.expiryTime.time, pMmsMsg->mmsAttrib.bUseDeliveryCustomTime, pMmsMsg->mmsAttrib.deliveryTime.time, pMmsMsg->mmsAttrib.msgStatus);
+
+ MSG_DEBUG("\n!!!!!!!!! QUERY : %s\n", sqlQuery);
+
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
+ return MSG_ERR_DB_EXEC;
+
+ MSG_END();
+
+ return MSG_SUCCESS;
+}
+#if 0
+msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pDestMsg)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+ MMS_MESSAGE_DATA_S tempMmsMsg = {0,};
+ MMS_MESSAGE_DATA_S *pMmsMsg = &tempMmsMsg;
int partCnt = 0;
- size_t nSize = 0;
+ unsigned int nSize = 0;
MsgType partHeader;
MmsAttrib pMmsAttrib;
*pDestMsg = _MsgMmsSerializeMessageData(pMmsMsg, &nSize);
- __MmsReleaseMmsLists(pMmsMsg);
+ MsgMmsReleaseMmsLists(pMmsMsg);
MmsMsg *pStoMmsMsg;
MmsReleaseMsgBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
pMsg->dataSize = nSize;
-
MSG_END();
return err;
FREE_CATCH:
if (bMultipartRelated) {
- __MmsReleaseMmsLists(pMmsMsg);
+ MsgMmsReleaseMmsLists(pMmsMsg);
}
L_CATCH:
return MSG_ERR_STORAGE_ERROR;
}
}
-
+#endif
msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData)
{
MSG_BEGIN();
msg_error_t err = MSG_SUCCESS;
-
- MmsMsg mmsMsg;
- bzero(&mmsMsg, sizeof(mmsMsg));
-
- char filePath[MAX_FULL_PATH_SIZE+1] = {0, };
char sqlQuery[MAX_QUERY_LEN + 1];
+ MmsMsg mmsMsg;
+ MMS_MESSAGE_DATA_S mmsMsgData = {0,};
+ char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
- FILE *pFile = NULL;
+ bzero(&mmsMsg, sizeof(mmsMsg));
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, KEEP_COPY = %d, ASK_READ_REPLY = %d, EXPIRY_TIME = %d, CUSTOM_DELIVERY_TIME = %d, DELIVERY_TIME= %d, PRIORITY = %d \
if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_EXEC;
- MMS_MESSAGE_DATA_S mmsMsgData;
-
- if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
- __MmsReleaseMmsLists(&mmsMsgData);
+ if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS) {
- THROW(MsgException::MMS_PLG_ERROR, "MMS Message Compose Error");
- }
+ if (_MsgMmsDeserializeMessageData(&mmsMsgData, pFileData) == false) {
+ MSG_DEBUG("Fail to Deserialize Message Data");
+ THROW(MsgException::MMS_PLG_ERROR, "MMS Message Compose Error");
+ }
- snprintf(filePath, MAX_FULL_PATH_SIZE+1, MSG_DATA_PATH"%d", mmsMsg.msgID);
+ if (MmsComposeSendReq(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData) != true) {
+ MmsReleaseMmsMsg(&mmsMsg);
+ MsgMmsReleaseMmsLists(&mmsMsgData);
+ THROW(MsgException::MMS_PLG_ERROR, "MMS Message MmsComposeSendReq Error");
+ }
- pFile = MsgOpenMMSFile(filePath);
+ //mms file
+ snprintf(raw_filepath, sizeof(raw_filepath), MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
- if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
- __MmsReleaseMmsLists(&mmsMsgData);
- MsgCloseFile(pFile);
+ //encode mms
+ if (MmsEncodeMmsMessage(&mmsMsg, raw_filepath) == false) {
+ MSG_DEBUG("Fail to Encode Message");
+ MmsReleaseMmsMsg(&mmsMsg);
+ MsgMmsReleaseMmsLists(&mmsMsgData);
+ THROW(MsgException::MMS_PLG_ERROR, "MMS Message Encode Error");
+ }
- THROW(MsgException::MMS_PLG_ERROR, "MMS Message Encode Send Req Error");
- }
+ //preview data
+ err = MmsMakePreviewInfo(pMsgInfo->msgId, &mmsMsgData);
- MsgCloseFile(pFile);
+ err = getMsgText(&mmsMsgData, pMsgInfo->msgText);
- int size = 0;
- bzero(filePath, sizeof(filePath));
- snprintf((char *)filePath, MAX_FULL_PATH_SIZE+1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
- if (MsgGetFileSize(filePath, &size) == false) {
- THROW(MsgException::MMS_PLG_ERROR, "MMS Message MsgGetFileSize Error");
- }
+ if (mmsMsgData.attachCnt > 0) {
+ if (updateMmsAttachCount(mmsMsg.msgID, mmsMsgData.attachCnt) != MSG_SUCCESS) {
+ MSG_DEBUG("Fail to updateMmsAttachCount");
+ }
+ }
- pMsgInfo->dataSize = size;
+ int size = 0;
+ if (MsgGetFileSize(raw_filepath, &size) == false) {
+ MmsReleaseMmsMsg(&mmsMsg);
+ MsgMmsReleaseMmsLists(&mmsMsgData);
+ THROW(MsgException::MMS_PLG_ERROR, "MMS Message MsgGetFileSize Error");
+ }
- MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
+ pMsgInfo->dataSize = size;
+ }
- __MmsReleaseMmsLists(&mmsMsgData);
+ MmsReleaseMmsMsg(&mmsMsg);
+ MsgMmsReleaseMmsLists(&mmsMsgData);
MSG_END();
return MSG_SUCCESS;
}
+void MmsPluginStorage::getMmsFromDB(msg_message_id_t msgId, MmsMsg *pMmsMsg)
+{
+ char sqlQuery[MAX_QUERY_LEN + 1];
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT VERSION, DATA_TYPE, DATE, HIDE_ADDRESS, ASK_DELIVERY_REPORT, REPORT_ALLOWED, \
+ READ_REPORT_ALLOWED_TYPE, ASK_READ_REPLY, READ, READ_REPORT_SEND_STATUS, READ_REPORT_SENT, PRIORITY, \
+ MSG_SIZE, MSG_CLASS, EXPIRY_TIME, CUSTOM_DELIVERY_TIME, DELIVERY_TIME, MSG_STATUS, \
+ MESSAGE_ID, TRANSACTION_ID, CONTENTS_LOCATION, FILE_PATH \
+ FROM %s WHERE MSG_ID = %d;",
+ MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId);
+
+ if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS)
+ MSG_DEBUG("MSG_ERR_DB_PREPARE");
+
+ if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
+ int i = 0;
+ pMmsMsg->mmsAttrib.version = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.dataType = (MmsDataType)dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.date = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.bHideAddress = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.bAskDeliveryReport = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.bReportAllowed = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.readReportAllowedType = (MmsRecvReadReportType)dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.bAskReadReply = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.bRead = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.readReportSendStatus = (MmsRecvReadReportSendStatus)dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.bReadReportSent = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.priority = (MmsPriority)dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.msgSize = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.expiryTime.time = dbHandle.columnInt(i++);
+ i++;//CUSTOM_DELIVERY_TIME
+ pMmsMsg->mmsAttrib.deliveryTime.time = dbHandle.columnInt(i++);
+ pMmsMsg->mmsAttrib.msgStatus = (msg_delivery_report_status_t)dbHandle.columnInt(i++);
+ snprintf(pMmsMsg->szMsgID, sizeof(pMmsMsg->szMsgID), "%s", dbHandle.columnText(i++));
+ snprintf(pMmsMsg->szTrID, sizeof(pMmsMsg->szTrID), "%s", dbHandle.columnText(i++));
+ snprintf(pMmsMsg->szContentLocation, sizeof(pMmsMsg->szContentLocation), "%s", dbHandle.columnText(i++));
+ snprintf(pMmsMsg->szFileName, sizeof(pMmsMsg->szFileName), "%s", dbHandle.columnText(i++));
+ }
+
+
+ dbHandle.finalizeQuery();
+}
+
void MmsPluginStorage::getMmsAttrib(msg_message_id_t msgId, MmsMsg *pMmsMsg)
{
char sqlQuery[MAX_QUERY_LEN + 1];
msg_error_t MmsPluginStorage::removePreviewInfo(int msgId)
{
char sqlQuery[MAX_QUERY_LEN + 1];
- char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
+ char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,};
// remove thumbnail file
memset(sqlQuery, 0x00, sizeof(sqlQuery));
return MSG_SUCCESS;
}
+
+msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
+{
+ char sqlQuery[MAX_QUERY_LEN + 1];
+ char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,};
+ char dirPath[MSG_FILEPATH_LEN_MAX + 1]= {0,};
+
+ //remove DB Preview
+ removePreviewInfo(msgId);
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID = %d;",
+ MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId);
+
+ if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_PREPARE;
+ }
+
+ if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
+ strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX);
+
+ snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath);
+
+ //delete pdu file
+ if (remove(filePath) == -1)
+ MSG_DEBUG("Fail to delete file [%s]", filePath);
+ else
+ MSG_DEBUG("Success to delete file [%s]", filePath);
+
+ //delete multipart files
+ MsgRmRf(dirPath);
+
+ //delete multipart dir
+ rmdir(dirPath);
+
+ } else {
+ MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery);
+ dbHandle.finalizeQuery();
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_STEP;
+ }
+
+ dbHandle.finalizeQuery();
+
+
+ // Delete Data from MMS table
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
+ MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId);
+
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ // Delete Data from MMS STATUS table
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
+ MSGFW_REPORT_TABLE_NAME, msgId);
+
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ return MSG_SUCCESS;
+}
+
+msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pDestMsg)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+ MMS_MESSAGE_DATA_S tempMmsMsgData = {0,};
+ MMS_MESSAGE_DATA_S *pMmsMsg = &tempMmsMsgData;
+
+ unsigned int nSize = 0;
+ bool bMultipartRelated = false;
+
+ bzero(pMmsMsg, sizeof(pMmsMsg));
+ pMmsMsg->regionCnt = 0;
+ pMmsMsg->pageCnt = 0;
+ pMmsMsg->attachCnt = 0;
+ pMmsMsg->transitionCnt = 0;
+ pMmsMsg->metaCnt = 0;
+ memset(pMmsMsg->szSmilFilePath, 0, MSG_FILEPATH_LEN_MAX);
+
+ MmsMsg tempMmsMsg;
+ memset(&tempMmsMsg, 0x00, sizeof(MmsMsg));
+
+ getMmsFromDB(pMsg->msgId, &tempMmsMsg);
+
+ snprintf(pMmsMsg->header.contentLocation, MSG_MSG_ID_LEN, "%s", tempMmsMsg.szContentLocation);
+ pMmsMsg->header.mmsVersion = tempMmsMsg.mmsAttrib.version;
+ pMmsMsg->header.messageClass = tempMmsMsg.mmsAttrib.msgClass;
+ pMmsMsg->header.mmsPriority = tempMmsMsg.mmsAttrib.priority;
+ snprintf(pMmsMsg->header.messageID, MSG_MSG_ID_LEN, "%s", tempMmsMsg.szMsgID);
+ snprintf(pMmsMsg->header.trID, MSG_MSG_ID_LEN, "%s", tempMmsMsg.szTrID);
+
+ if (pSendOptInfo != NULL) {
+
+ pSendOptInfo->bDeliverReq = tempMmsMsg.mmsAttrib.bAskDeliveryReport;
+ MSG_DEBUG("## delivery = %d ##", pSendOptInfo->bDeliverReq);
+
+ pSendOptInfo->bKeepCopy = tempMmsMsg.mmsAttrib.bLeaveCopy;
+ MSG_DEBUG("## bKeepCopy = %d ##", pSendOptInfo->bKeepCopy);
+
+ pSendOptInfo->option.mmsSendOptInfo.bReadReq = tempMmsMsg.mmsAttrib.bAskReadReply;
+ MSG_DEBUG("## bReadReq = %d ##", pSendOptInfo->option.mmsSendOptInfo.bReadReq);
+
+ pSendOptInfo->option.mmsSendOptInfo.priority = tempMmsMsg.mmsAttrib.priority;
+ MSG_DEBUG("## priority = %d ##", pSendOptInfo->option.mmsSendOptInfo.priority);
+
+ pSendOptInfo->option.mmsSendOptInfo.expiryTime.time = tempMmsMsg.mmsAttrib.expiryTime.time;
+ MSG_DEBUG("## expiryTime = %d ##", pSendOptInfo->option.mmsSendOptInfo.expiryTime.time);
+
+ pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time = tempMmsMsg.mmsAttrib.deliveryTime.time;
+ MSG_DEBUG("## deliveryTime = %d ##", pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time);
+ }
+
+ switch(pMsg->msgType.subType) {
+ case MSG_SENDREQ_MMS:
+ case MSG_SENDCONF_MMS:
+ case MSG_RETRIEVE_MMS:
+ case MSG_RETRIEVE_AUTOCONF_MMS:
+ case MSG_RETRIEVE_MANUALCONF_MMS:
+ {
+ if (MmsReadMsgBody(pMsg->msgId, true, false, NULL) == false) {
+ MSG_DEBUG("Fail to MmsReadMsgBody");
+ goto FREE_CATCH;
+ }
+
+ //header value
+ snprintf(pMmsMsg->header.szContentType, MSG_MSG_ID_LEN, "%s", MimeGetMimeStringFromMimeInt(mmsMsg.msgType.type));
+ pMmsMsg->header.contentType = mmsMsg.msgType.type;
+ pMmsMsg->header.messageType = mmsMsg.mmsAttrib.msgType;
+
+ //body value
+ if (MmsMakeMmsData(&mmsMsg, pMmsMsg) == false) {
+ MSG_DEBUG("Fail to makeMmsMessageData");
+ goto FREE_CATCH;
+ }
+ }
+ break;
+
+ case MSG_NOTIFICATIONIND_MMS:
+ pMmsMsg->header.messageType = MMS_MSGTYPE_NOTIFICATION_IND;
+
+ break;
+ default:
+
+ break;
+ }
+
+
+
+ *pDestMsg = _MsgMmsSerializeMessageData(pMmsMsg, &nSize);
+
+ MsgMmsReleaseMmsLists(pMmsMsg);
+
+
+ MmsMsg *pStoMmsMsg;
+ MmsPluginStorage::instance()->getMmsMessage(&pStoMmsMsg);
+ MmsInitHeader();
+ MmsUnregisterDecodeBuffer();
+#ifdef __SUPPORT_DRM__
+ MmsReleaseMsgDRMInfo(&pStoMmsMsg->msgType.drmInfo);
+#endif
+ MmsReleaseMsgBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
+
+ pMsg->dataSize = nSize;
+ MSG_END();
+
+ return err;
+
+FREE_CATCH:
+ if (bMultipartRelated) {
+ MsgMmsReleaseMmsLists(pMmsMsg);
+ }
+
+L_CATCH:
+ MSG_DEBUG("MmsPlgUpdateMessage : Update MMS Message Failed");
+ MSG_END();
+ {
+ MmsMsg *pMsg;
+ MmsPluginStorage::instance()->getMmsMessage(&pMsg);
+ MmsInitHeader();
+
+ MmsUnregisterDecodeBuffer();
+#ifdef __SUPPORT_DRM__
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
+#endif
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
+
+ return MSG_ERR_STORAGE_ERROR;
+ }
+}
+
+void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData)
+{
+ MSG_BEGIN();
+
+ msg_error_t err;
+ char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
+ MmsMsg mmsMsg;
+ MMS_MESSAGE_DATA_S mmsMsgData;
+
+ bzero(&mmsMsgData, sizeof(MMS_MESSAGE_DATA_S));
+ bzero(&mmsMsg, sizeof(mmsMsg));
+
+ if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS) {
+
+ if (_MsgMmsDeserializeMessageData(&mmsMsgData, pFileData) == false) {
+ MSG_DEBUG("Fail to Deserialize Message Data");
+ goto __CATCH;
+ }
+
+ if (MmsComposeSendReq(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData) != true) {
+ MSG_DEBUG("Fail to Compose Backup Message");
+ goto __CATCH;
+ }
+
+ //mms file
+ snprintf(raw_filepath, sizeof(raw_filepath), MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
+
+ //encode mms
+ if (MmsEncodeMmsMessage(&mmsMsg, raw_filepath) == false) {
+ MSG_DEBUG("Fail to Encode Message");
+ goto __CATCH;
+ }
+
+ //add to db
+ if (addMmsMsgToDB(&mmsMsg, raw_filepath) != MSG_SUCCESS) {
+ MSG_DEBUG("Fail to add db message");
+ goto __CATCH;
+ }
+
+ //preview data
+ err = MmsMakePreviewInfo(pMsgInfo->msgId, &mmsMsgData);
+ err = getMsgText(&mmsMsgData, pMsgInfo->msgText);
+
+ if (mmsMsgData.attachCnt > 0) {
+ if (updateMmsAttachCount(mmsMsg.msgID, mmsMsgData.attachCnt) != MSG_SUCCESS) {
+ MSG_DEBUG("Fail to updateMmsAttachCount");
+ goto __CATCH;
+ }
+ }
+
+ if (MsgGetFileSize(raw_filepath, (int *)&pMsgInfo->dataSize) == false) {
+ MSG_DEBUG("Fail to get mms file size [%s]", raw_filepath);
+ goto __CATCH;
+ }
+
+ MmsReleaseMmsMsg(&mmsMsg);
+ MsgMmsReleaseMmsLists(&mmsMsgData);
+ } else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) {
+
+ MmsComposeNotiMessage(&mmsMsg, pMsgInfo->msgId);
+
+ //add to db
+ if (addMmsMsgToDB(&mmsMsg, "") != MSG_SUCCESS) {
+ MSG_DEBUG("Fail to add db message");
+ goto __CATCH;
+ }
+
+ MmsReleaseMmsMsg(&mmsMsg);
+ } else if (pMsgInfo->msgType.subType == MSG_SENDCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS) {
+ MmsMsg *pMsg = NULL;
+ char szTemp[MAX_MSG_DATA_LEN + 1]= {0, };
+
+ if (!MmsReadMsgBody(pMsgInfo->msgId, true, true, pFileData))
+ THROW(MsgException::MMS_PLG_ERROR, "_MmsReadMsgBody Error");
+
+ MmsPluginStorage::instance()->getMmsMessage(&pMsg);
+
+ if (pMsgInfo->msgType.subType == MSG_SENDCONF_MMS)
+ pMsgInfo->networkStatus = MSG_NETWORK_SEND_SUCCESS;
+ else
+ pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_SUCCESS;
+ strcpy(szTemp,pMsgInfo->msgData);
+ memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1);
+ strncpy(pMsgInfo->msgData, pFileData, MAX_MSG_DATA_LEN);
+
+ MmsPluginStorage *pStorage = MmsPluginStorage::instance();
+
+ MMS_MESSAGE_DATA_S mmsMsgData;
+ bzero(&mmsMsgData,sizeof(MMS_MESSAGE_DATA_S));
+ if (mmsHeader.msgType.type == MIME_MULTIPART_RELATED || mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) {
+ char *pSmilDoc;
+ char szFileName[MSG_FILENAME_LEN_MAX] = {0, };
+
+ mmsMsgData.regionCnt = 0;
+ mmsMsgData.pageCnt = 0;
+ mmsMsgData.attachCnt = 0;
+ mmsMsgData.transitionCnt = 0;
+ mmsMsgData.metaCnt = 0;
+ memset(mmsMsgData.szSmilFilePath, 0, MSG_FILEPATH_LEN_MAX);
+
+ pSmilDoc = MmsSmilGetPresentationData(pMsgInfo->msgId);
+ if (pSmilDoc) {
+ MmsSmilParseSmilDoc(&mmsMsgData, pSmilDoc);
+
+ MmsPluginStorage::instance()->getMmsMessage(&pMsg);
+ strcpy(szFileName, pMsg->szFileName);
+
+ err = pStorage->getMsgText(&mmsMsgData, pMsgInfo->msgText);
+ MmsMakePreviewInfo(pMsgInfo->msgId, &mmsMsgData);
+ }
+
+ MsgMmsReleaseMmsLists(&mmsMsgData);
+ }
+
+ if (addMmsMsgToDB(pMsg, pMsgInfo) != MSG_SUCCESS) {
+ 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);
+
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+
+ } else {
+ MSG_DEBUG("Not support msg sub type [%d]", pMsgInfo->msgType.subType);
+ goto __CATCH;
+ }
+
+ MSG_END();
+ return;
+
+__CATCH:
+
+ removePreviewInfo(pMsgInfo->msgId);
+ MmsReleaseMmsMsg(&mmsMsg);
+ MsgMmsReleaseMmsLists(&mmsMsgData);
+
+ THROW(MsgException::MMS_PLG_ERROR, "MMS add Error");
+}
int err = -1;
err = thumbnail_request_save_to_file(srcPath, MEDIA_THUMB_LARGE, dstPath);
if (err < 0) {
- MSG_DEBUG("Make thumbnail: failed");
+ MSG_DEBUG("Make thumbnail: failed, err = %d", err);
return false;
}
return pFile;
}
+
+void removeLessGreaterMark(const char *szSrcID, char *szDest, int destSize)
+{
+ char szBuf[MSG_MSG_ID_LEN + 1] = {0, };
+ int cLen = strlen(szSrcID);
+
+ if (cLen > 1 && szSrcID[0] == '<' && szSrcID[cLen - 1] == '>') {
+ strncpy(szBuf, &szSrcID[1], cLen - 2);
+ szBuf[cLen - 2] = '\0';
+ } else if (cLen > 1 && szSrcID[0] == '"' && szSrcID[cLen-1] == '"') {
+ strncpy(szBuf, &szSrcID[1], cLen - 2);
+ szBuf[cLen - 2] = '\0';
+ } else {
+ strncpy(szBuf, szSrcID, cLen);
+ szBuf[cLen] = '\0';
+ }
+
+ snprintf(szDest, destSize, "%s", szBuf);
+}
typedef struct _MMS_ATTRIB_S {
MimeType contentType;
+ MmsMsgType msgType;
MmsDataType dataType;
UINT32 date;
UINT8 version;
/* Decoding */
void MmsInitHeader();
+void MmsReleaseHeader(MmsHeader *mms);
void MmsRegisterDecodeBuffer();
void MmsUnregisterDecodeBuffer(void);
bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength);
msg_error_t MmsUpdateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
-msg_error_t MmsGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg);
+msg_error_t MmsGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg);
msg_error_t MmsUpdateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo);
msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvdBodyLen, char *filePath);
+msg_error_t MmsDeleteMessage(msg_message_id_t msgId);
+
#ifdef __cplusplus
}
#endif
#include "MmsPluginTypes.h"
#include "MmsPluginCodec.h"
-bool MmsSetMsgAddressList(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S *pMsgInfo);
-char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType);
-bool MmsGetMsgBodyfromMsgInfo(const MSG_MESSAGE_INFO_S *pMsgInfo, MMS_MESSAGE_DATA_S *pMsgBody, char *pFileData);
-bool MmsGetSmilRawData(MMS_MESSAGE_DATA_S *pMsgBody, char *pRawData, int *nSize);
-bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, char *pData, int size);
-bool MmsInsertPartFromFile(MmsMsg *pMsg, char *szTitleName, char *szOrgFilePath, char *szContentID);
-bool MmsGetTypeByFileName(int *type, char *szFileName);
-MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, void *pData, int offset, int size, char *szContentID);
+MsgMultipart *MmsAllocMultipart(void);
+MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, char *szContentID, char *szContentLocation);
bool MmsIsMultipart(int type);
bool MmsIsText(int type);
bool MmsIsVitemContent(int type, char *pszName);
-MsgMultipart *MmsAllocMultipart(void);
bool MmsComposeMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMsgData, char *pFileData);
void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID);
void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t selectedMsgId);
-int MmsSearchMsgId(char *toNumber, char *szMsgID);
+bool MmsComposeSendReq(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMsgData);
+
+
+bool MmsEncodeMmsMessage(MmsMsg *pMmsMsg, const char *raw_filepath);
+
+bool MmsMakeMmsData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg);
+
bool MmsCheckAdditionalMedia(MMS_MESSAGE_DATA_S *pMsgData, MsgType *partHeader);
+
bool MmsRemovePims(MMS_MESSAGE_DATA_S *pMsgData);
msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg);
+
void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg);
+int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo);
#endif //MMS_PLUGIN_MESSAGE_H
*/
xmlNodePtr UtilxmlStringGetNodeList(xmlNodePtr pstNode, char *pszName);
+
+bool MmsSmilParseSmilDocOnlyLayout(MMS_MESSAGE_DATA_S *pMmsMsg, char *pSmilDoc);
+
+
#endif//MMS_PLUGIN_SMIL_H
msg_error_t removePreviewInfo(int msgId);
msg_error_t setReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus);
- msg_error_t plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg);
+ msg_error_t plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pDestMsg);
msg_error_t getContentLocation(MSG_MESSAGE_INFO_S *pMsgInfo);
msg_error_t getMmsRawFilePath(msg_message_id_t msgId, char *pFilepath);
msg_error_t getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsgText);
+ msg_error_t deleteMmsMessage(int msgId);
+
+ void getMmsFromDB(msg_message_id_t msgId, MmsMsg *pMmsMsg);
+
+
+
private:
msg_error_t addMmsMsgToDB(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, int attachCnt = 0);
-
+ msg_error_t addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_filepath);
static MmsPluginStorage *pInstance;
MsgDbHandler dbHandle;
int MsgStrlen(char *pStr);
bool MsgConvertCharToHex(char pSrc, char *pDest);
FILE *MmsFileOpen(char *pFileName);
+void removeLessGreaterMark(const char *szSrcID, char *szDest, int destSize);
#endif //MMS_PLUGIN_UTIL_H
static void MsgTapiInitCB(keynode_t *key, void* data)
{
MSG_DEBUG("MsgTapiInitCB is called.");
- mx.lock();
- cv.signal();
- mx.unlock();
+
+ bool bTelRdy = false;
+ bTelRdy = vconf_keynode_get_bool(key);
+
+ MSG_DEBUG("bTelRdy [%d]", bTelRdy);
+
+ if (bTelRdy) {
+ mx.lock();
+ cv.signal();
+ mx.unlock();
+ }
}
msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
if (MsgSettingSetInt(MSG_SIM_CHANGED, MSG_SIM_STATUS_NOT_FOUND) != MSG_SUCCESS)
MSG_DEBUG("MsgSettingSetInt is failed!!");
- bool bReady;
+ bool bReady = false;
MsgSettingGetBool(VCONFKEY_TELEPHONY_READY, &bReady);
MSG_DEBUG("Get VCONFKEY_TELEPHONY_READY [%d].", bReady);
if (ret != ETIMEDOUT) {
pTapiHandle = tel_init(NULL);
SmsPluginCallback::instance()->registerEvent();
+ } else {
+ MSG_DEBUG("MsgTapiInitCB is time out.");
}
}
catch (MsgException& e)
MSG_DEBUG("segment size : [%d], pData->segCount : [%d]", segSize, pData->segCount);
if (pData->segCount > MAX_SEGMENT_NUM)
- THROW(MsgException::SMS_PLG_ERROR, "Segment Count is over maximum : %d", pData->segCount);
+ THROW(MsgException::SMS_PLG_ERROR, "Segment Count is over maximum : %d", pData->segCount);
int headerCnt = 0;
if (CodingScheme == SMS_CHARSET_7BIT)
{
- if (((DataLen+headerSize)/maxSize) >= 1)
+ if ((DataLen+headerSize) > maxSize)
segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7;
else
segSize = DataLen;
}
else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
{
- if (((DataLen+headerSize)/maxSize) >= 1)
+ if ((DataLen+headerSize) > maxSize)
segSize = 140 - (headerLen + concat + headerSize);
else
segSize = DataLen;
#include <stdio.h>
#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <time.h>
-#include <stdlib.h>
+#include <glib.h>
#include "MsgTypes.h"
#include "MsgMmsTypes.h"
#include "MsgMmsMessage.h"
#include "MsgDebug.h"
-#include "MsgUtilFile.h"
-#include "MsgStorageTypes.h"
-#include "MsgInternalTypes.h"
-
-
-MMS_SMIL_ROOTLAYOUT rootlayout;
static void __release_glist_element(gpointer data, gpointer user_data);
static void __release_page_element(gpointer data, gpointer user_data);
+static msg_error_t __releasePageList(MMS_MESSAGE_DATA_S *pMsgData);
+static msg_error_t __releaseRegionList(MMS_MESSAGE_DATA_S *pMsgData);
+static msg_error_t __releaseAttachList(MMS_MESSAGE_DATA_S *pMsgData);
+static msg_error_t __releaseTransitionList(MMS_MESSAGE_DATA_S *pMsgData);
+static msg_error_t __releaseMetaList(MMS_MESSAGE_DATA_S *pMsgData);
-static void __release_glist_element(gpointer data, gpointer user_data)
+void __release_glist_element(gpointer data, gpointer user_data)
{
if(data != NULL) {
free(data);
}
}
-static void __release_page_element(gpointer data, gpointer user_data)
+void __release_page_element(gpointer data, gpointer user_data)
{
if(data != NULL) {
MMS_PAGE_S *page = (MMS_PAGE_S *)data;
}
}
-msg_error_t _MsgMmsReleasePageList(MMS_MESSAGE_DATA_S *pMsgData)
+msg_error_t __releasePageList(MMS_MESSAGE_DATA_S *pMsgData)
{
if (pMsgData == NULL) {
MSG_DEBUG("pMsgData is NULL");
return MSG_SUCCESS;
}
-msg_error_t _MsgMmsReleaseRegionList(MMS_MESSAGE_DATA_S *pMsgData)
+msg_error_t __releaseRegionList(MMS_MESSAGE_DATA_S *pMsgData)
{
if (pMsgData == NULL) {
MSG_DEBUG("pMsgData is NULL");
return MSG_SUCCESS;
}
-msg_error_t _MsgMmsReleaseAttachList(MMS_MESSAGE_DATA_S *pMsgData)
+msg_error_t __releaseAttachList(MMS_MESSAGE_DATA_S *pMsgData)
{
if (pMsgData == NULL) {
MSG_DEBUG("pMsgData is NULL");
return MSG_SUCCESS;
}
-msg_error_t _MsgMmsReleaseTransitionList(MMS_MESSAGE_DATA_S *pMsgData)
+msg_error_t __releaseTransitionList(MMS_MESSAGE_DATA_S *pMsgData)
{
if (pMsgData == NULL) {
MSG_DEBUG("pMsgData is NULL");
return MSG_SUCCESS;
}
-msg_error_t _MsgMmsReleaseMetaList(MMS_MESSAGE_DATA_S *pMsgData)
+msg_error_t __releaseMetaList(MMS_MESSAGE_DATA_S *pMsgData)
{
if (pMsgData == NULL) {
MSG_DEBUG("pMsgData is NULL");
return MSG_SUCCESS;
}
+void MsgMmsReleaseMmsLists(MMS_MESSAGE_DATA_S *pMsgData)
+{
+ __releasePageList(pMsgData);
+ __releaseRegionList(pMsgData);
+ __releaseAttachList(pMsgData);
+ __releaseTransitionList(pMsgData);
+ __releaseMetaList(pMsgData);
+}
+
msg_error_t _MsgMmsAddRegion(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_REGION* pRegion)
{
if(pMsgData == NULL || pRegion == NULL)
pMsgData->pagelist = g_list_append(pMsgData->pagelist, pPage);
pMsgData->pageCnt++;
-
+ MSG_DEBUG("MmsData's Page Count : %d", pMsgData->pageCnt);
return MSG_SUCCESS;
}
pPage->medialist = g_list_append(pPage->medialist, pMedia);
pPage->mediaCnt++;
- MSG_DEBUG("media's mediatype: %d", pMedia->mediatype);
- MSG_DEBUG("media's filename: %s", pMedia->szFileName);
- MSG_DEBUG("media's filepath: %s", pMedia->szFilePath);
- MSG_DEBUG("media's contentId: %s", pMedia->szContentID);
- MSG_DEBUG("page's media count: %d", pPage->mediaCnt);
-
+ MSG_DEBUG("Page's media count: %d", pPage->mediaCnt);
return MSG_SUCCESS;
}
return MSG_SUCCESS;
}
-bool _MsgMmsFindMatchedMedia(MMS_MESSAGE_DATA_S *pMsgData, char *pszFilePath)
-{
- if (pMsgData == NULL || pszFilePath == NULL)
- return false;
-
- if (pMsgData->pagelist) {
- for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) {
- MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx);
-
- if (page && page->medialist) {
- for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) {
- MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx);
- if (media) {
- if (strcmp(pszFilePath, media->szFilePath) == 0)
- return true;
- }
- }
- }
- }
- }
-
- return false;
-}
-
-msg_error_t _MsgMmsAddSmilDoc(char* pSmil, MMS_MESSAGE_DATA_S* pMsgData)
-{
- MSG_DEBUG("MsgMmsAddSmilDoc");
-
- if(pSmil == NULL || pMsgData == NULL)
- return MSG_ERR_INVALID_PARAMETER;
-
- char fullpath[MSG_FILEPATH_LEN_MAX] = {0,};
- char smilFileName[MSG_FILENAME_LEN_MAX+1] = {0,};
- time_t RawTime = 0;
-
- //Create smilFileName
- time(&RawTime);
- snprintf(smilFileName, MSG_FILENAME_LEN_MAX+1, "%lu", RawTime);
- snprintf(fullpath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_SMIL_FILE_PATH, smilFileName);
-
- if (MsgWriteSmilFile(fullpath, pSmil, strlen(pSmil)) == false) {
- MSG_DEBUG("MsgWriteSmilFile error");
- return MSG_ERR_MMS_ERROR;
- }
- strncpy(pMsgData->szSmilFilePath, smilFileName, MSG_FILEPATH_LEN_MAX-1);
-
- return MSG_SUCCESS;
-}
-
-
-char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S* pMsgData, size_t *pSize)
-{
- MSG_DEBUG("MsgMmsSerializeMessageData");
-
- if (pMsgData == NULL)
- return NULL;
-
- int bufsize = 0;
- int offset = 0;
- int pageCnt = 0;
- char *buf = NULL;
-
- pageCnt = pMsgData->pageCnt;
-
- int mediaCnt = 0;
-
- if (pMsgData->pagelist) {
- for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++) {
- bufsize += sizeof(int); // Media cnt
-
- MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx);
- mediaCnt = page->mediaCnt;
-
- if (page->medialist) {
- for (int i = 0; i < mediaCnt; i++) {
- MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, i);
-
- if (media->mediatype == MMS_SMIL_MEDIA_TEXT) {
- bufsize += (sizeof(MmsSmilMediaType) + MSG_FILENAME_LEN_MAX + 2 * MSG_FILEPATH_LEN_MAX + MSG_MSG_ID_LEN + 1
- + MAX_SMIL_ALT_LEN + MAX_SMIL_REGION_ID
-#ifdef __SUPPORT_DRM__
- + sizeof(MsgDrmType) + MSG_FILEPATH_LEN_MAX
-#endif
- + MAX_SMIL_TRANSIN_ID + MAX_SMIL_TRANSOUT_ID +
- 7 * sizeof(int) + 4* sizeof(bool) + sizeof(MmsTextDirection) /*+ sizeof(MmsSmilFontType)*/);
- } else {
- bufsize += (sizeof(MmsSmilMediaType) + MSG_FILENAME_LEN_MAX + 2 * MSG_FILEPATH_LEN_MAX + MSG_MSG_ID_LEN + 1
- + MAX_SMIL_ALT_LEN + MAX_SMIL_REGION_ID
-#ifdef __SUPPORT_DRM__
- + sizeof(MsgDrmType) + MSG_FILEPATH_LEN_MAX
-#endif
- + MAX_SMIL_TRANSIN_ID + MAX_SMIL_TRANSOUT_ID + 5 * sizeof(int)
-#ifdef MMS_SMIL_ANIMATE
- + MAX_SMIL_ANIMATE_ATTRIBUTE_NAME + MAX_SMIL_ANIMATE_ATTRIBUTE_TYPE + MAX_SMIL_ANIMATE_TARGET_ELEMENT
- + MAX_SMIL_ANIMATE_CALC_MODE + 5 * sizeof(int)
-#endif
- );
- }
- }
- }
-
- bufsize += sizeof(int) * 6;
- }
- }
-
- bufsize += sizeof(int); // region count;
- if (pMsgData->regionlist) {
- int elementSize = g_list_length(pMsgData->regionlist);
- bufsize += elementSize * (MAX_SMIL_REGION_ID + 4 * sizeof(MMS_LENGTH) + sizeof(int) + sizeof(REGION_FIT_TYPE_T));
- }
-
- bufsize += sizeof(int); // attachment count;
- if (pMsgData->attachlist) {
- int elementSize = g_list_length(pMsgData->attachlist);
- bufsize += elementSize * (sizeof(MimeType) + MSG_FILENAME_LEN_MAX + MSG_FILEPATH_LEN_MAX + sizeof(int)
-#ifdef __SUPPORT_DRM__
- + sizeof(MsgDrmType) + MSG_FILEPATH_LEN_MAX
-#endif
- );
- }
-
- bufsize += sizeof(int); // transition count;
- if (pMsgData->transitionlist) {
- int elementSize = g_list_length(pMsgData->transitionlist);
- bufsize += elementSize * (MAX_SMIL_TRANSITION_ID + sizeof(MmsSmilTransType) + sizeof(MmsSmilTransSubType) + sizeof(int));
- }
-
- bufsize += sizeof(int); // meta count;
- if (pMsgData->metalist) {
- int elementSize = g_list_length(pMsgData->metalist);
- bufsize += elementSize * (MAX_SMIL_META_ID + MAX_SMIL_META_NAME + MAX_SMIL_META_CONTENT);
- }
-
- bufsize += sizeof(MMS_SMIL_ROOTLAYOUT);
-
-#ifdef FEATURE_JAVA_MMS
- bufsize += sizeof(MMS_APPID_INFO_S);
-#endif
-
- int filePathLen = strlen(pMsgData->szSmilFilePath);
-
- bufsize += sizeof(int) + filePathLen + sizeof(int);
-
- MSG_DEBUG("MsgMmsSerializeMessageData: bufsize = %d", bufsize);
-
- buf = (char *)calloc(bufsize, 1);
-
- // copy file path length
- MSG_DEBUG("MsgMmsSerializeMessageData: smilFilePath Length = %d", filePathLen);
-
- memcpy(buf, &filePathLen, sizeof(int));
-
- offset += sizeof(int);
-
- // copy file path
- MSG_DEBUG("MsgMmsSerializeMessageData: smilFilePath = %s", pMsgData->szSmilFilePath);
-
- if (filePathLen > 0) {
- memcpy(buf + offset, pMsgData->szSmilFilePath, filePathLen);
-
- offset += filePathLen;
- }
-
- // copy page count
- MSG_DEBUG("MsgMmsSerializeMessageData: pageCnt = %d", pMsgData->pageCnt);
-
- memcpy(buf + offset, &(pMsgData->pageCnt), sizeof(int));
-
- offset += sizeof(int);
-
- if (pMsgData->pagelist) {
- for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++)
- {
- MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx);
- mediaCnt = page->mediaCnt;
-
- memcpy(buf + offset, &mediaCnt, sizeof(int));
- offset += sizeof(int);
-
- MSG_DEBUG("MsgMmsSerializeMessageData: mediaCnt = %d", mediaCnt);
- if (page->medialist) {
- for (int i = 0; i < mediaCnt; ++ i) {
- MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, i);
-
- memcpy(buf + offset, &(media->mediatype), sizeof(MmsSmilMediaType));
- offset += sizeof(MmsSmilMediaType);
- MSG_DEBUG("%d media's mediatype = %d", i, media->mediatype);
-
- memcpy(buf + offset, media->szSrc, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
-
- memcpy(buf + offset, media->szFileName, MSG_FILENAME_LEN_MAX);
- offset += MSG_FILENAME_LEN_MAX;
- MSG_DEBUG("%d media's filename = %s", i, media->szFileName);
-
- memcpy(buf + offset, media->szFilePath, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
- MSG_DEBUG("%d media's filepath = %s", i, media->szFilePath);
-
- memcpy(buf + offset, media->szContentID, MSG_MSG_ID_LEN + 1);
- offset += MSG_MSG_ID_LEN + 1;
- MSG_DEBUG("%d media's contentID = %s", i, media->szContentID);
-
- memcpy(buf + offset, media->regionId, MAX_SMIL_REGION_ID);
- offset += MAX_SMIL_REGION_ID;
- MSG_DEBUG("%d media's regionId = %s", i, media->regionId);
-
- memcpy(buf + offset, media->szAlt, MAX_SMIL_ALT_LEN);
- offset += MAX_SMIL_ALT_LEN;
-
-#ifdef __SUPPORT_DRM__
- memcpy(buf + offset, &(media->drmType), sizeof(MsgDrmType));
- offset += sizeof(MsgDrmType);
- memcpy(buf + offset, media->szDrm2FullPath, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
-#endif
-
- if (media->mediatype == MMS_SMIL_MEDIA_TEXT) {
- MSG_DEBUG("##### Media = TEXT #####");
- memcpy(buf + offset, media->sMedia.sText.szTransInId, MAX_SMIL_TRANSIN_ID);
- offset += MAX_SMIL_TRANSIN_ID;
-
- memcpy(buf + offset, media->sMedia.sText.szTransOutId, MAX_SMIL_TRANSOUT_ID);
- offset += MAX_SMIL_TRANSOUT_ID;
-
- memcpy(buf + offset, &(media->sMedia.sText.nRepeat), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sText.nBegin), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sText.nEnd), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sText.nDurTime), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sText.nBgColor), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sText.bBold), sizeof(bool));
- offset += sizeof(bool);
-
- memcpy(buf + offset, &(media->sMedia.sText.bUnderLine), sizeof(bool));
- offset += sizeof(bool);
-
- memcpy(buf + offset, &(media->sMedia.sText.bItalic), sizeof(bool));
- offset += sizeof(bool);
-
- memcpy(buf + offset, &(media->sMedia.sText.bReverse), sizeof(bool));
- offset += sizeof(bool);
-
- memcpy(buf + offset, &(media->sMedia.sText.nDirection), sizeof(MmsTextDirection));
- offset += sizeof(MmsTextDirection);
-
- //memcpy(buf + offset, &(media->sMedia.sText.nFont), sizeof(MmsSmilFontType));
- //offset += sizeof(MmsSmilFontType);
-
- memcpy(buf + offset, &(media->sMedia.sText.nSize), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sText.nColor), sizeof(int));
- offset += sizeof(int);
- } else {
- MSG_DEBUG("##### Media = IMAGE, AUDIO, VIDEO #####");
- memcpy(buf + offset, media->sMedia.sAVI.szTransInId, MAX_SMIL_TRANSIN_ID);
- offset += MAX_SMIL_TRANSIN_ID;
-
- memcpy(buf + offset, media->sMedia.sAVI.szTransOutId, MAX_SMIL_TRANSOUT_ID);
- offset += MAX_SMIL_TRANSOUT_ID;
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nRepeat), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nBegin), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nEnd), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nDurTime), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nBgColor), sizeof(int));
- offset += sizeof(int);
-
-#ifdef MMS_SMIL_ANIMATE
- memcpy(buf + offset, media->sMedia.sAVI.nAttributeName, MAX_SMIL_ANIMATE_ATTRIBUTE_NAME);
- offset += MAX_SMIL_ANIMATE_ATTRIBUTE_NAME;
-
- memcpy(buf + offset, media->sMedia.sAVI.nAttributeType, MAX_SMIL_ANIMATE_ATTRIBUTE_TYPE);
- offset += MAX_SMIL_ANIMATE_ATTRIBUTE_TYPE;
-
- memcpy(buf + offset, media->sMedia.sAVI.nTargetElement, MAX_SMIL_ANIMATE_TARGET_ELEMENT);
- offset += MAX_SMIL_ANIMATE_TARGET_ELEMENT;
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nFrom), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nTo), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nBy), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nValues), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, &(media->sMedia.sAVI.nDur), sizeof(int));
- offset += sizeof(int);
-
- memcpy(buf + offset, media->sMedia.sAVI.nCalcMode, MAX_SMIL_ANIMATE_CALC_MODE);
- offset += MAX_SMIL_ANIMATE_CALC_MODE;
-#endif
- }
- }
- }
-
- memcpy(buf + offset, &page->nDur, sizeof(int));
- offset += sizeof(int);
- memcpy(buf + offset, &page->nBegin, sizeof(int));
- offset += sizeof(int);
- memcpy(buf + offset, &page->nEnd, sizeof(int));
- offset += sizeof(int);
- memcpy(buf + offset, &page->nMin, sizeof(int));
- offset += sizeof(int);
- memcpy(buf + offset, &page->nMax, sizeof(int));
- offset += sizeof(int);
- memcpy(buf + offset, &page->nRepeat, sizeof(int));
- offset += sizeof(int);
- }
- }
-
- memcpy(buf + offset, &pMsgData->regionCnt, sizeof(int));
- offset += sizeof(int);
- MSG_DEBUG("pMsgData->regionCnt: %d", pMsgData->regionCnt);
-
- if (pMsgData->regionlist) {
- for (int i = 0; i < pMsgData->regionCnt; ++ i) {
- MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)g_list_nth_data(pMsgData->regionlist, i);
-
- memcpy(buf + offset, region->szID, MAX_SMIL_REGION_ID);
- offset += MAX_SMIL_REGION_ID;
- MSG_DEBUG("%d region's ID = %s", i, region->szID);
- memcpy(buf + offset, ®ion->nLeft, sizeof(MMS_LENGTH));
- offset += sizeof(MMS_LENGTH);
- memcpy(buf + offset, ®ion->nTop, sizeof(MMS_LENGTH));
- offset += sizeof(MMS_LENGTH);
- memcpy(buf + offset, ®ion->width, sizeof(MMS_LENGTH));
- offset += sizeof(MMS_LENGTH);
- memcpy(buf + offset, ®ion->height, sizeof(MMS_LENGTH));
- offset += sizeof(MMS_LENGTH);
- memcpy(buf + offset, ®ion->bgColor, sizeof(int));
- offset += sizeof(int);
- memcpy(buf + offset, ®ion->fit, sizeof(REGION_FIT_TYPE_T));
- offset += sizeof(REGION_FIT_TYPE_T);
- }
- }
-
- memcpy(buf + offset, &pMsgData->attachCnt, sizeof(int));
- offset += sizeof(int);
- MSG_DEBUG("pMsgData->attachCnt: %d", pMsgData->attachCnt);
-
- if (pMsgData->attachlist) {
- for (int i = 0; i < pMsgData->attachCnt; ++ i) {
- MMS_ATTACH_S *attach = (MMS_ATTACH_S *)g_list_nth_data(pMsgData->attachlist, i);
-
- memcpy(buf + offset, &(attach->mediatype), sizeof(MimeType));
- offset += sizeof(MimeType);
- MSG_DEBUG("%d attachment's mediatype = %d", i, attach->mediatype);
-
- memcpy(buf + offset, attach->szFileName, MSG_FILENAME_LEN_MAX);
- offset += MSG_FILENAME_LEN_MAX;
- MSG_DEBUG("%d attachment's filename = %s", i, attach->szFileName);
-
- memcpy(buf + offset, attach->szFilePath, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
- MSG_DEBUG("%d attachment's filepath = %s", i, attach->szFilePath);
-
- memcpy(buf + offset, &(attach->fileSize), sizeof(int));
- offset += sizeof(int);
- MSG_DEBUG("%d attachment's file size = %d", i, attach->fileSize);
-
-#ifdef __SUPPORT_DRM__
- memcpy(buf + offset, &(attach->drmType), sizeof(MsgDrmType));
- offset += sizeof(MsgDrmType);
- memcpy(buf + offset, attach->szDrm2FullPath, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
-#endif
- }
- }
-
- memcpy(buf + offset, &pMsgData->transitionCnt, sizeof(int));
- offset += sizeof(int);
- MSG_DEBUG("pMsgData->transitionCnt: %d", pMsgData->transitionCnt);
-
- if (pMsgData->transitionlist) {
- for (int i = 0; i < pMsgData->transitionCnt; ++ i) {
- MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)g_list_nth_data(pMsgData->transitionlist, i);
-
- memcpy(buf + offset, transition->szID, MAX_SMIL_TRANSITION_ID);
- offset += MAX_SMIL_TRANSITION_ID;
- MSG_DEBUG("%d transition's ID = %s", i, transition->szID);
-
- memcpy(buf + offset, &transition->nType, sizeof(MmsSmilTransType));
- offset += sizeof(MmsSmilTransType);
- memcpy(buf + offset, &transition->nSubType, sizeof(MmsSmilTransSubType));
- offset += sizeof(MmsSmilTransSubType);
- memcpy(buf + offset, &transition->nDur, sizeof(int));
- offset += sizeof(int);
- }
- }
-
- memcpy(buf + offset, &pMsgData->metaCnt, sizeof(int));
- offset += sizeof(int);
- MSG_DEBUG("pMsgData->metaCnt: %d", pMsgData->metaCnt);
-
- if (pMsgData->metalist) {
- for (int i = 0; i < pMsgData->metaCnt; ++ i) {
- MMS_SMIL_META *meta = (MMS_SMIL_META *)g_list_nth_data(pMsgData->metalist, i);
-
- memcpy(buf + offset, meta->szID, MAX_SMIL_META_ID);
- offset += MAX_SMIL_META_ID;
- MSG_DEBUG("%d meta's ID = %s", i, meta->szID);
-
- memcpy(buf + offset, meta->szName, MAX_SMIL_META_NAME);
- offset += MAX_SMIL_META_NAME;
- MSG_DEBUG("%d meta's ID = %s", i, meta->szID);
-
- memcpy(buf + offset, meta->szContent, MAX_SMIL_META_CONTENT);
- offset += MAX_SMIL_META_CONTENT;
- MSG_DEBUG("%d meta's ID = %s", i, meta->szID);
- }
- }
-
- memcpy(buf + offset, &pMsgData->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT));
- offset += sizeof(MMS_SMIL_ROOTLAYOUT);
-
-#ifdef FEATURE_JAVA_MMS
- memcpy(buf + offset, &pMsgData->msgAppId, sizeof(MMS_APPID_INFO_S));
- offset += sizeof(MMS_APPID_INFO_S);
-#endif
-
- *pSize = offset;
-
- return buf;
-}
-
int _MsgMmsGetPageCount(MMS_MESSAGE_DATA_S *pMsgData)
{
if (pMsgData == NULL) {
return count;
}
+bool _MsgMmsSetRootLayout(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_ROOTLAYOUT *pRootlayout)
+{
+ memcpy(&pMsgData->rootlayout, pRootlayout, sizeof(MMS_SMIL_ROOTLAYOUT));
+ return true;
+}
-bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S* pBody, char* pData)
+char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, size_t *pSize)
{
- MSG_DEBUG("MmsGetMsgBodyfromFile");
+ MSG_BEGIN();
- if (pBody == NULL || pData == NULL) {
- MSG_DEBUG("param is NULL. pBody = %x, pData = %x", pBody, pData);
- return false;
- }
+ if (pMsgData == NULL)
+ return NULL;
+ int bufsize = 0;
int offset = 0;
int pageCnt = 0;
- int filePathLen = 0;
+ char *buf = NULL;
- MMS_PAGE_S *pPage = NULL;
- MMS_MEDIA_S *pMedia = NULL;
- MMS_SMIL_REGION *pRegion = NULL;
- MMS_ATTACH_S *pAttach = NULL;
- MMS_SMIL_TRANSITION *pTransition = NULL;
- MMS_SMIL_META *pMeta = NULL;
+ bufsize += sizeof(int); // Page cnt
- memcpy(&filePathLen, pData, sizeof(int));
+ pageCnt = pMsgData->pageCnt;
- offset += sizeof(int);
+ if (pMsgData->pagelist) {
- MSG_DEBUG("Smil File Path Length : %d", filePathLen);
+ for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++) {
- if (filePathLen > MSG_FILEPATH_LEN_MAX) {
- MSG_DEBUG("Smil File Path Length is abnormal.");
- return false;
+ int mediaCnt = 0;
+
+ MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx);
+
+ mediaCnt = page->mediaCnt;
+
+ bufsize += sizeof(int); // Media cnt
+
+ if (page->medialist) {
+ bufsize += sizeof(MMS_MEDIA_S) * mediaCnt;
+ }
+
+ bufsize += sizeof(int) * 6;//Dur, Begin, End, Min, Max, Repeat
+ }
}
- memset(pBody->szSmilFilePath, 0x00, MSG_FILEPATH_LEN_MAX);
+ bufsize += sizeof(int); // region count;
- if (filePathLen > 0) {
- memcpy(pBody->szSmilFilePath, pData + offset, filePathLen);
+ if (pMsgData->regionlist) {
+ int elementSize = g_list_length(pMsgData->regionlist);
+ bufsize += elementSize * (sizeof(MMS_SMIL_REGION));
+ }
- offset += filePathLen;
+ bufsize += sizeof(int); // attachment count;
+ if (pMsgData->attachlist) {
+ int elementSize = g_list_length(pMsgData->attachlist);
+ bufsize += elementSize * sizeof(MMS_ATTACH_S);
}
- memcpy(&(pBody->pageCnt), pData + offset, sizeof(int));
+ bufsize += sizeof(int); // transition count;
+ if (pMsgData->transitionlist) {
+ int elementSize = g_list_length(pMsgData->transitionlist);
+ bufsize += elementSize * sizeof(MMS_SMIL_TRANSITION);
+ }
+
+ bufsize += sizeof(int); // meta count;
+ if (pMsgData->metalist) {
+ int elementSize = g_list_length(pMsgData->metalist);
+ bufsize += elementSize * sizeof(MMS_SMIL_META);
+ }
+
+ bufsize += sizeof(MMS_SMIL_ROOTLAYOUT);
+
+#ifdef FEATURE_JAVA_MMS
+ bufsize += sizeof(MMS_APPID_INFO_S);
+#endif
+
+ int filePathLen = strlen(pMsgData->szSmilFilePath);
+
+ bufsize += sizeof(int) + filePathLen;
+
+ bufsize += sizeof(int); // type
+ bufsize += sizeof(MMS_HEADER_DATA_S);
+ bufsize += sizeof(MMS_MULTIPART_DATA_S);
+
+ MSG_DEBUG("Serialize bufsize = %d", bufsize);
+ buf = (char *)calloc(bufsize, 1);
+
+ int serial_index = 0;
+
+ memcpy(buf, &pMsgData->backup_type, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d] backup type = %d",serial_index++, offset, pMsgData->backup_type);
offset += sizeof(int);
- pageCnt = pBody->pageCnt;
+ //smilFilePath
+ memcpy(buf + offset , &filePathLen, sizeof(int));
- MSG_DEBUG("MMS PAGE COUNT: %d", pageCnt);
+ // copy file path
+ MSG_DEBUG("[#%2d][%5d] smilFilePath = %s, len = %d",serial_index++, offset, pMsgData->szSmilFilePath, filePathLen);
+ offset += sizeof(int);
- for (int j = 0; j < pageCnt; ++j) {
- pPage = (MMS_PAGE_S *)calloc(sizeof(MMS_PAGE_S), 1);
+ if (filePathLen > 0) {
+ memcpy(buf + offset, pMsgData->szSmilFilePath, filePathLen);
+ offset += filePathLen;
+ }
- memcpy(&pPage->mediaCnt, pData + offset, sizeof(int));
- offset += sizeof(int);
- MSG_DEBUG("MMS MEDIA COUNT: %d", pPage->mediaCnt);
+ // copy page count
+ MSG_DEBUG("[#%2d][%5d] page count = %d",serial_index++, offset, pMsgData->pageCnt);
+ memcpy(buf + offset, &(pMsgData->pageCnt), sizeof(int));
+ offset += sizeof(int);
- for (int i = 0; i < pPage->mediaCnt; ++i) {
- pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1);
+ if (pMsgData->pagelist) {
+
+ for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++) {
+ MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx);
- memcpy(&pMedia->mediatype, pData + offset, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d][%d page] media count = %d",serial_index++, offset, pageIdx, page->mediaCnt);
+ memcpy(buf + offset, &page->mediaCnt, sizeof(int));
offset += sizeof(int);
- memcpy(pMedia->szSrc, pData + offset, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
+ if (page->medialist) {
+ for (int i = 0; i < page->mediaCnt; ++ i) {
+ MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, i);
+ memcpy(buf + offset, media, sizeof(MMS_MEDIA_S));
+ offset += sizeof(MMS_MEDIA_S);
+ }
+ }
- memcpy(pMedia->szFileName, pData + offset, MSG_FILENAME_LEN_MAX);
- offset += MSG_FILENAME_LEN_MAX;
+ memcpy(buf + offset, &page->nDur, sizeof(int));
+ offset += sizeof(int);
+ memcpy(buf + offset, &page->nBegin, sizeof(int));
+ offset += sizeof(int);
+ memcpy(buf + offset, &page->nEnd, sizeof(int));
+ offset += sizeof(int);
+ memcpy(buf + offset, &page->nMin, sizeof(int));
+ offset += sizeof(int);
+ memcpy(buf + offset, &page->nMax, sizeof(int));
+ offset += sizeof(int);
+ memcpy(buf + offset, &page->nRepeat, sizeof(int));
+ offset += sizeof(int);
+ }
+ }
- memcpy(pMedia->szFilePath, pData + offset, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
+ MSG_DEBUG("[#%2d][%5d] region count = %d",serial_index++, offset, pMsgData->regionCnt);
- memcpy(pMedia->szContentID, pData + offset, MSG_MSG_ID_LEN+1);
- offset += MSG_MSG_ID_LEN + 1;
+ memcpy(buf + offset, &pMsgData->regionCnt, sizeof(int));
+ offset += sizeof(int);
- memcpy(pMedia->regionId, pData + offset, MAX_SMIL_REGION_ID);
- offset += MAX_SMIL_REGION_ID;
+ if (pMsgData->regionlist) {
+ for (int i = 0; i < pMsgData->regionCnt; ++ i) {
+ MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)g_list_nth_data(pMsgData->regionlist, i);
+ memcpy(buf + offset, region, sizeof(MMS_SMIL_REGION));
+ offset += sizeof(MMS_SMIL_REGION);
+ }
+ }
- memcpy(pMedia->szAlt, pData + offset, MAX_SMIL_ALT_LEN);
- offset += MAX_SMIL_ALT_LEN;
+ MSG_DEBUG("[#%2d][%5d] attach count = %d",serial_index++, offset, pMsgData->attachCnt);
-#ifdef __SUPPORT_DRM__
- memcpy(&pMedia->drmType, pData + offset, sizeof(MsgDrmType));
- offset += sizeof(MsgDrmType);
+ memcpy(buf + offset, &pMsgData->attachCnt, sizeof(int));
+ offset += sizeof(int);
- memcpy(pMedia->szDrm2FullPath, pData + offset, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
-#endif
+ if (pMsgData->attachlist) {
+ for (int i = 0; i < pMsgData->attachCnt; ++ i) {
+ MMS_ATTACH_S *attach = (MMS_ATTACH_S *)g_list_nth_data(pMsgData->attachlist, i);
+ memcpy(buf + offset, attach, sizeof(MMS_ATTACH_S));
+ offset += sizeof(MMS_ATTACH_S);
+ }
+ }
- if (pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) {
- MSG_DEBUG("##### MEDIA TYPE = TEXT #####");
- memcpy(pMedia->sMedia.sText.szTransInId, pData + offset, MAX_SMIL_TRANSIN_ID);
- offset += MAX_SMIL_TRANSIN_ID;
+ MSG_DEBUG("[#%2d][%5d] transition count = %d",serial_index++, offset, pMsgData->transitionCnt);
- memcpy(pMedia->sMedia.sText.szTransOutId, pData + offset, MAX_SMIL_TRANSOUT_ID);
- offset += MAX_SMIL_TRANSOUT_ID;
+ memcpy(buf + offset, &pMsgData->transitionCnt, sizeof(int));
+ offset += sizeof(int);
+ if (pMsgData->transitionlist) {
+ for (int i = 0; i < pMsgData->transitionCnt; ++ i) {
+ MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)g_list_nth_data(pMsgData->transitionlist, i);
+ memcpy(buf + offset, transition, sizeof(MMS_SMIL_TRANSITION));
+ offset += sizeof(MMS_SMIL_TRANSITION);
+ }
+ }
- memcpy(&pMedia->sMedia.sText.nRepeat, pData + offset, sizeof(int));
- offset += sizeof(int);
+ MSG_DEBUG("[#%2d][%5d] meta count = %d",serial_index++, offset, pMsgData->metaCnt);
+ memcpy(buf + offset, &pMsgData->metaCnt, sizeof(int));
+ offset += sizeof(int);
- memcpy(&pMedia->sMedia.sText.nBegin, pData + offset, sizeof(int));
- offset += sizeof(int);
+ if (pMsgData->metalist) {
+ for (int i = 0; i < pMsgData->metaCnt; ++ i) {
+ MMS_SMIL_META *meta = (MMS_SMIL_META *)g_list_nth_data(pMsgData->metalist, i);
- memcpy(&pMedia->sMedia.sText.nEnd, pData + offset, sizeof(int));
- offset += sizeof(int);
+ memcpy(buf + offset, meta, sizeof(MMS_SMIL_META));
+ offset += sizeof(MMS_SMIL_META);
+ }
+ }
- memcpy(&pMedia->sMedia.sText.nDurTime, pData + offset, sizeof(int));
- offset += sizeof(int);
+ MSG_DEBUG("[#%2d][%5d] root layout",serial_index++, offset);
+ memcpy(buf + offset, &pMsgData->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT));
+ offset += sizeof(MMS_SMIL_ROOTLAYOUT);
- memcpy(&pMedia->sMedia.sText.nBgColor, pData + offset, sizeof(int));
- offset += sizeof(int);
+#ifdef FEATURE_JAVA_MMS
+ MSG_DEBUG("[#%2d][%5d] java mms",serial_index++, offset);
+ memcpy(buf + offset, &pMsgData->msgAppId, sizeof(MMS_APPID_INFO_S));
+ offset += sizeof(MMS_APPID_INFO_S);
+#endif
- memcpy(&pMedia->sMedia.sText.bBold, pData + offset, sizeof(bool));
- offset += sizeof(bool);
+ memcpy (buf + offset, &pMsgData->header, sizeof(MMS_HEADER_DATA_S));
+ MSG_DEBUG("[#%2d][%5d] mms header",serial_index++, offset);
+ offset += sizeof(MMS_HEADER_DATA_S);
- memcpy(&pMedia->sMedia.sText.bUnderLine, pData + offset, sizeof(bool));
- offset += sizeof(bool);
+ memcpy (buf + offset, &pMsgData->smil, sizeof(MMS_MULTIPART_DATA_S));
+ MSG_DEBUG("[#%2d][%5d] mms smil",serial_index++, offset);
+ offset += sizeof(MMS_MULTIPART_DATA_S);
- memcpy(&pMedia->sMedia.sText.bItalic, pData + offset, sizeof(bool));
- offset += sizeof(bool);
+ *pSize = offset;
- memcpy(&pMedia->sMedia.sText.bReverse, pData + offset, sizeof(bool));
- offset += sizeof(bool);
+ MSG_DEBUG("Expect Buffer Size: %d, Final offset : %d", bufsize, offset);
+ MSG_END();
+ return buf;
+}
- memcpy(&pMedia->sMedia.sText.nDirection, pData + offset, sizeof(MmsTextDirection));
- offset += sizeof(MmsTextDirection);
+bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pData)
+{
+ MSG_BEGIN();
- //memcpy(&pMedia->sMedia.sText.nFont, pData + offset, sizeof(MmsSmilFontType));
- //offset += sizeof(MmsSmilFontType);
+ if (pMsgData == NULL || pData == NULL) {
+ MSG_DEBUG("param is NULL. pBody = %x, pData = %x", pMsgData, pData);
+ return false;
+ }
- memcpy(&pMedia->sMedia.sText.nSize, pData + offset, sizeof(int));
- offset += sizeof(int);
+ int offset = 0;
+ int pageCnt = 0;
+ int filePathLen = 0;
- memcpy(&pMedia->sMedia.sText.nColor, pData + offset, sizeof(int));
- offset += sizeof(int);
- } else {
- MSG_DEBUG("##### MEDIA TYPE = IMAGE, AUDIO, VIDEO #####");
- memcpy(pMedia->sMedia.sAVI.szTransInId, pData + offset, MAX_SMIL_TRANSIN_ID);
- offset += MAX_SMIL_TRANSIN_ID;
+ MMS_PAGE_S *pPage = NULL;
+ MMS_MEDIA_S *pMedia = NULL;
+ MMS_SMIL_REGION *pRegion = NULL;
+ MMS_ATTACH_S *pAttach = NULL;
+ MMS_SMIL_TRANSITION *pTransition = NULL;
+ MMS_SMIL_META *pMeta = NULL;
+
+ int serial_index = 0;
- memcpy(pMedia->sMedia.sAVI.szTransOutId, pData + offset, MAX_SMIL_TRANSOUT_ID);
- offset += MAX_SMIL_TRANSOUT_ID;
+ int type;
- memcpy(&pMedia->sMedia.sAVI.nRepeat, pData + offset, sizeof(int));
- offset += sizeof(int);
+ memcpy(&type, pData, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d] backup type = %d",serial_index++, offset, type);
+ offset += sizeof(int);
- memcpy(&pMedia->sMedia.sAVI.nBegin, pData + offset, sizeof(int));
- offset += sizeof(int);
+ pMsgData->backup_type = type;
- memcpy(&pMedia->sMedia.sAVI.nEnd, pData + offset, sizeof(int));
- offset += sizeof(int);
+ memcpy(&filePathLen, pData + offset, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d] smil path len = %d",serial_index, offset, filePathLen);
+ offset += sizeof(int);
- memcpy(&pMedia->sMedia.sAVI.nDurTime, pData + offset, sizeof(int));
- offset += sizeof(int);
+ if (filePathLen > MSG_FILEPATH_LEN_MAX) {
+ MSG_DEBUG("Smil File Path Length is abnormal.");
+ return false;
+ }
+
+ memset(pMsgData->szSmilFilePath, 0x00, MSG_FILEPATH_LEN_MAX);
+
+ if (filePathLen > 0) {
+ memcpy(pMsgData->szSmilFilePath, pData + offset, filePathLen);
+ MSG_DEBUG("[#%2d][%5d] smil path = %s",serial_index, offset, pMsgData->szSmilFilePath);
+ offset += filePathLen;
+ }
- memcpy(&pMedia->sMedia.sAVI.nBgColor, pData + offset, sizeof(int));
- offset += sizeof(int);
-#ifdef MMS_SMIL_ANIMATE
- memcpy(pMedia->sMedia.sAVI.nAttributeName, pData + offset, MAX_SMIL_ANIMATE_ATTRIBUTE_NAME);
- offset += MAX_SMIL_ANIMATE_ATTRIBUTE_NAME;
+ serial_index++;
- memcpy(pMedia->sMedia.sAVI.nAttributeType, pData + offset, MAX_SMIL_ANIMATE_ATTRIBUTE_TYPE);
- offset += MAX_SMIL_ANIMATE_ATTRIBUTE_TYPE;
+ memcpy(&(pMsgData->pageCnt), pData + offset, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d] page count = %d",serial_index++, offset, pMsgData->pageCnt);
+ offset += sizeof(int);
- memcpy(pMedia->sMedia.sAVI.nTargetElement, pData + offset, MAX_SMIL_ANIMATE_TARGET_ELEMENT);
- offset += MAX_SMIL_ANIMATE_TARGET_ELEMENT;
+ pageCnt = pMsgData->pageCnt;
- memcpy(&pMedia->sMedia.sAVI.nFrom, pData + offset, sizeof(int));
- offset += sizeof(int);
+ for (int j = 0; j < pageCnt; ++j) {
+ pPage = (MMS_PAGE_S *)calloc(sizeof(MMS_PAGE_S), 1);
- memcpy(&pMedia->sMedia.sAVI.nTo, pData + offset, sizeof(int));
- offset += sizeof(int);
+ memcpy(&pPage->mediaCnt, pData + offset, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d][%d page] media count = %d", serial_index++, offset, j, pPage->mediaCnt);
+ offset += sizeof(int);
- memcpy(&pMedia->sMedia.sAVI.nBy, pData + offset, sizeof(int));
- offset += sizeof(int);
+ for (int i = 0; i < pPage->mediaCnt; ++i) {
+ pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1);
- memcpy(&pMedia->sMedia.sAVI.nValues, pData + offset, sizeof(int));
- offset += sizeof(int);
+ memcpy(pMedia, pData + offset, sizeof(MMS_MEDIA_S));
- memcpy(&pMedia->sMedia.sAVI.nDur, pData + offset, sizeof(int));
- offset += sizeof(int);
+ offset += sizeof(MMS_MEDIA_S);
- memcpy(pMedia->sMedia.sAVI.nCalcMode, pData + offset, MAX_SMIL_ANIMATE_CALC_MODE);
- offset += MAX_SMIL_ANIMATE_CALC_MODE;
-#endif
- }
pPage->medialist = g_list_append(pPage->medialist, pMedia);
}
memcpy(&pPage->nRepeat , pData + offset, sizeof(int));
offset += sizeof(int);
- pBody->pagelist = g_list_append(pBody->pagelist, pPage);
+ pMsgData->pagelist = g_list_append(pMsgData->pagelist, pPage);
}
//Processing Region List
- memcpy(&pBody->regionCnt, pData + offset, sizeof(int));
+ memcpy(&pMsgData->regionCnt, pData + offset, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d] region count = %d",serial_index++, offset, pMsgData->regionCnt);
offset += sizeof(int);
- MSG_DEBUG(" pBody->regionCnt: %d", pBody->regionCnt);
+ //MSG_DEBUG(" pBody->regionCnt: %d", pBody->regionCnt);
- for (int i = 0; i < pBody->regionCnt; ++i) {
+ for (int i = 0; i < pMsgData->regionCnt; ++i) {
pRegion = (MMS_SMIL_REGION *)calloc(sizeof(MMS_SMIL_REGION), 1);
- memcpy(pRegion->szID, pData + offset, MAX_SMIL_REGION_ID);
- offset += MAX_SMIL_REGION_ID;
- memcpy(&pRegion->nLeft, pData + offset, sizeof(MMS_LENGTH));
- offset += sizeof(MMS_LENGTH);
- memcpy(&pRegion->nTop, pData + offset, sizeof(MMS_LENGTH));
- offset += sizeof(MMS_LENGTH);
- memcpy(&pRegion->width, pData + offset, sizeof(MMS_LENGTH));
- offset += sizeof(MMS_LENGTH);
- memcpy(&pRegion->height, pData + offset, sizeof(MMS_LENGTH));
- offset += sizeof(MMS_LENGTH);
- memcpy(&pRegion->bgColor, pData + offset, sizeof(int));
- offset += sizeof(int);
- memcpy(&pRegion->fit, pData + offset, sizeof(REGION_FIT_TYPE_T));
- offset += sizeof(REGION_FIT_TYPE_T);
+ memcpy(pRegion, pData + offset, sizeof(MMS_SMIL_REGION));
+ offset += sizeof(MMS_SMIL_REGION);
- pBody->regionlist = g_list_append(pBody->regionlist, pRegion);
+ pMsgData->regionlist = g_list_append(pMsgData->regionlist, pRegion);
}
//Processing Attachment List
- memcpy(&pBody->attachCnt, pData + offset, sizeof(int));
+ memcpy(&pMsgData->attachCnt, pData + offset, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d] attach count = %d",serial_index++, offset, pMsgData->attachCnt);
offset += sizeof(int);
- MSG_DEBUG(" pBody->attachCnt: %d", pBody->attachCnt);
-
- for (int i = 0; i < pBody->attachCnt; ++i) {
+ for (int i = 0; i < pMsgData->attachCnt; ++i) {
pAttach = (MMS_ATTACH_S *)calloc(sizeof(MMS_ATTACH_S), 1);
- memcpy(&pAttach->mediatype, pData + offset, sizeof(MimeType));
- offset += sizeof(MimeType);
-
- memcpy(pAttach->szFileName, pData + offset, MSG_FILENAME_LEN_MAX);
- offset += MSG_FILENAME_LEN_MAX;
-
- memcpy(pAttach->szFilePath, pData + offset, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
+ memcpy(pAttach, pData + offset, sizeof(MMS_ATTACH_S));
+ offset += sizeof(MMS_ATTACH_S);
- memcpy(&pAttach->fileSize, pData + offset, sizeof(int));
- offset += sizeof(int);
-
-#ifdef __SUPPORT_DRM__
- memcpy(&pAttach->drmType, pData + offset, sizeof(MsgDrmType));
- offset += sizeof(MsgDrmType);
-
- memcpy(pAttach->szDrm2FullPath, pData + offset, MSG_FILEPATH_LEN_MAX);
- offset += MSG_FILEPATH_LEN_MAX;
-#endif
-
- pBody->attachlist = g_list_append(pBody->attachlist, pAttach);
+ pMsgData->attachlist = g_list_append(pMsgData->attachlist, pAttach);
}
//Processing Transition List
- memcpy(&pBody->transitionCnt, pData + offset, sizeof(int));
+ memcpy(&pMsgData->transitionCnt, pData + offset, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d] transition count = %d",serial_index++, offset, pMsgData->transitionCnt);
offset += sizeof(int);
- MSG_DEBUG(" pBody->transitionCnt: %d", pBody->transitionCnt);
-
- for (int i = 0; i < pBody->transitionCnt; ++i) {
+ for (int i = 0; i < pMsgData->transitionCnt; ++i) {
pTransition = (MMS_SMIL_TRANSITION *)calloc(sizeof(MMS_SMIL_TRANSITION), 1);
- memcpy(pTransition->szID, pData + offset, MAX_SMIL_TRANSITION_ID);
- offset += MAX_SMIL_TRANSITION_ID;
+ memcpy(pTransition, pData + offset, sizeof(MMS_SMIL_TRANSITION));
- memcpy(&pTransition->nType, pData + offset, sizeof(MmsSmilTransType));
- offset += sizeof(MmsSmilTransType);
- memcpy(&pTransition->nSubType, pData + offset, sizeof(MmsSmilTransSubType));
- offset += sizeof(MmsSmilTransSubType);
- memcpy(&pTransition->nDur, pData + offset, sizeof(int));
- offset += sizeof(int);
+ offset += sizeof(MMS_SMIL_TRANSITION);
- pBody->transitionlist = g_list_append(pBody->transitionlist, pTransition);
+ pMsgData->transitionlist = g_list_append(pMsgData->transitionlist, pTransition);
}
//Processing Meta List
- memcpy(&pBody->metaCnt, pData + offset, sizeof(int));
+ memcpy(&pMsgData->metaCnt, pData + offset, sizeof(int));
+ MSG_DEBUG("[#%2d][%5d] meta count = %d",serial_index++, offset, pMsgData->metaCnt);
offset += sizeof(int);
- MSG_DEBUG(" pBody->metaCnt: %d", pBody->metaCnt);
-
- for (int i = 0; i < pBody->metaCnt; ++i) {
+ for (int i = 0; i < pMsgData->metaCnt; ++i) {
pMeta = (MMS_SMIL_META *)calloc(sizeof(MMS_SMIL_META), 1);
- memcpy(pMeta->szID, pData + offset, MAX_SMIL_META_ID);
- offset += MAX_SMIL_META_ID;
-
- memcpy(pMeta->szName, pData + offset, MAX_SMIL_META_NAME);
- offset += MAX_SMIL_META_NAME;
+ memcpy(pMeta, pData + offset, sizeof(MMS_SMIL_META));
- memcpy(pMeta->szContent, pData + offset, MAX_SMIL_META_CONTENT);
- offset += MAX_SMIL_META_CONTENT;
+ offset += sizeof(MMS_SMIL_META);
- pBody->metalist = g_list_append(pBody->metalist, pMeta);
+ pMsgData->metalist = g_list_append(pMsgData->metalist, pMeta);
}
- memcpy(&pBody->rootlayout, pData + offset, sizeof(MMS_SMIL_ROOTLAYOUT));
+ MSG_DEBUG("[#%2d][%5d] root layout",serial_index++, offset);
+ memcpy(&pMsgData->rootlayout, pData + offset, sizeof(MMS_SMIL_ROOTLAYOUT));
offset += sizeof(MMS_SMIL_ROOTLAYOUT);
#ifdef FEATURE_JAVA_MMS
- memcpy(&pBody->msgAppId, pData + offset, sizeof(MMS_APPID_INFO_S));
+ MSG_DEBUG("[#%2d][%5d] java mms",serial_index++, offset);
+ memcpy(&pMsgData->msgAppId, pData + offset, sizeof(MMS_APPID_INFO_S));
offset += sizeof(MMS_APPID_INFO_S);
- MSG_DEBUG("java_app_id valid:%d, appId:%s repleToAppId:%s", pBody->msgAppId.valid, pBody->msgAppId.appId, pBody->msgAppId.replyToAppId);
+// MSG_DEBUG("java_app_id valid:%d, appId:%s repleToAppId:%s", pBody->msgAppId.valid, pBody->msgAppId.appId, pBody->msgAppId.replyToAppId);
#endif
- //free(pData);
- return true;
-}
+ memcpy(&pMsgData->header, pData + offset, sizeof(MMS_HEADER_DATA_S));
+ MSG_DEBUG("[#%2d][%5d] mms header",serial_index++, offset);
+ offset += sizeof(MMS_HEADER_DATA_S);
-bool _MsgMmsSetRootLayout(MMS_MESSAGE_DATA_S* pMmsMsg, MMS_SMIL_ROOTLAYOUT* pRootlayout)
-{
- memcpy(&pMmsMsg->rootlayout, pRootlayout, sizeof(MMS_SMIL_ROOTLAYOUT));
+ memcpy(&pMsgData->smil, pData + offset, sizeof(MMS_MULTIPART_DATA_S));
+ MSG_DEBUG("[#%2d][%5d] mms smil",serial_index++, offset);
+ offset += sizeof(MMS_MULTIPART_DATA_S);
+
+ MSG_DEBUG("Final offset : %d", offset);
+ MSG_END();
return true;
}