12 #include "../../service/gsmcal.h" 13 #include "../../service/gsmlogo.h" 14 #include "../../service/gsmmisc.h" 15 #include "../../misc/coding/coding.h" 16 #include "../../misc/coding/md5.h" 17 #include "../../misc/misc.h" 18 #include "../../debug.h" 21 #include "../../../helper/string.h" 23 #ifdef GSM_ENABLE_BACKUP 28 #define chk_fwrite(data, size, count, file) \ 29 if (fwrite(data, size, count, file) != count) goto fail; 31 GSM_Error FindBackupChecksum(
const char *FileName,
gboolean UseUnicode,
char *checksum)
35 char *buffer = NULL,buff[100]={0};
45 for (h = file_info; h != NULL; h = h->
Next) {
63 for (h = file_info; h != NULL; h = h->
Next) {
64 if (strncasecmp(
"Checksum", h->
SectionName, 8) == 0)
continue;
66 buffer = (
unsigned char *)realloc(buffer,len+strlen(h->
SectionName)+1);
71 buffer = (
unsigned char *)realloc(buffer,len+strlen(e->
EntryName)+1);
74 buffer = (
unsigned char *)realloc(buffer,len+strlen(e->
EntryValue)+1);
88 static unsigned char *ReadCFGText(
INI_Section *cfg,
const unsigned char *section,
const unsigned char *key,
const gboolean Unicode)
90 unsigned char unicode_key[500],*retval;
102 static GSM_Error SaveLinkedBackupText(FILE *file,
const char *myname,
const char *myvalue,
const gboolean UseUnicode)
105 unsigned char buffer2[1000],buffer3[1000];
107 current = strlen(myvalue); w = 0;
110 memcpy(buffer2,myvalue+(strlen(myvalue)-current),200);
112 current = current - 200;
114 memcpy(buffer2,myvalue+(strlen(myvalue)-current),current);
115 buffer2[current] = 0;
119 sprintf(buffer3,
"%s%02i = %s%c%c",myname,w,buffer2,13,10);
123 fprintf(file,
"%s%02i = %s%c%c",myname,w,buffer2,13,10);
125 if (current == 0)
break;
133 char *ReadLinkedBackupText(
INI_Section *file_info,
const char *section,
const char *myname,
const gboolean UseUnicode)
139 size_t len, cursize = 0, pos = 0;
143 sprintf(buffer2,
"%s%02i", myname, i);
144 readvalue = ReadCFGText(file_info, section, buffer2, UseUnicode);
145 if (readvalue == NULL) {
148 len = strlen(readvalue);
149 if (pos + len + 1 >= cursize) {
150 cursize += len + 100;
151 result = (
char *)realloc(result, cursize);
152 if (result == NULL)
return NULL;
155 strcpy(result + pos, readvalue);
163 static GSM_Error SaveBackupText(FILE *file,
const char *myname,
const char *myvalue,
const gboolean UseUnicode)
165 char buffer[10000]={0};
166 unsigned char buffer2[10000]={0};
168 if (myname[0] == 0x00) {
172 }
else fprintf(file,
"%s",myvalue);
175 sprintf(buffer,
"%s = \"", myname);
182 sprintf(buffer,
"\"%c%c",13,10);
188 fprintf(file,
"%s = \"%s\"%c%c", myname, buffer, 13, 10);
190 fprintf(file,
"%sUnicode = %s%c%c", myname, buffer, 13, 10);
198 static GSM_Error SaveBackupBase64(FILE *file,
char *myname,
unsigned char *data,
size_t length,
gboolean UseUnicode)
201 unsigned char *unicode_buffer=NULL;
208 buffer = (
char *)malloc(length * 2);
209 if (buffer == NULL) {
212 unicode_buffer = (
unsigned char *)malloc(length * 4);
213 if (unicode_buffer == NULL) {
221 error = SaveLinkedBackupText(file, myname, buffer, UseUnicode);
225 free(unicode_buffer);
230 #define ReadBackupText(file_info, section, myname, myvalue, UseUnicode) ReadBackupTextLen(file_info, section, myname, myvalue, sizeof(myvalue), UseUnicode) 232 static gboolean ReadBackupTextLen(
INI_Section *file_info,
const char *section,
const char *myname,
char *myvalue,
const size_t maxlen,
const gboolean UseUnicode)
234 unsigned char paramname[10000],*readvalue, decodedvalue[10000];
239 readvalue =
INI_GetValue(file_info, section, paramname, UseUnicode);
240 if (readvalue!=NULL) {
243 decodedvalue[maxlen - 1] = 0;
244 decodedvalue[maxlen - 2] = 0;
259 strcpy(paramname,myname);
260 strcat(paramname,
"Unicode");
261 readvalue = ReadCFGText(file_info, section, paramname, UseUnicode);
262 if (readvalue!=NULL) {
263 dbgprintf(NULL,
"Cfg read: %s %ld\n",readvalue,(
long)strlen(readvalue));
264 if (strlen(readvalue) >= maxlen - 1) {
269 myvalue[strlen(readvalue)/2]=0;
270 myvalue[strlen(readvalue)/2+1]=0;
273 strcpy(paramname,myname);
274 readvalue = ReadCFGText(file_info, section, paramname, UseUnicode);
275 if (readvalue!=NULL) {
277 EncodeUnicode(myvalue, decodedvalue, strlen(decodedvalue) - 1);
290 unsigned char buffer[100];
294 sprintf(buffer,
" = ");
296 if (error !=
ERR_NONE)
return error;
297 return SaveBackupText(file,
"", buffer, UseUnicode);
302 unsigned char buffer[100];
304 sprintf(buffer,
" = %04d%02d%02d%c%c", dt->
Year, dt->
Month, dt->
Day,13,10);
305 return SaveBackupText(file,
"", buffer, UseUnicode);
313 char buffer[1000]={0};
317 sprintf(buffer,
"Location = %03i%c%c",Pbk->
Location,13,10);
318 error = SaveBackupText(file,
"", buffer, UseUnicode);
319 if (error !=
ERR_NONE)
return error;
324 sprintf(buffer,
"Entry%02iLocation = Home%c%c",j,13,10);
325 error = SaveBackupText(file,
"", buffer, UseUnicode);
326 if (error !=
ERR_NONE)
return error;
329 sprintf(buffer,
"Entry%02iLocation = Work%c%c",j,13,10);
330 error = SaveBackupText(file,
"", buffer, UseUnicode);
331 if (error !=
ERR_NONE)
return error;
338 sprintf(buffer,
"Entry%02iType = NumberGeneral%c%c",j,13,10);
339 error = SaveBackupText(file,
"", buffer, UseUnicode);
340 if (error !=
ERR_NONE)
return error;
343 sprintf(buffer,
"Entry%02iType = NumberVideo%c%c",j,13,10);
344 error = SaveBackupText(file,
"", buffer, UseUnicode);
345 if (error !=
ERR_NONE)
return error;
348 sprintf(buffer,
"Entry%02iType = NumberMobile%c%c",j,13,10);
349 error = SaveBackupText(file,
"", buffer, UseUnicode);
350 if (error !=
ERR_NONE)
return error;
353 sprintf(buffer,
"Entry%02iType = NumberFax%c%c",j,13,10);
354 error = SaveBackupText(file,
"", buffer, UseUnicode);
355 if (error !=
ERR_NONE)
return error;
358 sprintf(buffer,
"Entry%02iType = NumberPager%c%c",j,13,10);
359 error = SaveBackupText(file,
"", buffer, UseUnicode);
360 if (error !=
ERR_NONE)
return error;
363 sprintf(buffer,
"Entry%02iType = NumberOther%c%c",j,13,10);
364 error = SaveBackupText(file,
"", buffer, UseUnicode);
365 if (error !=
ERR_NONE)
return error;
368 sprintf(buffer,
"Entry%02iType = NumberMessaging%c%c",j,13,10);
369 error = SaveBackupText(file,
"", buffer, UseUnicode);
370 if (error !=
ERR_NONE)
return error;
373 sprintf(buffer,
"Entry%02iType = Note%c%c",j,13,10);
374 error = SaveBackupText(file,
"", buffer, UseUnicode);
375 if (error !=
ERR_NONE)
return error;
378 sprintf(buffer,
"Entry%02iType = Postal%c%c",j,13,10);
379 error = SaveBackupText(file,
"", buffer, UseUnicode);
380 if (error !=
ERR_NONE)
return error;
383 sprintf(buffer,
"Entry%02iType = Email%c%c",j,13,10);
384 error = SaveBackupText(file,
"", buffer, UseUnicode);
385 if (error !=
ERR_NONE)
return error;
388 sprintf(buffer,
"Entry%02iType = Email2%c%c",j,13,10);
389 error = SaveBackupText(file,
"", buffer, UseUnicode);
390 if (error !=
ERR_NONE)
return error;
393 sprintf(buffer,
"Entry%02iType = URL%c%c",j,13,10);
394 error = SaveBackupText(file,
"", buffer, UseUnicode);
395 if (error !=
ERR_NONE)
return error;
398 sprintf(buffer,
"Entry%02iType = Name%c%c",j,13,10);
399 error = SaveBackupText(file,
"", buffer, UseUnicode);
400 if (error !=
ERR_NONE)
return error;
403 sprintf(buffer,
"Entry%02iType = CallerGroup%c%c",j,13,10);
404 error = SaveBackupText(file,
"", buffer, UseUnicode);
405 if (error !=
ERR_NONE)
return error;
406 sprintf(buffer,
"Entry%02iNumber = %i%c%c",j,Pbk->
Entries[j].
Number,13,10);
407 error = SaveBackupText(file,
"", buffer, UseUnicode);
408 if (error !=
ERR_NONE)
return error;
412 sprintf(buffer,
"Entry%02iType = RingtoneID%c%c",j,13,10);
413 error = SaveBackupText(file,
"", buffer, UseUnicode);
414 if (error !=
ERR_NONE)
return error;
415 sprintf(buffer,
"Entry%02iNumber = %i%c%c",j,Pbk->
Entries[j].
Number,13,10);
416 error = SaveBackupText(file,
"", buffer, UseUnicode);
417 if (error !=
ERR_NONE)
return error;
421 sprintf(buffer,
"Entry%02iType = PictureID%c%c",j,13,10);
422 error = SaveBackupText(file,
"", buffer, UseUnicode);
423 if (error !=
ERR_NONE)
return error;
424 sprintf(buffer,
"Entry%02iNumber = %i%c%c",j,Pbk->
Entries[j].
Number,13,10);
425 error = SaveBackupText(file,
"", buffer, UseUnicode);
426 if (error !=
ERR_NONE)
return error;
430 sprintf(buffer,
"Entry%02iType = PictureName%c%c",j,13,10);
431 error = SaveBackupText(file,
"", buffer, UseUnicode);
432 if (error !=
ERR_NONE)
return error;
435 sprintf(buffer,
"Entry%02iType = UserID%c%c",j,13,10);
436 error = SaveBackupText(file,
"", buffer, UseUnicode);
437 if (error !=
ERR_NONE)
return error;
440 sprintf(buffer,
"Entry%02iType = Category%c%c",j,13,10);
441 error = SaveBackupText(file,
"", buffer, UseUnicode);
442 if (error !=
ERR_NONE)
return error;
444 sprintf(buffer,
"Entry%02iNumber = %i%c%c",j,Pbk->
Entries[j].
Number,13,10);
445 error = SaveBackupText(file,
"", buffer, UseUnicode);
446 if (error !=
ERR_NONE)
return error;
451 sprintf(buffer,
"Entry%02iType = Private%c%c",j,13,10);
452 error = SaveBackupText(file,
"", buffer, UseUnicode);
453 if (error !=
ERR_NONE)
return error;
454 sprintf(buffer,
"Entry%02iNumber = %i%c%c",j,Pbk->
Entries[j].
Number,13,10);
455 error = SaveBackupText(file,
"", buffer, UseUnicode);
456 if (error !=
ERR_NONE)
return error;
460 sprintf(buffer,
"Entry%02iType = LastName%c%c",j,13,10);
461 error = SaveBackupText(file,
"", buffer, UseUnicode);
462 if (error !=
ERR_NONE)
return error;
465 sprintf(buffer,
"Entry%02iType = FirstName%c%c",j,13,10);
466 error = SaveBackupText(file,
"", buffer, UseUnicode);
467 if (error !=
ERR_NONE)
return error;
470 sprintf(buffer,
"Entry%02iType = SecondName%c%c",j,13,10);
471 error = SaveBackupText(file,
"", buffer, UseUnicode);
472 if (error !=
ERR_NONE)
return error;
475 sprintf(buffer,
"Entry%02iType = NickName%c%c",j,13,10);
476 error = SaveBackupText(file,
"", buffer, UseUnicode);
477 if (error !=
ERR_NONE)
return error;
480 sprintf(buffer,
"Entry%02iType = FormalName%c%c",j,13,10);
481 error = SaveBackupText(file,
"", buffer, UseUnicode);
482 if (error !=
ERR_NONE)
return error;
485 sprintf(buffer,
"Entry%02iType = NamePrefix%c%c",j,13,10);
486 error = SaveBackupText(file,
"", buffer, UseUnicode);
487 if (error !=
ERR_NONE)
return error;
490 sprintf(buffer,
"Entry%02iType = NameSuffix%c%c",j,13,10);
491 error = SaveBackupText(file,
"", buffer, UseUnicode);
492 if (error !=
ERR_NONE)
return error;
495 sprintf(buffer,
"Entry%02iType = Company%c%c",j,13,10);
496 error = SaveBackupText(file,
"", buffer, UseUnicode);
497 if (error !=
ERR_NONE)
return error;
500 sprintf(buffer,
"Entry%02iType = JobTitle%c%c",j,13,10);
501 error = SaveBackupText(file,
"", buffer, UseUnicode);
502 if (error !=
ERR_NONE)
return error;
505 sprintf(buffer,
"Entry%02iType = Address%c%c",j,13,10);
506 error = SaveBackupText(file,
"", buffer, UseUnicode);
507 if (error !=
ERR_NONE)
return error;
510 sprintf(buffer,
"Entry%02iType = City%c%c",j,13,10);
511 error = SaveBackupText(file,
"", buffer, UseUnicode);
512 if (error !=
ERR_NONE)
return error;
515 sprintf(buffer,
"Entry%02iType = State%c%c",j,13,10);
516 error = SaveBackupText(file,
"", buffer, UseUnicode);
517 if (error !=
ERR_NONE)
return error;
520 sprintf(buffer,
"Entry%02iType = Zip%c%c",j,13,10);
521 error = SaveBackupText(file,
"", buffer, UseUnicode);
522 if (error !=
ERR_NONE)
return error;
525 sprintf(buffer,
"Entry%02iType = Country%c%c",j,13,10);
526 error = SaveBackupText(file,
"", buffer, UseUnicode);
527 if (error !=
ERR_NONE)
return error;
530 sprintf(buffer,
"Entry%02iType = Custom1%c%c",j,13,10);
531 error = SaveBackupText(file,
"", buffer, UseUnicode);
532 if (error !=
ERR_NONE)
return error;
535 sprintf(buffer,
"Entry%02iType = Custom2%c%c",j,13,10);
536 error = SaveBackupText(file,
"", buffer, UseUnicode);
537 if (error !=
ERR_NONE)
return error;
540 sprintf(buffer,
"Entry%02iType = Custom3%c%c",j,13,10);
541 error = SaveBackupText(file,
"", buffer, UseUnicode);
542 if (error !=
ERR_NONE)
return error;
545 sprintf(buffer,
"Entry%02iType = Custom4%c%c",j,13,10);
546 error = SaveBackupText(file,
"", buffer, UseUnicode);
547 if (error !=
ERR_NONE)
return error;
550 sprintf(buffer,
"Entry%02iType = LUID%c%c",j,13,10);
551 error = SaveBackupText(file,
"", buffer, UseUnicode);
552 if (error !=
ERR_NONE)
return error;
555 sprintf(buffer,
"Entry%02iType = VOIP%c%c",j,13,10);
556 error = SaveBackupText(file,
"", buffer, UseUnicode);
557 if (error !=
ERR_NONE)
return error;
560 sprintf(buffer,
"Entry%02iType = WVID%c%c",j,13,10);
561 error = SaveBackupText(file,
"", buffer, UseUnicode);
562 if (error !=
ERR_NONE)
return error;
565 sprintf(buffer,
"Entry%02iType = SWIS%c%c",j,13,10);
566 error = SaveBackupText(file,
"", buffer, UseUnicode);
567 if (error !=
ERR_NONE)
return error;
570 sprintf(buffer,
"Entry%02iType = SIP%c%c",j,13,10);
571 error = SaveBackupText(file,
"", buffer, UseUnicode);
572 if (error !=
ERR_NONE)
return error;
575 sprintf(buffer,
"Entry%02iType = DTMF%c%c",j,13,10);
576 error = SaveBackupText(file,
"", buffer, UseUnicode);
577 if (error !=
ERR_NONE)
return error;
580 sprintf(buffer,
"Entry%02iType = Date%c%cEntry%02iText",j,13,10, j);
581 error = SaveBackupText(file,
"", buffer, UseUnicode);
582 if (error !=
ERR_NONE)
return error;
583 error = SaveVCalDate(file, &Pbk->
Entries[j].
Date, UseUnicode);
584 if (error !=
ERR_NONE)
return error;
588 sprintf(buffer,
"Entry%02iType = LastModified%c%cEntry%02iText",j,13,10, j);
589 error = SaveBackupText(file,
"", buffer, UseUnicode);
590 if (error !=
ERR_NONE)
return error;
591 error = SaveVCalDateTime(file, &Pbk->
Entries[j].
Date, UseUnicode);
592 if (error !=
ERR_NONE)
return error;
599 sprintf(buffer,
"Entry%02iType = PushToTalkID%c%c",j,13,10);
600 error = SaveBackupText(file,
"", buffer, UseUnicode);
601 if (error !=
ERR_NONE)
return error;
606 sprintf(buffer,
"Entry%02iType = BMPPhoto%c%c",j,13,10);
609 sprintf(buffer,
"Entry%02iType = GIFPhoto%c%c",j,13,10);
612 sprintf(buffer,
"Entry%02iType = JPEGPhoto%c%c",j,13,10);
615 sprintf(buffer,
"Entry%02iType = ICOPhoto%c%c",j,13,10);
618 sprintf(buffer,
"Entry%02iType = PNGPhoto%c%c",j,13,10);
622 sprintf(buffer,
"Entry%02iType = Photo%c%c",j,13,10);
625 error = SaveBackupText(file,
"", buffer, UseUnicode);
626 if (error !=
ERR_NONE)
return error;
627 sprintf(buffer,
"Entry%02iData", j);
629 if (error !=
ERR_NONE)
return error;
634 sprintf(buffer,
"Entry%02iText",j);
635 error = SaveBackupText(file,buffer,Pbk->
Entries[j].
Text, UseUnicode);
636 if (error !=
ERR_NONE)
return error;
646 sprintf(buffer,
"Entry%02iVoiceTag = %i%c%c",j,Pbk->
Entries[j].
VoiceTag,13,10);
647 error = SaveBackupText(file,
"", buffer, UseUnicode);
648 if (error !=
ERR_NONE)
return error;
652 sprintf(buffer,
"Entry%02iSMSList%02i = %i%c%c",j,i,Pbk->
Entries[j].
SMSList[i],13,10);
653 error = SaveBackupText(file,
"", buffer, UseUnicode);
654 if (error !=
ERR_NONE)
return error;
662 sprintf(buffer,
"%c%c",13,10);
663 error = SaveBackupText(file,
"", buffer, UseUnicode);
664 if (error !=
ERR_NONE)
return error;
671 char buffer[1000]={0};
674 sprintf(buffer,
"Location = %d%c%c", Note->
Location,13,10);
675 error = SaveBackupText(file,
"", buffer, UseUnicode);
676 if (error !=
ERR_NONE)
return error;
677 error = SaveBackupText(file,
"Text", Note->
Text, UseUnicode);
678 if (error !=
ERR_NONE)
return error;
679 sprintf(buffer,
"%c%c",13,10);
680 error = SaveBackupText(file,
"", buffer, UseUnicode);
681 if (error !=
ERR_NONE)
return error;
688 char buffer[1000]={0};
691 error = SaveBackupText(file,
"",
"Type = ", UseUnicode);
692 if (error !=
ERR_NONE)
return error;
693 sprintf(buffer,
"0%c%c",13,10);
696 case GSM_CAL_CALL : sprintf(buffer,
"Call%c%c", 13,10);
break;
701 case GSM_CAL_MEMO : sprintf(buffer,
"Memo%c%c", 13,10);
break;
703 case GSM_CAL_ALARM : sprintf(buffer,
"Alarm%c%c", 13,10);
break;
705 case GSM_CAL_T_ATHL : sprintf(buffer,
"Training/Athletism%c%c", 13,10);
break;
706 case GSM_CAL_T_BALL : sprintf(buffer,
"Training/BallGames%c%c", 13,10);
break;
707 case GSM_CAL_T_CYCL : sprintf(buffer,
"Training/Cycling%c%c", 13,10);
break;
708 case GSM_CAL_T_BUDO : sprintf(buffer,
"Training/Budo%c%c", 13,10);
break;
709 case GSM_CAL_T_DANC : sprintf(buffer,
"Training/Dance%c%c", 13,10);
break;
710 case GSM_CAL_T_EXTR : sprintf(buffer,
"Training/ExtremeSports%c%c", 13,10);
break;
711 case GSM_CAL_T_FOOT : sprintf(buffer,
"Training/Football%c%c", 13,10);
break;
712 case GSM_CAL_T_GOLF : sprintf(buffer,
"Training/Golf%c%c", 13,10);
break;
713 case GSM_CAL_T_GYM : sprintf(buffer,
"Training/Gym%c%c", 13,10);
break;
714 case GSM_CAL_T_HORS : sprintf(buffer,
"Training/HorseRaces%c%c", 13,10);
break;
715 case GSM_CAL_T_HOCK : sprintf(buffer,
"Training/Hockey%c%c", 13,10);
break;
716 case GSM_CAL_T_RACE : sprintf(buffer,
"Training/Races%c%c", 13,10);
break;
717 case GSM_CAL_T_RUGB : sprintf(buffer,
"Training/Rugby%c%c", 13,10);
break;
718 case GSM_CAL_T_SAIL : sprintf(buffer,
"Training/Sailing%c%c", 13,10);
break;
719 case GSM_CAL_T_STRE : sprintf(buffer,
"Training/StreetGames%c%c", 13,10);
break;
720 case GSM_CAL_T_SWIM : sprintf(buffer,
"Training/Swimming%c%c", 13,10);
break;
721 case GSM_CAL_T_TENN : sprintf(buffer,
"Training/Tennis%c%c", 13,10);
break;
722 case GSM_CAL_T_TRAV : sprintf(buffer,
"Training/Travels%c%c", 13,10);
break;
723 case GSM_CAL_T_WINT : sprintf(buffer,
"Training/WinterGames%c%c", 13,10);
break;
725 error = SaveBackupText(file,
"", buffer, UseUnicode);
726 if (error !=
ERR_NONE)
return error;
734 char buffer[1000]={0};
737 sprintf(buffer,
"Location = %d%c%c", Note->
Location,13,10);
738 error = SaveBackupText(file,
"", buffer, UseUnicode);
739 if (error !=
ERR_NONE)
return error;
740 error = SaveCalendarType(file, Note->
Type, UseUnicode);
741 if (error !=
ERR_NONE)
return error;
745 error = SaveBackupText(file,
"",
"StartTime", UseUnicode);
746 if (error !=
ERR_NONE)
return error;
747 error = SaveVCalDateTime(file, &Note->
Entries[i].
Date, UseUnicode);
748 if (error !=
ERR_NONE)
return error;
751 error = SaveBackupText(file,
"",
"StopTime", UseUnicode);
752 if (error !=
ERR_NONE)
return error;
753 error = SaveVCalDateTime(file, &Note->
Entries[i].
Date, UseUnicode);
754 if (error !=
ERR_NONE)
return error;
757 error = SaveBackupText(file,
"",
"ToneAlarm", UseUnicode);
758 if (error !=
ERR_NONE)
return error;
759 error = SaveVCalDateTime(file, &Note->
Entries[i].
Date, UseUnicode);
760 if (error !=
ERR_NONE)
return error;
763 error = SaveBackupText(file,
"",
"SilentAlarm", UseUnicode);
764 if (error !=
ERR_NONE)
return error;
765 error = SaveVCalDateTime(file, &Note->
Entries[i].
Date, UseUnicode);
766 if (error !=
ERR_NONE)
return error;
769 error = SaveBackupText(file,
"",
"LastModified", UseUnicode);
770 if (error !=
ERR_NONE)
return error;
771 error = SaveVCalDateTime(file, &Note->
Entries[i].
Date, UseUnicode);
772 if (error !=
ERR_NONE)
return error;
775 sprintf(buffer,
"Private = %d%c%c",Note->
Entries[i].
Number,13,10);
776 error = SaveBackupText(file,
"", buffer, UseUnicode);
777 if (error !=
ERR_NONE)
return error;
780 error = SaveBackupText(file,
"EventLocation", Note->
Entries[i].
Text, UseUnicode);
781 if (error !=
ERR_NONE)
return error;
784 sprintf(buffer,
"ContactID = %d%c%c",Note->
Entries[i].
Number,13,10);
785 error = SaveBackupText(file,
"", buffer, UseUnicode);
786 if (error !=
ERR_NONE)
return error;
789 error = SaveBackupText(file,
"Text", Note->
Entries[i].
Text, UseUnicode);
790 if (error !=
ERR_NONE)
return error;
793 error = SaveBackupText(file,
"Description", Note->
Entries[i].
Text, UseUnicode);
794 if (error !=
ERR_NONE)
return error;
797 error = SaveBackupText(file,
"LUID", Note->
Entries[i].
Text, UseUnicode);
798 if (error !=
ERR_NONE)
return error;
801 error = SaveBackupText(file,
"Phone", Note->
Entries[i].
Text, UseUnicode);
802 if (error !=
ERR_NONE)
return error;
805 error = SaveBackupText(file,
"",
"RepeatStopDate", UseUnicode);
806 if (error !=
ERR_NONE)
return error;
807 error = SaveVCalDate(file, &Note->
Entries[i].
Date, UseUnicode);
808 if (error !=
ERR_NONE)
return error;
811 error = SaveBackupText(file,
"",
"RepeatStartDate", UseUnicode);
812 if (error !=
ERR_NONE)
return error;
813 error = SaveVCalDate(file, &Note->
Entries[i].
Date, UseUnicode);
814 if (error !=
ERR_NONE)
return error;
817 sprintf(buffer,
"RepeatDayOfWeek = %d%c%c",Note->
Entries[i].
Number,13,10);
818 error = SaveBackupText(file,
"", buffer, UseUnicode);
819 if (error !=
ERR_NONE)
return error;
822 sprintf(buffer,
"RepeatDay = %d%c%c",Note->
Entries[i].
Number,13,10);
823 error = SaveBackupText(file,
"", buffer, UseUnicode);
824 if (error !=
ERR_NONE)
return error;
827 sprintf(buffer,
"RepeatWeekOfMonth = %d%c%c",Note->
Entries[i].
Number,13,10);
828 error = SaveBackupText(file,
"", buffer, UseUnicode);
829 if (error !=
ERR_NONE)
return error;
832 sprintf(buffer,
"RepeatMonth = %d%c%c",Note->
Entries[i].
Number,13,10);
833 error = SaveBackupText(file,
"", buffer, UseUnicode);
834 if (error !=
ERR_NONE)
return error;
837 sprintf(buffer,
"RepeatFrequency = %d%c%c",Note->
Entries[i].
Number,13,10);
838 error = SaveBackupText(file,
"", buffer, UseUnicode);
839 if (error !=
ERR_NONE)
return error;
842 sprintf(buffer,
"RepeatCount = %d%c%c",Note->
Entries[i].
Number,13,10);
843 error = SaveBackupText(file,
"", buffer, UseUnicode);
844 if (error !=
ERR_NONE)
return error;
847 sprintf(buffer,
"RepeatDayOfYear = %d%c%c",Note->
Entries[i].
Number,13,10);
848 error = SaveBackupText(file,
"", buffer, UseUnicode);
849 if (error !=
ERR_NONE)
return error;
853 sprintf(buffer,
"%c%c",13,10);
854 error = SaveBackupText(file,
"", buffer, UseUnicode);
855 if (error !=
ERR_NONE)
return error;
863 char buffer[10000]={0};
867 sprintf(buffer,
"Active = Yes%c%c",13,10);
868 error = SaveBackupText(file,
"", buffer, UseUnicode);
869 if (error !=
ERR_NONE)
return error;
877 error = SaveBackupText(file,
"", buffer, UseUnicode);
878 if (error !=
ERR_NONE)
return error;
880 sprintf(buffer,
"ReadOnly = Yes%c%c",13,10);
881 error = SaveBackupText(file,
"", buffer, UseUnicode);
882 if (error !=
ERR_NONE)
return error;
884 sprintf(buffer,
"Proxy");
885 error = SaveBackupText(file, buffer, settings->
Proxy, UseUnicode);
886 if (error !=
ERR_NONE)
return error;
887 sprintf(buffer,
"ProxyPort = %i%c%c",settings->
ProxyPort,13,10);
888 error = SaveBackupText(file,
"", buffer, UseUnicode);
889 if (error !=
ERR_NONE)
return error;
890 sprintf(buffer,
"Proxy2");
891 error = SaveBackupText(file, buffer, settings->
Proxy2, UseUnicode);
892 if (error !=
ERR_NONE)
return error;
893 sprintf(buffer,
"Proxy2Port = %i%c%c",settings->
Proxy2Port,13,10);
894 error = SaveBackupText(file,
"", buffer, UseUnicode);
895 if (error !=
ERR_NONE)
return error;
896 sprintf(buffer,
"%c%c",13,10);
897 error = SaveBackupText(file,
"", buffer, UseUnicode);
898 if (error !=
ERR_NONE)
return error;
899 for (i=0;i<settings->
Number;i++) {
900 sprintf(buffer,
"Title%02i",i);
901 error = SaveBackupText(file, buffer, settings->
Settings[i].
Title, UseUnicode);
902 if (error !=
ERR_NONE)
return error;
903 sprintf(buffer,
"HomePage%02i",i);
904 error = SaveBackupText(file, buffer, settings->
Settings[i].
HomePage, UseUnicode);
905 if (error !=
ERR_NONE)
return error;
907 sprintf(buffer,
"Type%02i = Continuous%c%c",i,13,10);
909 sprintf(buffer,
"Type%02i = Temporary%c%c",i,13,10);
911 error = SaveBackupText(file,
"", buffer, UseUnicode);
912 if (error !=
ERR_NONE)
return error;
914 sprintf(buffer,
"Security%02i = On%c%c",i,13,10);
916 sprintf(buffer,
"Security%02i = Off%c%c",i,13,10);
918 error = SaveBackupText(file,
"", buffer, UseUnicode);
919 if (error !=
ERR_NONE)
return error;
922 sprintf(buffer,
"Bearer%02i = SMS%c%c",i,13,10);
923 error = SaveBackupText(file,
"", buffer, UseUnicode);
924 if (error !=
ERR_NONE)
return error;
925 sprintf(buffer,
"Server%02i",i);
926 error = SaveBackupText(file, buffer, settings->
Settings[i].
Server, UseUnicode);
927 if (error !=
ERR_NONE)
return error;
928 sprintf(buffer,
"Service%02i",i);
929 error = SaveBackupText(file, buffer, settings->
Settings[i].
Service, UseUnicode);
930 if (error !=
ERR_NONE)
return error;
933 sprintf(buffer,
"Bearer%02i = GPRS%c%c",i,13,10);
934 error = SaveBackupText(file,
"", buffer, UseUnicode);
935 if (error !=
ERR_NONE)
return error;
936 sprintf(buffer,
"IP%02i",i);
937 error = SaveBackupText(file, buffer, settings->
Settings[i].
IPAddress, UseUnicode);
938 if (error !=
ERR_NONE)
return error;
941 sprintf(buffer,
"Bearer%02i = Data%c%c",i,13,10);
942 error = SaveBackupText(file,
"", buffer, UseUnicode);
943 if (error !=
ERR_NONE)
return error;
945 sprintf(buffer,
"CallType%02i = ISDN%c%c",i,13,10);
947 sprintf(buffer,
"CallType%02i = Analogue%c%c",i,13,10);
949 error = SaveBackupText(file,
"", buffer, UseUnicode);
950 if (error !=
ERR_NONE)
return error;
951 sprintf(buffer,
"IP%02i",i);
952 error = SaveBackupText(file, buffer, settings->
Settings[i].
IPAddress, UseUnicode);
953 if (error !=
ERR_NONE)
return error;
955 sprintf(buffer,
"Number%02i",i);
956 error = SaveBackupText(file, buffer, settings->
Settings[i].
DialUp, UseUnicode);
957 if (error !=
ERR_NONE)
return error;
959 sprintf(buffer,
"Login%02i = Manual%c%c",i,13,10);
961 sprintf(buffer,
"Login%02i = Automatic%c%c",i,13,10);
963 error = SaveBackupText(file,
"", buffer, UseUnicode);
964 if (error !=
ERR_NONE)
return error;
966 sprintf(buffer,
"Authentication%02i = Normal%c%c",i,13,10);
968 sprintf(buffer,
"Authentication%02i = Secure%c%c",i,13,10);
970 error = SaveBackupText(file,
"", buffer, UseUnicode);
971 if (error !=
ERR_NONE)
return error;
981 error = SaveBackupText(file,
"", buffer, UseUnicode);
982 if (error !=
ERR_NONE)
return error;
986 sprintf(buffer,
"User%02i",i);
987 error = SaveBackupText(file, buffer, settings->
Settings[i].
User, UseUnicode);
988 if (error !=
ERR_NONE)
return error;
989 sprintf(buffer,
"Password%02i",i);
990 error = SaveBackupText(file, buffer, settings->
Settings[i].
Password, UseUnicode);
991 if (error !=
ERR_NONE)
return error;
994 sprintf(buffer,
"Bearer%02i = USSD%c%c",i,13,10);
995 error = SaveBackupText(file,
"", buffer, UseUnicode);
996 if (error !=
ERR_NONE)
return error;
997 sprintf(buffer,
"ServiceCode%02i",i);
998 error = SaveBackupText(file, buffer, settings->
Settings[i].
Code, UseUnicode);
999 if (error !=
ERR_NONE)
return error;
1001 sprintf(buffer,
"IP%02i",i);
1003 sprintf(buffer,
"Number%02i",i);
1005 error = SaveBackupText(file, buffer, settings->
Settings[i].
Service, UseUnicode);
1006 if (error !=
ERR_NONE)
return error;
1008 sprintf(buffer,
"%c%c",13,10);
1009 error = SaveBackupText(file,
"", buffer, UseUnicode);
1010 if (error !=
ERR_NONE)
return error;
1017 char buffer[10000]={0};
1020 sprintf(buffer,
"HomePage");
1021 error = SaveBackupText(file, buffer, settings->
HomePage, UseUnicode);
1022 if (error !=
ERR_NONE)
return error;
1023 sprintf(buffer,
"User");
1024 error = SaveBackupText(file, buffer, settings->
User, UseUnicode);
1025 if (error !=
ERR_NONE)
return error;
1026 sprintf(buffer,
"Password");
1027 error = SaveBackupText(file, buffer, settings->
Password, UseUnicode);
1028 if (error !=
ERR_NONE)
return error;
1029 error = SaveWAPSettingsEntry(file, &settings->
Connection, UseUnicode);
1030 if (error !=
ERR_NONE)
return error;
1036 char buffer[10000]={0};
1039 sprintf(buffer,
"User");
1040 error = SaveBackupText(file, buffer, settings->
User, UseUnicode);
1041 if (error !=
ERR_NONE)
return error;
1042 sprintf(buffer,
"Password");
1043 error = SaveBackupText(file, buffer, settings->
Password, UseUnicode);
1044 if (error !=
ERR_NONE)
return error;
1045 sprintf(buffer,
"PhonebookDB");
1047 if (error !=
ERR_NONE)
return error;
1048 sprintf(buffer,
"CalendarDB");
1049 error = SaveBackupText(file, buffer, settings->
CalendarDataBase, UseUnicode);
1050 if (error !=
ERR_NONE)
return error;
1051 sprintf(buffer,
"Server");
1052 error = SaveBackupText(file, buffer, settings->
Server, UseUnicode);
1053 if (error !=
ERR_NONE)
return error;
1055 sprintf(buffer,
"SyncPhonebook = True%c%c",13,10);
1057 sprintf(buffer,
"SyncPhonebook = False%c%c",13,10);
1059 error = SaveBackupText(file,
"", buffer, UseUnicode);
1060 if (error !=
ERR_NONE)
return error;
1062 sprintf(buffer,
"SyncCalendar = True%c%c",13,10);
1064 sprintf(buffer,
"SyncCalendar = False%c%c",13,10);
1066 error = SaveBackupText(file,
"", buffer, UseUnicode);
1067 if (error !=
ERR_NONE)
return error;
1068 error = SaveWAPSettingsEntry(file, &settings->
Connection, UseUnicode);
1069 if (error !=
ERR_NONE)
return error;
1075 unsigned char buffer[10000]={0},buffer2[10000]={0};
1079 sprintf(buffer,
"Width = %ld%c%c", (
long)bitmap->
BitmapWidth,13,10);
1080 error = SaveBackupText(file,
"", buffer, UseUnicode);
1081 if (error !=
ERR_NONE)
return error;
1082 sprintf(buffer,
"Height = %ld%c%c", (
long)bitmap->
BitmapHeight,13,10);
1083 error = SaveBackupText(file,
"", buffer, UseUnicode);
1084 if (error !=
ERR_NONE)
return error;
1091 sprintf(buffer2,
"Bitmap%02i = \"%s\"%c%c",(
int)y,buffer,13,10);
1092 error = SaveBackupText(file,
"", buffer2, UseUnicode);
1093 if (error !=
ERR_NONE)
return error;
1100 unsigned char buffer[1000]={0};
1103 sprintf(buffer,
"Location = %03i%c%c",bitmap->
Location,13,10);
1104 error = SaveBackupText(file,
"", buffer, UseUnicode);
1105 if (error !=
ERR_NONE)
return error;
1107 error = SaveBackupText(file,
"Name", bitmap->
Text, UseUnicode);
1108 if (error !=
ERR_NONE)
return error;
1112 sprintf(buffer,
"FileRingtone = %02x%c%c",bitmap->
RingtoneID,13,10);
1114 sprintf(buffer,
"Ringtone = %02x%c%c",bitmap->
RingtoneID,13,10);
1116 error = SaveBackupText(file,
"", buffer, UseUnicode);
1117 if (error !=
ERR_NONE)
return error;
1120 sprintf(buffer,
"Enabled = True%c%c",13,10);
1122 sprintf(buffer,
"Enabled = False%c%c",13,10);
1124 error = SaveBackupText(file,
"", buffer, UseUnicode);
1125 if (error !=
ERR_NONE)
return error;
1127 error = SaveBitmapEntry(file, bitmap, UseUnicode);
1128 if (error !=
ERR_NONE)
return error;
1130 sprintf(buffer,
"%c%c",13,10);
1131 error = SaveBackupText(file,
"", buffer, UseUnicode);
1132 if (error !=
ERR_NONE)
return error;
1139 unsigned char buffer[1000]={0};
1142 error = SaveBackupText(file,
"URL", bookmark->
Address, UseUnicode);
1143 if (error !=
ERR_NONE)
return error;
1144 error = SaveBackupText(file,
"Title", bookmark->
Title, UseUnicode);
1145 if (error !=
ERR_NONE)
return error;
1146 sprintf(buffer,
"%c%c",13,10);
1147 error = SaveBackupText(file,
"", buffer, UseUnicode);
1148 if (error !=
ERR_NONE)
return error;
1155 unsigned char buffer[1000]={0};
1158 sprintf(buffer,
"[Startup]%c%c",13,10);
1159 error = SaveBackupText(file,
"", buffer, UseUnicode);
1160 if (error !=
ERR_NONE)
return error;
1162 error = SaveBackupText(file,
"Text", bitmap->
Text, UseUnicode);
1163 if (error !=
ERR_NONE)
return error;
1166 error = SaveBitmapEntry(file, bitmap, UseUnicode);
1167 if (error !=
ERR_NONE)
return error;
1169 sprintf(buffer,
"%c%c",13,10);
1170 error = SaveBackupText(file,
"", buffer, UseUnicode);
1171 if (error !=
ERR_NONE)
return error;
1178 unsigned char buffer[1000]={0};
1181 sprintf(buffer,
"Location = %03i%c%c",SMSC->
Location,13,10);
1182 error = SaveBackupText(file,
"", buffer, UseUnicode);
1183 if (error !=
ERR_NONE)
return error;
1184 error = SaveBackupText(file,
"Name", SMSC->
Name, UseUnicode);
1185 if (error !=
ERR_NONE)
return error;
1186 error = SaveBackupText(file,
"Number", SMSC->
Number, UseUnicode);
1187 if (error !=
ERR_NONE)
return error;
1188 error = SaveBackupText(file,
"DefaultNumber", SMSC->
DefaultNumber, UseUnicode);
1189 if (error !=
ERR_NONE)
return error;
1190 error = SaveBackupText(file,
"",
"Format = ", UseUnicode);
1191 if (error !=
ERR_NONE)
return error;
1198 error = SaveBackupText(file,
"", buffer, UseUnicode);
1199 if (error !=
ERR_NONE)
return error;
1200 sprintf(buffer,
"%c%cValidity = ",13,10);
1201 error = SaveBackupText(file,
"", buffer, UseUnicode);
1202 if (error !=
ERR_NONE)
return error;
1210 default : sprintf(buffer,
"MaximumTime" );
break;
1212 error = SaveBackupText(file,
"", buffer, UseUnicode);
1213 if (error !=
ERR_NONE)
return error;
1214 sprintf(buffer,
"%c%c%c%c",13,10,13,10);
1215 error = SaveBackupText(file,
"", buffer, UseUnicode);
1216 if (error !=
ERR_NONE)
return error;
1223 unsigned char *buffer=NULL;
1230 sprintf(buffer,
"Location = %i%c%c",ringtone->
Location,13,10);
1231 error = SaveBackupText(file,
"", buffer, UseUnicode);
1237 error = SaveBackupText(file,
"Name", ringtone->
Name, UseUnicode);
1243 switch (ringtone->
Format) {
1246 SaveLinkedBackupText(file,
"NokiaBinary", buffer, UseUnicode);
1250 SaveLinkedBackupText(file,
"Pure Midi", buffer, UseUnicode);
1254 SaveLinkedBackupText(file,
"SMAF", buffer, UseUnicode);
1259 sprintf(buffer,
"%c%c",13,10);
1260 error = SaveBackupText(file,
"", buffer, UseUnicode);
1264 if (error !=
ERR_NONE)
return error;
1271 unsigned char buffer[1000]={0};
1274 sprintf(buffer,
"[Operator]%c%c",13,10);
1275 error = SaveBackupText(file,
"", buffer, UseUnicode);
1276 if (error !=
ERR_NONE)
return error;
1277 sprintf(buffer,
"Network = \"%s\"%c%c", bitmap->
NetworkCode,13,10);
1278 error = SaveBackupText(file,
"", buffer, UseUnicode);
1279 if (error !=
ERR_NONE)
return error;
1280 error = SaveBitmapEntry(file, bitmap, UseUnicode);
1281 if (error !=
ERR_NONE)
return error;
1282 sprintf(buffer,
"%c%c",13,10);
1283 error = SaveBackupText(file,
"", buffer, UseUnicode);
1284 if (error !=
ERR_NONE)
return error;
1291 unsigned char buffer[1000]={0};
1295 sprintf(buffer,
"Location = %i%c%c",ToDo->
Location,13,10);
1296 error = SaveBackupText(file,
"", buffer, UseUnicode);
1297 if (error !=
ERR_NONE)
return error;
1298 error = SaveCalendarType(file, ToDo->
Type, UseUnicode);
1299 if (error !=
ERR_NONE)
return error;
1302 sprintf(buffer,
"Priority = High%c%c",13,10);
1305 sprintf(buffer,
"Priority = Medium%c%c",13,10);
1308 sprintf(buffer,
"Priority = Low%c%c",13,10);
1313 error = SaveBackupText(file,
"", buffer, UseUnicode);
1314 if (error !=
ERR_NONE)
return error;
1319 error = SaveBackupText(file,
"",
"DueTime", UseUnicode);
1320 if (error !=
ERR_NONE)
return error;
1321 error = SaveVCalDateTime(file, &ToDo->
Entries[j].
Date, UseUnicode);
1322 if (error !=
ERR_NONE)
return error;
1325 error = SaveBackupText(file,
"",
"StartTime", UseUnicode);
1326 if (error !=
ERR_NONE)
return error;
1327 error = SaveVCalDateTime(file, &ToDo->
Entries[j].
Date, UseUnicode);
1328 if (error !=
ERR_NONE)
return error;
1331 error = SaveBackupText(file,
"",
"CompletedTime", UseUnicode);
1332 if (error !=
ERR_NONE)
return error;
1333 error = SaveVCalDateTime(file, &ToDo->
Entries[j].
Date, UseUnicode);
1334 if (error !=
ERR_NONE)
return error;
1337 sprintf(buffer,
"Completed = %s%c%c",ToDo->
Entries[j].
Number == 1 ?
"yes" :
"no" ,13,10);
1338 error = SaveBackupText(file,
"", buffer, UseUnicode);
1339 if (error !=
ERR_NONE)
return error;
1342 error = SaveBackupText(file,
"",
"Alarm", UseUnicode);
1343 if (error !=
ERR_NONE)
return error;
1344 error = SaveVCalDateTime(file, &ToDo->
Entries[j].
Date, UseUnicode);
1345 if (error !=
ERR_NONE)
return error;
1348 error = SaveBackupText(file,
"",
"SilentAlarm", UseUnicode);
1349 if (error !=
ERR_NONE)
return error;
1350 error = SaveVCalDateTime(file, &ToDo->
Entries[j].
Date, UseUnicode);
1351 if (error !=
ERR_NONE)
return error;
1354 error = SaveBackupText(file,
"",
"LastModified", UseUnicode);
1355 if (error !=
ERR_NONE)
return error;
1356 error = SaveVCalDateTime(file, &ToDo->
Entries[j].
Date, UseUnicode);
1357 if (error !=
ERR_NONE)
return error;
1360 error = SaveBackupText(file,
"Text", ToDo->
Entries[j].
Text, UseUnicode);
1361 if (error !=
ERR_NONE)
return error;
1364 sprintf(buffer,
"Private = %i%c%c",ToDo->
Entries[j].
Number,13,10);
1365 error = SaveBackupText(file,
"", buffer, UseUnicode);
1366 if (error !=
ERR_NONE)
return error;
1369 sprintf(buffer,
"Category = %i%c%c",ToDo->
Entries[j].
Number,13,10);
1370 error = SaveBackupText(file,
"", buffer, UseUnicode);
1371 if (error !=
ERR_NONE)
return error;
1374 sprintf(buffer,
"ContactID = %i%c%c",ToDo->
Entries[j].
Number,13,10);
1375 error = SaveBackupText(file,
"", buffer, UseUnicode);
1376 if (error !=
ERR_NONE)
return error;
1379 error = SaveBackupText(file,
"Phone", ToDo->
Entries[j].
Text, UseUnicode);
1380 if (error !=
ERR_NONE)
return error;
1383 error = SaveBackupText(file,
"Description", ToDo->
Entries[j].
Text, UseUnicode);
1384 if (error !=
ERR_NONE)
return error;
1387 error = SaveBackupText(file,
"EventLocation", ToDo->
Entries[j].
Text, UseUnicode);
1388 if (error !=
ERR_NONE)
return error;
1391 error = SaveBackupText(file,
"LUID", ToDo->
Entries[j].
Text, UseUnicode);
1392 if (error !=
ERR_NONE)
return error;
1396 sprintf(buffer,
"%c%c",13,10);
1397 error = SaveBackupText(file,
"", buffer, UseUnicode);
1398 if (error !=
ERR_NONE)
return error;
1407 unsigned char buffer[1000]={0};
1410 sprintf(buffer,
"Location = %i%c%c",Profile->
Location,13,10);
1411 error = SaveBackupText(file,
"", buffer, UseUnicode);
1412 if (error !=
ERR_NONE)
return error;
1413 error = SaveBackupText(file,
"Name",Profile->
Name, UseUnicode);
1414 if (error !=
ERR_NONE)
return error;
1417 sprintf(buffer,
"DefaultName = TRUE%c%c",13,10);
1418 error = SaveBackupText(file,
"", buffer, UseUnicode);
1419 if (error !=
ERR_NONE)
return error;
1422 sprintf(buffer,
"HeadSetProfile = TRUE%c%c",13,10);
1423 error = SaveBackupText(file,
"", buffer, UseUnicode);
1424 if (error !=
ERR_NONE)
return error;
1427 sprintf(buffer,
"CarKitProfile = TRUE%c%c",13,10);
1428 error = SaveBackupText(file,
"", buffer, UseUnicode);
1429 if (error !=
ERR_NONE)
return error;
1433 sprintf(buffer,
"Feature%02i = ",j);
1434 error = SaveBackupText(file,
"", buffer, UseUnicode);
1435 if (error !=
ERR_NONE)
return error;
1442 sprintf(buffer,
"RingtoneID%c%c",13,10);
1444 sprintf(buffer,
"MessageToneID%c%c",13,10);
1446 error = SaveBackupText(file,
"", buffer, UseUnicode);
1447 if (error !=
ERR_NONE)
return error;
1448 sprintf(buffer,
"Value%02i = %i%c%c",j,Profile->
FeatureValue[j],13,10);
1449 error = SaveBackupText(file,
"", buffer, UseUnicode);
1450 if (error !=
ERR_NONE)
return error;
1454 sprintf(buffer,
"CallerGroups%c%c",13,10);
1455 error = SaveBackupText(file,
"", buffer, UseUnicode);
1456 if (error !=
ERR_NONE)
return error;
1457 sprintf(buffer,
"Value%02i = ",j);
1458 error = SaveBackupText(file,
"", buffer, UseUnicode);
1459 if (error !=
ERR_NONE)
return error;
1462 sprintf(buffer,
"%i",k);
1463 error = SaveBackupText(file,
"", buffer, UseUnicode);
1464 if (error !=
ERR_NONE)
return error;
1467 sprintf(buffer,
"%c%c",13,10);
1468 error = SaveBackupText(file,
"", buffer, UseUnicode);
1469 if (error !=
ERR_NONE)
return error;
1473 sprintf(buffer,
"ScreenSaverNumber%c%c",13,10);
1474 error = SaveBackupText(file,
"", buffer, UseUnicode);
1475 if (error !=
ERR_NONE)
return error;
1476 sprintf(buffer,
"Value%02i = %i%c%c",j,Profile->
FeatureValue[j],13,10);
1477 error = SaveBackupText(file,
"", buffer, UseUnicode);
1478 if (error !=
ERR_NONE)
return error;
1490 default : special =
TRUE;
1493 error = SaveBackupText(file,
"", buffer, UseUnicode);
1494 if (error !=
ERR_NONE)
return error;
1495 sprintf(buffer,
"Value%02i = ",j);
1496 error = SaveBackupText(file,
"", buffer, UseUnicode);
1497 if (error !=
ERR_NONE)
return error;
1537 default : sprintf(buffer,
"UNKNOWN%c%c",13,10);
1539 error = SaveBackupText(file,
"", buffer, UseUnicode);
1540 if (error !=
ERR_NONE)
return error;
1543 sprintf(buffer,
"%c%c",13,10);
1544 error = SaveBackupText(file,
"", buffer, UseUnicode);
1545 if (error !=
ERR_NONE)
return error;
1552 unsigned char buffer[1000]={0};
1555 sprintf(buffer,
"Location = %i%c%c",FMStation->
Location,13,10);
1556 error = SaveBackupText(file,
"", buffer, UseUnicode);
1557 if (error !=
ERR_NONE)
return error;
1558 error = SaveBackupText(file,
"StationName", FMStation->
StationName, UseUnicode);
1559 if (error !=
ERR_NONE)
return error;
1560 sprintf(buffer,
"Frequency = %f%c%c",FMStation->
Frequency,13,10);
1561 error = SaveBackupText(file,
"", buffer, UseUnicode);
1562 if (error !=
ERR_NONE)
return error;
1563 sprintf(buffer,
"%c%c",13,10);
1564 error = SaveBackupText(file,
"", buffer, UseUnicode);
1565 if (error !=
ERR_NONE)
return error;
1572 unsigned char buffer[1000]={0};
1575 sprintf(buffer,
"Location = %i%c%c",GPRSPoint->
Location,13,10);
1576 error = SaveBackupText(file,
"", buffer, UseUnicode);
1577 if (error !=
ERR_NONE)
return error;
1578 error = SaveBackupText(file,
"Name", GPRSPoint->
Name, UseUnicode);
1579 if (error !=
ERR_NONE)
return error;
1580 error = SaveBackupText(file,
"URL", GPRSPoint->
URL, UseUnicode);
1581 if (error !=
ERR_NONE)
return error;
1583 sprintf(buffer,
"Active = Yes%c%c",13,10);
1584 error = SaveBackupText(file,
"", buffer, UseUnicode);
1585 if (error !=
ERR_NONE)
return error;
1587 sprintf(buffer,
"%c%c",13,10);
1588 error = SaveBackupText(file,
"", buffer, UseUnicode);
1589 if (error !=
ERR_NONE)
return error;
1594 GSM_Error SaveBackup(
const char *FileName, GSM_Backup *backup,
gboolean UseUnicode)
1597 unsigned char buffer[1000]={0},checksum[200]={0};
1601 file = fopen(FileName,
"wb");
1605 sprintf(buffer,
"%c%c", 0xFE, 0xFF);
1606 error = SaveBackupText(file,
"", buffer,
FALSE);
1611 error = SaveBackupText(file,
"", buffer, UseUnicode);
1614 error = SaveBackupText(file,
"", buffer, UseUnicode);
1616 sprintf(buffer,
"[Backup]%c%c",13,10);
1617 error = SaveBackupText(file,
"", buffer, UseUnicode);
1619 sprintf(buffer,
"IMEI = \"%s\"%c%c",backup->IMEI,13,10);
1620 error = SaveBackupText(file,
"", buffer, UseUnicode);
1622 sprintf(buffer,
"Phone = \"%s\"%c%c",backup->Model,13,10);
1623 error = SaveBackupText(file,
"", buffer, UseUnicode);
1625 if (backup->Creator[0] != 0) {
1626 sprintf(buffer,
"Creator = \"%s\"%c%c",backup->Creator,13,10);
1627 error = SaveBackupText(file,
"", buffer, UseUnicode);
1630 if (backup->DateTimeAvailable) {
1631 error = SaveBackupText(file,
"",
"DateTime", UseUnicode);
1633 error = SaveVCalDateTime(file, &backup->DateTime, UseUnicode);
1636 sprintf(buffer,
"Format = 1.05%c%c",13,10);
1637 error = SaveBackupText(file,
"", buffer, UseUnicode);
1639 sprintf(buffer,
"%c%c",13,10);
1640 error = SaveBackupText(file,
"", buffer, UseUnicode);
1644 while (backup->PhonePhonebook[i]!=NULL) {
1645 sprintf(buffer,
"[PhonePBK%03i]%c%c",i+1,13,10);
1646 error = SaveBackupText(file,
"", buffer, UseUnicode);
1648 error = SavePbkEntry(file, backup->PhonePhonebook[i], UseUnicode);
1653 while (backup->SIMPhonebook[i]!=NULL) {
1654 sprintf(buffer,
"[SIMPBK%03i]%c%c",i+1,13,10);
1655 error = SaveBackupText(file,
"", buffer, UseUnicode);
1657 error = SavePbkEntry(file, backup->SIMPhonebook[i], UseUnicode);
1662 while (backup->Calendar[i]!=NULL) {
1663 sprintf(buffer,
"[Calendar%03i]%c%c",i+1,13,10);
1664 error = SaveBackupText(file,
"", buffer, UseUnicode);
1666 error = SaveCalendarEntry(file, backup->Calendar[i], UseUnicode);
1671 while (backup->Note[i]!=NULL) {
1672 sprintf(buffer,
"[Note%03i]%c%c",i+1,13,10);
1673 error = SaveBackupText(file,
"", buffer, UseUnicode);
1675 error = SaveNoteEntry(file, backup->Note[i], UseUnicode);
1680 while (backup->CallerLogos[i]!=NULL) {
1681 sprintf(buffer,
"[Caller%03i]%c%c",i+1,13,10);
1682 error = SaveBackupText(file,
"", buffer, UseUnicode);
1684 error = SaveCallerEntry(file, backup->CallerLogos[i], UseUnicode);
1689 while (backup->SMSC[i]!=NULL) {
1690 sprintf(buffer,
"[SMSC%03i]%c%c",i+1,13,10);
1691 error = SaveBackupText(file,
"", buffer, UseUnicode);
1693 error = SaveSMSCEntry(file, backup->SMSC[i], UseUnicode);
1698 while (backup->WAPBookmark[i]!=NULL) {
1699 sprintf(buffer,
"[WAPBookmark%03i]%c%c",i+1,13,10);
1700 error = SaveBackupText(file,
"", buffer, UseUnicode);
1702 error = SaveWAPBookmarkEntry(file, backup->WAPBookmark[i], UseUnicode);
1707 while (backup->WAPSettings[i]!=NULL) {
1708 sprintf(buffer,
"[WAPSettings%03i]%c%c",i+1,13,10);
1709 error = SaveBackupText(file,
"", buffer, UseUnicode);
1711 error = SaveWAPSettingsEntry(file, backup->WAPSettings[i], UseUnicode);
1716 while (backup->MMSSettings[i]!=NULL) {
1717 sprintf(buffer,
"[MMSSettings%03i]%c%c",i+1,13,10);
1718 error = SaveBackupText(file,
"", buffer, UseUnicode);
1720 error = SaveWAPSettingsEntry(file, backup->MMSSettings[i], UseUnicode);
1725 while (backup->SyncMLSettings[i]!=NULL) {
1726 sprintf(buffer,
"[SyncMLSettings%03i]%c%c",i+1,13,10);
1727 error = SaveBackupText(file,
"", buffer, UseUnicode);
1729 error = SaveSyncMLSettingsEntry(file, backup->SyncMLSettings[i], UseUnicode);
1734 while (backup->ChatSettings[i]!=NULL) {
1735 sprintf(buffer,
"[ChatSettings%03i]%c%c",i+1,13,10);
1736 error = SaveBackupText(file,
"", buffer, UseUnicode);
1738 error = SaveChatSettingsEntry(file, backup->ChatSettings[i], UseUnicode);
1743 while (backup->Ringtone[i]!=NULL) {
1744 sprintf(buffer,
"[Ringtone%03i]%c%c",i+1,13,10);
1745 error = SaveBackupText(file,
"", buffer, UseUnicode);
1747 error = SaveRingtoneEntry(file, backup->Ringtone[i], UseUnicode);
1752 while (backup->ToDo[i]!=NULL) {
1753 sprintf(buffer,
"[TODO%03i]%c%c",i+1,13,10);
1754 error = SaveBackupText(file,
"", buffer, UseUnicode);
1756 error = SaveToDoEntry(file, backup->ToDo[i], UseUnicode);
1761 while (backup->Profiles[i]!=NULL) {
1762 sprintf(buffer,
"[Profile%03i]%c%c",i+1,13,10);
1763 error = SaveBackupText(file,
"", buffer, UseUnicode);
1765 error = SaveProfileEntry(file, backup->Profiles[i], UseUnicode);
1770 while (backup->FMStation[i]!=NULL) {
1771 sprintf(buffer,
"[FMStation%03i]%c%c",i+1,13,10);
1772 error = SaveBackupText(file,
"", buffer, UseUnicode);
1774 error = SaveFMStationEntry(file, backup->FMStation[i], UseUnicode);
1779 while (backup->GPRSPoint[i]!=NULL) {
1780 sprintf(buffer,
"[GPRSPoint%03i]%c%c",i+1,13,10);
1781 error = SaveBackupText(file,
"", buffer, UseUnicode);
1783 error = SaveGPRSPointEntry(file, backup->GPRSPoint[i], UseUnicode);
1788 if (backup->StartupLogo!=NULL) {
1789 error = SaveStartupEntry(file, backup->StartupLogo, UseUnicode);
1792 if (backup->OperatorLogo!=NULL) {
1793 error = SaveOperatorEntry(file, backup->OperatorLogo, UseUnicode);
1799 FindBackupChecksum(FileName, UseUnicode, checksum);
1801 file = fopen(FileName,
"ab");
1803 sprintf(buffer,
"[Checksum]%c%c",13,10);
1804 error = SaveBackupText(file,
"", buffer, UseUnicode);
1806 sprintf(buffer,
"MD5=%s%c%c",checksum,13,10);
1807 error = SaveBackupText(file,
"", buffer, UseUnicode);
1820 unsigned char buffer[10000]={0};
1821 char *readvalue=NULL;
1835 if (strlen(buffer) == 11) {
1836 if (strncasecmp(
"Entry", buffer, 5) == 0 &&
1837 strncasecmp(
"Type", buffer+7, 4) == 0) {
1838 num = atoi(buffer+5);
1844 sprintf(buffer,
"Entry%02iLocation",num);
1845 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
1846 if (readvalue == NULL) {
1848 }
else if (strcasecmp(readvalue,
"Home") == 0) {
1850 }
else if (strcasecmp(readvalue,
"Work") == 0) {
1855 sprintf(buffer,
"Entry%02iType",num);
1856 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
1857 if (readvalue == NULL) {
1859 }
else if (strcasecmp(readvalue,
"NumberGeneral") == 0) {
1861 }
else if (strcasecmp(readvalue,
"NumberVideo") == 0) {
1863 }
else if (strcasecmp(readvalue,
"NumberMobileWork") == 0) {
1866 }
else if (strcasecmp(readvalue,
"NumberMobileHome") == 0) {
1869 }
else if (strcasecmp(readvalue,
"NumberMobile") == 0) {
1871 }
else if (strcasecmp(readvalue,
"NumberWork") == 0) {
1874 }
else if (strcasecmp(readvalue,
"NumberFax") == 0) {
1876 }
else if (strcasecmp(readvalue,
"NumberHome") == 0) {
1879 }
else if (strcasecmp(readvalue,
"NumberOther") == 0) {
1881 }
else if (strcasecmp(readvalue,
"NumberMessaging") == 0) {
1883 }
else if (strcasecmp(readvalue,
"NumberPager") == 0) {
1885 }
else if (strcasecmp(readvalue,
"Note") == 0) {
1887 }
else if (strcasecmp(readvalue,
"Postal") == 0) {
1889 }
else if (strcasecmp(readvalue,
"WorkPostal") == 0) {
1892 }
else if (strcasecmp(readvalue,
"Email") == 0) {
1894 }
else if (strcasecmp(readvalue,
"Email2") == 0) {
1896 }
else if (strcasecmp(readvalue,
"URL") == 0) {
1898 }
else if (strcasecmp(readvalue,
"FirstName") == 0) {
1900 }
else if (strcasecmp(readvalue,
"SecondName") == 0) {
1902 }
else if (strcasecmp(readvalue,
"NickName") == 0) {
1904 }
else if (strcasecmp(readvalue,
"FormalName") == 0) {
1906 }
else if (strcasecmp(readvalue,
"NamePrefix") == 0) {
1908 }
else if (strcasecmp(readvalue,
"NameSuffix") == 0) {
1910 }
else if (strcasecmp(readvalue,
"LastName") == 0) {
1912 }
else if (strcasecmp(readvalue,
"Company") == 0) {
1914 }
else if (strcasecmp(readvalue,
"JobTitle") == 0) {
1916 }
else if (strcasecmp(readvalue,
"Address") == 0) {
1918 }
else if (strcasecmp(readvalue,
"City") == 0) {
1920 }
else if (strcasecmp(readvalue,
"State") == 0) {
1922 }
else if (strcasecmp(readvalue,
"Zip") == 0) {
1924 }
else if (strcasecmp(readvalue,
"Country") == 0) {
1926 }
else if (strcasecmp(readvalue,
"WorkAddress") == 0) {
1929 }
else if (strcasecmp(readvalue,
"WorkCity") == 0) {
1932 }
else if (strcasecmp(readvalue,
"WorkState") == 0) {
1935 }
else if (strcasecmp(readvalue,
"WorkZip") == 0) {
1938 }
else if (strcasecmp(readvalue,
"WorkCountry") == 0) {
1941 }
else if (strcasecmp(readvalue,
"Custom1") == 0) {
1943 }
else if (strcasecmp(readvalue,
"Custom2") == 0) {
1945 }
else if (strcasecmp(readvalue,
"Custom3") == 0) {
1947 }
else if (strcasecmp(readvalue,
"Custom4") == 0) {
1949 }
else if (strcasecmp(readvalue,
"LUID") == 0) {
1951 }
else if (strcasecmp(readvalue,
"VOIP") == 0) {
1953 }
else if (strcasecmp(readvalue,
"SWIS") == 0) {
1955 }
else if (strcasecmp(readvalue,
"WVID") == 0) {
1957 }
else if (strcasecmp(readvalue,
"SIP") == 0) {
1959 }
else if (strcasecmp(readvalue,
"DTMF") == 0) {
1961 }
else if (strcasecmp(readvalue,
"Name") == 0) {
1963 }
else if (strcasecmp(readvalue,
"Category") == 0) {
1966 sprintf(buffer,
"Entry%02iNumber",num);
1967 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
1968 if (readvalue!=NULL) {
1973 }
else if (strcasecmp(readvalue,
"Private") == 0) {
1976 sprintf(buffer,
"Entry%02iNumber",num);
1977 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
1978 if (readvalue!=NULL) {
1983 }
else if (strcasecmp(readvalue,
"CallerGroup") == 0) {
1986 sprintf(buffer,
"Entry%02iNumber",num);
1987 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
1988 if (readvalue!=NULL) {
1993 }
else if (strcasecmp(readvalue,
"RingtoneID") == 0) {
1996 sprintf(buffer,
"Entry%02iNumber",num);
1997 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
1998 if (readvalue!=NULL) {
2003 }
else if (strcasecmp(readvalue,
"PictureID") == 0) {
2006 sprintf(buffer,
"Entry%02iNumber",num);
2007 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2008 if (readvalue!=NULL) {
2013 }
else if (strcasecmp(readvalue,
"Date") == 0) {
2015 sprintf(buffer,
"Entry%02iText",num);
2016 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2017 if (readvalue != NULL) {
2022 }
else if (strcasecmp(readvalue,
"LastModified") == 0) {
2024 sprintf(buffer,
"Entry%02iText",num);
2025 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2026 if (readvalue != NULL) {
2031 }
else if (strcasecmp(readvalue,
"BMPPhoto") == 0) {
2037 }
else if (strcasecmp(readvalue,
"GIFPhoto") == 0) {
2043 }
else if (strcasecmp(readvalue,
"JPEGPhoto") == 0) {
2049 }
else if (strcasecmp(readvalue,
"ICOPhoto") == 0) {
2055 }
else if (strcasecmp(readvalue,
"PNGPhoto") == 0) {
2061 }
else if (strcasecmp(readvalue,
"Photo") == 0) {
2067 }
else if (strcasecmp(readvalue,
"PushToTalkID") == 0) {
2069 }
else if (strcasecmp(readvalue,
"UserID") == 0) {
2074 sprintf(buffer,
"Entry%02iData",num);
2075 readvalue = ReadLinkedBackupText(file_info, section, buffer, UseUnicode);
2076 if (readvalue != NULL) {
2093 sprintf(buffer,
"Entry%02iText",num);
2097 sprintf(buffer,
"Entry%02iVoiceTag",num);
2098 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2099 if (readvalue!=NULL) {
2105 sprintf(buffer,
"Entry%02iSMSList%02i",num,i);
2106 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2107 if (readvalue==NULL) {
2127 unsigned char buffer[10000]={0};
2128 char *readvalue=NULL;
2130 sprintf(buffer,
"Type");
2131 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2133 if (readvalue!=NULL) {
2134 if (strcasecmp(readvalue,
"Call") == 0) {
2136 }
else if (strcasecmp(readvalue,
"Meeting") == 0) {
2138 }
else if (strcasecmp(readvalue,
"Birthday") == 0) {
2140 }
else if (strcasecmp(readvalue,
"Memo") == 0) {
2142 }
else if (strcasecmp(readvalue,
"Travel") == 0) {
2144 }
else if (strcasecmp(readvalue,
"Vacation") == 0) {
2146 }
else if (strcasecmp(readvalue,
"DailyAlarm") == 0) {
2148 }
else if (strcasecmp(readvalue,
"Alarm") == 0) {
2150 }
else if (strcasecmp(readvalue,
"Shopping") == 0) {
2152 }
else if (strcasecmp(readvalue,
"Training/Athletism") == 0) {
2154 }
else if (strcasecmp(readvalue,
"Training/BallGames") == 0) {
2156 }
else if (strcasecmp(readvalue,
"Training/Cycling") == 0) {
2158 }
else if (strcasecmp(readvalue,
"Training/Budo") == 0) {
2160 }
else if (strcasecmp(readvalue,
"Training/Dance") == 0) {
2162 }
else if (strcasecmp(readvalue,
"Training/ExtremeSports") == 0) {
2164 }
else if (strcasecmp(readvalue,
"Training/Football") == 0) {
2166 }
else if (strcasecmp(readvalue,
"Training/Golf") == 0) {
2168 }
else if (strcasecmp(readvalue,
"Training/Gym") == 0) {
2170 }
else if (strcasecmp(readvalue,
"Training/HorseRaces") == 0) {
2172 }
else if (strcasecmp(readvalue,
"Training/Hockey") == 0) {
2174 }
else if (strcasecmp(readvalue,
"Training/Races") == 0) {
2176 }
else if (strcasecmp(readvalue,
"Training/Rugby") == 0) {
2178 }
else if (strcasecmp(readvalue,
"Training/Sailing") == 0) {
2180 }
else if (strcasecmp(readvalue,
"Training/StreetGames") == 0) {
2182 }
else if (strcasecmp(readvalue,
"Training/Swimming") == 0) {
2184 }
else if (strcasecmp(readvalue,
"Training/Tennis") == 0) {
2186 }
else if (strcasecmp(readvalue,
"Training/Travels") == 0) {
2188 }
else if (strcasecmp(readvalue,
"Training/WinterGames") == 0) {
2190 }
else if (strcasecmp(readvalue,
"0") == 0) {
2197 unsigned char buffer[10000]={0},buf[20]={0};
2198 char *readvalue=NULL;
2201 sprintf(buffer,
"Location");
2202 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2203 if (readvalue!=NULL) note->
Location = atoi(readvalue);
2205 ReadCalendarType(file_info,section, &(note->
Type), UseUnicode);
2208 sprintf(buffer,
"Text");
2215 sprintf(buffer,
"Description");
2222 sprintf(buffer,
"LUID");
2229 sprintf(buffer,
"Phone");
2236 sprintf(buffer,
"Private");
2237 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2238 if (readvalue!=NULL) {
2245 sprintf(buffer,
"EventLocation");
2252 sprintf(buffer,
"ContactID");
2253 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2254 if (readvalue!=NULL) {
2262 sprintf(buffer,
"StartTime");
2263 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2270 sprintf(buffer,
"Recurrance");
2271 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2272 if (readvalue!=NULL) {
2274 rec = atoi(readvalue);
2286 case ((0xffff-1)/24):
2293 buf[0] = rec2 / 256;
2294 buf[1] = rec2 % 256;
2295 dbgprintf(NULL,
"Setting recurrance %i\n",rec2);
2299 sprintf(buffer,
"StopTime");
2300 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2308 sprintf(buffer,
"Alarm");
2309 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2312 sprintf(buffer,
"AlarmType");
2313 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2314 if (readvalue!=NULL)
2316 if (strcasecmp(readvalue,
"Silent") == 0) {
2324 sprintf(buffer,
"ToneAlarm");
2325 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2332 sprintf(buffer,
"SilentAlarm");
2333 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2340 sprintf(buffer,
"LastModified");
2341 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2349 sprintf(buffer,
"RepeatFrequency");
2350 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2351 if (readvalue!=NULL) {
2358 sprintf(buffer,
"RepeatDayOfWeek");
2359 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2360 if (readvalue!=NULL) {
2367 sprintf(buffer,
"RepeatDay");
2368 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2369 if (readvalue!=NULL) {
2376 sprintf(buffer,
"RepeatWeekOfMonth");
2377 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2378 if (readvalue!=NULL) {
2385 sprintf(buffer,
"RepeatMonth");
2386 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2387 if (readvalue!=NULL) {
2394 sprintf(buffer,
"RepeatCount");
2395 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2396 if (readvalue!=NULL) {
2403 sprintf(buffer,
"RepeatDayOfYear");
2404 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2405 if (readvalue!=NULL) {
2412 sprintf(buffer,
"RepeatStartDate");
2413 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2420 sprintf(buffer,
"RepeatStopDate");
2421 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2434 unsigned char buffer[10000]={0};
2435 char *readvalue=NULL;
2439 sprintf(buffer,
"Location");
2440 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2441 if (readvalue!=NULL) ToDo->
Location = atoi(readvalue);
2443 ReadCalendarType(file_info,section, &(ToDo->
Type), UseUnicode);
2446 sprintf(buffer,
"Priority");
2447 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2448 if (readvalue!=NULL) {
2449 if (!strcmp(readvalue,
"3") || !strcmp(readvalue,
"Low")) {
2452 if (!strcmp(readvalue,
"2") || !strcmp(readvalue,
"Medium")) {
2457 sprintf(buffer,
"StartTime");
2458 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2465 sprintf(buffer,
"CompletedTime");
2466 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2473 sprintf(buffer,
"Text");
2480 sprintf(buffer,
"Description");
2487 sprintf(buffer,
"EventLocation");
2494 sprintf(buffer,
"LUID");
2501 sprintf(buffer,
"Phone");
2508 sprintf(buffer,
"Private");
2509 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2510 if (readvalue!=NULL) {
2517 sprintf(buffer,
"Completed");
2518 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2519 if (readvalue!=NULL) {
2520 if (strncmp(readvalue,
"yes", 3) == 0) {
2530 sprintf(buffer,
"Category");
2531 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2532 if (readvalue!=NULL) {
2539 sprintf(buffer,
"ContactID");
2540 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2541 if (readvalue!=NULL) {
2548 sprintf(buffer,
"DueTime");
2549 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2556 sprintf(buffer,
"LastModified");
2557 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2564 sprintf(buffer,
"Alarm");
2565 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2572 sprintf(buffer,
"SilentAlarm");
2573 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2584 char *readvalue=NULL;
2585 unsigned char buffer[10000]={0};
2586 size_t Width=0, Height=0;
2590 sprintf(buffer,
"Width");
2591 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2593 sprintf(buffer,
"Height");
2594 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2598 sprintf(buffer,
"Bitmap%02i",(
int)y);
2599 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2600 if (readvalue!=NULL) {
2604 }
else return FALSE;
2611 unsigned char buffer[10000]={0};
2612 char *readvalue=NULL;
2615 bitmap->
DefaultBitmap = !ReadBitmapEntry(file_info, section, bitmap, UseUnicode);
2621 sprintf(buffer,
"Name");
2622 ReadBackupText(file_info, section, buffer, bitmap->
Text,UseUnicode);
2623 if (bitmap->
Text[0] == 0x00 && bitmap->
Text[1] == 0x00) {
2628 sprintf(buffer,
"Ringtone");
2629 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2630 if (readvalue==NULL) {
2631 sprintf(buffer,
"FileRingtone");
2632 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2633 if (readvalue==NULL) {
2645 sprintf(buffer,
"Enabled");
2646 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2648 if (readvalue!=NULL) {
2657 unsigned char buffer[10000]={0};
2659 sprintf(buffer,
"Text");
2660 ReadBackupText(file_info, section, buffer, bitmap->
Text,UseUnicode);
2661 if (bitmap->
Text[0]!=0 || bitmap->
Text[1]!=0) {
2666 ReadBitmapEntry(file_info, section, bitmap, UseUnicode);
2676 unsigned char buffer[10000]={0};
2678 sprintf(buffer,
"URL");
2679 ReadBackupText(file_info, section, buffer, bookmark->
Address,UseUnicode);
2680 sprintf(buffer,
"Title");
2681 ReadBackupText(file_info, section, buffer, bookmark->
Title,UseUnicode);
2686 unsigned char buffer[10000]={0};
2687 char *readvalue=NULL;
2689 sprintf(buffer,
"Network");
2690 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2694 ReadBitmapEntry(file_info, section, bitmap, UseUnicode);
2699 unsigned char buffer[10000]={0};
2700 char *readvalue=NULL;
2702 sprintf(buffer,
"Name");
2703 ReadBackupText(file_info, section, buffer, SMSC->
Name,UseUnicode);
2704 sprintf(buffer,
"Number");
2705 ReadBackupText(file_info, section, buffer, SMSC->
Number,UseUnicode);
2706 sprintf(buffer,
"DefaultNumber");
2707 ReadBackupText(file_info, section, buffer, SMSC->
DefaultNumber,UseUnicode);
2708 sprintf(buffer,
"Format");
2710 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2711 if (readvalue!=NULL) {
2712 if (strcasecmp(readvalue,
"Fax") == 0) {
2714 }
else if (strcasecmp(readvalue,
"Email") == 0) {
2716 }
else if (strcasecmp(readvalue,
"Pager") == 0) {
2720 sprintf(buffer,
"Validity");
2722 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2723 if (readvalue!=NULL) {
2724 if (strcasecmp(readvalue,
"1hour") == 0) {
2726 }
else if (strcasecmp(readvalue,
"6hours") == 0) {
2728 }
else if (strcasecmp(readvalue,
"24hours") == 0) {
2730 }
else if (strcasecmp(readvalue,
"72hours") == 0) {
2732 }
else if (strcasecmp(readvalue,
"1week") == 0) {
2740 unsigned char buffer[10000]={0}, *readvalue=NULL;
2745 sprintf(buffer,
"Bearer");
2746 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2747 if (readvalue!=NULL) {
2748 if (strcasecmp(readvalue,
"SMS") == 0) {
2750 }
else if (strcasecmp(readvalue,
"GPRS") == 0) {
2752 }
else if (strcasecmp(readvalue,
"USSD") == 0) {
2758 sprintf(buffer,
"Active");
2759 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2760 if (readvalue!=NULL) {
2761 if (strcasecmp(readvalue,
"Yes") == 0) settings->
Active =
TRUE;
2765 sprintf(buffer,
"ReadOnly");
2766 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2767 if (readvalue!=NULL) {
2768 if (strcasecmp(readvalue,
"Yes") == 0) settings->
ReadOnly =
TRUE;
2771 sprintf(buffer,
"Proxy");
2772 ReadBackupText(file_info, section, buffer, settings->
Proxy,UseUnicode);
2773 sprintf(buffer,
"ProxyPort");
2775 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2776 if (readvalue!=NULL) settings->
ProxyPort = atoi(readvalue);
2777 sprintf(buffer,
"Proxy2");
2778 ReadBackupText(file_info, section, buffer, settings->
Proxy2,UseUnicode);
2779 sprintf(buffer,
"Proxy2Port");
2781 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2782 if (readvalue!=NULL) settings->
Proxy2Port = atoi(readvalue);
2793 if (strlen(buffer) == 7) {
2794 if (strncasecmp(
"Title", buffer,5) == 0) num = atoi(buffer+5);
2798 sprintf(buffer,
"Title%02i",num);
2799 ReadBackupText(file_info, section, buffer, settings->
Settings[settings->
Number].
Title,UseUnicode);
2800 sprintf(buffer,
"HomePage%02i",num);
2802 sprintf(buffer,
"Type%02i",num);
2804 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2805 if (readvalue!=NULL) {
2808 sprintf(buffer,
"Security%02i",num);
2810 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2811 if (readvalue!=NULL)
2815 sprintf(buffer,
"Bearer%02i",num);
2816 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2817 if (readvalue!=NULL)
2819 if (strcasecmp(readvalue,
"SMS") == 0) {
2821 sprintf(buffer,
"Server%02i",num);
2822 ReadBackupText(file_info, section, buffer, settings->
Settings[settings->
Number].
Server,UseUnicode);
2823 sprintf(buffer,
"Service%02i",num);
2824 ReadBackupText(file_info, section, buffer, settings->
Settings[settings->
Number].
Service,UseUnicode);
2825 }
else if ((strcasecmp(readvalue,
"Data") == 0 || strcasecmp(readvalue,
"GPRS") == 0)) {
2828 sprintf(buffer,
"Number%02i",num);
2829 ReadBackupText(file_info, section, buffer, settings->
Settings[settings->
Number].
DialUp,UseUnicode);
2830 sprintf(buffer,
"IP%02i",num);
2832 sprintf(buffer,
"User%02i",num);
2833 ReadBackupText(file_info, section, buffer, settings->
Settings[settings->
Number].
User,UseUnicode);
2834 sprintf(buffer,
"Password%02i",num);
2836 sprintf(buffer,
"Authentication%02i",num);
2838 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2839 if (readvalue!=NULL)
2843 sprintf(buffer,
"CallSpeed%02i",num);
2845 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2846 if (readvalue!=NULL)
2851 sprintf(buffer,
"Login%02i",num);
2853 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2854 if (readvalue!=NULL)
2858 sprintf(buffer,
"CallType%02i",num);
2860 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2861 if (readvalue!=NULL)
2865 }
else if (strcasecmp(readvalue,
"USSD") == 0) {
2867 sprintf(buffer,
"ServiceCode%02i",num);
2868 ReadBackupText(file_info, section, buffer, settings->
Settings[settings->
Number].
Code,UseUnicode);
2869 sprintf(buffer,
"IP%02i",num);
2870 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2871 if (readvalue!=NULL) {
2873 sprintf(buffer,
"IP%02i",num);
2876 sprintf(buffer,
"Number%02i",num);
2878 ReadBackupText(file_info, section, buffer, settings->
Settings[settings->
Number].
Service,UseUnicode);
2888 unsigned char buffer[10000]={0}, *readvalue=NULL;
2891 sprintf(buffer,
"Name");
2892 ReadBackupText(file_info, section, buffer, ringtone->
Name,UseUnicode);
2894 sprintf(buffer,
"Location");
2895 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2896 if (readvalue!=NULL) ringtone->
Location = atoi(readvalue);
2897 sprintf(buffer,
"NokiaBinary00");
2898 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2899 if (readvalue!=NULL) {
2901 buffer2 = ReadLinkedBackupText(file_info, section,
"NokiaBinary", UseUnicode);
2907 sprintf(buffer,
"Pure Midi00");
2908 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2909 if (readvalue!=NULL) {
2911 buffer2 = ReadLinkedBackupText(file_info, section,
"Pure Midi", UseUnicode);
2922 unsigned char buffer[10000]={0};
2923 char *readvalue=NULL;
2928 sprintf(buffer,
"Name");
2929 ReadBackupText(file_info, section, buffer, Profile->
Name,UseUnicode);
2931 sprintf(buffer,
"Location");
2932 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2933 Profile->
Location = atoi(readvalue);
2936 sprintf(buffer,
"DefaultName");
2937 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2938 if (readvalue!=NULL && strcasecmp(buffer,
"TRUE") == 0) Profile->
DefaultName =
TRUE;
2941 sprintf(buffer,
"HeadSetProfile");
2942 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2943 if (readvalue!=NULL && strcasecmp(buffer,
"TRUE") == 0) Profile->
HeadSetProfile =
TRUE;
2946 sprintf(buffer,
"CarKitProfile");
2947 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2948 if (readvalue!=NULL && strcasecmp(buffer,
"TRUE") == 0) Profile->
CarKitProfile =
TRUE;
2959 if (strlen(buffer) == 9) {
2960 if (strncasecmp(
"Feature", buffer, 7) == 0) num = atoi(buffer+7);
2964 sprintf(buffer,
"Feature%02i",num);
2965 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2966 if (readvalue==NULL)
break;
2968 if (strcasecmp(readvalue,
"RingtoneID") == 0) {
2970 sprintf(buffer,
"Value%02i",num);
2971 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2974 }
else if (strcasecmp(readvalue,
"MessageToneID") == 0) {
2976 sprintf(buffer,
"Value%02i",num);
2977 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2980 }
else if (strcasecmp(readvalue,
"ScreenSaverNumber") == 0) {
2982 sprintf(buffer,
"Value%02i",num);
2983 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2986 }
else if (strcasecmp(readvalue,
"CallerGroups") == 0) {
2988 sprintf(buffer,
"Value%02i",num);
2989 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
2990 for (j = 0; j < 5; j++) {
2992 if (strchr(readvalue,
'1' + j) != NULL) {
2997 }
else if (strcasecmp(readvalue,
"IncomingCallAlert") == 0) {
3000 }
else if (strcasecmp(readvalue,
"RingtoneVolume") == 0) {
3003 }
else if (strcasecmp(readvalue,
"Vibrating") == 0) {
3006 }
else if (strcasecmp(readvalue,
"MessageTone") == 0) {
3009 }
else if (strcasecmp(readvalue,
"KeypadTones") == 0) {
3012 }
else if (strcasecmp(readvalue,
"WarningTones") == 0) {
3015 }
else if (strcasecmp(readvalue,
"ScreenSaver") == 0) {
3018 }
else if (strcasecmp(readvalue,
"ScreenSaverTimeout") == 0) {
3021 }
else if (strcasecmp(readvalue,
"AutomaticAnswer") == 0) {
3024 }
else if (strcasecmp(readvalue,
"Lights") == 0) {
3029 sprintf(buffer,
"Value%02i",num);
3030 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
3031 if (readvalue == NULL) {
3033 }
else if (strcasecmp(readvalue,
"Level1") == 0) {
3038 }
else if (strcasecmp(readvalue,
"Level2") == 0) {
3043 }
else if (strcasecmp(readvalue,
"Level3") == 0) {
3048 }
else if (strcasecmp(readvalue,
"Level4") == 0) {
3050 }
else if (strcasecmp(readvalue,
"Level5") == 0) {
3052 }
else if (strcasecmp(readvalue,
"Off") == 0) {
3079 }
else if (strcasecmp(readvalue,
"Ringing") == 0) {
3081 }
else if (strcasecmp(readvalue,
"BeepOnce") == 0) {
3086 }
else if (strcasecmp(readvalue,
"RingOnce") == 0) {
3088 }
else if (strcasecmp(readvalue,
"Ascending") == 0) {
3090 }
else if (strcasecmp(readvalue,
"CallerGroups") == 0) {
3092 }
else if (strcasecmp(readvalue,
"Standard") == 0) {
3094 }
else if (strcasecmp(readvalue,
"Special") == 0) {
3096 }
else if (strcasecmp(readvalue,
"Ascending") == 0) {
3098 }
else if (strcasecmp(readvalue,
"Personal") == 0) {
3100 }
else if (strcasecmp(readvalue,
"VibrateFirst") == 0) {
3102 }
else if (strcasecmp(readvalue,
"Auto") == 0) {
3104 }
else if (strcasecmp(readvalue,
"5Seconds") == 0) {
3106 }
else if (strcasecmp(readvalue,
"20Seconds") == 0) {
3108 }
else if (strcasecmp(readvalue,
"1Minute") == 0) {
3110 }
else if (strcasecmp(readvalue,
"2Minutes") == 0) {
3112 }
else if (strcasecmp(readvalue,
"5Minutes") == 0) {
3114 }
else if (strcasecmp(readvalue,
"10Minutes") == 0) {
3116 }
else if (strcasecmp(readvalue,
"On") == 0) {
3131 }
else unknown =
TRUE;
3140 unsigned char buffer[10000]={0}, *readvalue=NULL;
3146 sprintf(buffer,
"Location");
3147 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
3148 if (readvalue!=NULL) FMStation->
Location = atoi(readvalue);
3150 sprintf(buffer,
"StationName");
3151 ReadBackupText(file_info, section, buffer, FMStation->
StationName,UseUnicode);
3153 sprintf(buffer,
"Frequency");
3154 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
3155 if (readvalue != NULL) {
3156 FMStation->
Frequency = strtod(readvalue, &endptr);
3166 unsigned char buffer[10000]={0}, *readvalue=NULL;
3168 GPRSPoint->
Name[0] = 0;
3169 GPRSPoint->
Name[1] = 0;
3170 GPRSPoint->
URL[0] = 0;
3171 GPRSPoint->
URL[1] = 0;
3175 sprintf(buffer,
"Active");
3176 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
3177 if (readvalue!=NULL) {
3178 if (strcasecmp(readvalue,
"Yes") == 0) GPRSPoint->
Active =
TRUE;
3181 sprintf(buffer,
"Location");
3182 readvalue = ReadCFGText(file_info, section, buffer, UseUnicode);
3183 if (readvalue!=NULL) GPRSPoint->
Location = atoi(readvalue);
3185 sprintf(buffer,
"Name");
3186 ReadBackupText(file_info, section, buffer, GPRSPoint->
Name,UseUnicode);
3188 sprintf(buffer,
"URL");
3189 ReadBackupText(file_info, section, buffer, GPRSPoint->
URL,UseUnicode);
3194 unsigned char buffer[100]={0};
3196 sprintf(buffer,
"Text");
3197 ReadBackupText(file_info, section, buffer, Note->
Text,UseUnicode);
3200 GSM_Error LoadBackup(
const char *FileName, GSM_Backup *backup)
3203 char buffer[100]={0}, *readvalue=NULL;
3209 unsigned char guessbuffer[10]={0};
3212 file = fopen(FileName,
"rb");
3214 readbytes = fread(guessbuffer, 1, 9, file);
3216 if (readbytes >= 2 && ((guessbuffer[0] == 0xFE && guessbuffer[1] == 0xFF) ||
3217 (guessbuffer[0] == 0xFF && guessbuffer[1] == 0xFE))) {
3222 error =
INI_ReadFile(FileName, UseUnicode, &file_info);
3227 sprintf(buffer,
"Backup");
3230 readvalue = ReadCFGText(file_info, buffer,
"Format", UseUnicode);
3232 if (readvalue == NULL) {
3237 if (strcmp(readvalue,
"1.01")!=0 && strcmp(readvalue,
"1.02")!=0 &&
3238 strcmp(readvalue,
"1.05")!=0 &&
3239 strcmp(readvalue,
"1.03")!=0 && strcmp(readvalue,
"1.04")!=0) {
3244 readvalue = ReadCFGText(file_info, buffer,
"IMEI", UseUnicode);
3245 if (readvalue!=NULL) {
3246 strncpy(backup->IMEI, readvalue,
sizeof(backup->IMEI) - 1);
3247 backup->IMEI[
sizeof(backup->IMEI) - 1] = 0;
3249 readvalue = ReadCFGText(file_info, buffer,
"Phone", UseUnicode);
3250 if (readvalue!=NULL) {
3251 strncpy(backup->Model, readvalue,
sizeof(backup->Model) - 1);
3252 backup->Model[
sizeof(backup->Model) - 1] = 0;
3254 readvalue = ReadCFGText(file_info, buffer,
"Creator", UseUnicode);
3255 if (readvalue!=NULL) {
3256 strncpy(backup->Creator,readvalue,
sizeof(backup->Creator) - 1);
3257 backup->Creator[
sizeof(backup->Creator) - 1] = 0;
3259 readvalue = ReadCFGText(file_info, buffer,
"DateTime", UseUnicode);
3261 backup->DateTimeAvailable =
TRUE;
3264 sprintf(buffer,
"Checksum");
3266 readvalue = ReadCFGText(file_info, buffer,
"MD5", UseUnicode);
3267 if (readvalue!=NULL) strcpy(backup->MD5Original,readvalue);
3270 for (h = file_info; h != NULL; h = h->
Next) {
3279 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3280 if (readvalue==NULL)
break;
3281 if (num < GSM_BACKUP_MAX_PROFILES) {
3283 if (backup->Profiles[num] == NULL) {
3286 backup->Profiles[num + 1] = NULL;
3288 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_PROFILES\n");
3291 ReadProfileEntry(file_info, h->
SectionName, backup->Profiles[num], UseUnicode);
3296 for (h = file_info; h != NULL; h = h->
Next) {
3305 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3306 if (readvalue==NULL)
break;
3307 if (num < GSM_BACKUP_MAX_PHONEPHONEBOOK) {
3309 if (backup->PhonePhonebook[num] == NULL) {
3312 backup->PhonePhonebook[num + 1] = NULL;
3314 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_PHONEPHONEBOOK\n");
3317 backup->PhonePhonebook[num]->Location = atoi (readvalue);
3318 backup->PhonePhonebook[num]->MemoryType =
MEM_ME;
3319 ReadPbkEntry(file_info, h->
SectionName, backup->PhonePhonebook[num],UseUnicode);
3320 dbgprintf(NULL,
"number of entries = %i\n",backup->PhonePhonebook[num]->EntriesNum);
3325 for (h = file_info; h != NULL; h = h->
Next) {
3334 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3335 if (readvalue==NULL)
break;
3336 if (num < GSM_BACKUP_MAX_SIMPHONEBOOK) {
3338 if (backup->SIMPhonebook[num] == NULL) {
3341 backup->SIMPhonebook[num + 1] = NULL;
3343 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_SIMPHONEBOOK\n");
3346 backup->SIMPhonebook[num]->Location = atoi (readvalue);
3347 backup->SIMPhonebook[num]->MemoryType =
MEM_SM;
3348 ReadPbkEntry(file_info, h->
SectionName, backup->SIMPhonebook[num],UseUnicode);
3353 for (h = file_info; h != NULL; h = h->
Next) {
3362 readvalue = ReadCFGText(file_info, h->
SectionName,
"Type", UseUnicode);
3363 if (readvalue==NULL)
break;
3366 if (backup->Calendar[num] == NULL) {
3369 backup->Calendar[num + 1] = NULL;
3371 dbgprintf(NULL,
"Increase GSM_MAXCALENDARTODONOTES\n");
3374 backup->Calendar[num]->Location = num + 1;
3375 error = ReadCalendarEntry(file_info, h->
SectionName, backup->Calendar[num],UseUnicode);
3383 for (h = file_info; h != NULL; h = h->
Next) {
3392 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3393 if (readvalue==NULL)
break;
3394 if (num < GSM_BACKUP_MAX_CALLER) {
3396 if (backup->CallerLogos[num] == NULL) {
3399 backup->CallerLogos[num + 1] = NULL;
3401 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_CALLER\n");
3404 backup->CallerLogos[num]->Location = atoi (readvalue);
3405 ReadCallerEntry(file_info, h->
SectionName, backup->CallerLogos[num],UseUnicode);
3410 for (h = file_info; h != NULL; h = h->
Next) {
3419 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3420 if (readvalue==NULL)
break;
3421 if (num < GSM_BACKUP_MAX_SMSC) {
3423 if (backup->SMSC[num] == NULL) {
3426 backup->SMSC[num + 1] = NULL;
3428 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_SMSC\n");
3431 backup->SMSC[num]->Location = atoi (readvalue);
3432 ReadSMSCEntry(file_info, h->
SectionName, backup->SMSC[num],UseUnicode);
3437 for (h = file_info; h != NULL; h = h->
Next) {
3447 if (strncasecmp(
"WAPBookmark", h->
SectionName, 11) == 0) found =
TRUE;
3453 readvalue = ReadCFGText(file_info, h->
SectionName,
"URL", UseUnicode);
3454 if (readvalue==NULL)
break;
3455 if (num < GSM_BACKUP_MAX_WAPBOOKMARK) {
3457 if (backup->WAPBookmark[num] == NULL) {
3460 backup->WAPBookmark[num + 1] = NULL;
3462 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_WAPBOOKMARK\n");
3465 backup->WAPBookmark[num]->Location = num + 1;
3466 ReadWAPBookmarkEntry(file_info, h->
SectionName, backup->WAPBookmark[num],UseUnicode);
3471 for (h = file_info; h != NULL; h = h->
Next) {
3481 if (strncasecmp(
"WAPSettings", h->
SectionName, 11) == 0) found =
TRUE;
3487 readvalue = ReadCFGText(file_info, h->
SectionName,
"Title00", UseUnicode);
3488 if (readvalue==NULL)
break;
3489 if (num < GSM_BACKUP_MAX_WAPSETTINGS) {
3491 if (backup->WAPSettings[num] == NULL) {
3494 backup->WAPSettings[num + 1] = NULL;
3496 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_WAPSETTINGS\n");
3499 backup->WAPSettings[num]->Location = num + 1;
3500 dbgprintf(NULL,
"reading wap settings\n");
3501 ReadWAPSettingsEntry(file_info, h->
SectionName, backup->WAPSettings[num],UseUnicode);
3506 for (h = file_info; h != NULL; h = h->
Next) {
3515 readvalue = ReadCFGText(file_info, h->
SectionName,
"Title00", UseUnicode);
3516 if (readvalue==NULL)
break;
3517 if (num < GSM_BACKUP_MAX_MMSSETTINGS) {
3519 if (backup->MMSSettings[num] == NULL) {
3522 backup->MMSSettings[num + 1] = NULL;
3524 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_MMSSETTINGS\n");
3527 backup->MMSSettings[num]->Location = num + 1;
3528 dbgprintf(NULL,
"reading mms settings\n");
3529 ReadWAPSettingsEntry(file_info, h->
SectionName, backup->MMSSettings[num],UseUnicode);
3534 for (h = file_info; h != NULL; h = h->
Next) {
3543 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3544 if (readvalue==NULL)
break;
3545 if (num < GSM_BACKUP_MAX_RINGTONES) {
3547 if (backup->Ringtone[num] == NULL) {
3550 backup->Ringtone[num + 1] = NULL;
3552 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_RINGTONES\n");
3555 ReadRingtoneEntry(file_info, h->
SectionName, backup->Ringtone[num],UseUnicode);
3560 for (h = file_info; h != NULL; h = h->
Next) {
3569 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3570 if (readvalue==NULL)
break;
3573 if (backup->ToDo[num] == NULL) {
3576 backup->ToDo[num + 1] = NULL;
3578 dbgprintf(NULL,
"Increase GSM_MAXCALENDARTODONOTES\n");
3581 backup->ToDo[num]->Location = num + 1;
3582 error = ReadToDoEntry(file_info, h->
SectionName, backup->ToDo[num],UseUnicode);
3589 sprintf(buffer,
"Startup");
3590 readvalue = ReadCFGText(file_info, buffer,
"Text", UseUnicode);
3591 if (readvalue==NULL) {
3592 readvalue = ReadCFGText(file_info, buffer,
"Width", UseUnicode);
3594 if (readvalue!=NULL) {
3596 if (backup->StartupLogo == NULL) {
3599 ReadStartupEntry(file_info, buffer, backup->StartupLogo,UseUnicode);
3601 sprintf(buffer,
"Operator");
3602 readvalue = ReadCFGText(file_info, buffer,
"Network", UseUnicode);
3603 if (readvalue!=NULL) {
3605 if (backup->OperatorLogo == NULL) {
3608 ReadOperatorEntry(file_info, buffer, backup->OperatorLogo,UseUnicode);
3611 for (h = file_info; h != NULL; h = h->
Next) {
3620 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3621 if (readvalue==NULL)
break;
3622 if (num < GSM_BACKUP_MAX_FMSTATIONS) {
3624 if (backup->FMStation[num] == NULL) {
3627 backup->FMStation[num + 1] = NULL;
3629 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_FMSTATIONS\n");
3632 backup->FMStation[num]->Location = num + 1;
3633 error = ReadFMStationEntry(file_info, h->
SectionName, backup->FMStation[num],UseUnicode);
3641 for (h = file_info; h != NULL; h = h->
Next) {
3650 readvalue = ReadCFGText(file_info, h->
SectionName,
"Location", UseUnicode);
3651 if (readvalue==NULL)
break;
3652 if (num < GSM_BACKUP_MAX_GPRSPOINT) {
3654 if (backup->GPRSPoint[num] == NULL) {
3657 backup->GPRSPoint[num + 1] = NULL;
3659 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_GPRSPOINT\n");
3662 backup->GPRSPoint[num]->Location = num + 1;
3663 ReadGPRSPointEntry(file_info, h->
SectionName, backup->GPRSPoint[num],UseUnicode);
3668 for (h = file_info; h != NULL; h = h->
Next) {
3677 readvalue = ReadCFGText(file_info, h->
SectionName,
"Text", UseUnicode);
3678 if (readvalue==NULL)
break;
3679 if (num < GSM_BACKUP_MAX_NOTE) {
3681 if (backup->Note[num] == NULL) {
3684 backup->Note[num + 1] = NULL;
3686 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_NOTE\n");
3689 ReadNoteEntry(file_info, h->
SectionName, backup->Note[num],UseUnicode);
3693 if (backup->MD5Original[0]!=0) {
3694 FindBackupChecksum(FileName, UseUnicode, backup->MD5Calculated);
3696 for (h = file_info; h != NULL; h = h->
Next) {
3754 if (strncasecmp(
"WAPBookmark", h->
SectionName, 11) == 0) found =
TRUE;
3767 if (strncasecmp(
"WAPSettings", h->
SectionName, 11) == 0) found =
TRUE;
3837 unsigned char *readvalue=NULL, *readbuffer=NULL;
3846 readvalue = ReadCFGText(file_info, section,
"Sent",
FALSE);
3850 readvalue = ReadCFGText(file_info, section,
"PDU",
FALSE);
3851 if (readvalue != NULL) {
3852 if (strcmp(readvalue,
"Deliver") == 0) {
3854 }
else if (strcmp(readvalue,
"Submit" ) == 0) {
3856 }
else if (strcmp(readvalue,
"Status_Report" ) == 0) {
3860 readvalue = ReadCFGText(file_info, section,
"DateTime",
FALSE);
3861 if (readvalue != NULL) {
3868 readvalue = ReadCFGText(file_info, section,
"State",
FALSE);
3869 if (readvalue!=NULL) {
3870 if (strcasecmp(readvalue,
"Read") == 0) SMS->
State =
SMS_Read;
3871 else if (strcasecmp(readvalue,
"Sent") == 0) SMS->
State =
SMS_Sent;
3872 else if (strcasecmp(readvalue,
"UnSent") == 0) SMS->
State =
SMS_UnSent;
3874 ReadBackupText(file_info, section,
"Number", SMS->
Number,
FALSE);
3875 ReadBackupText(file_info, section,
"Name", SMS->
Name,
FALSE);
3878 readvalue = ReadCFGText(file_info, section,
"Coding",
FALSE);
3879 if (readvalue!=NULL) {
3885 readbuffer = ReadLinkedBackupText(file_info, section,
"Text",
FALSE);
3886 if (readbuffer == NULL) {
3887 dbgprintf(NULL,
"No text found, assuming empty!\n");
3892 dbgprintf(NULL,
"Linked text: %s\n", readbuffer);
3895 dbgprintf(NULL,
"Message text too long, truncating!\n");
3899 dbgprintf(NULL,
"Failed decoding binary field!\n");
3906 SMS->
Length = strlen(readbuffer)/2;
3908 SMS->
Length = strlen(readbuffer)/4;
3922 readvalue = ReadCFGText(file_info, section,
"UDH",
FALSE);
3923 if (readvalue!=NULL) {
3931 static GSM_Error GSM_ReadSMSBackupTextFile(
const char *FileName, GSM_SMS_Backup *backup)
3934 char *readvalue=NULL;
3938 backup->SMS[0] = NULL;
3946 for (h = file_info; h != NULL; h = h->
Next) {
3947 if (strncasecmp(
"SMSBackup", h->
SectionName, 9) == 0) {
3949 if (readvalue==NULL)
break;
3950 if (num < GSM_BACKUP_MAX_SMS) {
3953 backup->SMS[num + 1] = NULL;
3955 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_SMS\n");
3958 backup->SMS[num]->Location = num + 1;
3959 error = ReadSMSBackupEntry(file_info, h->
SectionName, backup->SMS[num]);
3972 GSM_Error GSM_ReadSMSBackupFile(
const char *FileName, GSM_SMS_Backup *backup)
3976 GSM_ClearSMSBackup(backup);
3978 file = fopen(FileName,
"rb");
3983 return GSM_ReadSMSBackupTextFile(FileName, backup);
3990 GSM_Error SaveTextComment(FILE *file,
unsigned char *comment)
3992 char buffer[10000]={0};
3993 size_t i=0, len=0, pos = 0;
3997 fprintf(file,
"; ");
3999 len = strlen(buffer);
4001 for (i = 0; i < len; i++) {
4002 if (buffer[i] == 10 || buffer[i] == 13) {
4003 fprintf(file,
"\n; ");
4007 fprintf(file,
"\n; ");
4010 fprintf(file,
"%c", buffer[i]);
4018 static GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup)
4021 unsigned char *buffer;
4026 buffer = malloc(10000);
4027 if (buffer == NULL) {
4035 fprintf(file,
"; Saved ");
4036 fprintf(file,
"%04d%02d%02dT%02d%02d%02d",
4042 while (backup->SMS[i]!=NULL) {
4043 fprintf(file,
"[SMSBackup%03i]\n",i);
4044 switch (backup->SMS[i]->Coding) {
4047 error = SaveTextComment(file, backup->SMS[i]->Text);
4057 error = SaveBackupText(file,
"SMSC", backup->SMS[i]->SMSC.Number,
FALSE);
4062 if (backup->SMS[i]->ReplyViaSameSMSC) {
4063 fprintf(file,
"SMSCReply = TRUE\n");
4065 fprintf(file,
"PDU = Deliver\n");
4066 }
else if (backup->SMS[i]->PDU ==
SMS_Submit) {
4067 fprintf(file,
"PDU = Submit\n");
4069 fprintf(file,
"PDU = Status_Report\n");
4071 if (backup->SMS[i]->DateTime.Year != 0) {
4072 fprintf(file,
"DateTime");
4073 error = SaveVCalDateTime(file,&backup->SMS[i]->DateTime,
FALSE);
4079 fprintf(file,
"State = ");
4080 switch (backup->SMS[i]->State) {
4081 case SMS_UnRead : fprintf(file,
"UnRead\n");
break;
4082 case SMS_Read : fprintf(file,
"Read\n");
break;
4083 case SMS_Sent : fprintf(file,
"Sent\n");
break;
4084 case SMS_UnSent : fprintf(file,
"UnSent\n");
break;
4086 error = SaveBackupText(file,
"Number", backup->SMS[i]->Number,
FALSE);
4091 error = SaveBackupText(file,
"Name", backup->SMS[i]->Name,
FALSE);
4096 if (backup->SMS[i]->UDH.Type !=
UDH_NoUDH) {
4097 EncodeHexBin(buffer,backup->SMS[i]->UDH.Text,backup->SMS[i]->UDH.Length);
4098 fprintf(file,
"UDH = %s\n",buffer);
4100 switch (backup->SMS[i]->Coding) {
4103 EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length*2);
4106 EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length);
4109 SaveLinkedBackupText(file,
"Text", buffer,
FALSE);
4111 fprintf(file,
"Coding = %s\n", s);
4112 fprintf(file,
"Folder = %i\n",backup->SMS[i]->Folder);
4113 fprintf(file,
"Length = %i\n",backup->SMS[i]->Length);
4114 fprintf(file,
"Class = %i\n",backup->SMS[i]->Class);
4115 fprintf(file,
"ReplySMSC = ");
4116 if (backup->SMS[i]->ReplyViaSameSMSC) fprintf(file,
"True\n");
else fprintf(file,
"False\n");
4117 fprintf(file,
"RejectDuplicates = ");
4118 if (backup->SMS[i]->RejectDuplicates) fprintf(file,
"True\n");
else fprintf(file,
"False\n");
4119 fprintf(file,
"ReplaceMessage = %i\n",backup->SMS[i]->ReplaceMessage);
4120 fprintf(file,
"MessageReference = %i\n",backup->SMS[i]->MessageReference);
4128 GSM_Error GSM_AddSMSBackupFile(
const char *FileName, GSM_SMS_Backup *backup)
4132 file = fopen(FileName,
"ab");
4136 SaveSMSBackupTextFile(file,backup);
4143 void GSM_ClearSMSBackup(GSM_SMS_Backup *backup)
4147 for (i = 0; i <= GSM_BACKUP_MAX_SMS; i++) {
4148 backup->SMS[i] = NULL;
4152 void GSM_FreeSMSBackup(GSM_SMS_Backup *backup)
4156 for (i = 0; i <= GSM_BACKUP_MAX_SMS; i++) {
4157 if (backup->SMS[i] == NULL)
break;
4158 free(backup->SMS[i]);
4159 backup->SMS[i] = NULL;
WAPSettings_Bearer ActiveBearer
char IPAddress[(20+1) *2]
unsigned char Name[(GSM_MAX_RINGTONE_NAME_LENGTH+1) *2]
gboolean IsNormalAuthentication
GSM_Profile_Feat_ID FeatureID[15]
unsigned char Text[(GSM_MAX_SMS_LENGTH+1) *2]
char * DecodeUnicodeString(const unsigned char *src)
GSM_RingtoneFormat Format
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
int INI_GetInt(INI_Section *cfg, const unsigned char *section, const unsigned char *key, int fallback)
unsigned char * DecodeUnicodeSpecialChars(unsigned char *dest, const unsigned char *buffer)
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
GSM_WAPSettings Settings[4]
void INI_Free(INI_Section *head)
GSM_ToDo_Priority Priority
unsigned char ReplaceMessage
gboolean FileSystemRingtone
const char * GSM_SMSCodingToString(GSM_Coding_Type type)
GSM_Error VC_StoreDateTime(char *Buffer, const size_t buff_len, size_t *Pos, const GSM_DateTime *Date, const char *Start)
GSM_CalendarNoteType Type
#define GSM_PHONEBOOK_ENTRIES
#define GSM_MAX_SMS_CHARS_LENGTH
void EncodeBASE64(const unsigned char *Input, char *Output, const size_t Length)
gboolean mywstrncasecmp(unsigned const char *a, unsigned const char *b, int num)
gboolean RejectDuplicates
gboolean FileSystemPicture
GSM_BinaryPicture_Types Type
void GSM_SetDefaultSMSData(GSM_SMSMessage *SMS)
size_t UnicodeLength(const unsigned char *str)
GSM_MultiWAPSettings Connection
char PhonebookDataBase[(50+1) *2]
GSM_BinaryPicture Picture
#define chk_fwrite(data, size, count, file)
WAPSettings_Bearer Bearer
char HomePage[(200+1) *2]
void GSM_GetCalendarRecurranceRepeat(GSM_Debug_Info *di, unsigned char *rec, unsigned char *endday, GSM_CalendarEntry *entry)
gboolean ReadVCALDateTime(const char *Buffer, GSM_DateTime *dt)
#define BACKUP_MAIN_HEADER
unsigned char DefaultNumber[(GSM_MAX_NUMBER_LENGTH+1) *2]
unsigned char Text[(GSM_PHONEBOOK_TEXT_LENGTH+1) *2]
char Text[(GSM_MAX_NOTE_TEXT_LENGTH+1) *2]
#define GSM_CALENDAR_ENTRIES
void GSM_PrintBitmap(FILE *file, GSM_Bitmap *bitmap)
GSM_Debug_Info GSM_global_debug
GSM_CalendarNoteType Type
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
unsigned char Name[(GSM_MAX_SMS_NAME_LENGTH+1) *2]
gboolean INI_GetBool(INI_Section *cfg, const unsigned char *section, const unsigned char *key, gboolean fallback)
unsigned char * EntryValue
GSM_SubToDoEntry Entries[GSM_TODO_ENTRIES]
gboolean GSM_IsPointBitmap(GSM_Bitmap *bmp, int x, int y)
GSM_NokiaBinaryRingtone NokiaBinary
GSM_Error INI_ReadFile(const char *FileName, gboolean Unicode, INI_Section **result)
char * EncodeSpecialChars(char *dest, const char *buffer)
unsigned char Frame[50000]
INI_Entry * INI_FindLastSectionEntry(INI_Section *file_info, const unsigned char *section, const gboolean Unicode)
GSM_Coding_Type GSM_StringToSMSCoding(const char *s)
#define GSM_MAXCALENDARTODONOTES
char CalendarDataBase[(50+1) *2]
GSM_MultiWAPSettings Connection
GSM_Profile_Feat_Value FeatureValue[15]
GSM_CalendarType EntryType
unsigned char Name[(GSM_MAX_GPRS_AP_NAME_LENGTH+1) *2]
unsigned char URL[(GSM_MAX_GPRS_AP_URL_LENGTH+1) *2]
char * OSDateTime(GSM_DateTime dt, gboolean TimeZone)
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
unsigned char Title[(50+1) *2]
GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES]
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
void GSM_ClearBitmap(GSM_Bitmap *bmp)
#define BACKUP_INFO_HEADER
void GSM_DecodeUDHHeader(GSM_Debug_Info *di, GSM_UDHHeader *UDH)
unsigned char * INI_GetValue(INI_Section *cfg, const unsigned char *section, const unsigned char *key, const gboolean Unicode)
gboolean DecodeHexBin(unsigned char *dest, const unsigned char *src, size_t len)
GSM_EntryLocation Location
void EncodeHexBin(char *dest, const unsigned char *src, size_t len)
unsigned char * SectionName
char * DecodeSpecialChars(char *dest, const char *buffer)
unsigned char * EncodeUnicodeSpecialChars(unsigned char *dest, const unsigned char *buffer)
unsigned char Text[2 *(GSM_BITMAP_TEXT_LENGTH+1)]
void GSM_SetPointBitmap(GSM_Bitmap *bmp, int x, int y)
unsigned char * EntryName
char HomePage[(100+1) *2]
unsigned char Address[(255+1) *2]
void CalculateMD5(unsigned char *buffer, int length, char *checksum)
unsigned char MessageReference
gboolean ReplyViaSameSMSC
char StationName[(GSM_MAX_FMSTATION_LENGTH+1) *2]
unsigned char Text[(GSM_MAX_TODO_TEXT_LENGTH+1) *2]
GSM_ValidityPeriod Relative
void GSM_GetMaxBitmapWidthHeight(GSM_Bitmap_Types Type, size_t *width, size_t *height)
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
int DecodeBASE64(const char *Input, unsigned char *Output, const size_t Length)
unsigned char Name[(GSM_MAX_SMSC_NAME_LENGTH+1) *2]
GSM_SubMemoryEntry Entries[GSM_PHONEBOOK_ENTRIES]