- Timestamp:
- Jul 9, 2002, 12:04:35 AM (22 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 2c8a07c
- Parents:
- 10b866d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
logging.c
r1aee7d9 re1c4636 9 9 void owl_log_outgoing(char *to, char *text) { 10 10 FILE *file; 11 char filename[MAXPATHLEN] ;11 char filename[MAXPATHLEN], *logpath; 12 12 char *tobuff, *ptr; 13 13 … … 21 21 } 22 22 23 sprintf(filename, "%s/zlog/people/%s", owl_global_get_homedir(&g), tobuff); 23 /* expand ~ in path names */ 24 logpath = owl_util_substitute(owl_global_get_logpath(&g), "~", 25 owl_global_get_homedir(&g)); 26 27 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff); 24 28 file=fopen(filename, "a"); 25 29 if (!file) { 26 30 owl_function_makemsg("Unable to open file for outgoing logging"); 31 owl_free(logpath); 27 32 return; 28 33 } … … 33 38 fclose(file); 34 39 35 sprintf(filename, "%s/zlog/people/all", owl_global_get_homedir(&g)); 40 snprintf(filename, MAXPATHLEN, "%s/all", logpath); 41 owl_free(logpath); 36 42 file=fopen(filename, "a"); 37 43 if (!file) { … … 50 56 void owl_log_incoming(owl_message *m) { 51 57 FILE *file, *allfile; 52 char filename[MAXPATHLEN], allfilename[MAXPATHLEN] ;58 char filename[MAXPATHLEN], allfilename[MAXPATHLEN], *logpath; 53 59 char *frombuff, *ptr, *from, *buff, *tmp; 54 60 int len, ch, i, personal; … … 86 92 87 93 for (i=0; i<len; i++) { 88 if (frombuff[i]<'!' || frombuff[i]> '~') from="weird";94 if (frombuff[i]<'!' || frombuff[i]>='~') from="weird"; 89 95 } 90 96 … … 95 101 } 96 102 97 /* create the filename */103 /* create the filename (expanding ~ in path names) */ 98 104 if (personal) { 99 sprintf(filename, "%s/%s", owl_global_get_logpath(&g), from); 100 sprintf(allfilename, "%s/all", owl_global_get_logpath(&g)); 105 logpath = owl_util_substitute(owl_global_get_logpath(&g), "~", 106 owl_global_get_homedir(&g)); 107 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, from); 108 snprintf(allfilename, MAXPATHLEN, "%s/all", logpath); 109 101 110 } else { 102 sprintf(filename, "%s/%s", owl_global_get_classlogpath(&g), from); 111 logpath = owl_util_substitute(owl_global_get_classlogpath(&g), "~", 112 owl_global_get_homedir(&g)); 113 114 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, from); 103 115 } 116 owl_free(logpath); 104 117 105 118 file=fopen(filename, "a");
Note: See TracChangeset
for help on using the changeset viewer.