- Timestamp:
- Oct 25, 2003, 11:53:43 PM (21 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:
- eec69e1
- Parents:
- 8c92848
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
logging.c
r15283bb r37eab7f 55 55 } 56 56 57 void owl_log_outgoing_aim(char *to, char *text) { 57 void owl_log_outgoing_aim(char *to, char *text) 58 { 58 59 FILE *file; 59 60 char filename[MAXPATHLEN], *logpath; … … 61 62 62 63 tobuff=owl_sprintf("aim:%s", to); 64 65 /* expand ~ in path names */ 66 logpath = owl_util_substitute(owl_global_get_logpath(&g), "~", 67 owl_global_get_homedir(&g)); 68 69 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff); 70 file=fopen(filename, "a"); 71 if (!file) { 72 owl_function_error("Unable to open file for outgoing logging"); 73 owl_free(logpath); 74 return; 75 } 76 fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); 77 if (text[strlen(text)-1]!='\n') { 78 fprintf(file, "\n"); 79 } 80 fclose(file); 81 82 snprintf(filename, MAXPATHLEN, "%s/all", logpath); 83 owl_free(logpath); 84 file=fopen(filename, "a"); 85 if (!file) { 86 owl_function_error("Unable to open file for outgoing logging"); 87 return; 88 } 89 fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); 90 if (text[strlen(text)-1]!='\n') { 91 fprintf(file, "\n"); 92 } 93 fclose(file); 94 95 owl_free(tobuff); 96 } 97 98 void owl_log_outgoing_loopback(char *text) 99 { 100 FILE *file; 101 char filename[MAXPATHLEN], *logpath; 102 char *tobuff; 103 104 tobuff=owl_sprintf("loopback:%s", "loppback"); 63 105 64 106 /* expand ~ in path names */ … … 142 184 /* we do not yet handle chat rooms */ 143 185 from=frombuff=owl_sprintf("aim:%s", owl_message_get_sender(m)); 186 } else if (owl_message_is_type_loopback(m)) { 187 from=frombuff=owl_strdup("loopback"); 144 188 } else { 145 189 from=frombuff=owl_strdup("unknown"); … … 220 264 if (owl_message_is_login(m)) fprintf(file, "LOGIN\n\n"); 221 265 if (owl_message_is_logout(m)) fprintf(file, "LOGOUT\n\n"); 222 } 266 } else { 267 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); 268 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); 269 fprintf(file, "%s\n\n", owl_message_get_body(m)); 270 } 271 223 272 fclose(file); 224 273 … … 245 294 if (owl_message_is_login(m)) fprintf(allfile, "LOGIN\n\n"); 246 295 if (owl_message_is_logout(m)) fprintf(allfile, "LOGOUT\n\n"); 296 } else { 297 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); 298 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); 299 fprintf(file, "%s\n\n", owl_message_get_body(m)); 247 300 } 248 301 fclose(allfile);
Note: See TracChangeset
for help on using the changeset viewer.