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 int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
306 bool bActivate = false;
307 int MsgId_from = 0, MsgId_to = 0;
309 for (int i = 0; i < MsgIdCnt; i++)
311 memset(keyName, 0x00, sizeof(keyName));
312 sprintf(keyName, "%s/%d", CB_CHANNEL_ACTIVATE, i);
314 MsgSettingGetBool(keyName, &bActivate);
316 memset(keyName, 0x00, sizeof(keyName));
317 sprintf(keyName, "%s/%d", CB_CHANNEL_ID_FROM, i);
319 MsgId_from = MsgSettingGetInt(keyName);
321 memset(keyName, 0x00, sizeof(keyName));
322 sprintf(keyName, "%s/%d", CB_CHANNEL_ID_TO, i);
324 MsgId_to = MsgSettingGetInt(keyName);
326 if (bActivate == true && CbPage.pageHeader.msgId >= MsgId_from && CbPage.pageHeader.msgId <= MsgId_to)
328 MSG_DEBUG("FIND CHANNEL = [%d]", CbPage.pageHeader.msgId);
337 unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S CbPage)
339 unsigned char currPageCnt = 0;
343 if (CbPage.pageHeader.totalPages > 1)
345 for (unsigned int i = 0; i < pageList.size(); i++)
347 if (pageList[i].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage.pageHeader.serialNum.msgCode)
349 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
351 if (pageList[i].msgId == CbPage.pageHeader.msgId)
353 int updateNum = CbPage.pageHeader.serialNum.updateNum - pageList[i].updateNum;
355 if (updateNum > 0) // New Message Content
359 else if (updateNum == 0) // Same Message Content
361 if (pageList[i].data.count(CbPage.pageHeader.page) != 0)
363 MSG_DEBUG("The Page Number already exists [%d]", CbPage.pageHeader.page);
367 pair<unsigned char, string> newData(CbPage.pageHeader.page, CbPage.pageData);
368 pageList[i].data.insert(newData);
370 MSG_DEBUG("PAGE DATA : %s", CbPage.pageData);
371 MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.c_str());
373 pageList[i].pageCnt++;
374 pageList[i].totalSize += CbPage.pageLength;
376 currPageCnt = pageList[i].pageCnt;
382 else // Old Message Content
391 if (bFind == false || CbPage.pageHeader.totalPages == 1)
393 addToPageLiat(CbPage);
401 void SmsPluginCbMsgHandler::MakeCbMsg(SMS_CBMSG_PAGE_S CbPage, SMS_CBMSG_S *pCbMsg)
403 pCbMsg->cbMsgType = CbPage.cbMsgType;
404 pCbMsg->msgId = CbPage.pageHeader.msgId;
405 pCbMsg->classType = CbPage.pageHeader.dcs.classType;
406 pCbMsg->codingScheme = CbPage.pageHeader.dcs.codingScheme;
407 pCbMsg->recvTime = CbPage.pageHeader.recvTime;
409 cbPageMap::iterator it;
412 for (unsigned int i = 0; i < pageList.size(); i++)
414 if (pageList[i].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage.pageHeader.serialNum.msgCode)
416 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
418 if (pageList[i].msgId == CbPage.pageHeader.msgId)
420 for (it = pageList[i].data.begin(); it != pageList[i].data.end(); it++)
422 tmpStr += it->second;
428 pCbMsg->msgLength = tmpStr.size();
430 memcpy(pCbMsg->msgData, tmpStr.c_str(), tmpStr.size());
431 pCbMsg->msgData[tmpStr.size()] = '\0';
433 MSG_DEBUG("SIZE : [%d] TOTAL MSG : %s", tmpStr.size(), tmpStr.c_str());
437 void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S cbMsg, MSG_MESSAGE_INFO_S *pMsgInfo)
439 pMsgInfo->msgId = (msg_message_id_t)cbMsg.msgId;
441 pMsgInfo->folderId = MSG_CBMSGBOX_ID;
443 // Convert Type values
444 pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
446 if (cbMsg.cbMsgType == SMS_CBMSG_TYPE_CBS)
447 pMsgInfo->msgType.subType = MSG_CB_SMS;
448 else if (cbMsg.cbMsgType == SMS_CBMSG_TYPE_JAVACBS)
449 pMsgInfo->msgType.subType = MSG_JAVACB_SMS;
451 switch(cbMsg.classType)
453 case SMS_MSG_CLASS_0:
454 pMsgInfo->msgType.classType = MSG_CLASS_0;
456 case SMS_MSG_CLASS_1:
457 pMsgInfo->msgType.classType = MSG_CLASS_1;
459 case SMS_MSG_CLASS_2:
460 pMsgInfo->msgType.classType = MSG_CLASS_2;
462 case SMS_MSG_CLASS_3:
463 pMsgInfo->msgType.classType = MSG_CLASS_3;
466 pMsgInfo->msgType.classType = MSG_CLASS_NONE;
469 pMsgInfo->storageId = MSG_STORAGE_PHONE;
470 pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
471 pMsgInfo->bRead = false;
472 pMsgInfo->bProtected = false;
473 pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
474 pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
477 pMsgInfo->nAddressCnt = 1;
479 pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
480 pMsgInfo->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN;
482 getDisplayName(cbMsg.msgId, pMsgInfo->addressList[0].addressVal);
483 MSG_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
485 pMsgInfo->msgPort.valid = false;
486 pMsgInfo->msgPort.dstPort = 0;
487 pMsgInfo->msgPort.srcPort = 0;
489 pMsgInfo->displayTime = cbMsg.recvTime;
490 MSG_DEBUG("recvTime is %s", ctime(&pMsgInfo->displayTime));
492 int bufSize = cbMsg.msgLength*2;
494 char tmpBuf[bufSize];
495 memset(tmpBuf, 0x00, sizeof(tmpBuf));
497 MSG_DEBUG("LENGTH %d CB MSG %s", cbMsg.msgLength, cbMsg.msgData);
499 SMS_LANG_INFO_S langInfo = {0};
501 langInfo.bSingleShift = false;
502 langInfo.bLockingShift = false;
504 // Convert Data values
505 if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
506 pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
507 else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
508 pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
510 if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN)
512 pMsgInfo->bTextSms = false;
514 // Save Message Data into File
515 char fileName[MAX_COMMON_INFO_SIZE+1];
516 memset(fileName, 0x00, sizeof(fileName));
518 if (MsgCreateFileName(fileName) == false)
519 THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
521 MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsgInfo->dataSize, fileName);
522 if (MsgWriteIpcFile(fileName, tmpBuf, pMsgInfo->dataSize) == false)
523 THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
525 strncpy(pMsgInfo->msgData, fileName, MAX_MSG_DATA_LEN);
529 pMsgInfo->bTextSms = true;
531 memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText));
532 memcpy(pMsgInfo->msgText, tmpBuf, pMsgInfo->dataSize);
537 void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
539 CB_PAGE_INFO_S tmpInfo;
541 tmpInfo.geoScope = CbPage.pageHeader.serialNum.geoScope;
542 tmpInfo.msgCode = CbPage.pageHeader.serialNum.msgCode;
543 tmpInfo.updateNum = CbPage.pageHeader.serialNum.updateNum;
544 tmpInfo.msgId = CbPage.pageHeader.msgId;
545 tmpInfo.totalPages = CbPage.pageHeader.totalPages;
548 tmpInfo.totalSize = CbPage.pageLength;
550 pair<unsigned char, string> newData(CbPage.pageHeader.page, CbPage.pageData);
551 tmpInfo.data.insert(newData);
553 MSG_DEBUG("MSG DATA : %s", CbPage.pageData);
554 MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.c_str());
556 pageList.push_back(tmpInfo);
560 void SmsPluginCbMsgHandler::removeFromPageList(SMS_CBMSG_PAGE_S CbPage)
564 for (index = 0; index < pageList.size(); index++)
566 if (pageList[index].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[index].msgCode == CbPage.pageHeader.serialNum.msgCode)
568 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[index].geoScope, pageList[index].msgCode);
570 if (pageList[index].msgId == CbPage.pageHeader.msgId) break;
574 MSG_DEBUG("remove index [%d]", index);
576 pageList.erase(pageList.begin()+index);
580 void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned char *pMsgData, SMS_CBMSG_DCS_S* pDcs)
582 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
583 pDcs->classType = SMS_MSG_CLASS_NONE;
584 pDcs->bCompressed = false;
585 pDcs->codingScheme = SMS_CHARSET_7BIT;
586 pDcs->langType = SMS_CBMSG_LANG_UNSPECIFIED;
587 memset(pDcs->iso639Lang, 0x00, sizeof(pDcs->iso639Lang));
589 pDcs->rawData = dcsData;
591 unsigned char codingGrp = (dcsData & 0xF0) >> 4;
599 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
600 pDcs->langType = (SMS_CBMSG_LANG_TYPE_T)dcsData;
606 if (dcsData == 0x10 || dcsData == 0x11)
608 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
609 pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
610 pDcs->langType = SMS_CBMSG_LANG_ISO639;
612 if (pMsgData != NULL)
614 pDcs->iso639Lang[0] = pMsgData[0] & 0x7F;
615 pDcs->iso639Lang[1] = (pMsgData[0] & 0x80) >> 7;
616 pDcs->iso639Lang[1] |= (pMsgData[1] & 0x3F) << 1;
617 pDcs->iso639Lang[2] = 0x13; /* CR char in GSM 7-bit Alphabet */
621 /* Default it to English if pMsgData is NULL */
622 pDcs->iso639Lang[0] = 0x45; /* E */
623 pDcs->iso639Lang[1] = 0x4E; /* N */
624 pDcs->iso639Lang[2] = 0x13; /* CR */
635 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
637 pDcs->bCompressed = (dcsData & 0x20) ? true : false;
640 pDcs->classType = (SMS_MSG_CLASS_T)(dcsData & 0x03);
642 pDcs->codingScheme = (SMS_CODING_SCHEME_T)(dcsData & 0x0C);
654 pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP;
660 pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING;
661 pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
662 pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
669 void SmsPluginCbMsgHandler::convertLangType(SMS_CBMSG_LANG_TYPE_T InType , MSG_CB_LANGUAGE_TYPE_T *pOutType)
673 case SMS_CBMSG_LANG_GERMAN :
674 *pOutType = MSG_CBLANG_TYPE_GER;
677 case SMS_CBMSG_LANG_ENGLISH :
678 *pOutType = MSG_CBLANG_TYPE_ENG;
681 case SMS_CBMSG_LANG_ITALIAN :
682 *pOutType = MSG_CBLANG_TYPE_ITA;
685 case SMS_CBMSG_LANG_FRENCH :
686 *pOutType = MSG_CBLANG_TYPE_FRE;
689 case SMS_CBMSG_LANG_SPANISH :
690 *pOutType = MSG_CBLANG_TYPE_SPA;
693 case SMS_CBMSG_LANG_DUTCH :
694 *pOutType = MSG_CBLANG_TYPE_NED;
697 case SMS_CBMSG_LANG_SWEDISH :
698 *pOutType = MSG_CBLANG_TYPE_SWE;
701 case SMS_CBMSG_LANG_PORTUGUESE :
702 *pOutType = MSG_CBLANG_TYPE_POR;
705 case SMS_CBMSG_LANG_TURKISH :
706 *pOutType = MSG_CBLANG_TYPE_TUR;
710 *pOutType = MSG_CBLANG_TYPE_MAX;
716 unsigned long SmsPluginCbMsgHandler::getRecvTime()
720 recvTime = time(NULL);
722 return (unsigned long)recvTime;
726 void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayName)
728 int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
733 char strTmp[CB_CHANNEL_NAME_MAX+1];
735 for (int i = 0; i < MsgIdCnt; i++)
737 memset(from, 0x00, sizeof(from));
738 sprintf(from, "%s/%d", CB_CHANNEL_ID_FROM, i);
740 memset(to, 0x00, sizeof(to));
741 sprintf(to, "%s/%d", CB_CHANNEL_ID_TO, i);
743 if (MsgId >= MsgSettingGetInt(from) && MsgId <= MsgSettingGetInt(to))
745 char *channelName = NULL;
746 MSG_DEBUG("FIND MSG ID = [%d]", MsgId);
748 memset(keyName, 0x00, sizeof(keyName));
749 sprintf(keyName, "%s/%d", CB_CHANNEL_NAME, i);
751 memset(strTmp, 0x00, sizeof(strTmp));
753 channelName = MsgSettingGetString(keyName);
755 strncpy(strTmp, channelName, CB_CHANNEL_NAME_MAX);
762 if (strlen(strTmp) > 0)
763 sprintf(pDisplayName, "[%s]", strTmp);
765 sprintf(pDisplayName, "[%d]", MsgId);
767 sprintf(pDisplayName, "[%d]", MsgId);
774 sprintf(pDisplayName, "[%d]", MsgId);