summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/service
Unidiff
Diffstat (limited to 'gammu/emb/common/service') (more/less context) (show whitespace changes)
-rw-r--r--gammu/emb/common/service/backup/backgen.h4
-rw-r--r--gammu/emb/common/service/backup/backtext.c221
-rw-r--r--gammu/emb/common/service/backup/gsmback.c36
-rw-r--r--gammu/emb/common/service/backup/gsmback.h2
-rw-r--r--gammu/emb/common/service/gsmcal.h2
-rw-r--r--gammu/emb/common/service/gsmdata.c120
-rw-r--r--gammu/emb/common/service/gsmdata.h2
-rw-r--r--gammu/emb/common/service/gsmlogo.c47
-rw-r--r--gammu/emb/common/service/gsmlogo.h28
-rw-r--r--gammu/emb/common/service/gsmmisc.h7
-rw-r--r--gammu/emb/common/service/gsmring.c45
-rw-r--r--gammu/emb/common/service/gsmring.h8
-rw-r--r--gammu/emb/common/service/sms/gsmmulti.c5
-rw-r--r--gammu/emb/common/service/sms/gsmmulti.h11
-rw-r--r--gammu/emb/common/service/sms/gsmsms.c5
-rw-r--r--gammu/emb/common/service/sms/gsmsms.h5
16 files changed, 491 insertions, 57 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
@@ -21,6 +21,8 @@
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
@@ -43,6 +45,8 @@ typedef struct {
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];
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
@@ -151,13 +151,13 @@ static void SaveBackupText(FILE *file, char *myname, char *myvalue, bool UseUnic
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);
@@ -174,9 +174,10 @@ static bool ReadBackupText(INI_Section *file_info, char *section, char *myname,
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;
@@ -197,7 +198,7 @@ static bool ReadBackupText(INI_Section *file_info, char *section, char *myname,
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;
@@ -418,6 +419,17 @@ static void SavePbkEntry(FILE *file, GSM_MemoryEntry *Pbk, bool UseUnicode)
418 SaveBackupText(file, "", buffer, UseUnicode); 419 SaveBackupText(file, "", buffer, UseUnicode);
419} 420}
420 421
422static 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
421static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnicode) 433static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnicode)
422{ 434{
423 int i; 435 int i;
@@ -657,6 +669,48 @@ static void SaveWAPSettingsEntry(FILE *file, GSM_MultiWAPSettings *settings, boo
657 } 669 }
658} 670}
659 671
672static 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
685static 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
660static void SaveBitmapEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) 714static 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];
@@ -765,22 +819,23 @@ static void SaveSMSCEntry(FILE *file, GSM_SMSC *SMSC, bool UseUnicode)
765static void SaveRingtoneEntry(FILE *file, GSM_Ringtone *ringtone, bool UseUnicode) 819static 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 }
@@ -1075,6 +1130,13 @@ GSM_Error SaveBackup(char *FileName, GSM_Backup *backup, bool 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);
@@ -1110,6 +1172,20 @@ GSM_Error SaveBackup(char *FileName, GSM_Backup *backup, bool 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);
@@ -2656,7 +2732,132 @@ GSM_Error LoadBackup(char *FileName, GSM_Backup *backup, bool UseUnicode)
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
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
@@ -73,6 +73,18 @@ void GSM_FreeBackup(GSM_Backup *backup)
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;
@@ -120,15 +132,15 @@ void GSM_FreeBackup(GSM_Backup *backup)
120 132
121GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode) 133GSM_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);
@@ -148,13 +160,13 @@ GSM_Error GSM_ReadBackupFile(char *FileName, GSM_Backup *backup)
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);
@@ -177,6 +189,8 @@ void GSM_ClearBackup(GSM_Backup *backup)
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;
@@ -209,6 +223,8 @@ void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info)
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;
@@ -246,6 +262,8 @@ void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info)
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;
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
@@ -29,6 +29,8 @@ typedef struct {
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;
diff --git a/gammu/emb/common/service/gsmcal.h b/gammu/emb/common/service/gsmcal.h
index 067a4a4..0a41b7b 100644
--- a/gammu/emb/common/service/gsmcal.h
+++ b/gammu/emb/common/service/gsmcal.h
@@ -405,7 +405,7 @@ typedef struct {
405 405
406typedef struct { 406typedef struct {
407 int Location; 407 int Location;
408 char Text[100]; 408 char Text[3000*2];
409} GSM_NoteEntry; 409} GSM_NoteEntry;
410 410
411GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note); 411GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note);
diff --git a/gammu/emb/common/service/gsmdata.c b/gammu/emb/common/service/gsmdata.c
index 94e9b7b..9303b57 100644
--- a/gammu/emb/common/service/gsmdata.c
+++ b/gammu/emb/common/service/gsmdata.c
@@ -246,13 +246,15 @@ void NOKIA_EncodeWAPMMSSettingsSMSText(unsigned char *Buffer, int *Length, GSM_W
246} 246}
247 247
248/* http://forum.nokia.com: OTA Settings 7.0 */ 248/* http://forum.nokia.com: OTA Settings 7.0 */
249/* first it used default/ISO coding */
250/* Joergen Thomsen changed to UTF8 */
249void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark) 251void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark)
250{ 252{
251 unsigned charbuffer[100]; 253 unsigned charbuffer[100];
252 bool UnicodeCoding = false;
253 254
254 EncodeUTF8QuotedPrintable(buffer,bookmark->Title); 255 // bool UnicodeCoding = false;
255 if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; 256 //EncodeUTF8QuotedPrintable(buffer,bookmark->Title);
257 //if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true;
256 258
257 Buffer[(*Length)++] = 0x01; //Push ID 259 Buffer[(*Length)++] = 0x01; //Push ID
258 Buffer[(*Length)++] = 0x06; //PDU Type (push) 260 Buffer[(*Length)++] = 0x06; //PDU Type (push)
@@ -265,34 +267,110 @@ void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPB
265 strcpy(Buffer+(*Length),"\x81\xEA"); 267 strcpy(Buffer+(*Length),"\x81\xEA");
266 (*Length)=(*Length)+2; //charset UTF-8 short int. 268 (*Length)=(*Length)+2; //charset UTF-8 short int.
267 269
270 /* removed by Joergen Thomsen */
268 /* Block from sniffs. UNKNOWN */ 271 /* Block from sniffs. UNKNOWN */
269 if (!UnicodeCoding) { 272 //if (!UnicodeCoding) {
270 Buffer[(*Length)++] = 0x00; 273 // Buffer[(*Length)++] = 0x00;
271 Buffer[(*Length)++] = 0x01; 274 // Buffer[(*Length)++] = 0x01;
272 } else { 275 //} else {
273 strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); 276 // strcpy(Buffer+(*Length),"\x01\x01\x87\x68");
274 (*Length)=(*Length)+4; 277 // (*Length)=(*Length)+4;
275 } 278 //}
276 Buffer[(*Length)++] = 0x00; 279 //Buffer[(*Length)++] = 0x00;
280
281 /* added by Joergen Thomsen */
282 Buffer[(*Length)++] = 0x01; // Version WBXML 1.1
283 Buffer[(*Length)++] = 0x01; // Unknown public identifier
284 Buffer[(*Length)++] = 0x6A; // charset UTF-8
285 Buffer[(*Length)++] = 0x00; // string table length
277 286
278 Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content 287 Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content
279 /* URL */ 288 /* URL */
280 Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes 289 Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes
281 Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK 290 Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK
282 Buffer[(*Length)++] = 0x01; //END PARMeter 291 Buffer[(*Length)++] = 0x01; //END PARMeter
283 if (!UnicodeCoding) { 292
284 /* TITLE */ 293 /* removed by Joergen Thomsen */
285 AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); 294 // if (!UnicodeCoding) {
286 /* URL */ 295 // /* TITLE */
287 AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); 296 // AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title));
288 } else { 297 // /* URL */
298 // AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address));
299 // } else {
300 // /* TITLE */
301 // AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1);
302 // /* URL */
303 // AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1);
304 // }
305
306 /* added by Joergen Thomsen */
289 /* TITLE */ 307 /* TITLE */
290 AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); 308 EncodeUTF8(buffer, bookmark->Title);
309 AddWAPSMSParameterText(Buffer, Length, 0x15, buffer, strlen(buffer));
291 /* URL */ 310 /* URL */
292 AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); 311 EncodeUTF8(buffer, bookmark->Address);
312 AddWAPSMSParameterText(Buffer, Length, 0x17, buffer, strlen(buffer));
313
314 Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC)
315 Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC-LIST)
293 } 316 }
294 Buffer[(*Length)++] = 0x01; //END PARMeter 317
295 Buffer[(*Length)++] = 0x01; //END PARMeter 318void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, int *Length, char *Text, char *URL)
319{
320 int i;
321
322 Buffer[(*Length)++] = 0x01; //Push ID
323 Buffer[(*Length)++] = 0x06; //PDU Type (push)
324 Buffer[(*Length)++] = 28; //Headers length (content type + headers)
325 strcpy(Buffer+(*Length),"\x1F\x23");
326 (*Length)=(*Length)+2; //Value length
327 strcpy(Buffer+(*Length),"application/vnd.wap.sic");
328 (*Length)=(*Length)+23; //MIME-Type
329 Buffer[(*Length)++] = 0x00; //end inline string
330 strcpy(Buffer+(*Length),"\x81\xEA");
331 (*Length)=(*Length)+2; //charset UTF-8 short int.
332
333 Buffer[(*Length)++] = 0x02; // WBXML 1.2
334 Buffer[(*Length)++] = 0x05; // SI 1.0 Public Identifier
335 Buffer[(*Length)++] = 0x6A; // charset UTF-8
336 Buffer[(*Length)++] = 0x00; // string table length
337 Buffer[(*Length)++] = 0x45; // SI with content
338 Buffer[(*Length)++] = 0xC6; // indication with content and attributes
339 Buffer[(*Length)++] = 0x0B;// address
340 Buffer[(*Length)++] = 0x03; // Inline string
341 for (i=0;i<(int)strlen(URL);i++) {
342 Buffer[(*Length)++] = URL[i];//Text
343 }
344 Buffer[(*Length)++] = 0x00; // END Inline string
345
346#ifdef XXX
347 Buffer[(*Length)++] = 0x0A;// created...
348 Buffer[(*Length)++] = 0xC3;// OPAQUE
349 Buffer[(*Length)++] = 0x07;// length
350 Buffer[(*Length)++] = 0x19;// year
351 Buffer[(*Length)++] = 0x80;// year
352 Buffer[(*Length)++] = 0x21;// month
353 Buffer[(*Length)++] = 0x12;// ..
354 Buffer[(*Length)++] = 0x00;// ..
355 Buffer[(*Length)++] = 0x00;// ..
356 Buffer[(*Length)++] = 0x00;// ..
357 Buffer[(*Length)++] = 0x10;// expires
358 Buffer[(*Length)++] = 0xC3;// OPAQUE
359 Buffer[(*Length)++] = 0x04;// length
360 Buffer[(*Length)++] = 0x20;// year
361 Buffer[(*Length)++] = 0x10;// year
362 Buffer[(*Length)++] = 0x06;// month
363 Buffer[(*Length)++] = 0x25;// day
364#endif
365
366 Buffer[(*Length)++] = 0x01; // END (indication)
367 Buffer[(*Length)++] = 0x03; // Inline string
368 for (i=0;i<(int)strlen(Text);i++) {
369 Buffer[(*Length)++] = Text[i];//Text
370 }
371 Buffer[(*Length)++] = 0x00; // END Inline string
372 Buffer[(*Length)++] = 0x01; // END (indication)
373 Buffer[(*Length)++] = 0x01; // END (SI)
296} 374}
297 375
298void GSM_EncodeMMSFile(GSM_EncodeMultiPartMMSInfo *Info, unsigned char *Buffer, int *Length) 376void GSM_EncodeMMSFile(GSM_EncodeMultiPartMMSInfo *Info, unsigned char *Buffer, int *Length)
diff --git a/gammu/emb/common/service/gsmdata.h b/gammu/emb/common/service/gsmdata.h
index f5f8e07..e81589f 100644
--- a/gammu/emb/common/service/gsmdata.h
+++ b/gammu/emb/common/service/gsmdata.h
@@ -88,6 +88,8 @@ typedef struct {
88 88
89void GSM_EncodeMMSIndicatorSMSText(unsigned char *Buffer, int *Length, GSM_MMSIndicator Indicator); 89void GSM_EncodeMMSIndicatorSMSText(unsigned char *Buffer, int *Length, GSM_MMSIndicator Indicator);
90 90
91void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, int *Length, char *Text, char *URL);
92
91/* ------------------------------ MMS file --------------------------------- */ 93/* ------------------------------ MMS file --------------------------------- */
92 94
93#define MAX_MULTI_MMS 20 95#define MAX_MULTI_MMS 20
diff --git a/gammu/emb/common/service/gsmlogo.c b/gammu/emb/common/service/gsmlogo.c
index c992915..7c19967 100644
--- a/gammu/emb/common/service/gsmlogo.c
+++ b/gammu/emb/common/service/gsmlogo.c
@@ -2,6 +2,7 @@
2 2
3#include <string.h> 3#include <string.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#include <sys/stat.h>
5 6
6#include "../misc/misc.h" 7#include "../misc/misc.h"
7#include "../misc/coding/coding.h" 8#include "../misc/coding/coding.h"
@@ -161,6 +162,7 @@ void PHONE_DecodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *B
161 Bitmap->Sender[0] = 0; 162 Bitmap->Sender[0] = 0;
162 Bitmap->Sender[1] = 0; 163 Bitmap->Sender[1] = 0;
163 Bitmap->ID = 0; 164 Bitmap->ID = 0;
165 Bitmap->Name = NULL;
164 166
165 GSM_ClearBitmap(Bitmap); 167 GSM_ClearBitmap(Bitmap);
166 for (x=0;x<Bitmap->BitmapWidth;x++) { 168 for (x=0;x<Bitmap->BitmapWidth;x++) {
@@ -626,17 +628,17 @@ GSM_Error GSM_SaveBitmapFile(char *FileName, GSM_MultiBitmap *bitmap)
626 if (file == NULL) return ERR_CANTOPENFILE; 628 if (file == NULL) return ERR_CANTOPENFILE;
627 629
628 /* Attempt to identify filetype */ 630 /* Attempt to identify filetype */
629 if (strstr(FileName,".nlm")) { 631 if (mystrcasestr(FileName,".nlm")) {
630 error=savenlm(file,bitmap); 632 error=savenlm(file,bitmap);
631 } else if (strstr(FileName,".ngg")) { 633 } else if (mystrcasestr(FileName,".ngg")) {
632 error=savengg(file,bitmap); 634 error=savengg(file,bitmap);
633 } else if (strstr(FileName,".nol")) { 635 } else if (mystrcasestr(FileName,".nol")) {
634 error=savenol(file,bitmap); 636 error=savenol(file,bitmap);
635 } else if (strstr(FileName,".xpm")) { 637 } else if (mystrcasestr(FileName,".xpm")) {
636 error=savexpm(file,bitmap); 638 error=savexpm(file,bitmap);
637 } else if (strstr(FileName,".nsl")) { 639 } else if (mystrcasestr(FileName,".nsl")) {
638 error=savensl(file,bitmap); 640 error=savensl(file,bitmap);
639 } else if (strstr(FileName,".wbmp")) { 641 } else if (mystrcasestr(FileName,".wbmp")) {
640 error=savewbmp(file,bitmap); 642 error=savewbmp(file,bitmap);
641 } else { 643 } else {
642 error=savebmp(file,bitmap); 644 error=savebmp(file,bitmap);
@@ -955,6 +957,33 @@ static GSM_Error loadwbmp(FILE *file, GSM_MultiBitmap *bitmap)
955 return ERR_NONE; 957 return ERR_NONE;
956} 958}
957 959
960static GSM_Error loadgif(FILE *file, GSM_MultiBitmap *bitmap)
961{
962 GSM_Bitmap *bmap = &bitmap->Bitmap[0];
963 char *buffer;
964 struct stat st;
965 int length;
966
967 dbgprintf("loading gif file\n");
968 fstat(fileno(file), &st);
969 bmap->BinaryPic.Length = length = st.st_size;
970 bmap->BinaryPic.Buffer = buffer = malloc(length);
971 if (bmap->BinaryPic.Buffer == NULL)
972 return ERR_MOREMEMORY;
973
974 fread(buffer, 1, length, file);
975 dbgprintf("Length %i name \"%s\"\n", length,
976 DecodeUnicodeString(bmap->Name));
977
978 bmap->Type = GSM_PictureBinary;
979 bmap->BinaryPic.Type = PICTURE_GIF;
980 bmap->BitmapWidth = 256 * buffer[7] + buffer[6];
981 bmap->BitmapHeight = 256 * buffer[9] + buffer[8];
982 bitmap->Number = 1;
983
984 return ERR_NONE;
985}
986
958GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) 987GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap)
959{ 988{
960 FILE *file; 989 FILE *file;
@@ -963,6 +992,10 @@ GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap)
963 file = fopen(FileName, "rb"); 992 file = fopen(FileName, "rb");
964 if (file == NULL) return ERR_CANTOPENFILE; 993 if (file == NULL) return ERR_CANTOPENFILE;
965 994
995 bitmap->Bitmap[0].Name = malloc((strlen(FileName) + 1) * 2);
996 if (bitmap->Bitmap[0].Name == NULL) return ERR_MOREMEMORY;
997 EncodeUnicode(bitmap->Bitmap[0].Name, FileName, strlen(FileName));
998
966 fread(buffer, 1, 9, file); /* Read the header of the file. */ 999 fread(buffer, 1, 9, file); /* Read the header of the file. */
967 rewind(file); 1000 rewind(file);
968 1001
@@ -981,6 +1014,8 @@ GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap)
981 return loadnolngg(file,bitmap,false); 1014 return loadnolngg(file,bitmap,false);
982 } else if (memcmp(buffer, "FORM",4)==0) { 1015 } else if (memcmp(buffer, "FORM",4)==0) {
983 return loadnsl(file,bitmap); 1016 return loadnsl(file,bitmap);
1017 } else if (memcmp(buffer, "GIF",3)==0) {
1018 return loadgif(file,bitmap);
984 } 1019 }
985 return ERR_UNKNOWN; 1020 return ERR_UNKNOWN;
986} 1021}
diff --git a/gammu/emb/common/service/gsmlogo.h b/gammu/emb/common/service/gsmlogo.h
index b1b579d..6c6e2d8 100644
--- a/gammu/emb/common/service/gsmlogo.h
+++ b/gammu/emb/common/service/gsmlogo.h
@@ -5,6 +5,20 @@
5 5
6#include "../gsmcomon.h" 6#include "../gsmcomon.h"
7 7
8typedef enum {
9 PICTURE_BMP = 1,
10 PICTURE_GIF,
11 PICTURE_JPG,
12 PICTURE_ICN,
13 PICTURE_PNG
14} GSM_BinaryPicture_Types;
15
16typedef struct {
17 GSM_BinaryPicture_Types Type;
18 unsigned char *Buffer;
19 int Length;
20} GSM_BinaryPicture;
21
8/** 22/**
9 * Enum to handle all possible bitmaps, which are not saved in various filesystems. 23 * Enum to handle all possible bitmaps, which are not saved in various filesystems.
10 */ 24 */
@@ -45,7 +59,11 @@ typedef enum {
45 /** 59 /**
46 * Image defined in Smart Messaging specification 60 * Image defined in Smart Messaging specification
47 */ 61 */
48 GSM_PictureImage 62 GSM_PictureImage,
63 /**
64 * Binary picture (BMP, GIF, etc.)
65 */
66 GSM_PictureBinary
49} GSM_Bitmap_Types; 67} GSM_Bitmap_Types;
50 68
51 #define GSM_BITMAP_SIZE(65+7)/8*96 69 #define GSM_BITMAP_SIZE(65+7)/8*96
@@ -115,6 +133,14 @@ typedef struct {
115 * For colour bitmaps: ID 133 * For colour bitmaps: ID
116 */ 134 */
117 unsigned char ID; 135 unsigned char ID;
136 /**
137 * For binary pictures (GIF, BMP, etc.): frame and length
138 */
139 GSM_BinaryPicture BinaryPic;
140 /**
141 * Bitmap name
142 */
143 char *Name;
118} GSM_Bitmap; 144} GSM_Bitmap;
119 145
120#define MAX_MULTI_BITMAP 6 146#define MAX_MULTI_BITMAP 6
diff --git a/gammu/emb/common/service/gsmmisc.h b/gammu/emb/common/service/gsmmisc.h
index 37501ad..793d3d1 100644
--- a/gammu/emb/common/service/gsmmisc.h
+++ b/gammu/emb/common/service/gsmmisc.h
@@ -292,7 +292,12 @@ typedef struct {
292typedef enum { 292typedef enum {
293 GSM_Date_DDMMYYYY = 1, 293 GSM_Date_DDMMYYYY = 1,
294 GSM_Date_MMDDYYYY, 294 GSM_Date_MMDDYYYY,
295 GSM_Date_YYYYMMDD 295 GSM_Date_YYYYMMDD,
296 GSM_Date_DDMMMYY,
297 GSM_Date_MMDDYY,
298 GSM_Date_DDMMYY,
299 GSM_Date_YYMMDD,
300 GSM_Date_OFF
296} GSM_DateFormat; 301} GSM_DateFormat;
297 302
298typedef struct { 303typedef struct {
diff --git a/gammu/emb/common/service/gsmring.c b/gammu/emb/common/service/gsmring.c
index 7df46f1..dab028c 100644
--- a/gammu/emb/common/service/gsmring.c
+++ b/gammu/emb/common/service/gsmring.c
@@ -1,12 +1,15 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* Based on some work from Ralf Thelen (7110 ringtones), 2/* Based on some work from Ralf Thelen (7110 ringtones) and others */
3 * Gnokii (RTTL and SM) and others 3/* Based on some work (RTTL and SM) from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later
4 */ 6 */
5 7
6#include <stdlib.h> 8#include <stdlib.h>
7#include <string.h> 9#include <string.h>
8#include <ctype.h> 10#include <ctype.h>
9#include <math.h> 11#include <math.h>
12#include <sys/stat.h>
10#ifdef WIN32 13#ifdef WIN32
11# include <windows.h> 14# include <windows.h>
12#endif 15#endif
@@ -156,6 +159,12 @@ static GSM_Error savepuremidi(FILE *file, GSM_Ringtone *ringtone)
156 return ERR_NONE; 159 return ERR_NONE;
157} 160}
158 161
162static GSM_Error savemmf(FILE *file, GSM_Ringtone *ringtone)
163{
164 fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file);
165 return ERR_NONE;
166}
167
159GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone) 168GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone)
160{ 169{
161 GSM_RingNoteScaleDefNoteScale; 170 GSM_RingNoteScaleDefNoteScale;
@@ -485,6 +494,9 @@ GSM_Error GSM_SaveRingtoneFile(char *FileName, GSM_Ringtone *ringtone)
485 case RING_MIDI: 494 case RING_MIDI:
486 savepuremidi(file, ringtone); 495 savepuremidi(file, ringtone);
487 break; 496 break;
497 case RING_MMF:
498 savemmf(file, ringtone);
499 break;
488 } 500 }
489 501
490 fclose(file); 502 fclose(file);
@@ -769,6 +781,26 @@ static GSM_Error loadpuremidi(FILE *file, GSM_Ringtone *ringtone)
769 return ERR_NONE; 781 return ERR_NONE;
770} 782}
771 783
784static GSM_Error loadmmf(FILE *file, GSM_Ringtone *ringtone)
785{
786 struct stat st;
787 char *buffer;
788 int length;
789
790 dbgprintf("loading smaf file\n");
791 fstat(fileno(file), &st);
792 ringtone->BinaryTone.Length = length = st.st_size;
793 ringtone->BinaryTone.Buffer = buffer = malloc(length);
794 if (buffer == NULL)
795 return ERR_MOREMEMORY;
796 fread(buffer, 1, length, file);
797
798 dbgprintf("Length %i name \"%s\"\n", length,
799 DecodeUnicodeString(ringtone->Name));
800
801 return ERR_NONE;
802}
803
772static GSM_Error loadre(FILE *file, GSM_Ringtone *ringtone) 804static GSM_Error loadre(FILE *file, GSM_Ringtone *ringtone)
773{ 805{
774 unsigned char buffer[2000]; 806 unsigned char buffer[2000];
@@ -816,6 +848,10 @@ GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone)
816 buffer[2]==0x68 && buffer[3]==0x64) { 848 buffer[2]==0x68 && buffer[3]==0x64) {
817 ringtone->Format = RING_MIDI; 849 ringtone->Format = RING_MIDI;
818 } 850 }
851 if (buffer[0]==0x4D && buffer[1]==0x4D &&
852 buffer[2]==0x4D && buffer[3]==0x44) {
853 ringtone->Format = RING_MMF;
854 }
819 } 855 }
820 rewind(file); 856 rewind(file);
821 switch (ringtone->Format) { 857 switch (ringtone->Format) {
@@ -842,6 +878,11 @@ GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone)
842 case RING_MIDI: 878 case RING_MIDI:
843 EncodeUnicode(ringtone->Name,FileName,strlen(FileName)); 879 EncodeUnicode(ringtone->Name,FileName,strlen(FileName));
844 error = loadpuremidi(file,ringtone); 880 error = loadpuremidi(file,ringtone);
881 break;
882 case RING_MMF:
883 EncodeUnicode(ringtone->Name,FileName,strlen(FileName));
884 error = loadmmf(file,ringtone);
885 break;
845 } 886 }
846 fclose(file); 887 fclose(file);
847 return(error); 888 return(error);
diff --git a/gammu/emb/common/service/gsmring.h b/gammu/emb/common/service/gsmring.h
index 207cf31..2d2dd7a 100644
--- a/gammu/emb/common/service/gsmring.h
+++ b/gammu/emb/common/service/gsmring.h
@@ -120,21 +120,23 @@ typedef struct {
120 bool AllNotesScale; 120 bool AllNotesScale;
121} GSM_NoteRingtone; 121} GSM_NoteRingtone;
122 122
123/* FIXME: should use BinaryTone instead? */
123/* Structure to hold Nokia binary ringtones. */ 124/* Structure to hold Nokia binary ringtones. */
124typedef struct { 125typedef struct {
125 unsigned char Frame[30000]; 126 unsigned char Frame[50000];
126 int Length; 127 int Length;
127} GSM_NokiaBinaryRingtone; 128} GSM_NokiaBinaryRingtone;
128 129
129typedef struct { 130typedef struct {
130 unsigned char *Frame; 131 unsigned char *Buffer;
131 int Length; 132 int Length;
132} GSM_BinaryTone; 133} GSM_BinaryTone;
133 134
134typedef enum { 135typedef enum {
135 RING_NOTETONE = 1, 136 RING_NOTETONE = 1,
136 RING_NOKIABINARY, 137 RING_NOKIABINARY,
137 RING_MIDI 138 RING_MIDI,
139 RING_MMF
138} GSM_RingtoneFormat; 140} GSM_RingtoneFormat;
139 141
140/** 142/**
diff --git a/gammu/emb/common/service/sms/gsmmulti.c b/gammu/emb/common/service/sms/gsmmulti.c
index 6c1cdcd..bdb5ee9 100644
--- a/gammu/emb/common/service/sms/gsmmulti.c
+++ b/gammu/emb/common/service/sms/gsmmulti.c
@@ -487,6 +487,11 @@ GSM_Error GSM_EncodeMultiPartSMS(GSM_MultiPartSMSInfo *Info,
487 UDH= UDH_MMSIndicatorLong; 487 UDH= UDH_MMSIndicatorLong;
488 GSM_EncodeMMSIndicatorSMSText(Buffer,&Length,*Info->Entries[0].MMSIndicator); 488 GSM_EncodeMMSIndicatorSMSText(Buffer,&Length,*Info->Entries[0].MMSIndicator);
489 break; 489 break;
490 case SMS_WAPIndicatorLong:
491 Class= 1;
492 UDH= UDH_MMSIndicatorLong;
493 GSM_EncodeWAPIndicatorSMSText(Buffer,&Length,Info->Entries[0].MMSIndicator->Title,Info->Entries[0].MMSIndicator->Address);
494 break;
490 case SMS_NokiaRingtoneLong: 495 case SMS_NokiaRingtoneLong:
491 case SMS_NokiaRingtone: 496 case SMS_NokiaRingtone:
492 UDH= UDH_NokiaRingtone; 497 UDH= UDH_NokiaRingtone;
diff --git a/gammu/emb/common/service/sms/gsmmulti.h b/gammu/emb/common/service/sms/gsmmulti.h
index c672261..3f70d81 100644
--- a/gammu/emb/common/service/sms/gsmmulti.h
+++ b/gammu/emb/common/service/sms/gsmmulti.h
@@ -3,6 +3,10 @@
3#ifndef __gsm_multi_h 3#ifndef __gsm_multi_h
4#define __gsm_multi_h 4#define __gsm_multi_h
5 5
6#if defined(_MSC_VER) && defined(__cplusplus)
7 extern "C" {
8#endif
9
6#include "../../gsmcomon.h" 10#include "../../gsmcomon.h"
7#include "../gsmlogo.h" 11#include "../gsmlogo.h"
8#include "../gsmcal.h" 12#include "../gsmcal.h"
@@ -172,7 +176,7 @@ typedef enum {
172 * IMelody 1.0 with UPI. 176 * IMelody 1.0 with UPI.
173 */ 177 */
174 SMS_EMSSound10Long, 178 SMS_EMSSound10Long,
175 /*** 179 /**
176 * IMelody 1.2 with UPI. 180 * IMelody 1.2 with UPI.
177 */ 181 */
178 SMS_EMSSound12Long, 182 SMS_EMSSound12Long,
@@ -190,6 +194,7 @@ typedef enum {
190 SMS_EMSVariableBitmap, 194 SMS_EMSVariableBitmap,
191 SMS_EMSVariableBitmapLong, 195 SMS_EMSVariableBitmapLong,
192 SMS_MMSIndicatorLong, 196 SMS_MMSIndicatorLong,
197 SMS_WAPIndicatorLong,
193 /** 198 /**
194 * Variable bitmap with black and white colors 199 * Variable bitmap with black and white colors
195 */ 200 */
@@ -264,6 +269,10 @@ void GSM_FreeMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info);
264 */ 269 */
265GSM_Error GSM_LinkSMS(GSM_MultiSMSMessage **INPUT, GSM_MultiSMSMessage **OUTPUT, bool ems); 270GSM_Error GSM_LinkSMS(GSM_MultiSMSMessage **INPUT, GSM_MultiSMSMessage **OUTPUT, bool ems);
266 271
272#if defined(_MSC_VER) && defined(__cplusplus)
273 }
274#endif
275
267#endif 276#endif
268 277
269/* How should editor hadle tabs in this file? Add editor commands here. 278/* How should editor hadle tabs in this file? Add editor commands here.
diff --git a/gammu/emb/common/service/sms/gsmsms.c b/gammu/emb/common/service/sms/gsmsms.c
index 9920835..feceba4 100644
--- a/gammu/emb/common/service/sms/gsmsms.c
+++ b/gammu/emb/common/service/sms/gsmsms.c
@@ -1,5 +1,8 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* based on some work from Pawel Kot, others and Gnokii */ 2/* Based on some Pawel Kot and others work from Gnokii (www.gnokii.org)
3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4 * GNU GPL version 2 or later
5 */
3 6
4#include <ctype.h> 7#include <ctype.h>
5#include <string.h> 8#include <string.h>
diff --git a/gammu/emb/common/service/sms/gsmsms.h b/gammu/emb/common/service/sms/gsmsms.h
index d87ff60..0b950d3 100644
--- a/gammu/emb/common/service/sms/gsmsms.h
+++ b/gammu/emb/common/service/sms/gsmsms.h
@@ -1,5 +1,8 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* based on some work from Pawel Kot, others and Gnokii */ 2/* Based on some Pawel Kot and others work from Gnokii (www.gnokii.org)
3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4 * GNU GPL version 2 or later
5 */
3 6
4#ifndef __gsm_sms_h 7#ifndef __gsm_sms_h
5#define __gsm_sms_h 8#define __gsm_sms_h