Diffstat (limited to 'gammu/emb/common/service/backup') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/service/backup/backgen.h | 4 | ||||
-rw-r--r-- | gammu/emb/common/service/backup/backtext.c | 229 | ||||
-rw-r--r-- | gammu/emb/common/service/backup/gsmback.c | 36 | ||||
-rw-r--r-- | gammu/emb/common/service/backup/gsmback.h | 2 |
4 files changed, 248 insertions, 23 deletions
diff --git a/gammu/emb/common/service/backup/backgen.h b/gammu/emb/common/service/backup/backgen.h index 9d7d973..9a930fc 100644 --- a/gammu/emb/common/service/backup/backgen.h +++ b/gammu/emb/common/service/backup/backgen.h | |||
@@ -20,8 +20,10 @@ | |||
20 | #define GSM_BACKUP_MAX_SMSC 10 | 20 | #define GSM_BACKUP_MAX_SMSC 10 |
21 | #define GSM_BACKUP_MAX_WAPBOOKMARK40 | 21 | #define GSM_BACKUP_MAX_WAPBOOKMARK40 |
22 | #define GSM_BACKUP_MAX_WAPSETTINGS30 | 22 | #define GSM_BACKUP_MAX_WAPSETTINGS30 |
23 | #define GSM_BACKUP_MAX_MMSSETTINGS30 | 23 | #define GSM_BACKUP_MAX_MMSSETTINGS30 |
24 | #define GSM_BACKUP_MAX_SYNCMLSETTINGS10 | ||
25 | #define GSM_BACKUP_MAX_CHATSETTINGS10 | ||
24 | #define GSM_BACKUP_MAX_RINGTONES30 | 26 | #define GSM_BACKUP_MAX_RINGTONES30 |
25 | #define GSM_BACKUP_MAX_PROFILES 10 | 27 | #define GSM_BACKUP_MAX_PROFILES 10 |
26 | #define GSM_BACKUP_MAX_FMSTATIONS20 | 28 | #define GSM_BACKUP_MAX_FMSTATIONS20 |
27 | #define GSM_BACKUP_MAX_GPRSPOINT10 | 29 | #define GSM_BACKUP_MAX_GPRSPOINT10 |
@@ -42,8 +44,10 @@ typedef struct { | |||
42 | GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; | 44 | GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; |
43 | GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; | 45 | GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; |
44 | GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; | 46 | GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; |
45 | GSM_MultiWAPSettings *MMSSettings[GSM_BACKUP_MAX_MMSSETTINGS + 1]; | 47 | GSM_MultiWAPSettings *MMSSettings[GSM_BACKUP_MAX_MMSSETTINGS + 1]; |
48 | GSM_SyncMLSettings*SyncMLSettings [GSM_BACKUP_MAX_SYNCMLSETTINGS + 1]; | ||
49 | GSM_ChatSettings *ChatSettings [GSM_BACKUP_MAX_CHATSETTINGS + 1]; | ||
46 | GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; | 50 | GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; |
47 | GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; | 51 | GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; |
48 | GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; | 52 | GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; |
49 | GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; | 53 | GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; |
diff --git a/gammu/emb/common/service/backup/backtext.c b/gammu/emb/common/service/backup/backtext.c index fee0f73..4cb1bb7 100644 --- a/gammu/emb/common/service/backup/backtext.c +++ b/gammu/emb/common/service/backup/backtext.c | |||
@@ -150,15 +150,15 @@ static void SaveBackupText(FILE *file, char *myname, char *myvalue, bool UseUnic | |||
150 | sprintf(buffer,"%s = \"",myname); | 150 | sprintf(buffer,"%s = \"",myname); |
151 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | 151 | EncodeUnicode(buffer2,buffer,strlen(buffer)); |
152 | fwrite(buffer2,1,strlen(buffer)*2,file); | 152 | fwrite(buffer2,1,strlen(buffer)*2,file); |
153 | 153 | ||
154 | fwrite(myvalue,1,UnicodeLength(myvalue)*2,file); | 154 | fwrite(EncodeUnicodeSpecialChars(myvalue),1,UnicodeLength(EncodeUnicodeSpecialChars(myvalue))*2,file); |
155 | 155 | ||
156 | sprintf(buffer,"\"%c%c",13,10); | 156 | sprintf(buffer,"\"%c%c",13,10); |
157 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | 157 | EncodeUnicode(buffer2,buffer,strlen(buffer)); |
158 | fwrite(buffer2,1,strlen(buffer)*2,file); | 158 | fwrite(buffer2,1,strlen(buffer)*2,file); |
159 | } else { | 159 | } else { |
160 | sprintf(buffer,"%s = \"%s\"%c%c",myname,DecodeUnicodeString(myvalue),13,10); | 160 | sprintf(buffer,"%s = \"%s\"%c%c",myname,EncodeSpecialChars(DecodeUnicodeString(myvalue)),13,10); |
161 | fprintf(file,"%s",buffer); | 161 | fprintf(file,"%s",buffer); |
162 | 162 | ||
163 | EncodeHexBin(buffer,myvalue,UnicodeLength(myvalue)*2); | 163 | EncodeHexBin(buffer,myvalue,UnicodeLength(myvalue)*2); |
164 | fprintf(file,"%sUnicode = %s%c%c",myname,buffer,13,10); | 164 | fprintf(file,"%sUnicode = %s%c%c",myname,buffer,13,10); |
@@ -167,17 +167,18 @@ static void SaveBackupText(FILE *file, char *myname, char *myvalue, bool UseUnic | |||
167 | } | 167 | } |
168 | 168 | ||
169 | static bool ReadBackupText(INI_Section *file_info, char *section, char *myname, char *myvalue, bool UseUnicode) | 169 | static bool ReadBackupText(INI_Section *file_info, char *section, char *myname, char *myvalue, bool UseUnicode) |
170 | { | 170 | { |
171 | unsigned char paramname[10000],*readvalue; | 171 | unsigned char paramname[10000],*readvalue; |
172 | 172 | ||
173 | if (UseUnicode) { | 173 | if (UseUnicode) { |
174 | EncodeUnicode(paramname,myname,strlen(myname)); | 174 | EncodeUnicode(paramname,myname,strlen(myname)); |
175 | readvalue = INI_GetValue(file_info, section, paramname, UseUnicode); | 175 | readvalue = INI_GetValue(file_info, section, paramname, UseUnicode); |
176 | if (readvalue!=NULL) { | 176 | if (readvalue!=NULL) { |
177 | CopyUnicodeString(myvalue,readvalue+2); | 177 | CopyUnicodeString(myvalue,DecodeUnicodeSpecialChars(readvalue+2)); |
178 | myvalue[UnicodeLength(readvalue)*2-4]=0; | 178 | myvalue[UnicodeLength(myvalue)*2-2]=0; |
179 | myvalue[UnicodeLength(readvalue)*2-3]=0; | 179 | myvalue[UnicodeLength(myvalue)*2-1]=0; |
180 | |||
180 | dbgprintf("%s\n",DecodeUnicodeString(readvalue)); | 181 | dbgprintf("%s\n",DecodeUnicodeString(readvalue)); |
181 | } else { | 182 | } else { |
182 | myvalue[0]=0; | 183 | myvalue[0]=0; |
183 | myvalue[1]=0; | 184 | myvalue[1]=0; |
@@ -196,9 +197,9 @@ static bool ReadBackupText(INI_Section *file_info, char *section, char *myname, | |||
196 | } else { | 197 | } else { |
197 | strcpy(paramname,myname); | 198 | strcpy(paramname,myname); |
198 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); | 199 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); |
199 | if (readvalue!=NULL) { | 200 | if (readvalue!=NULL) { |
200 | EncodeUnicode(myvalue,readvalue+1,strlen(readvalue)-2); | 201 | EncodeUnicode(myvalue,DecodeSpecialChars(readvalue+1),strlen(DecodeSpecialChars(readvalue+1))-1); |
201 | } else { | 202 | } else { |
202 | myvalue[0]=0; | 203 | myvalue[0]=0; |
203 | myvalue[1]=0; | 204 | myvalue[1]=0; |
204 | return false; | 205 | return false; |
@@ -417,8 +418,19 @@ static void SavePbkEntry(FILE *file, GSM_MemoryEntry *Pbk, bool UseUnicode) | |||
417 | sprintf(buffer,"%c%c",13,10); | 418 | sprintf(buffer,"%c%c",13,10); |
418 | SaveBackupText(file, "", buffer, UseUnicode); | 419 | SaveBackupText(file, "", buffer, UseUnicode); |
419 | } | 420 | } |
420 | 421 | ||
422 | static void SaveNoteEntry(FILE *file, GSM_NoteEntry *Note, bool UseUnicode) | ||
423 | { | ||
424 | char buffer[1000]; | ||
425 | |||
426 | sprintf(buffer,"Location = %d%c%c", Note->Location,13,10); | ||
427 | SaveBackupText(file, "", buffer, UseUnicode); | ||
428 | SaveBackupText(file, "Text", Note->Text, UseUnicode); | ||
429 | sprintf(buffer, "%c%c",13,10); | ||
430 | SaveBackupText(file, "", buffer, UseUnicode); | ||
431 | } | ||
432 | |||
421 | static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnicode) | 433 | static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnicode) |
422 | { | 434 | { |
423 | int i; | 435 | int i; |
424 | charbuffer[1000]; | 436 | charbuffer[1000]; |
@@ -432,11 +444,11 @@ static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnico | |||
432 | case GSM_CAL_MEETING : sprintf(buffer,"Meeting%c%c", 13,10); break; | 444 | case GSM_CAL_MEETING : sprintf(buffer,"Meeting%c%c", 13,10); break; |
433 | case GSM_CAL_BIRTHDAY : sprintf(buffer,"Birthday%c%c", 13,10); break; | 445 | case GSM_CAL_BIRTHDAY : sprintf(buffer,"Birthday%c%c", 13,10); break; |
434 | case GSM_CAL_TRAVEL : sprintf(buffer,"Travel%c%c", 13,10); break; | 446 | case GSM_CAL_TRAVEL : sprintf(buffer,"Travel%c%c", 13,10); break; |
435 | case GSM_CAL_VACATION : sprintf(buffer,"Vacation%c%c", 13,10); break; | 447 | case GSM_CAL_VACATION : sprintf(buffer,"Vacation%c%c", 13,10); break; |
436 | case GSM_CAL_MEMO : sprintf(buffer,"Memo%c%c", 13,10); break; | 448 | case GSM_CAL_MEMO : sprintf(buffer,"Memo%c%c", 13,10); break; |
437 | case GSM_CAL_ALARM : sprintf(buffer,"Alarm%c%c", 13,10); break; | 449 | case GSM_CAL_ALARM : sprintf(buffer,"Alarm%c%c", 13,10); break; |
438 | case GSM_CAL_DAILY_ALARM : sprintf(buffer,"DailyAlarm%c%c", 13,10); break; | 450 | case GSM_CAL_DAILY_ALARM: sprintf(buffer,"DailyAlarm%c%c", 13,10); break; |
439 | case GSM_CAL_T_ATHL : sprintf(buffer,"Training/Athletism%c%c", 13,10); break; | 451 | case GSM_CAL_T_ATHL : sprintf(buffer,"Training/Athletism%c%c", 13,10); break; |
440 | case GSM_CAL_T_BALL : sprintf(buffer,"Training/BallGames%c%c", 13,10); break; | 452 | case GSM_CAL_T_BALL : sprintf(buffer,"Training/BallGames%c%c", 13,10); break; |
441 | case GSM_CAL_T_CYCL : sprintf(buffer,"Training/Cycling%c%c", 13,10); break; | 453 | case GSM_CAL_T_CYCL : sprintf(buffer,"Training/Cycling%c%c", 13,10); break; |
442 | case GSM_CAL_T_BUDO : sprintf(buffer,"Training/Budo%c%c", 13,10); break; | 454 | case GSM_CAL_T_BUDO : sprintf(buffer,"Training/Budo%c%c", 13,10); break; |
@@ -656,8 +668,50 @@ static void SaveWAPSettingsEntry(FILE *file, GSM_MultiWAPSettings *settings, boo | |||
656 | SaveBackupText(file, "", buffer, UseUnicode); | 668 | SaveBackupText(file, "", buffer, UseUnicode); |
657 | } | 669 | } |
658 | } | 670 | } |
659 | 671 | ||
672 | static void SaveChatSettingsEntry(FILE *file, GSM_ChatSettings *settings, bool UseUnicode) | ||
673 | { | ||
674 | char buffer[10000]; | ||
675 | |||
676 | sprintf(buffer,"HomePage"); | ||
677 | SaveBackupText(file, buffer, settings->HomePage, UseUnicode); | ||
678 | sprintf(buffer,"User"); | ||
679 | SaveBackupText(file, buffer, settings->User, UseUnicode); | ||
680 | sprintf(buffer,"Password"); | ||
681 | SaveBackupText(file, buffer, settings->Password, UseUnicode); | ||
682 | SaveWAPSettingsEntry(file, &settings->Connection, UseUnicode); | ||
683 | } | ||
684 | |||
685 | static void SaveSyncMLSettingsEntry(FILE *file, GSM_SyncMLSettings *settings, bool UseUnicode) | ||
686 | { | ||
687 | char buffer[10000]; | ||
688 | |||
689 | sprintf(buffer,"User"); | ||
690 | SaveBackupText(file, buffer, settings->User, UseUnicode); | ||
691 | sprintf(buffer,"Password"); | ||
692 | SaveBackupText(file, buffer, settings->Password, UseUnicode); | ||
693 | sprintf(buffer,"PhonebookDB"); | ||
694 | SaveBackupText(file, buffer, settings->PhonebookDataBase, UseUnicode); | ||
695 | sprintf(buffer,"CalendarDB"); | ||
696 | SaveBackupText(file, buffer, settings->CalendarDataBase, UseUnicode); | ||
697 | sprintf(buffer,"Server"); | ||
698 | SaveBackupText(file, buffer, settings->Server, UseUnicode); | ||
699 | if (settings->SyncPhonebook) { | ||
700 | sprintf(buffer,"SyncPhonebook = True%c%c",13,10); | ||
701 | } else { | ||
702 | sprintf(buffer,"SyncPhonebook = False%c%c",13,10); | ||
703 | } | ||
704 | SaveBackupText(file, "", buffer, UseUnicode); | ||
705 | if (settings->SyncCalendar) { | ||
706 | sprintf(buffer,"SyncCalendar = True%c%c",13,10); | ||
707 | } else { | ||
708 | sprintf(buffer,"SyncCalendar = False%c%c",13,10); | ||
709 | } | ||
710 | SaveBackupText(file, "", buffer, UseUnicode); | ||
711 | SaveWAPSettingsEntry(file, &settings->Connection, UseUnicode); | ||
712 | } | ||
713 | |||
660 | static void SaveBitmapEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) | 714 | static void SaveBitmapEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) |
661 | { | 715 | { |
662 | unsigned char buffer[10000],buffer2[10000]; | 716 | unsigned char buffer[10000],buffer2[10000]; |
663 | int x,y; | 717 | int x,y; |
@@ -763,25 +817,26 @@ static void SaveSMSCEntry(FILE *file, GSM_SMSC *SMSC, bool UseUnicode) | |||
763 | } | 817 | } |
764 | 818 | ||
765 | static void SaveRingtoneEntry(FILE *file, GSM_Ringtone *ringtone, bool UseUnicode) | 819 | static void SaveRingtoneEntry(FILE *file, GSM_Ringtone *ringtone, bool UseUnicode) |
766 | { | 820 | { |
767 | unsigned char buffer[45000]; | 821 | unsigned char buffer[45000]; |
768 | int i,j; | ||
769 | 822 | ||
770 | sprintf(buffer,"Location = %i%c%c",ringtone->Location,13,10); | 823 | sprintf(buffer,"Location = %i%c%c",ringtone->Location,13,10); |
771 | SaveBackupText(file, "", buffer, UseUnicode); | 824 | SaveBackupText(file, "", buffer, UseUnicode); |
772 | SaveBackupText(file, "Name", ringtone->Name, UseUnicode); | 825 | SaveBackupText(file, "Name", ringtone->Name, UseUnicode); |
773 | switch (ringtone->Format) { | 826 | switch (ringtone->Format) { |
774 | case RING_NOKIABINARY: | 827 | case RING_NOKIABINARY: |
775 | j = 0; i = 0; | ||
776 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | 828 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); |
777 | SaveLinkedBackupText(file, "NokiaBinary", buffer, UseUnicode); | 829 | SaveLinkedBackupText(file, "NokiaBinary", buffer, UseUnicode); |
778 | break; | 830 | break; |
779 | case RING_MIDI: | 831 | case RING_MIDI: |
780 | j = 0; i = 0; | ||
781 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | 832 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); |
782 | SaveLinkedBackupText(file, "Pure Midi", buffer, UseUnicode); | 833 | SaveLinkedBackupText(file, "Pure Midi", buffer, UseUnicode); |
783 | break; | 834 | break; |
835 | case RING_MMF: | ||
836 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | ||
837 | SaveLinkedBackupText(file, "SMAF", buffer, UseUnicode); | ||
838 | break; | ||
784 | case RING_NOTETONE: | 839 | case RING_NOTETONE: |
785 | break; | 840 | break; |
786 | } | 841 | } |
787 | sprintf(buffer,"%c%c",13,10); | 842 | sprintf(buffer,"%c%c",13,10); |
@@ -1074,8 +1129,15 @@ GSM_Error SaveBackup(char *FileName, GSM_Backup *backup, bool UseUnicode) | |||
1074 | SaveCalendarEntry(file, backup->Calendar[i], UseUnicode); | 1129 | SaveCalendarEntry(file, backup->Calendar[i], UseUnicode); |
1075 | i++; | 1130 | i++; |
1076 | } | 1131 | } |
1077 | i=0; | 1132 | i=0; |
1133 | while (backup->Note[i]!=NULL) { | ||
1134 | sprintf(buffer,"[Note%03i]%c%c",i+1,13,10); | ||
1135 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1136 | SaveNoteEntry(file, backup->Note[i], UseUnicode); | ||
1137 | i++; | ||
1138 | } | ||
1139 | i=0; | ||
1078 | while (backup->CallerLogos[i]!=NULL) { | 1140 | while (backup->CallerLogos[i]!=NULL) { |
1079 | sprintf(buffer,"[Caller%03i]%c%c",i+1,13,10); | 1141 | sprintf(buffer,"[Caller%03i]%c%c",i+1,13,10); |
1080 | SaveBackupText(file, "", buffer, UseUnicode); | 1142 | SaveBackupText(file, "", buffer, UseUnicode); |
1081 | SaveCallerEntry(file, backup->CallerLogos[i], UseUnicode); | 1143 | SaveCallerEntry(file, backup->CallerLogos[i], UseUnicode); |
@@ -1109,8 +1171,22 @@ GSM_Error SaveBackup(char *FileName, GSM_Backup *backup, bool UseUnicode) | |||
1109 | SaveWAPSettingsEntry(file, backup->MMSSettings[i], UseUnicode); | 1171 | SaveWAPSettingsEntry(file, backup->MMSSettings[i], UseUnicode); |
1110 | i++; | 1172 | i++; |
1111 | } | 1173 | } |
1112 | i=0; | 1174 | i=0; |
1175 | while (backup->SyncMLSettings[i]!=NULL) { | ||
1176 | sprintf(buffer,"[SyncMLSettings%03i]%c%c",i+1,13,10); | ||
1177 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1178 | SaveSyncMLSettingsEntry(file, backup->SyncMLSettings[i], UseUnicode); | ||
1179 | i++; | ||
1180 | } | ||
1181 | i=0; | ||
1182 | while (backup->ChatSettings[i]!=NULL) { | ||
1183 | sprintf(buffer,"[ChatSettings%03i]%c%c",i+1,13,10); | ||
1184 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1185 | SaveChatSettingsEntry(file, backup->ChatSettings[i], UseUnicode); | ||
1186 | i++; | ||
1187 | } | ||
1188 | i=0; | ||
1113 | while (backup->Ringtone[i]!=NULL) { | 1189 | while (backup->Ringtone[i]!=NULL) { |
1114 | sprintf(buffer,"[Ringtone%03i]%c%c",i+1,13,10); | 1190 | sprintf(buffer,"[Ringtone%03i]%c%c",i+1,13,10); |
1115 | SaveBackupText(file, "", buffer, UseUnicode); | 1191 | SaveBackupText(file, "", buffer, UseUnicode); |
1116 | SaveRingtoneEntry(file, backup->Ringtone[i], UseUnicode); | 1192 | SaveRingtoneEntry(file, backup->Ringtone[i], UseUnicode); |
@@ -2655,9 +2731,134 @@ GSM_Error LoadBackup(char *FileName, GSM_Backup *backup, bool UseUnicode) | |||
2655 | } | 2731 | } |
2656 | if (backup->MD5Original[0]!=0) { | 2732 | if (backup->MD5Original[0]!=0) { |
2657 | FindBackupChecksum(FileName, UseUnicode, backup->MD5Calculated); | 2733 | FindBackupChecksum(FileName, UseUnicode, backup->MD5Calculated); |
2658 | } | 2734 | } |
2659 | 2735 | for (h = file_info; h != NULL; h = h->Next) { | |
2736 | found = false; | ||
2737 | if (UseUnicode) { | ||
2738 | EncodeUnicode(buffer,"Backup",4); | ||
2739 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2740 | } else { | ||
2741 | if (mystrncasecmp("Backup", h->SectionName, 6)) found = true; | ||
2742 | } | ||
2743 | if (UseUnicode) { | ||
2744 | EncodeUnicode(buffer,"Checksum",4); | ||
2745 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2746 | } else { | ||
2747 | if (mystrncasecmp("Checksum", h->SectionName, 8)) found = true; | ||
2748 | } | ||
2749 | if (UseUnicode) { | ||
2750 | EncodeUnicode(buffer,"Profile",7); | ||
2751 | if (mywstrncasecmp(buffer, h->SectionName, 7)) found = true; | ||
2752 | } else { | ||
2753 | if (mystrncasecmp("Profile", h->SectionName, 7)) found = true; | ||
2754 | } | ||
2755 | if (UseUnicode) { | ||
2756 | EncodeUnicode(buffer,"PhonePBK",8); | ||
2757 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2758 | } else { | ||
2759 | if (mystrncasecmp("PhonePBK", h->SectionName, 8)) found = true; | ||
2760 | } | ||
2761 | if (UseUnicode) { | ||
2762 | EncodeUnicode(buffer,"SIMPBK",6); | ||
2763 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2764 | } else { | ||
2765 | if (mystrncasecmp("SIMPBK", h->SectionName, 6)) found = true; | ||
2766 | } | ||
2767 | if (UseUnicode) { | ||
2768 | EncodeUnicode(buffer,"Calendar",8); | ||
2769 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2770 | } else { | ||
2771 | if (mystrncasecmp("Calendar", h->SectionName, 8)) found = true; | ||
2772 | } | ||
2773 | if (UseUnicode) { | ||
2774 | EncodeUnicode(buffer,"Caller",6); | ||
2775 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2776 | } else { | ||
2777 | if (mystrncasecmp("Caller", h->SectionName, 6)) found = true; | ||
2778 | } | ||
2779 | if (UseUnicode) { | ||
2780 | EncodeUnicode(buffer,"SMSC",4); | ||
2781 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2782 | } else { | ||
2783 | if (mystrncasecmp("SMSC", h->SectionName, 4)) found = true; | ||
2784 | } | ||
2785 | if (UseUnicode) { | ||
2786 | EncodeUnicode(buffer,"WAPBookmark",11); | ||
2787 | if (mywstrncasecmp(buffer, h->SectionName, 11)) found = true; | ||
2788 | if (!found) { | ||
2789 | EncodeUnicode(buffer,"Bookmark",8); | ||
2790 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2791 | } | ||
2792 | } else { | ||
2793 | if (mystrncasecmp("WAPBookmark", h->SectionName, 11)) found = true; | ||
2794 | if (!found) { | ||
2795 | if (mystrncasecmp("Bookmark", h->SectionName, 8)) found = true; | ||
2796 | } | ||
2797 | } | ||
2798 | if (UseUnicode) { | ||
2799 | EncodeUnicode(buffer,"WAPSettings",11); | ||
2800 | if (mywstrncasecmp(buffer, h->SectionName, 11)) found = true; | ||
2801 | if (!found) { | ||
2802 | EncodeUnicode(buffer,"Settings",8); | ||
2803 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2804 | } | ||
2805 | } else { | ||
2806 | if (mystrncasecmp("WAPSettings", h->SectionName, 11)) found = true; | ||
2807 | if (!found) { | ||
2808 | if (mystrncasecmp("Settings", h->SectionName, 8)) found = true; | ||
2809 | } | ||
2810 | } | ||
2811 | if (UseUnicode) { | ||
2812 | EncodeUnicode(buffer,"MMSSettings",8); | ||
2813 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2814 | } else { | ||
2815 | if (mystrncasecmp("MMSSettings", h->SectionName, 8)) found = true; | ||
2816 | } | ||
2817 | if (UseUnicode) { | ||
2818 | EncodeUnicode(buffer,"Ringtone",8); | ||
2819 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2820 | } else { | ||
2821 | if (mystrncasecmp("Ringtone", h->SectionName, 8)) found = true; | ||
2822 | } | ||
2823 | if (UseUnicode) { | ||
2824 | EncodeUnicode(buffer,"TODO",4); | ||
2825 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2826 | } else { | ||
2827 | if (mystrncasecmp("TODO", h->SectionName, 4)) found = true; | ||
2828 | } | ||
2829 | if (UseUnicode) { | ||
2830 | EncodeUnicode(buffer,"Startup",7); | ||
2831 | if (mywstrncasecmp(buffer, h->SectionName, 7)) found = true; | ||
2832 | } else { | ||
2833 | if (mystrncasecmp("Startup", h->SectionName, 7)) found = true; | ||
2834 | } | ||
2835 | if (UseUnicode) { | ||
2836 | EncodeUnicode(buffer,"Operator",7); | ||
2837 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2838 | } else { | ||
2839 | if (mystrncasecmp("Operator", h->SectionName, 8)) found = true; | ||
2840 | } | ||
2841 | if (UseUnicode) { | ||
2842 | EncodeUnicode(buffer,"FMStation",9); | ||
2843 | if (mywstrncasecmp(buffer, h->SectionName, 9)) found = true; | ||
2844 | } else { | ||
2845 | if (mystrncasecmp("FMStation", h->SectionName, 9)) found = true; | ||
2846 | } | ||
2847 | if (UseUnicode) { | ||
2848 | EncodeUnicode(buffer,"GPRSPoint",9); | ||
2849 | if (mywstrncasecmp(buffer, h->SectionName, 9)) found = true; | ||
2850 | } else { | ||
2851 | if (mystrncasecmp("GPRSPoint", h->SectionName, 9)) found = true; | ||
2852 | } | ||
2853 | if (UseUnicode) { | ||
2854 | EncodeUnicode(buffer,"Note",4); | ||
2855 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2856 | } else { | ||
2857 | if (mystrncasecmp("Note", h->SectionName, 4)) found = true; | ||
2858 | } | ||
2859 | if (!found) return ERR_NOTIMPLEMENTED; | ||
2860 | } | ||
2660 | return ERR_NONE; | 2861 | return ERR_NONE; |
2661 | } | 2862 | } |
2662 | 2863 | ||
2663 | /* ---------------------- backup files for SMS ----------------------------- */ | 2864 | /* ---------------------- backup files for SMS ----------------------------- */ |
diff --git a/gammu/emb/common/service/backup/gsmback.c b/gammu/emb/common/service/backup/gsmback.c index 91ac745..c94a4d2 100644 --- a/gammu/emb/common/service/backup/gsmback.c +++ b/gammu/emb/common/service/backup/gsmback.c | |||
@@ -72,8 +72,20 @@ void GSM_FreeBackup(GSM_Backup *backup) | |||
72 | backup->MMSSettings[i] = NULL; | 72 | backup->MMSSettings[i] = NULL; |
73 | i++; | 73 | i++; |
74 | } | 74 | } |
75 | i=0; | 75 | i=0; |
76 | while (backup->SyncMLSettings[i]!=NULL) { | ||
77 | free(backup->SyncMLSettings[i]); | ||
78 | backup->SyncMLSettings[i] = NULL; | ||
79 | i++; | ||
80 | } | ||
81 | i=0; | ||
82 | while (backup->ChatSettings[i]!=NULL) { | ||
83 | free(backup->ChatSettings[i]); | ||
84 | backup->ChatSettings[i] = NULL; | ||
85 | i++; | ||
86 | } | ||
87 | i=0; | ||
76 | while (backup->Ringtone[i]!=NULL) { | 88 | while (backup->Ringtone[i]!=NULL) { |
77 | free(backup->Ringtone[i]); | 89 | free(backup->Ringtone[i]); |
78 | backup->Ringtone[i] = NULL; | 90 | backup->Ringtone[i] = NULL; |
79 | i++; | 91 | i++; |
@@ -119,17 +131,17 @@ void GSM_FreeBackup(GSM_Backup *backup) | |||
119 | } | 131 | } |
120 | 132 | ||
121 | GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode) | 133 | GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode) |
122 | { | 134 | { |
123 | if (strstr(FileName,".lmb")) { | 135 | if (mystrcasestr(FileName,".lmb")) { |
124 | return SaveLMB(FileName,backup); | 136 | return SaveLMB(FileName,backup); |
125 | } else if (strstr(FileName,".vcs")) { | 137 | } else if (mystrcasestr(FileName,".vcs")) { |
126 | return SaveVCalendar(FileName,backup); | 138 | return SaveVCalendar(FileName,backup); |
127 | } else if (strstr(FileName,".vcf")) { | 139 | } else if (mystrcasestr(FileName,".vcf")) { |
128 | return SaveVCard(FileName,backup); | 140 | return SaveVCard(FileName,backup); |
129 | } else if (strstr(FileName,".ldif")) { | 141 | } else if (mystrcasestr(FileName,".ldif")) { |
130 | return SaveLDIF(FileName,backup); | 142 | return SaveLDIF(FileName,backup); |
131 | } else if (strstr(FileName,".ics")) { | 143 | } else if (mystrcasestr(FileName,".ics")) { |
132 | return SaveICS(FileName,backup); | 144 | return SaveICS(FileName,backup); |
133 | } else { | 145 | } else { |
134 | return SaveBackup(FileName,backup, UseUnicode); | 146 | return SaveBackup(FileName,backup, UseUnicode); |
135 | } | 147 | } |
@@ -147,15 +159,15 @@ GSM_Error GSM_ReadBackupFile(char *FileName, GSM_Backup *backup) | |||
147 | 159 | ||
148 | GSM_ClearBackup(backup); | 160 | GSM_ClearBackup(backup); |
149 | 161 | ||
150 | /* Attempt to identify filetype */ | 162 | /* Attempt to identify filetype */ |
151 | if (strstr(FileName,".vcs")) { | 163 | if (mystrcasestr(FileName,".vcs")) { |
152 | return LoadVCalendar(FileName,backup); | 164 | return LoadVCalendar(FileName,backup); |
153 | } else if (strstr(FileName,".vcf")) { | 165 | } else if (mystrcasestr(FileName,".vcf")) { |
154 | return LoadVCard(FileName,backup); | 166 | return LoadVCard(FileName,backup); |
155 | } else if (strstr(FileName,".ldif")) { | 167 | } else if (mystrcasestr(FileName,".ldif")) { |
156 | return LoadLDIF(FileName,backup); | 168 | return LoadLDIF(FileName,backup); |
157 | } else if (strstr(FileName,".ics")) { | 169 | } else if (mystrcasestr(FileName,".ics")) { |
158 | return LoadICS(FileName,backup); | 170 | return LoadICS(FileName,backup); |
159 | } else if (memcmp(buffer, "LMB ",4)==0) { | 171 | } else if (memcmp(buffer, "LMB ",4)==0) { |
160 | return LoadLMB(FileName,backup); | 172 | return LoadLMB(FileName,backup); |
161 | } else if (buffer[0] == 0xFE && buffer[1] == 0xFF) { | 173 | } else if (buffer[0] == 0xFE && buffer[1] == 0xFF) { |
@@ -176,8 +188,10 @@ void GSM_ClearBackup(GSM_Backup *backup) | |||
176 | backup->SMSC [0] = NULL; | 188 | backup->SMSC [0] = NULL; |
177 | backup->WAPBookmark[0] = NULL; | 189 | backup->WAPBookmark[0] = NULL; |
178 | backup->WAPSettings[0] = NULL; | 190 | backup->WAPSettings[0] = NULL; |
179 | backup->MMSSettings[0] = NULL; | 191 | backup->MMSSettings[0] = NULL; |
192 | backup->SyncMLSettings[0] = NULL; | ||
193 | backup->ChatSettings[0] = NULL; | ||
180 | backup->Ringtone[0] = NULL; | 194 | backup->Ringtone[0] = NULL; |
181 | backup->Profiles[0] = NULL; | 195 | backup->Profiles[0] = NULL; |
182 | backup->ToDo [0] = NULL; | 196 | backup->ToDo [0] = NULL; |
183 | backup->GPRSPoint[0] = NULL; | 197 | backup->GPRSPoint[0] = NULL; |
@@ -208,8 +222,10 @@ void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info) | |||
208 | info->SMSC = false; | 222 | info->SMSC = false; |
209 | info->WAPBookmark = false; | 223 | info->WAPBookmark = false; |
210 | info->WAPSettings = false; | 224 | info->WAPSettings = false; |
211 | info->MMSSettings = false; | 225 | info->MMSSettings = false; |
226 | info->SyncMLSettings = false; | ||
227 | info->ChatSettings = false; | ||
212 | info->Ringtone = false; | 228 | info->Ringtone = false; |
213 | info->StartupLogo = false; | 229 | info->StartupLogo = false; |
214 | info->OperatorLogo = false; | 230 | info->OperatorLogo = false; |
215 | info->Profiles = false; | 231 | info->Profiles = false; |
@@ -245,8 +261,10 @@ void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info) | |||
245 | info->SMSC = true; | 261 | info->SMSC = true; |
246 | info->WAPBookmark = true; | 262 | info->WAPBookmark = true; |
247 | info->WAPSettings = true; | 263 | info->WAPSettings = true; |
248 | info->MMSSettings = true; | 264 | info->MMSSettings = true; |
265 | info->SyncMLSettings = true; | ||
266 | info->ChatSettings = true; | ||
249 | info->Ringtone = true; | 267 | info->Ringtone = true; |
250 | info->StartupLogo = true; | 268 | info->StartupLogo = true; |
251 | info->OperatorLogo = true; | 269 | info->OperatorLogo = true; |
252 | info->Profiles = true; | 270 | info->Profiles = true; |
diff --git a/gammu/emb/common/service/backup/gsmback.h b/gammu/emb/common/service/backup/gsmback.h index 1fd99b0..791e81d 100644 --- a/gammu/emb/common/service/backup/gsmback.h +++ b/gammu/emb/common/service/backup/gsmback.h | |||
@@ -28,8 +28,10 @@ typedef struct { | |||
28 | bool WAPBookmark; | 28 | bool WAPBookmark; |
29 | bool Profiles; | 29 | bool Profiles; |
30 | bool WAPSettings; | 30 | bool WAPSettings; |
31 | bool MMSSettings; | 31 | bool MMSSettings; |
32 | bool SyncMLSettings; | ||
33 | bool ChatSettings; | ||
32 | bool Ringtone; | 34 | bool Ringtone; |
33 | bool StartupLogo; | 35 | bool StartupLogo; |
34 | bool OperatorLogo; | 36 | bool OperatorLogo; |
35 | bool FMStation; | 37 | bool FMStation; |