wrong character in the GSM 03.38 table (ç for Ç)
[gammu.git] / smsd / services / files.c
blob19766fe1c07382a50c24d438fbc348c2ea2fa986
1 /* (c) 2002-2004 by Joergen Thomsen */
3 #include <gammu.h>
5 #include <string.h>
6 #include <stdio.h>
7 #include <errno.h>
8 #include <time.h>
9 #include <stdlib.h>
10 #include <assert.h>
12 #ifdef WIN32
13 #include <io.h>
14 #endif
15 #if defined HAVE_DIRENT_H && defined HAVE_SCANDIR && defined HAVE_ALPHASORT
16 #define HAVE_DIRBROWSING
17 #include <dirent.h>
18 #endif
20 #include "../core.h"
22 #include "../../helper/string.h"
24 /**
25 * Helper define to check error code from fwrite.
27 #define chk_fwrite(data, size, count, file) \
28 if (fwrite(data, size, count, file) != count) goto fail;
30 /* Save SMS from phone (called Inbox sms - it's in phone Inbox) somewhere */
31 static GSM_Error SMSDFiles_SaveInboxSMS(GSM_MultiSMSMessage * sms, GSM_SMSDConfig * Config, char **Locations)
33 GSM_Error error = ERR_NONE;
34 int i, j;
35 unsigned char FileName[100], FullName[400], ext[4], buffer[64], buffer2[400];
36 gboolean done;
37 FILE *file;
38 size_t locations_size = 0, locations_pos = 0;
39 #ifdef GSM_ENABLE_BACKUP
40 GSM_SMS_Backup backup;
41 #endif
42 *Locations = NULL;
44 j = 0;
45 done = FALSE;
46 for (i = 0; i < sms->Number && !done; i++) {
47 strcpy(ext, "txt");
48 if (sms->SMS[i].Coding == SMS_Coding_8bit)
49 strcpy(ext, "bin");
50 DecodeUnicode(sms->SMS[i].Number, buffer2);
51 /* we loop on yy for the first SMS assuming that if xxxx_yy_00.ext is absent,
52 any xxxx_yy_01,02, must be garbage, that can be overwritten */
53 file = NULL;
54 do {
55 sprintf(FileName,
56 "IN%02d%02d%02d_%02d%02d%02d_%02i_%s_%02i.%s",
57 sms->SMS[i].DateTime.Year, sms->SMS[i].DateTime.Month, sms->SMS[i].DateTime.Day,
58 sms->SMS[i].DateTime.Hour, sms->SMS[i].DateTime.Minute, sms->SMS[i].DateTime.Second, j, buffer2, i, ext);
59 strcpy(FullName, Config->inboxpath);
60 strcat(FullName, FileName);
61 if (file)
62 fclose(file);
63 file = fopen(FullName, "r");
64 } while ((i == 0) && file != NULL && (++j < 100));
66 if (file) {
67 fclose(file);
68 if (i == 0) {
69 SMSD_Log(DEBUG_ERROR, Config, "Cannot save %s. No available file names", FileName);
70 return ERR_CANTOPENFILE;
73 errno = 0;
75 if ((sms->SMS[i].PDU == SMS_Status_Report) && strcasecmp(Config->deliveryreport, "log") == 0) {
76 strcpy(buffer, DecodeUnicodeString(sms->SMS[i].Number));
77 SMSD_Log(DEBUG_NOTICE, Config, "Delivery report: %s to %s, message reference 0x%02x",
78 DecodeUnicodeString(sms->SMS[i].Text), buffer, sms->SMS[i].MessageReference);
79 } else {
80 if (locations_pos + strlen(FileName) + 2 >= locations_size) {
81 locations_size += strlen(FileName) + 30;
82 *Locations = (char *)realloc(*Locations, locations_size);
83 assert(*Locations != NULL);
84 if (locations_pos == 0) {
85 *Locations[0] = 0;
88 strcat(*Locations, FileName);
89 strcat(*Locations, " ");
90 locations_pos += strlen(FileName) + 1;
92 if (strcasecmp(Config->inboxformat, "detail") == 0) {
93 #ifndef GSM_ENABLE_BACKUP
94 SMSD_Log(DEBUG_ERROR, Config, "Saving in detail format not compiled in!");
96 #else
97 for (j = 0; j < sms->Number; j++) {
98 backup.SMS[j] = &sms->SMS[j];
100 backup.SMS[sms->Number] = NULL;
101 error = GSM_AddSMSBackupFile(FullName, &backup);
102 done = TRUE;
103 #endif
104 } else {
105 file = fopen(FullName, "wb");
106 if (file == NULL) {
107 SMSD_LogErrno(Config, "Cannot save file!");
108 return ERR_CANTOPENFILE;
111 switch (sms->SMS[i].Coding) {
112 case SMS_Coding_Unicode_No_Compression:
113 case SMS_Coding_Default_No_Compression:
114 DecodeUnicode(sms->SMS[i].Text, buffer2);
115 if (strcasecmp(Config->inboxformat, "unicode") == 0) {
116 buffer[0] = 0xFE;
117 buffer[1] = 0xFF;
118 chk_fwrite(buffer, 1, 2, file);
119 chk_fwrite(sms->SMS[i].Text, 1, strlen(buffer2) * 2, file);
120 } else {
121 chk_fwrite(buffer2, 1, strlen(buffer2), file);
123 break;
124 case SMS_Coding_8bit:
125 chk_fwrite(sms->SMS[i].Text, 1, (size_t) sms->SMS[i].Length, file);
126 default:
127 break;
129 fclose(file);
132 if (error != ERR_NONE) {
133 return error;
136 SMSD_Log(DEBUG_INFO, Config, "%s %s", (sms->SMS[i].PDU == SMS_Status_Report ? "Delivery report" : "Received"), FileName);
139 return ERR_NONE;
140 fail:
141 return ERR_WRITING_FILE;
144 /* Find one multi SMS to sending and return it (or return ERR_EMPTY)
145 * There is also set ID for SMS
146 * File extension convention:
147 * OUTxxxxx.txt : normal text SMS
148 * Options appended to the extension applying to this SMS only:
149 * d: delivery report requested
150 * f: flash SMS
151 * b: WAP bookmark as name,URL
152 * e.g. OUTG20040620_193810_123_+4512345678_xpq.txtdf
153 * is a flash text SMS requesting delivery reports
155 static GSM_Error SMSDFiles_FindOutboxSMS(GSM_MultiSMSMessage * sms, GSM_SMSDConfig * Config, char *ID)
157 GSM_MultiPartSMSInfo SMSInfo;
158 GSM_WAPBookmark Bookmark;
159 char FileName[100], FullName[400];
160 unsigned char Buffer[(GSM_MAX_SMS_LENGTH * GSM_MAX_MULTI_SMS + 1) * 2];
161 unsigned char Buffer2[(GSM_MAX_SMS_LENGTH * GSM_MAX_MULTI_SMS + 1) * 2];
162 FILE *File;
163 int i, len, phlen;
164 char *pos1, *pos2, *options = NULL;
165 gboolean backup = FALSE;
166 #ifdef GSM_ENABLE_BACKUP
167 GSM_SMS_Backup smsbackup;
168 GSM_Error error;
169 #endif
170 #ifdef WIN32
171 struct _finddata_t c_file;
172 intptr_t hFile;
174 strcpy(FullName, Config->outboxpath);
175 strcat(FullName, "OUT*.txt*");
176 hFile = _findfirst(FullName, &c_file);
177 if (hFile == -1) {
178 strcpy(FullName, Config->outboxpath);
179 strcat(FullName, "OUT*.smsbackup*");
180 hFile = _findfirst(FullName, &c_file);
181 backup = TRUE;
183 if (hFile == -1) {
184 return ERR_EMPTY;
185 } else {
186 strcpy(FileName, c_file.name);
188 _findclose(hFile);
189 #elif defined(HAVE_DIRBROWSING)
190 struct dirent **namelist = NULL;
191 int cur_file, num_files;
192 char *pos;
194 strcpy(FullName, Config->outboxpath);
196 FullName[strlen(Config->outboxpath) - 1] = '\0';
198 num_files = scandir(FullName, &namelist, 0, alphasort);
200 for (cur_file = 0; cur_file < num_files; cur_file++) {
201 /* Hidden file or current/parent directory */
202 if (namelist[cur_file]->d_name[0] == '.') {
203 continue;
205 /* We care only about files starting with out */
206 if (strncasecmp(namelist[cur_file]->d_name, "out", 3) != 0) {
207 continue;
209 /* Check extension */
210 pos = strrchr(namelist[cur_file]->d_name, '.');
211 if (pos == NULL) {
212 continue;
214 if (strncasecmp(pos, ".txt", 4) == 0) {
215 /* We have found text file */
216 backup = FALSE;
217 break;
219 if (strncasecmp(pos, ".smsbackup", 10) == 0) {
220 /* We have found a SMS backup file */
221 backup = TRUE;
222 break;
225 /* Remember file name */
226 if (cur_file < num_files) {
227 strcpy(FileName, namelist[cur_file]->d_name);
229 /* Free scandir result */
230 for (i = 0; i < num_files; i++) {
231 free(namelist[i]);
233 free(namelist);
234 namelist = NULL;
235 /* Did we actually find something? */
236 if (cur_file >= num_files) {
237 return ERR_EMPTY;
239 #else
240 return ERR_NOTSUPPORTED;
241 #endif
242 strcpy(FullName, Config->outboxpath);
243 strcat(FullName, FileName);
245 if (backup) {
246 #ifdef GSM_ENABLE_BACKUP
247 /* Remember ID */
248 strcpy(ID, FileName);
249 /* Load backup */
250 GSM_ClearSMSBackup(&smsbackup);
251 error = GSM_ReadSMSBackupFile(FullName, &smsbackup);
252 if (error != ERR_NONE) {
253 return error;
255 /* Copy it to our message */
256 sms->Number = 0;
257 for (i = 0; smsbackup.SMS[i] != NULL; i++) {
258 sms->SMS[sms->Number++] = *smsbackup.SMS[i];
260 /* Free memory */
261 GSM_FreeSMSBackup(&smsbackup);
263 /* Set delivery report flag */
264 if (sms->SMS[0].PDU == SMS_Status_Report) {
265 Config->currdeliveryreport = 1;
266 } else {
267 Config->currdeliveryreport = -1;
270 #else
271 SMSD_Log(DEBUG_ERROR, Config, "SMS backup loading disabled at compile time!");
272 return ERR_DISABLED;
274 #endif
275 } else {
276 options = strrchr(FileName, '.') + 4;
278 File = fopen(FullName, "rb");
279 if (File == NULL) {
280 return ERR_CANTOPENFILE;
282 len = fread(Buffer, 1, sizeof(Buffer) - 2, File);
283 fclose(File);
285 if ((len < 2) || (len >= 2 && ((Buffer[0] != 0xFF || Buffer[1] != 0xFE) && (Buffer[0] != 0xFE || Buffer[1] != 0xFF)))) {
286 if (len > GSM_MAX_SMS_LENGTH * GSM_MAX_MULTI_SMS)
287 len = GSM_MAX_SMS_LENGTH * GSM_MAX_MULTI_SMS;
288 EncodeUnicode(Buffer2, Buffer, len);
289 len = len * 2;
290 memmove(Buffer, Buffer2, len);
291 Buffer[len] = 0;
292 Buffer[len + 1] = 0;
293 } else {
294 Buffer[len] = 0;
295 Buffer[len + 1] = 0;
296 /* Possibly convert byte order */
297 ReadUnicodeFile(Buffer2, Buffer);
300 GSM_ClearMultiPartSMSInfo(&SMSInfo);
301 sms->Number = 0;
303 SMSInfo.ReplaceMessage = 0;
304 SMSInfo.Entries[0].Buffer = Buffer2;
305 SMSInfo.Class = -1;
306 SMSInfo.EntriesNum = 1;
307 Config->currdeliveryreport = -1;
308 if (strchr(options, 'd'))
309 Config->currdeliveryreport = 1;
310 if (strchr(options, 'f'))
311 SMSInfo.Class = 0; /* flash SMS */
313 if (strcasecmp(Config->transmitformat, "unicode") == 0) {
314 SMSInfo.Entries[0].ID = SMS_ConcatenatedTextLong;
315 SMSInfo.UnicodeCoding = TRUE;
316 } else if (strcasecmp(Config->transmitformat, "7bit") == 0) {
317 SMSInfo.Entries[0].ID = SMS_ConcatenatedTextLong;
318 SMSInfo.UnicodeCoding = FALSE;
319 } else {
320 /* auto */
321 SMSInfo.Entries[0].ID = SMS_ConcatenatedAutoTextLong;
324 if (strchr(options, 'b')) { // WAP bookmark as title,URL
325 SMSInfo.Entries[0].Buffer = NULL;
326 SMSInfo.Entries[0].Bookmark = &Bookmark;
327 SMSInfo.Entries[0].ID = SMS_NokiaWAPBookmarkLong;
328 SMSInfo.Entries[0].Bookmark->Location = 0;
329 pos2 = mywstrstr(Buffer2, "\0,");
330 if (pos2 == NULL) {
331 pos2 = Buffer2;
332 } else {
333 *pos2 = '\0';
334 pos2++;
335 *pos2 = '\0';
336 pos2++; // replace comma by zero
339 len = UnicodeLength(Buffer2);
340 if (len > 50) {
341 len = 50;
343 memmove(&SMSInfo.Entries[0].Bookmark->Title, Buffer2, len * 2);
344 pos1 = &SMSInfo.Entries[0].Bookmark->Title[0] + len * 2;
345 *pos1 = '\0';
346 pos1++;
347 *pos1 = '\0';
349 len = UnicodeLength(pos2);
350 if (len > 255) {
351 len = 255;
353 memmove(&SMSInfo.Entries[0].Bookmark->Address, pos2, len * 2);
354 pos1 = &SMSInfo.Entries[0].Bookmark->Address[0] + len * 2;
355 *pos1 = '\0';
356 pos1++;
357 *pos1 = '\0';
360 GSM_EncodeMultiPartSMS(GSM_GetDebug(Config->gsm), &SMSInfo, sms);
362 strcpy(ID, FileName);
363 pos1 = FileName;
364 for (i = 1; i <= 3 && pos1 != NULL; i++) {
365 pos1 = strchr(++pos1, '_');
367 if (pos1 != NULL) {
368 /* OUT<priority><date>_<time>_<serialno>_<phone number>_<anything>.txt */
369 pos2 = strchr(++pos1, '_');
370 if (pos2 != NULL) {
371 phlen = strlen(pos1) - strlen(pos2);
372 } else {
373 /* something wrong */
374 return ERR_UNKNOWN;
376 } else if (i == 2) {
377 /* OUTxxxxxxx.txt or OUTxxxxxxx */
378 pos1 = &FileName[3];
379 pos2 = strchr(pos1, '.');
380 if (pos2 == NULL) {
381 phlen = strlen(pos1);
382 } else {
383 phlen = strlen(pos1) - strlen(pos2);
385 } else if (i == 4) {
386 /* OUT<priority>_<phone number>_<serialno>.txt */
387 pos1 = strchr(FileName, '_');
388 pos2 = strchr(++pos1, '_');
389 phlen = strlen(pos1) - strlen(pos2);
390 } else {
391 /* something wrong */
392 return ERR_UNKNOWN;
395 for (len = 0; len < sms->Number; len++) {
396 EncodeUnicode(sms->SMS[len].Number, pos1, phlen);
400 if (sms->Number != 0) {
401 DecodeUnicode(sms->SMS[0].Number, Buffer);
402 if (options != NULL && strchr(options, 'b')) { // WAP bookmark as title,URL
403 SMSD_Log(DEBUG_NOTICE, Config, "Found %i sms to \"%s\" with bookmark \"%s\" cod %i lgt %i udh: t %i l %i dlr: %i fls: %i",
404 sms->Number,
405 Buffer,
406 DecodeUnicodeString(SMSInfo.Entries[0].Bookmark->Address),
407 sms->SMS[0].Coding, sms->SMS[0].Length, sms->SMS[0].UDH.Type, sms->SMS[0].UDH.Length, Config->currdeliveryreport, SMSInfo.Class);
408 } else {
409 SMSD_Log(DEBUG_NOTICE, Config, "Found %i sms to \"%s\" with text \"%s\" cod %i lgt %i udh: t %i l %i dlr: %i fls: %i",
410 sms->Number,
411 Buffer,
412 DecodeUnicodeString(sms->SMS[0].Text),
413 sms->SMS[0].Coding, sms->SMS[0].Length, sms->SMS[0].UDH.Type, sms->SMS[0].UDH.Length, Config->currdeliveryreport, sms->SMS[0].Class);
415 } else {
416 SMSD_Log(DEBUG_NOTICE, Config, "error: SMS-count = 0");
419 return ERR_NONE;
422 /* After sending SMS is moved to Sent Items or Error Items. */
423 static GSM_Error SMSDFiles_MoveSMS(GSM_MultiSMSMessage * sms UNUSED, GSM_SMSDConfig * Config, char *ID, gboolean alwaysDelete, gboolean sent)
425 FILE *oFile, *iFile;
426 size_t ilen = 0, olen = 0;
427 char Buffer[(GSM_MAX_SMS_LENGTH * GSM_MAX_MULTI_SMS + 1) * 2], ifilename[400], ofilename[400];
428 const char *sourcepath, *destpath;
430 sourcepath = Config->outboxpath;
431 if (sent) {
432 destpath = Config->sentsmspath;
433 } else {
434 destpath = Config->errorsmspath;
437 strcpy(ifilename, sourcepath);
438 strcat(ifilename, ID);
439 strcpy(ofilename, destpath);
440 strcat(ofilename, ID);
442 if (strcmp(ifilename, ofilename) != 0) {
443 iFile = fopen(ifilename, "r");
444 if (iFile == NULL) {
445 return ERR_CANTOPENFILE;
447 ilen = fread(Buffer, 1, sizeof(Buffer), iFile);
448 fclose(iFile);
449 oFile = fopen(ofilename, "w");
450 if (oFile == NULL) {
451 return ERR_CANTOPENFILE;
453 olen = fwrite(Buffer, 1, ilen, oFile);
454 fclose(oFile);
456 if (ilen == olen) {
457 if ((strcmp(ifilename, "/") == 0) || (remove(ifilename) != 0)) {
458 SMSD_LogErrno(Config, "Can not delete file");
459 SMSD_Log(DEBUG_INFO, Config, "Could not delete %s", ifilename);
460 return ERR_UNKNOWN;
462 return ERR_NONE;
463 } else {
464 SMSD_Log(DEBUG_INFO, Config, "Error copying SMS %s -> %s", ifilename, ofilename);
465 if (alwaysDelete) {
466 if ((strcmp(ifilename, "/") == 0) || (remove(ifilename) != 0)) {
467 SMSD_LogErrno(Config, "Can not delete file");
468 SMSD_Log(DEBUG_INFO, Config, "Could not delete %s", ifilename);
471 return ERR_UNKNOWN;
475 /* Adds SMS to Outbox */
476 static GSM_Error SMSDFiles_CreateOutboxSMS(GSM_MultiSMSMessage * sms, GSM_SMSDConfig * Config, char *NewID)
478 int i, j;
479 unsigned char FileName[100], FullName[400], ext[17], buffer[64], buffer2[400];
480 FILE *file;
481 time_t rawtime;
482 struct tm *timeinfo;
484 #ifdef GSM_ENABLE_BACKUP
485 GSM_Error error;
486 GSM_SMS_Backup backup;
487 #endif
489 j = 0;
490 time(&rawtime);
491 timeinfo = localtime(&rawtime);
493 for (i = 0; i < sms->Number; i++) {
494 if (strcasecmp(Config->outboxformat, "detail") == 0) {
495 strcpy(ext, "smsbackup");
496 } else {
497 strcpy(ext, "txt");
499 DecodeUnicode(sms->SMS[i].Number, buffer2);
501 file = NULL;
502 do {
503 sprintf(FileName,
504 "OUTC%04d%02d%02d_%02d%02d%02d_00_%s_sms%d.%s",
505 1900 + timeinfo->tm_year, timeinfo->tm_mon, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, buffer2, j, ext);
506 strcpy(FullName, Config->outboxpath);
507 strcat(FullName, FileName);
508 if (file)
509 fclose(file);
510 file = fopen(FullName, "r");
511 } while (file != NULL && (++j < 100));
513 if (file) {
514 fclose(file);
515 if (i == 0) {
516 SMSD_Log(DEBUG_ERROR, Config, "Cannot save %s. No available file names", FileName);
517 return ERR_CANTOPENFILE;
521 if (strcasecmp(Config->outboxformat, "detail") == 0) {
522 #ifndef GSM_ENABLE_BACKUP
523 SMSD_Log(DEBUG_ERROR, Config, "Saving in detail format not compiled in!");
525 #else
526 for (j = 0; j < sms->Number; j++) {
527 backup.SMS[j] = &sms->SMS[j];
529 backup.SMS[sms->Number] = NULL;
530 error = GSM_AddSMSBackupFile(FullName, &backup);
532 if (error != ERR_NONE) {
533 return error;
535 #endif
536 /* Force leaving the loop */
537 i = sms->Number;
538 } else {
539 file = fopen(FullName, "wb");
540 if (file == NULL) {
541 SMSD_LogErrno(Config, "Cannot save file!");
542 return ERR_CANTOPENFILE;
544 switch (sms->SMS[i].Coding) {
545 case SMS_Coding_Unicode_No_Compression:
546 case SMS_Coding_Default_No_Compression:
547 if (strcasecmp(Config->outboxformat, "unicode") == 0) {
548 buffer[0] = 0xFE;
549 buffer[1] = 0xFF;
550 chk_fwrite(buffer, 1, 2, file);
551 chk_fwrite(sms->SMS[i].Text, 1, UnicodeLength(sms->SMS[i].Text) * 2, file);
552 } else {
553 DecodeUnicode(sms->SMS[i].Text, buffer2);
554 chk_fwrite(buffer2, 1, strlen(buffer2), file);
556 break;
557 case SMS_Coding_8bit:
558 chk_fwrite(sms->SMS[i].Text, 1, (size_t) sms->SMS[i].Length, file);
559 default:
560 break;
562 fclose(file);
565 SMSD_Log(DEBUG_INFO, Config, "Created outbox message %s", FileName);
568 if (NewID != NULL) {
569 strcpy(NewID, FullName);
572 return ERR_NONE;
573 fail:
574 return ERR_WRITING_FILE;
577 static GSM_Error SMSDFiles_AddSentSMSInfo(GSM_MultiSMSMessage * sms UNUSED, GSM_SMSDConfig * Config, char *ID UNUSED, int Part, GSM_SMSDSendingError err, int TPMR)
579 if (err == SMSD_SEND_OK) {
580 SMSD_Log(DEBUG_INFO, Config, "Transmitted %s (%s: %i) to %s, message reference 0x%02x",
581 Config->SMSID, (Part == sms->Number ? "total" : "part"), Part, DecodeUnicodeString(sms->SMS[0].Number), TPMR);
584 return ERR_NONE;
587 GSM_Error SMSDFiles_ReadConfiguration(GSM_SMSDConfig *Config)
589 static unsigned char emptyPath[1] = "\0";
591 Config->inboxpath=INI_GetValue(Config->smsdcfgfile, "smsd", "inboxpath", FALSE);
592 if (Config->inboxpath == NULL) Config->inboxpath = emptyPath;
594 Config->inboxformat=INI_GetValue(Config->smsdcfgfile, "smsd", "inboxformat", FALSE);
595 if (Config->inboxformat == NULL ||
596 (strcasecmp(Config->inboxformat, "detail") != 0 &&
597 strcasecmp(Config->inboxformat, "standard") != 0 &&
598 strcasecmp(Config->inboxformat, "unicode") != 0)) {
599 Config->inboxformat = "standard";
601 SMSD_Log(DEBUG_NOTICE, Config, "Inbox is \"%s\" with format \"%s\"", Config->inboxpath, Config->inboxformat);
604 Config->outboxpath=INI_GetValue(Config->smsdcfgfile, "smsd", "outboxpath", FALSE);
605 if (Config->outboxpath == NULL) Config->outboxpath = emptyPath;
607 Config->transmitformat=INI_GetValue(Config->smsdcfgfile, "smsd", "transmitformat", FALSE);
608 if (Config->transmitformat == NULL || (strcasecmp(Config->transmitformat, "auto") != 0 && strcasecmp(Config->transmitformat, "unicode") != 0)) {
609 Config->transmitformat = "7bit";
611 Config->outboxformat=INI_GetValue(Config->smsdcfgfile, "smsd", "outboxformat", FALSE);
612 if (Config->outboxformat == NULL ||
613 (strcasecmp(Config->outboxformat, "detail") != 0 &&
614 strcasecmp(Config->outboxformat, "standard") != 0 &&
615 strcasecmp(Config->outboxformat, "unicode") != 0)) {
616 #ifdef GSM_ENABLE_BACKUP
617 Config->outboxformat = "detail";
618 #else
619 Config->outboxformat = "standard";
620 #endif
622 SMSD_Log(DEBUG_NOTICE, Config, "Outbox is \"%s\" with format \"%s\" and transmission format \"%s\"",
623 Config->outboxpath,
624 Config->outboxformat,
625 Config->transmitformat);
627 Config->sentsmspath=INI_GetValue(Config->smsdcfgfile, "smsd", "sentsmspath", FALSE);
628 if (Config->sentsmspath == NULL) Config->sentsmspath = Config->outboxpath;
629 SMSD_Log(DEBUG_NOTICE, Config, "Sent SMS moved to \"%s\"",Config->sentsmspath);
631 Config->errorsmspath=INI_GetValue(Config->smsdcfgfile, "smsd", "errorsmspath", FALSE);
632 if (Config->errorsmspath == NULL) Config->errorsmspath = Config->sentsmspath;
633 SMSD_Log(DEBUG_NOTICE, Config, "SMS with errors moved to \"%s\"",Config->errorsmspath);
635 return ERR_NONE;
638 GSM_SMSDService SMSDFiles = {
639 NONEFUNCTION, /* Init */
640 NONEFUNCTION, /* Free */
641 NONEFUNCTION, /* InitAfterConnect */
642 SMSDFiles_SaveInboxSMS,
643 SMSDFiles_FindOutboxSMS,
644 SMSDFiles_MoveSMS,
645 SMSDFiles_CreateOutboxSMS,
646 SMSDFiles_AddSentSMSInfo,
647 NOTIMPLEMENTED, /* RefreshSendStatus */
648 NOTIMPLEMENTED, /* RefreshPhoneStatus */
649 SMSDFiles_ReadConfiguration
652 /* How should editor handle tabs in this file? Add editor commands here.
653 * vim: noexpandtab sw=8 ts=8 sts=8: