author | zautrix <zautrix> | 2004-10-25 08:56:23 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-25 08:56:23 (UTC) |
commit | 62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3 (patch) (unidiff) | |
tree | c2b7a41b0c8fffdc0786b84ff86724ea8f08d6a1 /gammu/emb/common/service/backup | |
parent | feff0930372dd51af24dc3b46697e70838277ea5 (diff) | |
download | kdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.zip kdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.tar.gz kdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.tar.bz2 |
gammu updates
Diffstat (limited to 'gammu/emb/common/service/backup') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/service/backup/backgen.h | 2 | ||||
-rw-r--r-- | gammu/emb/common/service/backup/backtext.c | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/gammu/emb/common/service/backup/backgen.h b/gammu/emb/common/service/backup/backgen.h index 9a930fc..9d97954 100644 --- a/gammu/emb/common/service/backup/backgen.h +++ b/gammu/emb/common/service/backup/backgen.h | |||
@@ -43,31 +43,31 @@ typedef struct { | |||
43 | GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1]; | 43 | GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1]; |
44 | GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; | 44 | GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; |
45 | GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; | 45 | GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; |
46 | GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; | 46 | GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; |
47 | 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]; | 48 | GSM_SyncMLSettings*SyncMLSettings [GSM_BACKUP_MAX_SYNCMLSETTINGS + 1]; |
49 | GSM_ChatSettings *ChatSettings [GSM_BACKUP_MAX_CHATSETTINGS + 1]; | 49 | GSM_ChatSettings *ChatSettings [GSM_BACKUP_MAX_CHATSETTINGS + 1]; |
50 | GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; | 50 | GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; |
51 | GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; | 51 | GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; |
52 | GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; | 52 | GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; |
53 | GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; | 53 | GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; |
54 | GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1]; | 54 | GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1]; |
55 | GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1]; | 55 | GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1]; |
56 | GSM_Bitmap *StartupLogo; | 56 | GSM_Bitmap *StartupLogo; |
57 | GSM_Bitmap *OperatorLogo; | 57 | GSM_Bitmap *OperatorLogo; |
58 | } GSM_Backup; | 58 | } GSM_Backup; |
59 | 59 | ||
60 | #define GSM_BACKUP_MAX_SMS500 | 60 | #define GSM_BACKUP_MAX_SMS500 |
61 | 61 | ||
62 | typedef struct { | 62 | typedef struct { |
63 | GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS]; | 63 | GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS]; |
64 | } GSM_SMS_Backup; | 64 | } GSM_SMS_Backup; |
65 | 65 | ||
66 | extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); | 66 | extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); |
67 | extern GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); | 67 | extern GSM_Error GSM_AddSMSBackupFile (char *FileName, GSM_SMS_Backup *backup); |
68 | 68 | ||
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | /* How should editor hadle tabs in this file? Add editor commands here. | 71 | /* How should editor hadle tabs in this file? Add editor commands here. |
72 | * vim: noexpandtab sw=8 ts=8 sts=8: | 72 | * vim: noexpandtab sw=8 ts=8 sts=8: |
73 | */ | 73 | */ |
diff --git a/gammu/emb/common/service/backup/backtext.c b/gammu/emb/common/service/backup/backtext.c index 4cb1bb7..07a3b22 100644 --- a/gammu/emb/common/service/backup/backtext.c +++ b/gammu/emb/common/service/backup/backtext.c | |||
@@ -2975,57 +2975,61 @@ static GSM_Error GSM_ReadSMSBackupTextFile(char *FileName, GSM_SMS_Backup *backu | |||
2975 | return ERR_MOREMEMORY; | 2975 | return ERR_MOREMEMORY; |
2976 | } | 2976 | } |
2977 | backup->SMS[num]->Location = num + 1; | 2977 | backup->SMS[num]->Location = num + 1; |
2978 | ReadSMSBackupEntry(file_info, h->SectionName, backup->SMS[num]); | 2978 | ReadSMSBackupEntry(file_info, h->SectionName, backup->SMS[num]); |
2979 | num++; | 2979 | num++; |
2980 | } | 2980 | } |
2981 | } | 2981 | } |
2982 | return ERR_NONE; | 2982 | return ERR_NONE; |
2983 | } | 2983 | } |
2984 | 2984 | ||
2985 | GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) | 2985 | GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) |
2986 | { | 2986 | { |
2987 | FILE *file; | 2987 | FILE *file; |
2988 | 2988 | ||
2989 | backup->SMS[0] = NULL; | 2989 | backup->SMS[0] = NULL; |
2990 | 2990 | ||
2991 | file = fopen(FileName, "rb"); | 2991 | file = fopen(FileName, "rb"); |
2992 | if (file == NULL) return(ERR_CANTOPENFILE); | 2992 | if (file == NULL) return(ERR_CANTOPENFILE); |
2993 | 2993 | ||
2994 | fclose(file); | 2994 | fclose(file); |
2995 | 2995 | ||
2996 | return GSM_ReadSMSBackupTextFile(FileName, backup); | 2996 | return GSM_ReadSMSBackupTextFile(FileName, backup); |
2997 | } | 2997 | } |
2998 | 2998 | ||
2999 | GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) | 2999 | static GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) |
3000 | { | 3000 | { |
3001 | int i,w,current; | 3001 | int i,w,current; |
3002 | unsigned char buffer[10000]; | 3002 | unsigned char buffer[10000]; |
3003 | GSM_DateTimeDT; | 3003 | GSM_DateTimeDT; |
3004 | 3004 | ||
3005 | fprintf(file,"\n# File created by Gammu (www.mwiacek.com) version %s\n",VERSION); | 3005 | fprintf(file,"\n# File created by Gammu (www.mwiacek.com) version %s\n",VERSION); |
3006 | GSM_GetCurrentDateTime (&DT); | 3006 | GSM_GetCurrentDateTime (&DT); |
3007 | fprintf(file,"# Saved %s\n\n",OSDateTime(DT,false)); | 3007 | fprintf(file,"# Saved "); |
3008 | fprintf(file, "%04d%02d%02dT%02d%02d%02d", | ||
3009 | DT.Year, DT.Month, DT.Day, | ||
3010 | DT.Hour, DT.Minute, DT.Second); | ||
3011 | fprintf(file," (%s)\n\n",OSDateTime(DT,false)); | ||
3008 | 3012 | ||
3009 | i=0; | 3013 | i=0; |
3010 | while (backup->SMS[i]!=NULL) { | 3014 | while (backup->SMS[i]!=NULL) { |
3011 | fprintf(file,"[SMSBackup%03i]\n",i); | 3015 | fprintf(file,"[SMSBackup%03i]\n",i); |
3012 | switch (backup->SMS[i]->Coding) { | 3016 | switch (backup->SMS[i]->Coding) { |
3013 | case SMS_Coding_Unicode: | 3017 | case SMS_Coding_Unicode: |
3014 | case SMS_Coding_Default: | 3018 | case SMS_Coding_Default: |
3015 | sprintf(buffer,"%s",DecodeUnicodeString(backup->SMS[i]->Text)); | 3019 | sprintf(buffer,"%s",DecodeUnicodeString(backup->SMS[i]->Text)); |
3016 | fprintf(file,"#"); | 3020 | fprintf(file,"#"); |
3017 | current = 0; | 3021 | current = 0; |
3018 | for (w=0;w<(int)(strlen(buffer));w++) { | 3022 | for (w=0;w<(int)(strlen(buffer));w++) { |
3019 | switch (buffer[w]) { | 3023 | switch (buffer[w]) { |
3020 | case 10: | 3024 | case 10: |
3021 | fprintf(file,"\n#"); | 3025 | fprintf(file,"\n#"); |
3022 | current = 0; | 3026 | current = 0; |
3023 | break; | 3027 | break; |
3024 | case 13: | 3028 | case 13: |
3025 | break; | 3029 | break; |
3026 | default: | 3030 | default: |
3027 | if (isprint(buffer[w])) { | 3031 | if (isprint(buffer[w])) { |
3028 | fprintf(file,"%c",buffer[w]); | 3032 | fprintf(file,"%c",buffer[w]); |
3029 | current ++; | 3033 | current ++; |
3030 | } | 3034 | } |
3031 | if (current == 75) { | 3035 | if (current == 75) { |
@@ -3067,43 +3071,43 @@ GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) | |||
3067 | EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length); | 3071 | EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length); |
3068 | break; | 3072 | break; |
3069 | } | 3073 | } |
3070 | SaveLinkedBackupText(file, "Text", buffer, false); | 3074 | SaveLinkedBackupText(file, "Text", buffer, false); |
3071 | switch (backup->SMS[i]->Coding) { | 3075 | switch (backup->SMS[i]->Coding) { |
3072 | case SMS_Coding_Unicode : fprintf(file,"Coding = Unicode\n"); break; | 3076 | case SMS_Coding_Unicode : fprintf(file,"Coding = Unicode\n"); break; |
3073 | case SMS_Coding_Default : fprintf(file,"Coding = Default\n"); break; | 3077 | case SMS_Coding_Default : fprintf(file,"Coding = Default\n"); break; |
3074 | case SMS_Coding_8bit : fprintf(file,"Coding = 8bit\n"); break; | 3078 | case SMS_Coding_8bit : fprintf(file,"Coding = 8bit\n"); break; |
3075 | } | 3079 | } |
3076 | fprintf(file,"Folder = %i\n",backup->SMS[i]->Folder); | 3080 | fprintf(file,"Folder = %i\n",backup->SMS[i]->Folder); |
3077 | fprintf(file,"Length = %i\n",backup->SMS[i]->Length); | 3081 | fprintf(file,"Length = %i\n",backup->SMS[i]->Length); |
3078 | fprintf(file,"Class = %i\n",backup->SMS[i]->Class); | 3082 | fprintf(file,"Class = %i\n",backup->SMS[i]->Class); |
3079 | fprintf(file,"ReplySMSC = "); | 3083 | fprintf(file,"ReplySMSC = "); |
3080 | if (backup->SMS[i]->ReplyViaSameSMSC) fprintf(file,"True\n"); else fprintf(file,"False\n"); | 3084 | if (backup->SMS[i]->ReplyViaSameSMSC) fprintf(file,"True\n"); else fprintf(file,"False\n"); |
3081 | fprintf(file,"RejectDuplicates = "); | 3085 | fprintf(file,"RejectDuplicates = "); |
3082 | if (backup->SMS[i]->RejectDuplicates) fprintf(file,"True\n"); else fprintf(file,"False\n"); | 3086 | if (backup->SMS[i]->RejectDuplicates) fprintf(file,"True\n"); else fprintf(file,"False\n"); |
3083 | fprintf(file,"ReplaceMessage = %i\n",backup->SMS[i]->ReplaceMessage); | 3087 | fprintf(file,"ReplaceMessage = %i\n",backup->SMS[i]->ReplaceMessage); |
3084 | fprintf(file,"MessageReference = %i\n",backup->SMS[i]->MessageReference); | 3088 | fprintf(file,"MessageReference = %i\n",backup->SMS[i]->MessageReference); |
3085 | fprintf(file,"\n"); | 3089 | fprintf(file,"\n"); |
3086 | i++; | 3090 | i++; |
3087 | } | 3091 | } |
3088 | return ERR_NONE; | 3092 | return ERR_NONE; |
3089 | } | 3093 | } |
3090 | 3094 | ||
3091 | GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) | 3095 | GSM_Error GSM_AddSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) |
3092 | { | 3096 | { |
3093 | FILE *file; | 3097 | FILE *file; |
3094 | 3098 | ||
3095 | file = fopen(FileName, "wb"); | 3099 | file = fopen(FileName, "ab"); |
3096 | if (file == NULL) return(ERR_CANTOPENFILE); | 3100 | if (file == NULL) return(ERR_CANTOPENFILE); |
3097 | 3101 | ||
3098 | SaveSMSBackupTextFile(file,backup); | 3102 | SaveSMSBackupTextFile(file,backup); |
3099 | 3103 | ||
3100 | fclose(file); | 3104 | fclose(file); |
3101 | 3105 | ||
3102 | return ERR_NONE; | 3106 | return ERR_NONE; |
3103 | } | 3107 | } |
3104 | 3108 | ||
3105 | #endif | 3109 | #endif |
3106 | 3110 | ||
3107 | /* How should editor hadle tabs in this file? Add editor commands here. | 3111 | /* How should editor hadle tabs in this file? Add editor commands here. |
3108 | * vim: noexpandtab sw=8 ts=8 sts=8: | 3112 | * vim: noexpandtab sw=8 ts=8 sts=8: |
3109 | */ | 3113 | */ |