Modify flora license version.
[platform/core/messaging/msg-service.git] / framework / setting-handler / MsgSettingHandler.cpp
1 /*
2 * Copyright 2012-2013  Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.1 (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
7 *
8 *    http://floralicense.org/license/
9 *
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.
15 */
16
17 #include "MsgDebug.h"
18 #include "MsgPluginManager.h"
19 #include "MsgSettingHandler.h"
20 #include "MsgGconfWrapper.h"
21
22
23 #define DEF_BUF_LEN     128
24
25 /*==================================================================================================
26                                                                 STATIC FUNCTION PROTOTYPES
27 ==================================================================================================*/
28
29 /*==================================================================================================
30                                      FUNCTION IMPLEMENTATION
31 ==================================================================================================*/
32 msg_error_t MsgInitSimConfig(MSG_SIM_STATUS_T SimStatus)
33 {
34         MSG_DEBUG("Start to initialize SIM Configuration");
35
36         msg_error_t err = MSG_SUCCESS;
37
38         if (SimStatus != MSG_SIM_STATUS_NOT_FOUND)
39         {
40                 MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE;
41                 MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType);
42
43                 if (plg == NULL)
44                 {
45                         MSG_DEBUG("No plugin for %d type", mainType);
46                         return MSG_ERR_INVALID_PLUGIN_HANDLE;
47                 }
48
49                 // Check SIM Status
50                 MSG_DEBUG(" ** SIM is available - status : [%d] ** ", SimStatus);
51
52                 err = plg->initConfigData(SimStatus);
53         }
54
55         return err;
56 }
57
58
59 msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting)
60 {
61         msg_error_t err = MSG_SUCCESS;
62
63 #ifdef USE_GCONF
64         err = MsgGconfGetClient();
65
66         if (err != MSG_SUCCESS)
67         {
68                 MSG_DEBUG("Get GConf Client Error");
69                 return MSG_ERR_NULL_POINTER;
70         }
71 #endif
72
73         MSG_DEBUG("Setting Type : %d", pSetting->type);
74
75         switch (pSetting->type)
76         {
77                 case MSG_GENERAL_OPT :
78                         err = MsgSetGeneralOpt(pSetting);
79                         break;
80                 case MSG_SMS_SENDOPT :
81                         err = MsgSetSMSSendOpt(pSetting);
82                         break;
83                 case MSG_SMSC_LIST :
84                         err = MsgSetSMSCList(pSetting, true);
85                         break;
86                 case MSG_MMS_SENDOPT :
87                         err = MsgSetMMSSendOpt(pSetting);
88                         break;
89                 case MSG_MMS_RECVOPT :
90                         err = MsgSetMMSRecvOpt(pSetting);
91                         break;
92                 case MSG_MMS_STYLEOPT :
93                         err = MsgSetMMSStyleOpt(pSetting);
94                         break;
95                 case MSG_PUSHMSG_OPT :
96                         err = MsgSetPushMsgOpt(pSetting);
97                         break;
98                 case MSG_CBMSG_OPT :
99                         err = MsgSetCBMsgOpt(pSetting, true);
100                         break;
101                 case MSG_VOICEMAIL_OPT :
102                         err = MsgSetVoiceMailOpt(pSetting, true);
103                         break;
104                 case MSG_MSGSIZE_OPT:
105                         err = MsgSetMsgSizeOpt(pSetting);
106                         break;
107                 default :
108                         break;
109         }
110
111 #ifdef USE_GCONF
112         MsgGconfUnrefClient();
113 #endif
114
115         return err;
116 }
117
118
119 msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting)
120 {
121 #ifdef USE_GCONF
122         msg_error_t err = MsgGconfGetClient();
123
124         if (err != MSG_SUCCESS)
125         {
126                 MSG_DEBUG("Get GConf Client Error");
127                 return MSG_ERR_NULL_POINTER;
128         }
129 #endif
130
131         // Check SIM is present or not
132         MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
133
134         switch (pSetting->type)
135         {
136                 case MSG_GENERAL_OPT :
137                         MsgGetGeneralOpt(pSetting);
138                         break;
139                 case MSG_SMS_SENDOPT :
140                         MsgGetSMSSendOpt(pSetting);
141                         break;
142                 case MSG_SMSC_LIST :
143                 {
144                         if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
145                                 MSG_DEBUG("SIM is not present..");
146                                 return MSG_ERR_NO_SIM;
147                         }
148                         MsgGetSMSCList(pSetting);
149                 }
150                 break;
151                 case MSG_MMS_SENDOPT :
152                         MsgGetMMSSendOpt(pSetting);
153                         break;
154                 case MSG_MMS_RECVOPT :
155                         MsgGetMMSRecvOpt(pSetting);
156                         break;
157                 case MSG_MMS_STYLEOPT :
158                         MsgGetMMSStyleOpt(pSetting);
159                         break;
160                 case MSG_PUSHMSG_OPT :
161                         MsgGetPushMsgOpt(pSetting);
162                         break;
163                 case MSG_CBMSG_OPT :
164                 {
165                         if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
166                                 MSG_DEBUG("SIM is not present..");
167                                 return MSG_ERR_NO_SIM;
168                         }
169                         MsgGetCBMsgOpt(pSetting);
170                 }
171                 break;
172                 case MSG_VOICEMAIL_OPT :
173                         MsgGetVoiceMailOpt(pSetting);
174                         break;
175                 case MSG_MSGSIZE_OPT :
176                         MsgGetMsgSizeOpt(pSetting);
177                         break;
178
179                 default :
180                         break;
181         }
182
183 #ifdef USE_GCONF
184         MsgGconfUnrefClient();
185 #endif
186
187         return MSG_SUCCESS;
188 }
189
190
191 msg_error_t MsgSetGeneralOpt(const MSG_SETTING_S *pSetting)
192 {
193         MSG_GENERAL_OPT_S generalOpt;
194         bool bValue = false;
195
196         memcpy(&generalOpt, &(pSetting->option.generalOpt), sizeof(MSG_GENERAL_OPT_S));
197
198         MsgSettingGetBool(MSG_KEEP_COPY, &bValue);
199         if (bValue != generalOpt.bKeepCopy) {
200                 if (MsgSettingSetBool(MSG_KEEP_COPY, generalOpt.bKeepCopy) != MSG_SUCCESS) {
201                         MSG_DEBUG("Error to set config data [%s]", MSG_KEEP_COPY);
202                         return MSG_ERR_SET_SETTING;
203                 }
204         }
205
206         MsgSettingGetBool(MSG_AUTO_ERASE, &bValue);
207         if (bValue != generalOpt.bAutoErase) {
208                 if (MsgSettingSetBool(MSG_AUTO_ERASE, generalOpt.bAutoErase) != MSG_SUCCESS) {
209                         MSG_DEBUG("Error to set config data [%s]", MSG_AUTO_ERASE);
210                         return MSG_ERR_SET_SETTING;
211                 }
212         }
213
214 #ifdef  __NOT_USED_BY_DESIGN_CHANGE__
215         iValue = MsgSettingGetInt(MSG_ALERT_TONE);
216         if (iValue != (int)generalOpt.alertTone) {
217                 if (MsgSettingSetInt(MSG_ALERT_TONE, (int)generalOpt.alertTone) != MSG_SUCCESS) {
218                         MSG_DEBUG("Error to set config data [%s]", MSG_ALERT_TONE);
219                         return MSG_ERR_SET_SETTING;
220                 }
221         }
222 #endif  /* __NOT_USED_BY_DESIGN_CHANGE__ */
223
224         return MSG_SUCCESS;
225 }
226
227
228 msg_error_t MsgSetSMSSendOpt(const MSG_SETTING_S *pSetting)
229 {
230         MSG_SMS_SENDOPT_S sendOpt;
231         int iValue = 0;
232         bool bValue = false;
233
234         memcpy(&sendOpt, &(pSetting->option.smsSendOpt), sizeof(MSG_SMS_SENDOPT_S));
235
236         iValue = MsgSettingGetInt(SMS_SEND_DCS);
237         if (iValue != (int)sendOpt.dcs) {
238                 if (MsgSettingSetInt(SMS_SEND_DCS, (int)sendOpt.dcs) != MSG_SUCCESS) {
239                         MSG_DEBUG("Error to set config data [%s]", SMS_SEND_DCS);
240                         return MSG_ERR_SET_SETTING;
241                 }
242         }
243
244         iValue = MsgSettingGetInt(SMS_SEND_NETWORK_MODE);
245         if (iValue != (int)sendOpt.netMode) {
246                 if (MsgSettingSetInt(SMS_SEND_NETWORK_MODE, (int)sendOpt.netMode) != MSG_SUCCESS) {
247                         MSG_DEBUG("Error to set config data [%s]", SMS_SEND_NETWORK_MODE);
248                         return MSG_ERR_SET_SETTING;
249                 }
250         }
251
252         MsgSettingGetBool(SMS_SEND_REPLY_PATH, &bValue);
253         if (bValue != sendOpt.bReplyPath) {
254                 if (MsgSettingSetBool(SMS_SEND_REPLY_PATH, sendOpt.bReplyPath) != MSG_SUCCESS) {
255                         MSG_DEBUG("Error to set config data [%s]", SMS_SEND_REPLY_PATH);
256                         return MSG_ERR_SET_SETTING;
257                 }
258         }
259
260         MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &bValue);
261         if (bValue != sendOpt.bDeliveryReport) {
262                 if (MsgSettingSetBool(SMS_SEND_DELIVERY_REPORT, sendOpt.bDeliveryReport) != MSG_SUCCESS) {
263                         MSG_DEBUG("Error to set config data [%s]", SMS_SEND_DELIVERY_REPORT);
264                         return MSG_ERR_SET_SETTING;
265                 }
266         }
267
268         iValue = MsgSettingGetInt(SMS_SEND_SAVE_STORAGE);
269         if (iValue != (int)sendOpt.saveStorage) {
270                 if (MsgSettingSetInt(SMS_SEND_SAVE_STORAGE, (int)sendOpt.saveStorage) != MSG_SUCCESS) {
271                         MSG_DEBUG("Error to set config data [%s]", SMS_SEND_SAVE_STORAGE);
272                         return MSG_ERR_SET_SETTING;
273                 }
274         }
275
276         return MSG_SUCCESS;
277 }
278
279
280 msg_error_t MsgSetSMSCList(const MSG_SETTING_S *pSetting, bool bSetSim)
281 {
282         msg_error_t err = MSG_SUCCESS;
283
284         for (int index = 0; index < pSetting->option.smscList.totalCnt; index++)
285         {
286                 if(strlen(pSetting->option.smscList.smscData[index].smscAddr.address) > SMSC_ADDR_MAX)
287                 {
288                         MSG_DEBUG("SMSC address is too long [%d]", strlen(pSetting->option.smscList.smscData[index].smscAddr.address));
289                         return MSG_ERR_SET_SIM_SET;
290                 }
291         }
292
293         if (bSetSim == true)
294         {
295                 err = MsgSetConfigInSim(pSetting);
296
297                 if (err != MSG_SUCCESS)
298                 {
299                         MSG_DEBUG("Error to set config data in sim [%d]", err);
300                         return err;
301                 }
302         }
303
304         MSG_SMSC_LIST_S smscList;
305
306         memcpy(&smscList, &(pSetting->option.smscList), sizeof(MSG_SMSC_LIST_S));
307
308         char keyName[DEF_BUF_LEN] = {0, };
309
310         // No selected SMSC Info. in SIM.
311         if (bSetSim == true)
312         {
313                 if (MsgSettingSetInt(SMSC_SELECTED, smscList.selected) != MSG_SUCCESS)
314                 {
315                         MSG_DEBUG("Error to set config data [%s]", SMSC_SELECTED);
316                         return MSG_ERR_SET_SETTING;
317                 }
318         }
319
320         if (MsgSettingSetInt(SMSC_TOTAL_COUNT, smscList.totalCnt) != MSG_SUCCESS)
321         {
322                 MSG_DEBUG("Error to set config data [%s]", SMSC_TOTAL_COUNT);
323                 return MSG_ERR_SET_SETTING;
324         }
325
326         for (int i = 0; i < smscList.totalCnt; i++)
327         {
328                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_PID, i);
329
330                 if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].pid)) != MSG_SUCCESS)
331                         break;
332
333                 memset(keyName, 0x00, sizeof(keyName));
334                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_VAL_PERIOD, i);
335
336                 if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].valPeriod)) != MSG_SUCCESS)
337                         break;
338
339                 memset(keyName, 0x00, sizeof(keyName));
340                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NAME, i);
341
342                 if ((err = MsgSettingSetString(keyName, smscList.smscData[i].name)) != MSG_SUCCESS)
343                         break;
344
345                 memset(keyName, 0x00, sizeof(keyName));
346                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_TON, i);
347
348                 if (smscList.smscData[i].smscAddr.address[0] == '+')
349                         smscList.smscData[i].smscAddr.ton = MSG_TON_INTERNATIONAL;
350                 else
351                         smscList.smscData[i].smscAddr.ton = MSG_TON_NATIONAL;
352
353                 if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].smscAddr.ton)) != MSG_SUCCESS)
354                         break;
355
356                 memset(keyName, 0x00, sizeof(keyName));
357                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NPI, i);
358
359                 smscList.smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value
360
361                 if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].smscAddr.npi)) != MSG_SUCCESS)
362                         break;
363
364                 memset(keyName, 0x00, sizeof(keyName));
365                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_ADDRESS, i);
366
367                 if ((err = MsgSettingSetString(keyName, smscList.smscData[i].smscAddr.address)) != MSG_SUCCESS)
368                         break;
369         }
370
371         if (err != MSG_SUCCESS)
372         {
373                 MSG_DEBUG("Error to set config data [%s]", keyName);
374         }
375
376         return err;
377 }
378
379
380 msg_error_t MsgSetMMSSendOpt(const MSG_SETTING_S *pSetting)
381 {
382         MSG_MMS_SENDOPT_S sendOpt;
383         int iValue = 0;
384         bool bValue = false;
385
386         memcpy(&sendOpt, &(pSetting->option.mmsSendOpt), sizeof(MSG_MMS_SENDOPT_S));
387
388         iValue = MsgSettingGetInt(MMS_SEND_MSG_CLASS);
389         if (iValue != (int)sendOpt.msgClass) {
390                 if (MsgSettingSetInt(MMS_SEND_MSG_CLASS, (int)sendOpt.msgClass) != MSG_SUCCESS) {
391                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_MSG_CLASS);
392                         return MSG_ERR_SET_SETTING;
393                 }
394         }
395
396         iValue = MsgSettingGetInt(MMS_SEND_PRIORITY);
397         if (iValue != (int)sendOpt.priority) {
398                 if (MsgSettingSetInt(MMS_SEND_PRIORITY, (int)sendOpt.priority) != MSG_SUCCESS) {
399                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_PRIORITY);
400                         return MSG_ERR_SET_SETTING;
401                 }
402         }
403
404         iValue = MsgSettingGetInt(MMS_SEND_EXPIRY_TIME);
405         if (iValue != (int)sendOpt.expiryTime) {
406                 if (MsgSettingSetInt(MMS_SEND_EXPIRY_TIME, (int)sendOpt.expiryTime) != MSG_SUCCESS) {
407                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_EXPIRY_TIME);
408                         return MSG_ERR_SET_SETTING;
409                 }
410         }
411
412         iValue = MsgSettingGetInt(MMS_SEND_DELIVERY_TIME);
413         if (iValue != (int)sendOpt.deliveryTime) {
414                 if (MsgSettingSetInt(MMS_SEND_DELIVERY_TIME, (int)sendOpt.deliveryTime) != MSG_SUCCESS) {
415                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_DELIVERY_TIME);
416                         return MSG_ERR_SET_SETTING;
417                 }
418         }
419
420         iValue = MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY);
421         if (iValue != (int)sendOpt.customDeliveryTime) {
422                 if (MsgSettingSetInt(MMS_SEND_CUSTOM_DELIVERY, sendOpt.customDeliveryTime) != MSG_SUCCESS) {
423                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_CUSTOM_DELIVERY);
424                         return MSG_ERR_SET_SETTING;
425                 }
426         }
427
428         MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &bValue);
429         if (bValue != sendOpt.bSenderVisibility) {
430                 if (MsgSettingSetBool(MMS_SEND_SENDER_VISIBILITY, sendOpt.bSenderVisibility) != MSG_SUCCESS) {
431                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_SENDER_VISIBILITY);
432                         return MSG_ERR_SET_SETTING;
433                 }
434         }
435
436         MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &bValue);
437         if (bValue != sendOpt.bDeliveryReport) {
438                 if (MsgSettingSetBool(MMS_SEND_DELIVERY_REPORT, sendOpt.bDeliveryReport) != MSG_SUCCESS) {
439                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_DELIVERY_REPORT);
440                         return MSG_ERR_SET_SETTING;
441                 }
442         }
443
444         MsgSettingGetBool(MMS_SEND_READ_REPLY, &bValue);
445         if (bValue != sendOpt.bReadReply) {
446                 if (MsgSettingSetBool(MMS_SEND_READ_REPLY, sendOpt.bReadReply) != MSG_SUCCESS) {
447                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_READ_REPLY);
448                         return MSG_ERR_SET_SETTING;
449                 }
450         }
451 #ifdef  __NOT_USED_BY_DESIGN_CHANGE__
452         if (MsgSettingSetBool(MMS_SEND_KEEP_COPY, sendOpt.bKeepCopy) != MSG_SUCCESS)
453         {
454                 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_KEEP_COPY);
455                 return MSG_ERR_SET_SETTING;
456         }
457 #endif  /* __NOT_USED_BY_DESIGN_CHANGE__ */
458
459         MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &bValue);
460         if (bValue != sendOpt.bBodyReplying) {
461                 if (MsgSettingSetBool(MMS_SEND_BODY_REPLYING, sendOpt.bBodyReplying) != MSG_SUCCESS) {
462                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_BODY_REPLYING);
463                         return MSG_ERR_SET_SETTING;
464                 }
465         }
466
467         MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &bValue);
468         if (bValue != sendOpt.bHideRecipients) {
469                 if (MsgSettingSetBool(MMS_SEND_HIDE_RECIPIENTS, sendOpt.bHideRecipients) != MSG_SUCCESS)
470                 {
471                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_HIDE_RECIPIENTS);
472                         return MSG_ERR_SET_SETTING;
473                 }
474         }
475
476         iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING);
477         if (iValue != sendOpt.replyCharging) {
478                 if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING, sendOpt.replyCharging) != MSG_SUCCESS) {
479                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING);
480                         return MSG_ERR_SET_SETTING;
481                 }
482         }
483
484         iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE);
485         if (iValue != (int)sendOpt.replyChargingDeadline) {
486                 if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_DEADLINE, sendOpt.replyChargingDeadline) != MSG_SUCCESS) {
487                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING_DEADLINE);
488                         return MSG_ERR_SET_SETTING;
489                 }
490         }
491
492         iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE);
493         if (iValue != (int)sendOpt.replyChargingSize) {
494                 if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_SIZE, sendOpt.replyChargingSize) != MSG_SUCCESS) {
495                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING_SIZE);
496                         return MSG_ERR_SET_SETTING;
497                 }
498         }
499
500         iValue = MsgSettingGetInt(MMS_SEND_CREATION_MODE);
501         if (iValue != sendOpt.creationMode) {
502                 if (MsgSettingSetInt(MMS_SEND_CREATION_MODE, sendOpt.creationMode) != MSG_SUCCESS) {
503                         MSG_DEBUG("Error to set config data [%s]", MMS_SEND_CREATION_MODE);
504                         return MSG_ERR_SET_SETTING;
505                 }
506         }
507
508         return MSG_SUCCESS;
509 }
510
511
512 msg_error_t MsgSetMMSRecvOpt(const MSG_SETTING_S *pSetting)
513 {
514         MSG_MMS_RECVOPT_S recvOpt;
515         int iValue = 0;
516         bool bValue = false;
517
518         memcpy(&recvOpt, &(pSetting->option.mmsRecvOpt), sizeof(MSG_MMS_RECVOPT_S));
519
520         iValue = MsgSettingGetInt(MMS_RECV_HOME_NETWORK);
521         if (iValue != (int)recvOpt.homeNetwork) {
522                 if (MsgSettingSetInt(MMS_RECV_HOME_NETWORK, (int)recvOpt.homeNetwork) != MSG_SUCCESS) {
523                         MSG_DEBUG("Error to set config data [%s]", MMS_RECV_HOME_NETWORK);
524                         return MSG_ERR_SET_SETTING;
525                 }
526         }
527
528         iValue = MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK);
529         if (iValue != (int)recvOpt.abroadNetwok) {
530                 if (MsgSettingSetInt(MMS_RECV_ABROAD_NETWORK, (int)recvOpt.abroadNetwok) != MSG_SUCCESS) {
531                         MSG_DEBUG("Error to set config data [%s]", MMS_RECV_ABROAD_NETWORK);
532                         return MSG_ERR_SET_SETTING;
533                 }
534         }
535
536         MsgSettingGetBool(MMS_RECV_READ_RECEIPT, &bValue);
537         if (bValue != recvOpt.readReceipt) {
538                 if (MsgSettingSetBool(MMS_RECV_READ_RECEIPT, recvOpt.readReceipt) != MSG_SUCCESS) {
539                         MSG_DEBUG("Error to set config data [%s]", MMS_RECV_READ_RECEIPT);
540                         return MSG_ERR_SET_SETTING;
541                 }
542         }
543
544         MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &bValue);
545         if (bValue != recvOpt.bDeliveryReceipt) {
546                 if (MsgSettingSetBool(MMS_RECV_DELIVERY_RECEIPT, recvOpt.bDeliveryReceipt) != MSG_SUCCESS) {
547                         MSG_DEBUG("Error to set config data [%s]", MMS_RECV_DELIVERY_RECEIPT);
548                         return MSG_ERR_SET_SETTING;
549                 }
550         }
551
552         MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bValue);
553         if (bValue != recvOpt.bRejectUnknown) {
554                 if (MsgSettingSetBool(MMS_RECV_REJECT_UNKNOWN, recvOpt.bRejectUnknown) != MSG_SUCCESS) {
555                         MSG_DEBUG("Error to set config data [%s]", MMS_RECV_REJECT_UNKNOWN);
556                         return MSG_ERR_SET_SETTING;
557                 }
558         }
559
560         MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bValue);
561         if (bValue != recvOpt.bRejectAdvertisement) {
562                 if (MsgSettingSetBool(MMS_RECV_REJECT_ADVERTISE, recvOpt.bRejectAdvertisement) != MSG_SUCCESS) {
563                         MSG_DEBUG("Error to set config data [%s]", MMS_RECV_REJECT_ADVERTISE);
564                         return MSG_ERR_SET_SETTING;
565                 }
566         }
567
568         return MSG_SUCCESS;
569 }
570
571
572 msg_error_t MsgSetMMSStyleOpt(const MSG_SETTING_S *pSetting)
573 {
574         MSG_MMS_STYLEOPT_S styleOpt;
575         int iValue = 0;
576         bool bValue = false;
577
578         memcpy(&styleOpt, &(pSetting->option.mmsStyleOpt), sizeof(MSG_MMS_STYLEOPT_S));
579
580         iValue = MsgSettingGetInt(MMS_STYLE_FONT_SIZE);
581         if (iValue != (int)styleOpt.fontSize) {
582                 if (MsgSettingSetInt(MMS_STYLE_FONT_SIZE, styleOpt.fontSize) != MSG_SUCCESS) {
583                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_SIZE);
584                         return MSG_ERR_SET_SETTING;
585                 }
586         }
587
588         MsgSettingGetBool(MMS_STYLE_FONT_STYLE_BOLD, &bValue);
589         if (bValue != styleOpt.bFontStyleBold) {
590                 if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_BOLD, styleOpt.bFontStyleBold) != MSG_SUCCESS) {
591                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_BOLD);
592                         return MSG_ERR_SET_SETTING;
593                 }
594         }
595
596         MsgSettingGetBool(MMS_STYLE_FONT_STYLE_ITALIC, &bValue);
597         if (bValue != styleOpt.bFontStyleItalic) {
598                 if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_ITALIC, styleOpt.bFontStyleItalic) != MSG_SUCCESS) {
599                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_ITALIC);
600                         return MSG_ERR_SET_SETTING;
601                 }
602         }
603
604         MsgSettingGetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, &bValue);
605         if (bValue != styleOpt.bFontStyleUnderline) {
606                 if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, styleOpt.bFontStyleUnderline) != MSG_SUCCESS) {
607                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_UNDERLINE);
608                         return MSG_ERR_SET_SETTING;
609                 }
610         }
611
612         iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED);
613         if (iValue != (int)styleOpt.fontColorRed) {
614                 if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_RED, styleOpt.fontColorRed) != MSG_SUCCESS) {
615                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_RED);
616                         return MSG_ERR_SET_SETTING;
617                 }
618         }
619
620         iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN);
621         if (iValue != (int)styleOpt.fontColorGreen) {
622                 if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_GREEN, styleOpt.fontColorGreen) != MSG_SUCCESS) {
623                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_GREEN);
624                         return MSG_ERR_SET_SETTING;
625                 }
626         }
627
628         iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE);
629         if (iValue != (int)styleOpt.fontColorBlue) {
630                 if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_BLUE, styleOpt.fontColorBlue) != MSG_SUCCESS) {
631                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_BLUE);
632                         return MSG_ERR_SET_SETTING;
633                 }
634         }
635
636         iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE);
637         if (iValue != (int)styleOpt.fontColorHue) {
638                 if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, styleOpt.fontColorHue) != MSG_SUCCESS) {
639                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_HUE);
640                         return MSG_ERR_SET_SETTING;
641                 }
642         }
643
644         iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED);
645         if (iValue != (int)styleOpt.bgColorRed) {
646                 if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_RED, styleOpt.bgColorRed) != MSG_SUCCESS) {
647                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_RED);
648                         return MSG_ERR_SET_SETTING;
649                 }
650         }
651
652         iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN);
653         if (iValue != (int)styleOpt.bgColorGreen) {
654                 if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_GREEN, styleOpt.bgColorGreen) != MSG_SUCCESS) {
655                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_GREEN);
656                         return MSG_ERR_SET_SETTING;
657                 }
658         }
659
660         iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE);
661         if (iValue != (int)styleOpt.bgColorBlue) {
662                 if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_BLUE, styleOpt.bgColorBlue) != MSG_SUCCESS) {
663                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_BLUE);
664                         return MSG_ERR_SET_SETTING;
665                 }
666         }
667
668         iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE);
669         if (iValue != (int)styleOpt.bgColorHue) {
670                 if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_HUE, styleOpt.bgColorHue) != MSG_SUCCESS) {
671                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_HUE);
672                         return MSG_ERR_SET_SETTING;
673                 }
674         }
675
676         iValue = MsgSettingGetInt(MMS_STYLE_PAGE_DUR);
677         if (iValue != (int)styleOpt.pageDur) {
678                 if (MsgSettingSetInt(MMS_STYLE_PAGE_DUR, styleOpt.pageDur) != MSG_SUCCESS) {
679                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_DUR);
680                         return MSG_ERR_SET_SETTING;
681                 }
682         }
683
684         iValue = MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR);
685         if (iValue != (int)styleOpt.pageCustomDur) {
686                 if (MsgSettingSetInt(MMS_STYLE_PAGE_CUSTOM_DUR, styleOpt.pageCustomDur) != MSG_SUCCESS) {
687                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_CUSTOM_DUR);
688                         return MSG_ERR_SET_SETTING;
689                 }
690         }
691
692         iValue = MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL);
693         if (iValue != (int)styleOpt.pageDurManual) {
694                 if (MsgSettingSetInt(MMS_STYLE_PAGE_DUR_MANUAL, styleOpt.pageDurManual) != MSG_SUCCESS) {
695                         MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_DUR_MANUAL);
696                         return MSG_ERR_SET_SETTING;
697                 }
698         }
699
700         return MSG_SUCCESS;
701 }
702
703 msg_error_t MsgSetPushMsgOpt(const MSG_SETTING_S *pSetting)
704 {
705         MSG_PUSHMSG_OPT_S pushOpt;
706         int iValue = 0;
707         bool bValue = false;
708
709         memcpy(&pushOpt, &(pSetting->option.pushMsgOpt), sizeof(MSG_PUSHMSG_OPT_S));
710
711         MsgSettingGetBool(PUSH_RECV_OPTION, &bValue);
712         if (bValue != pushOpt.bReceive) {
713                 if (MsgSettingSetBool(PUSH_RECV_OPTION, pushOpt.bReceive) != MSG_SUCCESS) {
714                         MSG_DEBUG("Error to set config data [%s]", PUSH_RECV_OPTION);
715                         return MSG_ERR_SET_SETTING;
716                 }
717         }
718
719         iValue = MsgSettingGetInt(PUSH_SERVICE_TYPE);
720         if (iValue != (int)pushOpt.serviceType) {
721                 if (MsgSettingSetInt(PUSH_SERVICE_TYPE, (int)pushOpt.serviceType) != MSG_SUCCESS) {
722                         MSG_DEBUG("Error to set config data [%s]", PUSH_SERVICE_TYPE);
723                         return MSG_ERR_SET_SETTING;
724                 }
725         }
726
727         return MSG_SUCCESS;
728 }
729
730
731 msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim)
732 {
733         msg_error_t err = MSG_SUCCESS;
734
735         MSG_CBMSG_OPT_S cbOpt;
736         int iValue = 0;
737         bool bValue = false;
738
739         memcpy(&cbOpt, &(pSetting->option.cbMsgOpt), sizeof(MSG_CBMSG_OPT_S));
740
741         if (bSetSim == true) {
742                 cbOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT);
743
744                 if (cbOpt.channelData.channelCnt > cbOpt.maxSimCnt) {
745                         MSG_DEBUG("Channel Count is over Max SIM Count [%d]", cbOpt.channelData.channelCnt);
746                         return MSG_ERR_SET_SIM_SET;
747                 }
748
749                 err = MsgSetConfigInSim(pSetting);
750                 if (err != MSG_SUCCESS) {
751                         MSG_DEBUG("Error to set config data in sim [%d]", err);
752                         return err;
753                 }
754         }
755
756         MsgSettingGetBool(CB_RECEIVE, &bValue);
757         if (bValue != cbOpt.bReceive) {
758                 if (MsgSettingSetBool(CB_RECEIVE, cbOpt.bReceive) != MSG_SUCCESS) {
759                         MSG_DEBUG("Error to set config data [%s]", CB_RECEIVE);
760                         return MSG_ERR_SET_SETTING;
761                 }
762         }
763
764         iValue = MsgSettingGetInt(CB_MAX_SIM_COUNT);
765         if (iValue != cbOpt.maxSimCnt) {
766                 if (MsgSettingSetInt(CB_MAX_SIM_COUNT, cbOpt.maxSimCnt) != MSG_SUCCESS) {
767                         MSG_DEBUG("Error to set config data [%s]", CB_MAX_SIM_COUNT);
768                         return MSG_ERR_SET_SETTING;
769                 }
770         }
771
772         iValue = MsgSettingGetInt(CB_CHANNEL_COUNT);
773         if (iValue != cbOpt.channelData.channelCnt) {
774                 if (MsgSettingSetInt(CB_CHANNEL_COUNT, cbOpt.channelData.channelCnt) != MSG_SUCCESS) {
775                         MSG_DEBUG("Error to set config data [%s]", CB_CHANNEL_COUNT);
776                         return MSG_ERR_SET_SETTING;
777                 }
778         }
779
780         char keyName[DEF_BUF_LEN] = {0, };
781
782         for (int i = 0; i < cbOpt.channelData.channelCnt; i++)
783         {
784                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ACTIVATE, i);
785
786                 if ((err = MsgSettingSetBool(keyName, cbOpt.channelData.channelInfo[i].bActivate)) != MSG_SUCCESS)
787                         break;
788
789                 memset(keyName, 0x00, sizeof(keyName));
790                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_FROM, i);
791
792                 if ((err = MsgSettingSetInt(keyName, cbOpt.channelData.channelInfo[i].from)) != MSG_SUCCESS)
793                         break;
794
795                 memset(keyName, 0x00, sizeof(keyName));
796                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_TO, i);
797
798                 if ((err = MsgSettingSetInt(keyName, cbOpt.channelData.channelInfo[i].to)) != MSG_SUCCESS)
799                         break;
800
801                 memset(keyName, 0x00, sizeof(keyName));
802                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_NAME, i);
803
804                 if ((err = MsgSettingSetString(keyName, cbOpt.channelData.channelInfo[i].name)) != MSG_SUCCESS)
805                         break;
806         }
807
808         if (bSetSim == true)
809         {
810                 for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++)
811                 {
812                         memset(keyName, 0x00, sizeof(keyName));
813                         snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_LANGUAGE, i);
814
815                         if (MsgSettingSetBool(keyName, cbOpt.bLanguage[i]) != MSG_SUCCESS)
816                         {
817                                 MSG_DEBUG("Error to set config data [%s]", keyName);
818                                 return MSG_ERR_SET_SETTING;
819                         }
820                 }
821         }
822
823         return err;
824 }
825
826
827 msg_error_t MsgSetVoiceMailOpt(const MSG_SETTING_S *pSetting, bool bSetSim)
828 {
829         MSG_VOICEMAIL_OPT_S voiceMailOpt;
830         char *pValue = NULL;
831         msg_error_t err = MSG_SUCCESS;
832
833         memcpy(&voiceMailOpt, &(pSetting->option.voiceMailOpt), sizeof(MSG_VOICEMAIL_OPT_S));
834
835         pValue = MsgSettingGetString(VOICEMAIL_NUMBER);
836         if (pValue != NULL && strcmp(pValue, voiceMailOpt.mailNumber) == 0) {
837                 /* Value is same with previous one. Therefore, we don't need to save it. */
838         } else {
839                 if (bSetSim == true) {
840                         err = MsgSetConfigInSim(pSetting);
841
842                         if (err == MSG_SUCCESS) {
843                                 err = MsgSettingSetString(VOICEMAIL_NUMBER, voiceMailOpt.mailNumber);
844                                 if (err != MSG_SUCCESS)
845                                         MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_NUMBER);
846                         } else {
847                                 MSG_DEBUG("Error to set config data in sim [%d]", err);
848                         }
849                 } else {
850                         err = MsgSettingSetString(VOICEMAIL_NUMBER, voiceMailOpt.mailNumber);
851                         if (err != MSG_SUCCESS)
852                                 MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_NUMBER);
853                 }
854         }
855
856         if (pValue != NULL) {
857                 free(pValue);
858                 pValue = NULL;
859         }
860
861         return err;
862 }
863
864
865 msg_error_t MsgSetMsgSizeOpt(const MSG_SETTING_S *pSetting)
866 {
867         MSG_MSGSIZE_OPT_S msgSizeOpt;
868         int iValue = 0;
869
870         memcpy(&msgSizeOpt, &(pSetting->option.msgSizeOpt), sizeof(MSG_MSGSIZE_OPT_S));
871
872         iValue = MsgSettingGetInt(MSGSIZE_OPTION);
873         if (iValue != msgSizeOpt.nMsgSize) {
874                 if (MsgSettingSetInt(MSGSIZE_OPTION, msgSizeOpt.nMsgSize) != MSG_SUCCESS) {
875                         MSG_DEBUG("Error to set config data [%s]", MSGSIZE_OPTION);
876                         return MSG_ERR_SET_SETTING;
877                 }
878         }
879
880         return MSG_SUCCESS;
881 }
882
883
884 void MsgGetGeneralOpt(MSG_SETTING_S *pSetting)
885 {
886         memset(&(pSetting->option.generalOpt), 0x00, sizeof(MSG_GENERAL_OPT_S));
887
888         MsgSettingGetBool(MSG_KEEP_COPY, &pSetting->option.generalOpt.bKeepCopy);
889
890 #ifdef  __NOT_USED_BY_DESIGN_CHANGE__
891         pSetting->option.generalOpt.alertTone = (MSG_ALERT_TONE_T)MsgSettingGetInt(MSG_ALERT_TONE);
892
893         MsgSettingGetBool(MSG_AUTO_ERASE, &pSetting->option.generalOpt.bAutoErase);
894 #endif  /* __NOT_USED_BY_DESIGN_CHANGE__ */
895 }
896
897
898 void MsgGetSMSSendOpt(MSG_SETTING_S *pSetting)
899 {
900         memset(&(pSetting->option.smsSendOpt), 0x00, sizeof(MSG_SMS_SENDOPT_S));
901
902         pSetting->option.smsSendOpt.dcs = (msg_encode_type_t)MsgSettingGetInt(SMS_SEND_DCS);
903
904         pSetting->option.smsSendOpt.netMode = (MSG_SMS_NETWORK_MODE_T)MsgSettingGetInt(SMS_SEND_NETWORK_MODE);
905
906         MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSetting->option.smsSendOpt.bReplyPath);
907
908         MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSetting->option.smsSendOpt.bDeliveryReport);
909
910         pSetting->option.smsSendOpt.saveStorage = (MSG_SMS_SAVE_STORAGE_T)MsgSettingGetInt(SMS_SEND_SAVE_STORAGE);
911 }
912
913
914 void MsgGetSMSCList(MSG_SETTING_S *pSetting)
915 {
916         char keyName[DEF_BUF_LEN] = {0, };
917         char *tmpValue = NULL;
918
919         memset(&(pSetting->option.smscList), 0x00, sizeof(MSG_SMSC_LIST_S));
920
921         pSetting->option.smscList.selected = MsgSettingGetInt(SMSC_SELECTED);
922
923         pSetting->option.smscList.totalCnt = MsgSettingGetInt(SMSC_TOTAL_COUNT);
924
925         for (int i = 0; i < pSetting->option.smscList.totalCnt; i++)
926         {
927                 memset(keyName, 0x00, sizeof(keyName));
928                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_PID, i);
929
930                 pSetting->option.smscList.smscData[i].pid = (MSG_SMS_PID_T)MsgSettingGetInt(keyName);
931
932 #ifdef  __NOT_USED_BY_DESIGN_CHANGE__
933                 memset(keyName, 0x00, sizeof(keyName));
934                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_DCS, i);
935
936                 pSetting->option.smscList.smscData[i].dcs = (msg_encode_type_t)MsgSettingGetInt(keyName);
937 #endif  /* __NOT_USED_BY_DESIGN_CHANGE__ */
938
939                 memset(keyName, 0x00, sizeof(keyName));
940                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_VAL_PERIOD, i);
941
942                 pSetting->option.smscList.smscData[i].valPeriod = (MSG_VAL_PERIOD_T)MsgSettingGetInt(keyName);
943
944                 memset(keyName, 0x00, sizeof(keyName));
945                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NAME, i);
946
947                 memset(pSetting->option.smscList.smscData[i].name, 0x00, SMSC_NAME_MAX+1);
948
949                 tmpValue = MsgSettingGetString(keyName);
950                 if (tmpValue != NULL) {
951                         strncpy(pSetting->option.smscList.smscData[i].name, tmpValue, SMSC_NAME_MAX);
952                         free(tmpValue);
953                         tmpValue = NULL;
954                 }
955
956                 memset(keyName, 0x00, sizeof(keyName));
957                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_TON, i);
958
959                 pSetting->option.smscList.smscData[i].smscAddr.ton = (MSG_SMS_TON_T)MsgSettingGetInt(keyName);
960
961                 memset(keyName, 0x00, sizeof(keyName));
962                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NPI, i);
963
964                 pSetting->option.smscList.smscData[i].smscAddr.npi = (MSG_SMS_NPI_T)MsgSettingGetInt(keyName);
965
966                 memset(keyName, 0x00, sizeof(keyName));
967                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_ADDRESS, i);
968
969                 memset(pSetting->option.smscList.smscData[i].smscAddr.address, 0x00, sizeof(pSetting->option.smscList.smscData[i].smscAddr.address));
970
971                 tmpValue = MsgSettingGetString(keyName);
972                 if (tmpValue != NULL) {
973                         strncpy(pSetting->option.smscList.smscData[i].smscAddr.address, tmpValue, SMSC_ADDR_MAX);
974                         free(tmpValue);
975                         tmpValue = NULL;
976                 }
977         }
978 }
979
980
981 void MsgGetMMSSendOpt(MSG_SETTING_S *pSetting)
982 {
983         memset(&(pSetting->option.mmsSendOpt), 0x00, sizeof(MSG_MMS_SENDOPT_S));
984
985         pSetting->option.mmsSendOpt.msgClass = (MSG_MMS_MSG_CLASS_TYPE_T)MsgSettingGetInt(MMS_SEND_MSG_CLASS);
986
987         pSetting->option.mmsSendOpt.priority = (msg_priority_type_t)MsgSettingGetInt(MMS_SEND_PRIORITY);
988
989         pSetting->option.mmsSendOpt.expiryTime = (MSG_MMS_EXPIRY_TIME_T)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME);
990
991         pSetting->option.mmsSendOpt.deliveryTime = (MSG_MMS_DELIVERY_TIME_T)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME);
992
993         pSetting->option.mmsSendOpt.customDeliveryTime = MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY);
994
995         MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &pSetting->option.mmsSendOpt.bSenderVisibility);
996
997         MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &pSetting->option.mmsSendOpt.bDeliveryReport);
998
999         MsgSettingGetBool(MMS_SEND_READ_REPLY, &pSetting->option.mmsSendOpt.bReadReply);
1000
1001 #ifdef  __NOT_USED_BY_DESIGN_CHANGE__
1002         MsgSettingGetBool(MSG_KEEP_COPY, &pSetting->option.mmsSendOpt.bKeepCopy);
1003 #endif  /* __NOT_USED_BY_DESIGN_CHANGE__ */
1004
1005         MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &pSetting->option.mmsSendOpt.bBodyReplying);
1006
1007         MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &pSetting->option.mmsSendOpt.bHideRecipients);
1008
1009         pSetting->option.mmsSendOpt.replyCharging = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING);
1010
1011         pSetting->option.mmsSendOpt.replyChargingDeadline = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE);
1012
1013         pSetting->option.mmsSendOpt.replyChargingSize = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE);
1014
1015         pSetting->option.mmsSendOpt.creationMode = MsgSettingGetInt(MMS_SEND_CREATION_MODE);
1016 }
1017
1018
1019 void MsgGetMMSRecvOpt(MSG_SETTING_S *pSetting)
1020 {
1021         memset(&(pSetting->option.mmsRecvOpt), 0x00, sizeof(MSG_MMS_RECVOPT_S));
1022
1023         pSetting->option.mmsRecvOpt.homeNetwork = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_HOME_NETWORK);
1024
1025         pSetting->option.mmsRecvOpt.abroadNetwok = (MSG_MMS_ABROAD_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK);
1026
1027         MsgSettingGetBool(MMS_RECV_READ_RECEIPT, &pSetting->option.mmsRecvOpt.readReceipt);
1028
1029         MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &pSetting->option.mmsRecvOpt.bDeliveryReceipt);
1030
1031         MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &pSetting->option.mmsRecvOpt.bRejectUnknown);
1032
1033         MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &pSetting->option.mmsRecvOpt.bRejectAdvertisement);
1034 }
1035
1036
1037 void MsgGetMMSStyleOpt(MSG_SETTING_S *pSetting)
1038 {
1039         memset(&(pSetting->option.mmsStyleOpt), 0x00, sizeof(MSG_MMS_STYLEOPT_S));
1040
1041         pSetting->option.mmsStyleOpt.fontSize = MsgSettingGetInt(MMS_STYLE_FONT_SIZE);
1042
1043         MsgSettingGetBool(MMS_STYLE_FONT_STYLE_BOLD, &pSetting->option.mmsStyleOpt.bFontStyleBold);
1044
1045         MsgSettingGetBool(MMS_STYLE_FONT_STYLE_ITALIC, &pSetting->option.mmsStyleOpt.bFontStyleItalic);
1046
1047         MsgSettingGetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, &pSetting->option.mmsStyleOpt.bFontStyleUnderline);
1048
1049         pSetting->option.mmsStyleOpt.fontColorRed = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED);
1050
1051         pSetting->option.mmsStyleOpt.fontColorGreen = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN);
1052
1053         pSetting->option.mmsStyleOpt.fontColorBlue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE);
1054
1055         pSetting->option.mmsStyleOpt.fontColorHue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE);
1056
1057         pSetting->option.mmsStyleOpt.bgColorRed = MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED);
1058
1059         pSetting->option.mmsStyleOpt.bgColorGreen = MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN);
1060
1061         pSetting->option.mmsStyleOpt.bgColorBlue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE);
1062
1063         pSetting->option.mmsStyleOpt.bgColorHue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE);
1064
1065         pSetting->option.mmsStyleOpt.pageDur = MsgSettingGetInt(MMS_STYLE_PAGE_DUR);
1066
1067         pSetting->option.mmsStyleOpt.pageCustomDur = MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR);
1068
1069         pSetting->option.mmsStyleOpt.pageDurManual = MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL);
1070 }
1071
1072
1073 void MsgGetPushMsgOpt(MSG_SETTING_S *pSetting)
1074 {
1075         memset(&(pSetting->option.pushMsgOpt), 0x00, sizeof(MSG_PUSHMSG_OPT_S));
1076
1077         MsgSettingGetBool(PUSH_RECV_OPTION, &pSetting->option.pushMsgOpt.bReceive);
1078
1079         pSetting->option.pushMsgOpt.serviceType = (MSG_PUSH_SERVICE_TYPE_T)MsgSettingGetInt(PUSH_SERVICE_TYPE);
1080 }
1081
1082
1083 void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting)
1084 {
1085         char keyName[DEF_BUF_LEN] = {0, };
1086         char *tmpValue = NULL;
1087
1088         memset(&(pSetting->option.cbMsgOpt), 0x00, sizeof(MSG_CBMSG_OPT_S));
1089
1090         MsgSettingGetBool(CB_RECEIVE, &pSetting->option.cbMsgOpt.bReceive);
1091
1092         pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT);
1093
1094         pSetting->option.cbMsgOpt.channelData.channelCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
1095
1096         for (int i = 0; i < pSetting->option.cbMsgOpt.channelData.channelCnt; i++)
1097         {
1098                 memset(keyName, 0x00, sizeof(keyName));
1099                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ACTIVATE, i);
1100
1101                 MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.channelData.channelInfo[i].bActivate);
1102
1103                 memset(keyName, 0x00, sizeof(keyName));
1104                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_FROM, i);
1105                 pSetting->option.cbMsgOpt.channelData.channelInfo[i].from = MsgSettingGetInt(keyName);
1106                 MSG_DEBUG("channel[%d]: from: %d", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].from);
1107
1108                 memset(keyName, 0x00, sizeof(keyName));
1109                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_TO, i);
1110                 pSetting->option.cbMsgOpt.channelData.channelInfo[i].to = MsgSettingGetInt(keyName);
1111                 MSG_DEBUG("channel[%d]: to: %d", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].to);
1112
1113                 memset(keyName, 0x00, sizeof(keyName));
1114                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_NAME, i);
1115
1116                 tmpValue = MsgSettingGetString(keyName);
1117                 if (tmpValue != NULL) {
1118                         strncpy(pSetting->option.cbMsgOpt.channelData.channelInfo[i].name, tmpValue, CB_CHANNEL_NAME_MAX);
1119                         MSG_DEBUG("channel[%d]: channel_name: %s", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].name);
1120                         free(tmpValue);
1121                         tmpValue = NULL;
1122                 }
1123         }
1124
1125         for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++)
1126         {
1127                 memset(keyName, 0x00, sizeof(keyName));
1128                 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_LANGUAGE, i);
1129
1130                 MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.bLanguage[i]);
1131         }
1132 }
1133
1134 void MsgGetVoiceMailOpt(MSG_SETTING_S *pSetting)
1135 {
1136         char *tmpValue = NULL;
1137
1138         memset(&(pSetting->option.voiceMailOpt), 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
1139
1140         tmpValue = MsgSettingGetString(VOICEMAIL_NUMBER);
1141         if (tmpValue != NULL) {
1142                 strncpy(pSetting->option.voiceMailOpt.mailNumber, tmpValue, MAX_PHONE_NUMBER_LEN);
1143                 free(tmpValue);
1144                 tmpValue = NULL;
1145         }
1146 }
1147
1148
1149 void MsgGetMsgSizeOpt(MSG_SETTING_S *pSetting)
1150 {
1151         memset(&(pSetting->option.msgSizeOpt), 0x00, sizeof(MSG_MSGSIZE_OPT_S));
1152
1153         pSetting->option.msgSizeOpt.nMsgSize = MsgSettingGetInt(MSGSIZE_OPTION);
1154 }
1155
1156
1157 msg_error_t MsgSetConfigInSim(const MSG_SETTING_S *pSetting)
1158 {
1159         msg_error_t err = MSG_SUCCESS;
1160
1161         MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE);
1162
1163         // Get Setting Data from SIM
1164         if (plg != NULL)
1165                 err = plg->setConfigData(pSetting);
1166         else
1167                 err = MSG_ERR_NULL_POINTER;
1168
1169         if (err != MSG_SUCCESS)
1170         {
1171                 MSG_DEBUG("Error. Error code is %d.", err);
1172                 return err;
1173         }
1174
1175         return err;
1176 }
1177
1178 #ifdef  __NOT_USED_BY_ENV_CHANGE__
1179 void MsgSetDefaultConfig()
1180 {
1181         bool bTmp = false;
1182         char keyName[128];
1183
1184         // Set Default General SendOpt
1185         if (MsgSettingGetBool(MSG_KEEP_COPY, &bTmp) < 0)
1186                 MsgSettingSetBool(MSG_KEEP_COPY, true);
1187
1188         if (MsgSettingGetInt(MSG_ALERT_TONE) < 0)
1189                 MsgSettingSetInt(MSG_ALERT_TONE, (int)MSG_ALERT_TONE_ONCE);
1190
1191         if (MsgSettingGetBool(MSG_AUTO_ERASE, &bTmp) < 0)
1192                 MsgSettingGetBool(MSG_AUTO_ERASE, false);
1193
1194         // Set Default SMS SendOpt
1195         if (MsgSettingGetInt(SMS_SEND_DCS) < 0)
1196                 MsgSettingSetInt(SMS_SEND_DCS, (int)MSG_ENCODE_AUTO);
1197
1198         if (MsgSettingGetInt(SMS_SEND_NETWORK_MODE) < 0)
1199                 MsgSettingSetInt(SMS_SEND_NETWORK_MODE, (int)MSG_SMS_NETWORK_CS_ONLY);
1200
1201         if (MsgSettingGetBool(SMS_SEND_REPLY_PATH, &bTmp) < 0)
1202                 MsgSettingSetBool(SMS_SEND_REPLY_PATH, false);
1203
1204         if (MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &bTmp) < 0)
1205                 MsgSettingSetBool(SMS_SEND_DELIVERY_REPORT, false);
1206
1207         if (MsgSettingGetInt(SMS_SEND_SAVE_STORAGE) < 0)
1208                 MsgSettingSetInt(SMS_SEND_SAVE_STORAGE, (int)MSG_SMS_SAVE_STORAGE_PHONE);
1209
1210         // Set Default SMSC List
1211         if (MsgSettingGetInt(SMSC_SELECTED) < 0)
1212                 MsgSettingSetInt(SMSC_SELECTED, 0);
1213
1214         if (MsgSettingGetInt(SMSC_TOTAL_COUNT) < 0)
1215                 MsgSettingSetInt(SMSC_TOTAL_COUNT, 1);
1216
1217         memset(keyName, 0x00, sizeof(keyName));
1218         sprintf(keyName, "%s/%d", SMSC_PID, 0);
1219
1220         if (MsgSettingGetInt(keyName) < 0)
1221                 MsgSettingSetInt(keyName, (int)MSG_PID_TEXT);
1222
1223         memset(keyName, 0x00, sizeof(keyName));
1224         sprintf(keyName, "%s/%d", SMSC_VAL_PERIOD, MSG_VAL_MAXIMUM);
1225
1226         if (MsgSettingGetInt(keyName) < 0)
1227                 MsgSettingSetInt(keyName, 0);
1228
1229         memset(keyName, 0x00, sizeof(keyName));
1230         sprintf(keyName, "%s/%d", SMSC_NAME, 0);
1231
1232         char *smscName = NULL;
1233
1234         smscName = MsgSettingGetString(keyName);
1235
1236         if (smscName == NULL) {
1237                 MsgSettingSetString(keyName, (char*)"SMS Centre 1");
1238         } else {
1239                 free(smscName);
1240                 smscName = NULL;
1241         }
1242
1243         memset(keyName, 0x00, sizeof(keyName));
1244         sprintf(keyName, "%s/%d", SMSC_TON, 0);
1245
1246         if (MsgSettingGetInt(keyName) < 0)
1247                 MsgSettingSetInt(keyName, (int)MSG_TON_INTERNATIONAL);
1248
1249         memset(keyName, 0x00, sizeof(keyName));
1250         sprintf(keyName, "%s/%d", SMSC_NPI, 0);
1251
1252         if (MsgSettingGetInt(keyName) < 0)
1253                 MsgSettingSetInt(keyName, (int)MSG_NPI_ISDN);
1254
1255         memset(keyName, 0x00, sizeof(keyName));
1256         sprintf(keyName, "%s/%d", SMSC_ADDRESS, 0);
1257
1258         char *smscAddress = NULL;
1259
1260         smscAddress = MsgSettingGetString(keyName);
1261
1262         if (smscAddress == NULL) {
1263                 MsgSettingSetString(keyName, (char*)"8210911111");
1264         } else {
1265                 free(smscAddress);
1266                 smscAddress = NULL;
1267         }
1268
1269         // Set Default MMS Send Opt
1270         if (MsgSettingGetInt(MMS_SEND_MSG_CLASS) < 0)
1271                 MsgSettingSetInt(MMS_SEND_MSG_CLASS, (int)MSG_CLASS_AUTO);
1272
1273         if (MsgSettingGetInt(MMS_SEND_PRIORITY) < 0)
1274                 MsgSettingSetInt(MMS_SEND_PRIORITY, (int)MSG_MESSAGE_PRIORITY_NORMAL);
1275
1276         if (MsgSettingGetInt(MMS_SEND_EXPIRY_TIME) < 0)
1277                 MsgSettingSetInt(MMS_SEND_EXPIRY_TIME, 86400);
1278
1279         if (MsgSettingGetInt(MMS_SEND_DELIVERY_TIME) < 0)
1280                 MsgSettingSetInt(MMS_SEND_DELIVERY_TIME, 0);
1281
1282         if (MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY) < 0)
1283                 MsgSettingSetInt(MMS_SEND_CUSTOM_DELIVERY, 0);
1284
1285         if (MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &bTmp) < 0)
1286                 MsgSettingSetBool(MMS_SEND_SENDER_VISIBILITY, false);
1287
1288         if (MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &bTmp) < 0)
1289                 MsgSettingSetBool(MMS_SEND_DELIVERY_REPORT, true);
1290
1291         if (MsgSettingGetBool(MMS_SEND_READ_REPLY, &bTmp) < 0)
1292                 MsgSettingSetBool(MMS_SEND_READ_REPLY, false);
1293
1294         if (MsgSettingGetBool(MMS_SEND_KEEP_COPY, &bTmp) < 0)
1295                 MsgSettingSetBool(MMS_SEND_KEEP_COPY, false);
1296
1297         if (MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &bTmp) < 0)
1298                 MsgSettingSetBool(MMS_SEND_BODY_REPLYING, false);
1299
1300         if (MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &bTmp) < 0)
1301                 MsgSettingSetBool(MMS_SEND_HIDE_RECIPIENTS, false);
1302
1303         if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING) < 0)
1304                 MsgSettingSetInt(MMS_SEND_REPLY_CHARGING, (int)MSG_REPLY_CHARGING_NONE);
1305
1306         if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE) < 0)
1307                 MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_DEADLINE, 0);
1308
1309         if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE) < 0)
1310                 MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_SIZE, 0);
1311
1312         // Set Default MMS Recv Opt
1313         if (MsgSettingGetInt(MMS_RECV_HOME_NETWORK) < 0)
1314                 MsgSettingSetInt(MMS_RECV_HOME_NETWORK, (int)MSG_HOME_AUTO_DOWNLOAD);
1315
1316         if (MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK) < 0)
1317                 MsgSettingSetInt(MMS_RECV_ABROAD_NETWORK, (int)MSG_ABROAD_RESTRICTED);
1318
1319         if (MsgSettingGetInt(MMS_RECV_READ_RECEIPT) < 0)
1320                 MsgSettingSetInt(MMS_RECV_READ_RECEIPT, (int)MSG_SEND_READ_REPORT_NEVER);
1321
1322         if (MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &bTmp) < 0)
1323                 MsgSettingSetBool(MMS_RECV_DELIVERY_RECEIPT, true);
1324
1325         if (MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bTmp) < 0)
1326                 MsgSettingSetBool(MMS_RECV_REJECT_UNKNOWN, false);
1327
1328         if (MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bTmp) < 0)
1329                 MsgSettingSetBool(MMS_RECV_REJECT_ADVERTISE, false);
1330
1331         // Set Default MMS Style Opt
1332         if (MsgSettingGetInt(MMS_STYLE_FONT_SIZE) < 0)
1333                 MsgSettingSetInt(MMS_STYLE_FONT_SIZE, 30);
1334
1335         if (MsgSettingGetInt(MMS_STYLE_FONT_STYLE) < 0)
1336                 MsgSettingSetInt(MMS_STYLE_FONT_STYLE, 0);
1337
1338         if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED) < 0)
1339                 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_RED, 0);
1340
1341         if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN) < 0)
1342                 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_GREEN, 0);
1343
1344         if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE) < 0)
1345                 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_BLUE, 0);
1346
1347         if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE) < 0)
1348                 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, 255);
1349
1350         if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED) < 0)
1351                 MsgSettingSetInt(MMS_STYLE_BG_COLOR_RED, 255);
1352
1353         if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN) < 0)
1354                 MsgSettingSetInt(MMS_STYLE_BG_COLOR_GREEN, 255);
1355
1356         if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE) < 0)
1357                 MsgSettingSetInt(MMS_STYLE_BG_COLOR_BLUE, 255);
1358
1359         if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE) < 0)
1360                 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, 255);
1361
1362         if (MsgSettingGetInt(MMS_STYLE_PAGE_DUR) < 0)
1363                 MsgSettingSetInt(MMS_STYLE_PAGE_DUR, 2);
1364
1365         if (MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR) < 0)
1366                 MsgSettingSetInt(MMS_STYLE_PAGE_CUSTOM_DUR, 0);
1367
1368         if (MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL) < 0)
1369                 MsgSettingSetInt(MMS_STYLE_PAGE_DUR_MANUAL, 0);
1370
1371         // Set Default Push Msg Opt
1372         if (MsgSettingGetBool(PUSH_RECV_OPTION, &bTmp) < 0)
1373                 MsgSettingSetBool(PUSH_RECV_OPTION, false);
1374
1375         if (MsgSettingGetInt(PUSH_SERVICE_TYPE) < 0)
1376                 MsgSettingSetInt(PUSH_SERVICE_TYPE, (int)MSG_PUSH_SERVICE_PROMPT);
1377
1378         // Set Default Cb Msg Opt
1379         if (MsgSettingGetBool(CB_RECEIVE, &bTmp) < 0)
1380                 MsgSettingSetBool(CB_RECEIVE, false);
1381
1382         if (MsgSettingGetBool(CB_ALL_CHANNEL, &bTmp) < 0)
1383                 MsgSettingSetBool(CB_ALL_CHANNEL, false);
1384
1385         if (MsgSettingGetInt(CB_MAX_SIM_COUNT) < 0)
1386                 MsgSettingSetInt(CB_MAX_SIM_COUNT, 0);
1387
1388         if (MsgSettingGetInt(CB_CHANNEL_COUNT) < 0)
1389                 MsgSettingSetInt(CB_CHANNEL_COUNT, 0);
1390
1391         for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++)
1392         {
1393                 memset(keyName, 0x00, sizeof(keyName));
1394                 sprintf(keyName, "%s/%d", CB_LANGUAGE, i);
1395
1396                 if (MsgSettingGetBool(keyName, &bTmp) < 0)
1397                         MsgSettingSetBool(keyName, false);
1398         }
1399
1400         // Set Default SOS Msg Opt
1401         if (MsgSettingGetBool(SOS_SEND_OPTION, &bTmp) < 0)
1402                 MsgSettingSetBool(SOS_SEND_OPTION, false);
1403
1404         if (MsgSettingGetInt(SOS_RECIPIENT_COUNT) < 0)
1405                 MsgSettingSetInt(SOS_RECIPIENT_COUNT, 0);
1406
1407         if (MsgSettingGetInt(SOS_REPEAT_COUNT) < 0)
1408                 MsgSettingSetInt(SOS_REPEAT_COUNT, (int)MSG_SOS_REPEAT_ONCE);
1409
1410         char *tmpValue = NULL;
1411
1412         tmpValue = MsgSettingGetString(keyName);
1413
1414         if (tmpValue == NULL) {
1415                 MsgSettingSetString(keyName, NULL);
1416         } else {
1417                 free(tmpValue);
1418                 tmpValue = NULL;
1419         }
1420
1421         if (MsgSettingGetInt(SOS_ALERT_TYPE) < 0)
1422                 MsgSettingSetInt(SOS_ALERT_TYPE, (int)MSG_SOS_ALERT_TYPE_SOS);
1423
1424         if (MsgSettingGetInt(MSGSIZE_OPTION) < 0)
1425                 MsgSettingSetInt(MSGSIZE_OPTION, 300);
1426 }
1427 #endif  /* __NOT_USED_BY_ENV_CHANGE__ */