2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "MsgCppTypes.h"
21 #include "MsgException.h"
22 #include "MsgGconfWrapper.h"
23 #include "MsgUtilFile.h"
24 #include "SmsPluginTextConvert.h"
25 #include "SmsPluginUDCodec.h"
26 #include "SmsPluginStorage.h"
27 #include "SmsPluginEventHandler.h"
28 #include "SmsPluginCbMsgHandler.h"
31 /*==================================================================================================
32 IMPLEMENTATION OF SmsPluginCbMsgHandler - Member Functions
33 ==================================================================================================*/
34 SmsPluginCbMsgHandler* SmsPluginCbMsgHandler::pInstance = NULL;
37 SmsPluginCbMsgHandler::SmsPluginCbMsgHandler()
43 SmsPluginCbMsgHandler::~SmsPluginCbMsgHandler()
49 SmsPluginCbMsgHandler* SmsPluginCbMsgHandler::instance()
52 pInstance = new SmsPluginCbMsgHandler();
58 void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
62 SMS_CB_NETWORK_TYPE_T type = pCbMsg->CbMsgType;
64 SMS_CBMSG_PAGE_S CbMsgPage = {0};
68 case SMS_CB_NETWORK_TYPE_2G_GSM :
69 Decode2gCbMsg(pCbMsg, &CbMsgPage);
72 case SMS_CB_NETWORK_TYPE_3G_UMTS :
73 Decode3gCbMsg(pCbMsg, &CbMsgPage);
77 // Check CB Msg Options
78 bool bJavaMsg = false;
80 if (!checkCbOpt(CbMsgPage, &bJavaMsg))
82 MSG_DEBUG("The CB Msg is not supported by option.");
88 MSG_DEBUG("JAVA CB Msg.");
89 CbMsgPage.cbMsgType = SMS_CBMSG_TYPE_JAVACBS;
93 unsigned char pageCnt = checkCbPage(CbMsgPage);
95 if (pageCnt == CbMsgPage.pageHeader.totalPages)
97 MSG_DEBUG("RECEIVED LAST MSG : %d", pageCnt);
99 SMS_CBMSG_S cbMsg = {};
100 MSG_MESSAGE_INFO_S msgInfo = {};
102 // Make CB Msg Structure
103 MakeCbMsg(CbMsgPage, &cbMsg);
105 // Convert to MSG_MESSAGE_INFO_S
106 convertCbMsgToMsginfo(cbMsg, &msgInfo);
108 // Add CB Msg into DB
109 msg_error_t err = MSG_SUCCESS;
111 err = SmsPluginStorage::instance()->addMessage(&msgInfo);
113 if (err == MSG_SUCCESS)
116 err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
118 if (err != MSG_SUCCESS)
120 MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
125 MSG_DEBUG("addMessage() Error !! [%d]", err);
129 removeFromPageList(CbMsgPage);
135 void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
137 if (pCbMsg->Length > MAX_CBMSG_PAGE_SIZE)
138 THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbMsg->Length);
140 unsigned char cbData[pCbMsg->Length+1];
142 memset(cbData, 0x00, sizeof(cbData));
143 memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
144 cbData[pCbMsg->Length] = '\0';
146 pCbPage->cbMsgType = SMS_CBMSG_TYPE_CBS;
149 pCbPage->pageHeader.serialNum.geoScope = (cbData[0] & 0xC0) >> 6;
151 pCbPage->pageHeader.serialNum.msgCode = (cbData[0] & 0x3F) << 4;
152 pCbPage->pageHeader.serialNum.msgCode |= (cbData[1] & 0xF0) >> 4;
154 pCbPage->pageHeader.serialNum.updateNum = cbData[1] & 0x0F;
156 MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
158 pCbPage->pageHeader.msgId = (cbData[2] << 8) | cbData[3];
160 MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
163 decodeCbMsgDCS(cbData[4], (unsigned char*)cbData[6], &(pCbPage->pageHeader.dcs));
166 pCbPage->pageHeader.totalPages = cbData[5] & 0x0F;
167 pCbPage->pageHeader.page = (cbData[5] & 0xF0) >> 4;
169 if (pCbPage->pageHeader.totalPages > MAX_CBMSG_PAGE_NUM)
170 THROW(MsgException::SMS_PLG_ERROR, "CB Page Count is over MAX[%d]", pCbPage->pageHeader.totalPages);
172 MSG_DEBUG("Total Page : [%d], Page : [%d]", pCbPage->pageHeader.totalPages, pCbPage->pageHeader.page);
174 // Convert Language Type
175 convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
177 MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
180 pCbPage->pageHeader.recvTime = getRecvTime();
183 int dataLen = pCbMsg->Length - 6;
185 switch (pCbPage->pageHeader.dcs.codingScheme)
187 case SMS_CHARSET_7BIT :
189 MSG_DEBUG("GSM 7 BIT");
191 dataLen = (dataLen*8) / 7;
193 SmsPluginUDCodec udCodec;
194 int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pCbPage->pageData);
196 MSG_DEBUG("dataLen : [%d]", dataLen);
197 MSG_DEBUG("unpackLen : [%d]", unpackLen);
199 pCbPage->pageLength = unpackLen;
200 pCbPage->pageData[unpackLen] = '\0';
202 // pCbPage->pageLength = strlen(pCbPage->pageData);
203 // pCbPage->pageData[pCbPage->pageLength] = '\0';
207 case SMS_CHARSET_8BIT :
208 case SMS_CHARSET_UCS2 :
212 memcpy(pCbPage->pageData, &cbData[6], dataLen);
214 pCbPage->pageLength = strlen(pCbPage->pageData);
216 pCbPage->pageData[pCbPage->pageLength] = '\0';
221 MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
225 void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
227 if (pCbMsg->Length > (MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM))
228 THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbMsg->Length);
230 char cbData[(MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM)+1];
232 memset(cbData, 0x00, sizeof(cbData));
233 memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
234 cbData[pCbMsg->Length] = '\0';
236 pCbPage->cbMsgType = (SMS_CBMSG_TYPE_T)cbData[0];
238 pCbPage->pageHeader.msgId = (cbData[1] << 8) | cbData[2];
240 MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
243 pCbPage->pageHeader.serialNum.geoScope = (cbData[3] & 0xC0) >> 6;
245 pCbPage->pageHeader.serialNum.msgCode = (cbData[3] & 0x3F) << 4;
246 pCbPage->pageHeader.serialNum.msgCode |= (cbData[4] & 0xF0) >> 4;
248 pCbPage->pageHeader.serialNum.updateNum = cbData[4] & 0x0F;
250 MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
253 decodeCbMsgDCS(cbData[5], (unsigned char*)cbData[6], &(pCbPage->pageHeader.dcs));
255 // Convert Language Type
256 convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
258 MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
261 pCbPage->pageHeader.recvTime = getRecvTime();
265 bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
267 bool bReceive = false;
268 MsgSettingGetBool(CB_RECEIVE, &bReceive);
270 // Receive CB Msg = FALSE
273 MSG_DEBUG("RECEIVE CB = FALSE");
280 memset(keyName, 0x00, sizeof(keyName));
281 sprintf(keyName, "%s/%d", CB_LANGUAGE, MSG_CBLANG_TYPE_ALL);
283 bool bAllLang = false;
284 MsgSettingGetBool(keyName, &bAllLang);
288 MSG_DEBUG("ALL LANGUAGE = FALSE");
290 memset(keyName, 0x00, sizeof(keyName));
291 sprintf(keyName, "%s/%d", CB_LANGUAGE, CbPage.pageHeader.langType);
295 MsgSettingGetBool(keyName, &bLang);
297 if (!bLang || CbPage.pageHeader.langType == MSG_CBLANG_TYPE_MAX)
299 MSG_DEBUG("LANGUAGE [%d] = FALSE", CbPage.pageHeader.langType);
304 bool bAllChannel = false;
305 MsgSettingGetBool(CB_ALL_CHANNEL, &bAllChannel);
307 // Receive All Channel = FALSE
310 MSG_DEBUG("RECEIVE ALL CHANNEL = FALSE");
312 int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
314 bool bActivate = false;
317 for (int i = 0; i < MsgIdCnt; i++)
319 memset(keyName, 0x00, sizeof(keyName));
320 sprintf(keyName, "%s/%d", CB_CHANNEL_ACTIVATE, i);
322 MsgSettingGetBool(keyName, &bActivate);
324 memset(keyName, 0x00, sizeof(keyName));
325 sprintf(keyName, "%s/%d", CB_CHANNEL_ID, i);
327 MsgId = MsgSettingGetInt(keyName);
329 if (bActivate == true && CbPage.pageHeader.msgId == MsgId)
331 MSG_DEBUG("FIND CHANNEL = [%d]", MsgId);
336 else // Receive All Channel = TRUE
338 MSG_DEBUG("RECEIVE ALL CHANNEL = TRUE");
346 unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S CbPage)
348 unsigned char currPageCnt = 0;
352 if (CbPage.pageHeader.totalPages > 1)
354 for (unsigned int i = 0; i < pageList.size(); i++)
356 if (pageList[i].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage.pageHeader.serialNum.msgCode)
358 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
360 if (pageList[i].msgId == CbPage.pageHeader.msgId)
362 int updateNum = CbPage.pageHeader.serialNum.updateNum - pageList[i].updateNum;
364 if (updateNum > 0) // New Message Content
368 else if (updateNum == 0) // Same Message Content
370 if (pageList[i].data.count(CbPage.pageHeader.page) != 0)
372 MSG_DEBUG("The Page Number already exists [%d]", CbPage.pageHeader.page);
376 pair<unsigned char, string> newData(CbPage.pageHeader.page, CbPage.pageData);
377 pageList[i].data.insert(newData);
379 MSG_DEBUG("PAGE DATA : %s", CbPage.pageData);
380 MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.c_str());
382 pageList[i].pageCnt++;
383 pageList[i].totalSize += CbPage.pageLength;
385 currPageCnt = pageList[i].pageCnt;
391 else // Old Message Content
400 if (bFind == false || CbPage.pageHeader.totalPages == 1)
402 addToPageLiat(CbPage);
410 void SmsPluginCbMsgHandler::MakeCbMsg(SMS_CBMSG_PAGE_S CbPage, SMS_CBMSG_S *pCbMsg)
412 pCbMsg->cbMsgType = CbPage.cbMsgType;
413 pCbMsg->msgId = CbPage.pageHeader.msgId;
414 pCbMsg->classType = CbPage.pageHeader.dcs.classType;
415 pCbMsg->codingScheme = CbPage.pageHeader.dcs.codingScheme;
416 pCbMsg->recvTime = CbPage.pageHeader.recvTime;
418 cbPageMap::iterator it;
421 for (unsigned int i = 0; i < pageList.size(); i++)
423 if (pageList[i].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage.pageHeader.serialNum.msgCode)
425 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
427 if (pageList[i].msgId == CbPage.pageHeader.msgId)
429 for (it = pageList[i].data.begin(); it != pageList[i].data.end(); it++)
431 tmpStr += it->second;
437 pCbMsg->msgLength = tmpStr.size();
439 memcpy(pCbMsg->msgData, tmpStr.c_str(), tmpStr.size());
440 pCbMsg->msgData[tmpStr.size()] = '\0';
442 MSG_DEBUG("SIZE : [%d] TOTAL MSG : %s", tmpStr.size(), tmpStr.c_str());
446 void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S cbMsg, MSG_MESSAGE_INFO_S *pMsgInfo)
448 pMsgInfo->msgId = (msg_message_id_t)cbMsg.msgId;
450 pMsgInfo->folderId = MSG_CBMSGBOX_ID;
452 // Convert Type values
453 pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
455 if (cbMsg.cbMsgType == SMS_CBMSG_TYPE_CBS)
456 pMsgInfo->msgType.subType = MSG_CB_SMS;
457 else if (cbMsg.cbMsgType == SMS_CBMSG_TYPE_JAVACBS)
458 pMsgInfo->msgType.subType = MSG_JAVACB_SMS;
460 switch(cbMsg.classType)
462 case SMS_MSG_CLASS_0:
463 pMsgInfo->msgType.classType = MSG_CLASS_0;
465 case SMS_MSG_CLASS_1:
466 pMsgInfo->msgType.classType = MSG_CLASS_1;
468 case SMS_MSG_CLASS_2:
469 pMsgInfo->msgType.classType = MSG_CLASS_2;
471 case SMS_MSG_CLASS_3:
472 pMsgInfo->msgType.classType = MSG_CLASS_3;
475 pMsgInfo->msgType.classType = MSG_CLASS_NONE;
478 pMsgInfo->storageId = MSG_STORAGE_PHONE;
479 pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
480 pMsgInfo->bRead = false;
481 pMsgInfo->bProtected = false;
482 pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
483 pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
486 pMsgInfo->nAddressCnt = 1;
488 pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
489 pMsgInfo->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN;
491 getDisplayName(cbMsg.msgId, pMsgInfo->addressList[0].addressVal);
492 MSG_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
494 pMsgInfo->msgPort.valid = false;
495 pMsgInfo->msgPort.dstPort = 0;
496 pMsgInfo->msgPort.srcPort = 0;
498 pMsgInfo->displayTime = cbMsg.recvTime;
499 MSG_DEBUG("recvTime is %s", ctime(&pMsgInfo->displayTime));
501 int bufSize = cbMsg.msgLength*2;
503 char tmpBuf[bufSize];
504 memset(tmpBuf, 0x00, sizeof(tmpBuf));
506 MSG_DEBUG("LENGTH %d CB MSG %s", cbMsg.msgLength, cbMsg.msgData);
508 SMS_LANG_INFO_S langInfo = {0};
510 langInfo.bSingleShift = false;
511 langInfo.bLockingShift = false;
513 // Convert Data values
514 if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
515 pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
516 else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
517 pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
519 if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN)
521 pMsgInfo->bTextSms = false;
523 // Save Message Data into File
524 char fileName[MAX_COMMON_INFO_SIZE+1];
525 memset(fileName, 0x00, sizeof(fileName));
527 if (MsgCreateFileName(fileName) == false)
528 THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
530 MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsgInfo->dataSize, fileName);
531 if (MsgWriteIpcFile(fileName, tmpBuf, pMsgInfo->dataSize) == false)
532 THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
534 strncpy(pMsgInfo->msgData, fileName, MAX_MSG_DATA_LEN);
538 pMsgInfo->bTextSms = true;
540 memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText));
541 memcpy(pMsgInfo->msgText, tmpBuf, pMsgInfo->dataSize);
546 void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
548 CB_PAGE_INFO_S tmpInfo;
550 tmpInfo.geoScope = CbPage.pageHeader.serialNum.geoScope;
551 tmpInfo.msgCode = CbPage.pageHeader.serialNum.msgCode;
552 tmpInfo.updateNum = CbPage.pageHeader.serialNum.updateNum;
553 tmpInfo.msgId = CbPage.pageHeader.msgId;
554 tmpInfo.totalPages = CbPage.pageHeader.totalPages;
557 tmpInfo.totalSize = CbPage.pageLength;
559 pair<unsigned char, string> newData(CbPage.pageHeader.page, CbPage.pageData);
560 tmpInfo.data.insert(newData);
562 MSG_DEBUG("MSG DATA : %s", CbPage.pageData);
563 MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.c_str());
565 pageList.push_back(tmpInfo);
569 void SmsPluginCbMsgHandler::removeFromPageList(SMS_CBMSG_PAGE_S CbPage)
573 for (index = 0; index < pageList.size(); index++)
575 if (pageList[index].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[index].msgCode == CbPage.pageHeader.serialNum.msgCode)
577 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[index].geoScope, pageList[index].msgCode);
579 if (pageList[index].msgId == CbPage.pageHeader.msgId) break;
583 MSG_DEBUG("remove index [%d]", index);
585 pageList.erase(pageList.begin()+index);
589 void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned char *pMsgData, SMS_CBMSG_DCS_S* pDcs)
591 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
592 pDcs->classType = SMS_MSG_CLASS_NONE;
593 pDcs->bCompressed = false;
594 pDcs->codingScheme = SMS_CHARSET_7BIT;
595 pDcs->langType = SMS_CBMSG_LANG_UNSPECIFIED;
596 memset(pDcs->iso639Lang, 0x00, sizeof(pDcs->iso639Lang));
598 pDcs->rawData = dcsData;
600 unsigned char codingGrp = (dcsData & 0xF0) >> 4;
608 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
609 pDcs->langType = (SMS_CBMSG_LANG_TYPE_T)dcsData;
615 if (dcsData == 0x10 || dcsData == 0x11)
617 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
618 pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
619 pDcs->langType = SMS_CBMSG_LANG_ISO639;
621 if (pMsgData != NULL)
623 pDcs->iso639Lang[0] = pMsgData[0] & 0x7F;
624 pDcs->iso639Lang[1] = (pMsgData[0] & 0x80) >> 7;
625 pDcs->iso639Lang[1] |= (pMsgData[1] & 0x3F) << 1;
626 pDcs->iso639Lang[2] = 0x13; /* CR char in GSM 7-bit Alphabet */
630 /* Default it to English if pMsgData is NULL */
631 pDcs->iso639Lang[0] = 0x45; /* E */
632 pDcs->iso639Lang[1] = 0x4E; /* N */
633 pDcs->iso639Lang[2] = 0x13; /* CR */
644 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
646 pDcs->bCompressed = (dcsData & 0x20) ? true : false;
649 pDcs->classType = (SMS_MSG_CLASS_T)(dcsData & 0x03);
651 pDcs->codingScheme = (SMS_CODING_SCHEME_T)(dcsData & 0x0C);
663 pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP;
669 pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING;
670 pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
671 pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
678 void SmsPluginCbMsgHandler::convertLangType(SMS_CBMSG_LANG_TYPE_T InType , MSG_CB_LANGUAGE_TYPE_T *pOutType)
682 case SMS_CBMSG_LANG_GERMAN :
683 *pOutType = MSG_CBLANG_TYPE_GER;
686 case SMS_CBMSG_LANG_ENGLISH :
687 *pOutType = MSG_CBLANG_TYPE_ENG;
690 case SMS_CBMSG_LANG_ITALIAN :
691 *pOutType = MSG_CBLANG_TYPE_ITA;
694 case SMS_CBMSG_LANG_FRENCH :
695 *pOutType = MSG_CBLANG_TYPE_FRE;
698 case SMS_CBMSG_LANG_SPANISH :
699 *pOutType = MSG_CBLANG_TYPE_SPA;
702 case SMS_CBMSG_LANG_DUTCH :
703 *pOutType = MSG_CBLANG_TYPE_NED;
706 case SMS_CBMSG_LANG_SWEDISH :
707 *pOutType = MSG_CBLANG_TYPE_SWE;
710 case SMS_CBMSG_LANG_PORTUGUESE :
711 *pOutType = MSG_CBLANG_TYPE_POR;
714 case SMS_CBMSG_LANG_TURKISH :
715 *pOutType = MSG_CBLANG_TYPE_TUR;
719 *pOutType = MSG_CBLANG_TYPE_MAX;
725 unsigned long SmsPluginCbMsgHandler::getRecvTime()
729 recvTime = time(NULL);
731 return (unsigned long)recvTime;
735 void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayName)
737 int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
740 char strTmp[CB_CHANNEL_NAME_MAX+1];
742 for (int i = 0; i < MsgIdCnt; i++)
744 memset(keyName, 0x00, sizeof(keyName));
745 sprintf(keyName, "%s/%d", CB_CHANNEL_ID, i);
747 if (MsgId == MsgSettingGetInt(keyName))
749 char *channelName = NULL;
750 MSG_DEBUG("FIND MSG ID = [%d]", MsgId);
752 memset(keyName, 0x00, sizeof(keyName));
753 sprintf(keyName, "%s/%d", CB_CHANNEL_NAME, i);
755 memset(strTmp, 0x00, sizeof(strTmp));
757 channelName = MsgSettingGetString(keyName);
759 strncpy(strTmp, channelName, CB_CHANNEL_NAME_MAX);
766 if (strlen(strTmp) > 0)
767 sprintf(pDisplayName, "[%s]", strTmp);
769 sprintf(pDisplayName, "[%d]", MsgId);
775 sprintf(pDisplayName, "[%d]", MsgId);