Diffstat (limited to 'gammu/emb/common/service/backup/backtext.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/service/backup/backtext.c | 12 |
1 files changed, 8 insertions, 4 deletions
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 | |||
@@ -2991,25 +2991,29 @@ GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) | |||
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)); |
@@ -3083,21 +3087,21 @@ GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) | |||
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 | } |