[7d4fbcd] | 1 | #include "owl.h" |
---|
| 2 | #include <stdlib.h> |
---|
| 3 | #include <string.h> |
---|
| 4 | #include <ctype.h> |
---|
| 5 | #include <sys/param.h> |
---|
| 6 | |
---|
[1aee7d9] | 7 | static const char fileIdent[] = "$Id$"; |
---|
| 8 | |
---|
[15b34fd] | 9 | /* This is now the one function that should be called to log a |
---|
| 10 | * message. It will do all the work necessary by calling the other |
---|
| 11 | * functions in this file as necessary. |
---|
| 12 | */ |
---|
| 13 | void owl_log_message(owl_message *m) { |
---|
| 14 | owl_function_debugmsg("owl_log_message: entering"); |
---|
| 15 | |
---|
| 16 | /* should we be logging this message? */ |
---|
| 17 | if (!owl_log_shouldlog_message(m)) { |
---|
| 18 | owl_function_debugmsg("owl_log_message: not logging message"); |
---|
| 19 | return; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | /* handle incmoing messages */ |
---|
| 23 | if (owl_message_is_direction_in(m)) { |
---|
| 24 | owl_log_incoming(m); |
---|
| 25 | owl_function_debugmsg("owl_log_message: leaving"); |
---|
| 26 | return; |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | /* handle outgoing messages */ |
---|
| 30 | if (owl_message_is_type_aim(m)) { |
---|
| 31 | owl_log_outgoing_aim(m); |
---|
| 32 | } else if (owl_message_is_type_zephyr(m)) { |
---|
| 33 | owl_log_outgoing_zephyr(m); |
---|
| 34 | } else if (owl_message_is_type_loopback(m)) { |
---|
| 35 | owl_log_outgoing_loopback(m); |
---|
| 36 | } else { |
---|
| 37 | owl_function_error("Unknown message type for logging"); |
---|
| 38 | } |
---|
| 39 | owl_function_debugmsg("owl_log_message: leaving"); |
---|
| 40 | } |
---|
[7d4fbcd] | 41 | |
---|
[15b34fd] | 42 | /* Return 1 if we should log the given message, otherwise return 0 */ |
---|
| 43 | int owl_log_shouldlog_message(owl_message *m) { |
---|
| 44 | owl_filter *f; |
---|
[12c35df] | 45 | |
---|
[15b34fd] | 46 | /* If there's a logfilter and this message matches it, log */ |
---|
| 47 | f=owl_global_get_filter(&g, owl_global_get_logfilter(&g)); |
---|
| 48 | if (f && owl_filter_message_match(f, m)) return(1); |
---|
[7d4fbcd] | 49 | |
---|
[15b34fd] | 50 | /* otherwise we do things based on the logging variables */ |
---|
| 51 | |
---|
| 52 | /* skip login/logout messages if appropriate */ |
---|
| 53 | if (!owl_global_is_loglogins(&g) && owl_message_is_loginout(m)) return(0); |
---|
| 54 | |
---|
| 55 | /* check for nolog */ |
---|
| 56 | if (!strcasecmp(owl_message_get_opcode(m), "nolog") || !strcasecmp(owl_message_get_instance(m), "nolog")) return(0); |
---|
| 57 | |
---|
| 58 | /* check direction */ |
---|
| 59 | if ((owl_global_get_loggingdirection(&g)==OWL_LOGGING_DIRECTION_IN) && owl_message_is_direction_out(m)) { |
---|
| 60 | return(0); |
---|
| 61 | } |
---|
| 62 | if ((owl_global_get_loggingdirection(&g)==OWL_LOGGING_DIRECTION_OUT) && owl_message_is_direction_in(m)) { |
---|
| 63 | return(0); |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | if (owl_message_is_type_zephyr(m)) { |
---|
| 67 | if (owl_message_is_personal(m) && !owl_global_is_logging(&g)) return(0); |
---|
| 68 | if (!owl_message_is_personal(m) && !owl_global_is_classlogging(&g)) return(0); |
---|
| 69 | } else { |
---|
| 70 | if (owl_message_is_private(m) || owl_message_is_loginout(m)) { |
---|
| 71 | if (!owl_global_is_logging(&g)) return(0); |
---|
| 72 | } else { |
---|
| 73 | if (!owl_global_is_classlogging(&g)) return(0); |
---|
| 74 | } |
---|
[7d4fbcd] | 75 | } |
---|
[15b34fd] | 76 | return(1); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | void owl_log_outgoing_zephyr(owl_message *m) |
---|
| 80 | { |
---|
| 81 | FILE *file; |
---|
| 82 | char filename[MAXPATHLEN], *logpath; |
---|
| 83 | char *to, *text; |
---|
| 84 | |
---|
| 85 | /* strip local realm */ |
---|
| 86 | to=short_zuser(owl_message_get_recipient(m)); |
---|
[7d4fbcd] | 87 | |
---|
[e1c4636] | 88 | /* expand ~ in path names */ |
---|
[15b34fd] | 89 | logpath=owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g)); |
---|
[e1c4636] | 90 | |
---|
[15b34fd] | 91 | text=owl_message_get_body(m); |
---|
| 92 | |
---|
| 93 | snprintf(filename, MAXPATHLEN, "%s/%s", logpath, to); |
---|
[7d4fbcd] | 94 | file=fopen(filename, "a"); |
---|
| 95 | if (!file) { |
---|
[836ea3a3] | 96 | owl_function_error("Unable to open file for outgoing logging"); |
---|
[e1c4636] | 97 | owl_free(logpath); |
---|
[15b34fd] | 98 | owl_free(to); |
---|
[7d4fbcd] | 99 | return; |
---|
| 100 | } |
---|
[15b34fd] | 101 | fprintf(file, "OUTGOING (owl): %s\n%s\n", to, text); |
---|
[7d4fbcd] | 102 | if (text[strlen(text)-1]!='\n') { |
---|
| 103 | fprintf(file, "\n"); |
---|
| 104 | } |
---|
| 105 | fclose(file); |
---|
| 106 | |
---|
[e1c4636] | 107 | snprintf(filename, MAXPATHLEN, "%s/all", logpath); |
---|
| 108 | owl_free(logpath); |
---|
[7d4fbcd] | 109 | file=fopen(filename, "a"); |
---|
| 110 | if (!file) { |
---|
[836ea3a3] | 111 | owl_function_error("Unable to open file for outgoing logging"); |
---|
[15b34fd] | 112 | owl_free(to); |
---|
[7d4fbcd] | 113 | return; |
---|
| 114 | } |
---|
[15b34fd] | 115 | fprintf(file, "OUTGOING (owl): %s\n%s\n", to, text); |
---|
[7d4fbcd] | 116 | if (text[strlen(text)-1]!='\n') { |
---|
| 117 | fprintf(file, "\n"); |
---|
| 118 | } |
---|
| 119 | fclose(file); |
---|
| 120 | |
---|
[15b34fd] | 121 | owl_free(to); |
---|
[7d4fbcd] | 122 | } |
---|
| 123 | |
---|
[2b86d14] | 124 | void owl_log_outgoing_zephyr_error(char *to, char *text) |
---|
| 125 | { |
---|
| 126 | FILE *file; |
---|
| 127 | char filename[MAXPATHLEN], *logpath; |
---|
[15b34fd] | 128 | char *tobuff; |
---|
[2b86d14] | 129 | |
---|
[15b34fd] | 130 | tobuff=short_zuser(to); |
---|
[2b86d14] | 131 | |
---|
| 132 | /* expand ~ in path names */ |
---|
[15b34fd] | 133 | logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g)); |
---|
[2b86d14] | 134 | |
---|
| 135 | snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff); |
---|
| 136 | file=fopen(filename, "a"); |
---|
| 137 | if (!file) { |
---|
| 138 | owl_function_error("Unable to open file for outgoing logging"); |
---|
| 139 | owl_free(logpath); |
---|
[15b34fd] | 140 | owl_free(tobuff); |
---|
[2b86d14] | 141 | return; |
---|
| 142 | } |
---|
| 143 | fprintf(file, "ERROR (owl): %s\n%s\n", tobuff, text); |
---|
| 144 | if (text[strlen(text)-1]!='\n') { |
---|
| 145 | fprintf(file, "\n"); |
---|
| 146 | } |
---|
| 147 | fclose(file); |
---|
| 148 | |
---|
| 149 | snprintf(filename, MAXPATHLEN, "%s/all", logpath); |
---|
| 150 | owl_free(logpath); |
---|
| 151 | file=fopen(filename, "a"); |
---|
| 152 | if (!file) { |
---|
| 153 | owl_function_error("Unable to open file for outgoing logging"); |
---|
[15b34fd] | 154 | owl_free(tobuff); |
---|
[2b86d14] | 155 | return; |
---|
| 156 | } |
---|
| 157 | fprintf(file, "ERROR (owl): %s\n%s\n", tobuff, text); |
---|
| 158 | if (text[strlen(text)-1]!='\n') { |
---|
| 159 | fprintf(file, "\n"); |
---|
| 160 | } |
---|
| 161 | fclose(file); |
---|
| 162 | |
---|
| 163 | owl_free(tobuff); |
---|
| 164 | } |
---|
| 165 | |
---|
[15b34fd] | 166 | void owl_log_outgoing_aim(owl_message *m) |
---|
[37eab7f] | 167 | { |
---|
[aac889a] | 168 | FILE *file; |
---|
| 169 | char filename[MAXPATHLEN], *logpath; |
---|
[15b34fd] | 170 | char *tobuff, *normalto, *text; |
---|
[aac889a] | 171 | |
---|
[15b34fd] | 172 | owl_function_debugmsg("owl_log_outgoing_aim: entering"); |
---|
[12c35df] | 173 | |
---|
[15b34fd] | 174 | /* normalize and downcase the screenname */ |
---|
| 175 | normalto=owl_aim_normalize_screenname(owl_message_get_recipient(m)); |
---|
[421c286f] | 176 | downstr(normalto); |
---|
| 177 | tobuff=owl_sprintf("aim:%s", normalto); |
---|
| 178 | owl_free(normalto); |
---|
[aac889a] | 179 | |
---|
| 180 | /* expand ~ in path names */ |
---|
[15b34fd] | 181 | logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g)); |
---|
[aac889a] | 182 | |
---|
[15b34fd] | 183 | text=owl_message_get_body(m); |
---|
| 184 | |
---|
[aac889a] | 185 | snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff); |
---|
| 186 | file=fopen(filename, "a"); |
---|
| 187 | if (!file) { |
---|
[836ea3a3] | 188 | owl_function_error("Unable to open file for outgoing logging"); |
---|
[aac889a] | 189 | owl_free(logpath); |
---|
[15b34fd] | 190 | owl_free(tobuff); |
---|
[aac889a] | 191 | return; |
---|
| 192 | } |
---|
| 193 | fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); |
---|
| 194 | if (text[strlen(text)-1]!='\n') { |
---|
| 195 | fprintf(file, "\n"); |
---|
| 196 | } |
---|
| 197 | fclose(file); |
---|
| 198 | |
---|
| 199 | snprintf(filename, MAXPATHLEN, "%s/all", logpath); |
---|
| 200 | owl_free(logpath); |
---|
| 201 | file=fopen(filename, "a"); |
---|
| 202 | if (!file) { |
---|
[836ea3a3] | 203 | owl_function_error("Unable to open file for outgoing logging"); |
---|
[15b34fd] | 204 | owl_free(tobuff); |
---|
[aac889a] | 205 | return; |
---|
| 206 | } |
---|
| 207 | fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); |
---|
| 208 | if (text[strlen(text)-1]!='\n') { |
---|
| 209 | fprintf(file, "\n"); |
---|
| 210 | } |
---|
| 211 | fclose(file); |
---|
| 212 | |
---|
| 213 | owl_free(tobuff); |
---|
| 214 | } |
---|
| 215 | |
---|
[15b34fd] | 216 | void owl_log_outgoing_loopback(owl_message *m) |
---|
[37eab7f] | 217 | { |
---|
| 218 | FILE *file; |
---|
| 219 | char filename[MAXPATHLEN], *logpath; |
---|
[15b34fd] | 220 | char *tobuff, *text; |
---|
[12c35df] | 221 | |
---|
| 222 | tobuff=owl_sprintf("loopback"); |
---|
[37eab7f] | 223 | |
---|
| 224 | /* expand ~ in path names */ |
---|
[15b34fd] | 225 | logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g)); |
---|
| 226 | |
---|
| 227 | text=owl_message_get_body(m); |
---|
[37eab7f] | 228 | |
---|
| 229 | snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff); |
---|
| 230 | file=fopen(filename, "a"); |
---|
| 231 | if (!file) { |
---|
| 232 | owl_function_error("Unable to open file for outgoing logging"); |
---|
| 233 | owl_free(logpath); |
---|
[15b34fd] | 234 | owl_free(tobuff); |
---|
[37eab7f] | 235 | return; |
---|
| 236 | } |
---|
| 237 | fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); |
---|
| 238 | if (text[strlen(text)-1]!='\n') { |
---|
| 239 | fprintf(file, "\n"); |
---|
| 240 | } |
---|
| 241 | fclose(file); |
---|
| 242 | |
---|
| 243 | snprintf(filename, MAXPATHLEN, "%s/all", logpath); |
---|
| 244 | owl_free(logpath); |
---|
| 245 | file=fopen(filename, "a"); |
---|
| 246 | if (!file) { |
---|
| 247 | owl_function_error("Unable to open file for outgoing logging"); |
---|
[15b34fd] | 248 | owl_free(tobuff); |
---|
[37eab7f] | 249 | return; |
---|
| 250 | } |
---|
| 251 | fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text); |
---|
| 252 | if (text[strlen(text)-1]!='\n') { |
---|
| 253 | fprintf(file, "\n"); |
---|
| 254 | } |
---|
| 255 | fclose(file); |
---|
| 256 | |
---|
| 257 | owl_free(tobuff); |
---|
| 258 | } |
---|
| 259 | |
---|
[15283bb] | 260 | void owl_log_incoming(owl_message *m) |
---|
| 261 | { |
---|
[7d4fbcd] | 262 | FILE *file, *allfile; |
---|
[e1c4636] | 263 | char filename[MAXPATHLEN], allfilename[MAXPATHLEN], *logpath; |
---|
[e6449bc] | 264 | char *frombuff=NULL, *from=NULL, *buff=NULL, *ptr; |
---|
[7d4fbcd] | 265 | int len, ch, i, personal; |
---|
[12c35df] | 266 | |
---|
[15b34fd] | 267 | /* figure out if it's a "personal" message or not */ |
---|
[aac889a] | 268 | if (owl_message_is_type_zephyr(m)) { |
---|
| 269 | if (owl_message_is_personal(m)) { |
---|
| 270 | personal=1; |
---|
| 271 | } else { |
---|
| 272 | personal=0; |
---|
| 273 | } |
---|
[7d4fbcd] | 274 | } else { |
---|
[79a0e82] | 275 | if (owl_message_is_private(m) || owl_message_is_loginout(m)) { |
---|
[aac889a] | 276 | personal=1; |
---|
| 277 | } else { |
---|
| 278 | personal=0; |
---|
| 279 | } |
---|
[7d4fbcd] | 280 | } |
---|
| 281 | |
---|
[aac889a] | 282 | if (owl_message_is_type_zephyr(m)) { |
---|
| 283 | if (personal) { |
---|
| 284 | if (owl_message_is_type_zephyr(m)) { |
---|
[15b34fd] | 285 | from=frombuff=short_zuser(owl_message_get_sender(m)); |
---|
[aac889a] | 286 | } |
---|
| 287 | } else { |
---|
| 288 | from=frombuff=owl_strdup(owl_message_get_class(m)); |
---|
[7d4fbcd] | 289 | } |
---|
[aac889a] | 290 | } else if (owl_message_is_type_aim(m)) { |
---|
| 291 | /* we do not yet handle chat rooms */ |
---|
[421c286f] | 292 | char *normalto; |
---|
| 293 | normalto=owl_aim_normalize_screenname(owl_message_get_sender(m)); |
---|
| 294 | downstr(normalto); |
---|
| 295 | from=frombuff=owl_sprintf("aim:%s", normalto); |
---|
| 296 | owl_free(normalto); |
---|
[37eab7f] | 297 | } else if (owl_message_is_type_loopback(m)) { |
---|
| 298 | from=frombuff=owl_strdup("loopback"); |
---|
[e6449bc] | 299 | } else { |
---|
| 300 | from=frombuff=owl_strdup("unknown"); |
---|
[7d4fbcd] | 301 | } |
---|
| 302 | |
---|
| 303 | /* check for malicious sender formats */ |
---|
| 304 | len=strlen(frombuff); |
---|
| 305 | if (len<1 || len>35) from="weird"; |
---|
| 306 | if (strchr(frombuff, '/')) from="weird"; |
---|
| 307 | |
---|
| 308 | ch=frombuff[0]; |
---|
| 309 | if (!isalnum(ch)) from="weird"; |
---|
| 310 | |
---|
| 311 | for (i=0; i<len; i++) { |
---|
[e1c4636] | 312 | if (frombuff[i]<'!' || frombuff[i]>='~') from="weird"; |
---|
[7d4fbcd] | 313 | } |
---|
| 314 | |
---|
| 315 | if (!strcmp(frombuff, ".") || !strcasecmp(frombuff, "..")) from="weird"; |
---|
| 316 | |
---|
| 317 | if (!personal) { |
---|
| 318 | if (strcmp(from, "weird")) downstr(from); |
---|
| 319 | } |
---|
| 320 | |
---|
[e1c4636] | 321 | /* create the filename (expanding ~ in path names) */ |
---|
[7d4fbcd] | 322 | if (personal) { |
---|
[15b34fd] | 323 | logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g)); |
---|
[e1c4636] | 324 | snprintf(filename, MAXPATHLEN, "%s/%s", logpath, from); |
---|
| 325 | snprintf(allfilename, MAXPATHLEN, "%s/all", logpath); |
---|
| 326 | |
---|
[7d4fbcd] | 327 | } else { |
---|
[15b34fd] | 328 | logpath = owl_text_substitute(owl_global_get_classlogpath(&g), "~", owl_global_get_homedir(&g)); |
---|
[e1c4636] | 329 | snprintf(filename, MAXPATHLEN, "%s/%s", logpath, from); |
---|
[7d4fbcd] | 330 | } |
---|
[e1c4636] | 331 | owl_free(logpath); |
---|
[7d4fbcd] | 332 | |
---|
| 333 | file=fopen(filename, "a"); |
---|
| 334 | if (!file) { |
---|
[836ea3a3] | 335 | owl_function_error("Unable to open file for incoming logging"); |
---|
[15b34fd] | 336 | owl_free(frombuff); |
---|
[7d4fbcd] | 337 | return; |
---|
| 338 | } |
---|
| 339 | |
---|
| 340 | allfile=NULL; |
---|
| 341 | if (personal) { |
---|
| 342 | allfile=fopen(allfilename, "a"); |
---|
| 343 | if (!allfile) { |
---|
[836ea3a3] | 344 | owl_function_error("Unable to open file for incoming logging"); |
---|
[15b34fd] | 345 | owl_free(frombuff); |
---|
[79a0e82] | 346 | fclose(file); |
---|
[7d4fbcd] | 347 | return; |
---|
| 348 | } |
---|
| 349 | } |
---|
| 350 | |
---|
[aac889a] | 351 | /* write to the main file */ |
---|
| 352 | if (owl_message_is_type_zephyr(m)) { |
---|
[e6449bc] | 353 | char *tmp; |
---|
| 354 | |
---|
[aac889a] | 355 | tmp=short_zuser(owl_message_get_sender(m)); |
---|
| 356 | fprintf(file, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m)); |
---|
| 357 | if (strcmp(owl_message_get_opcode(m), "")) fprintf(file, " Opcode: %s", owl_message_get_opcode(m)); |
---|
| 358 | fprintf(file, "\n"); |
---|
| 359 | fprintf(file, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m)); |
---|
| 360 | ptr=owl_zephyr_get_zsig(owl_message_get_notice(m), &i); |
---|
| 361 | buff=owl_malloc(i+10); |
---|
| 362 | memcpy(buff, ptr, i); |
---|
| 363 | buff[i]='\0'; |
---|
| 364 | fprintf(file, "From: %s <%s>\n\n", buff, tmp); |
---|
[269ed34] | 365 | fprintf(file, "%s\n\n", owl_message_get_body(m)); |
---|
[e6449bc] | 366 | owl_free(tmp); |
---|
[79a0e82] | 367 | } else if (owl_message_is_type_aim(m) && !owl_message_is_loginout(m)) { |
---|
[aac889a] | 368 | fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); |
---|
| 369 | fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); |
---|
| 370 | fprintf(file, "%s\n\n", owl_message_get_body(m)); |
---|
[79a0e82] | 371 | } else if (owl_message_is_type_aim(m) && owl_message_is_loginout(m)) { |
---|
| 372 | fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); |
---|
| 373 | fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); |
---|
| 374 | if (owl_message_is_login(m)) fprintf(file, "LOGIN\n\n"); |
---|
| 375 | if (owl_message_is_logout(m)) fprintf(file, "LOGOUT\n\n"); |
---|
[37eab7f] | 376 | } else { |
---|
| 377 | fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); |
---|
| 378 | fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); |
---|
| 379 | fprintf(file, "%s\n\n", owl_message_get_body(m)); |
---|
[aac889a] | 380 | } |
---|
[37eab7f] | 381 | |
---|
[7d4fbcd] | 382 | fclose(file); |
---|
| 383 | |
---|
[aac889a] | 384 | /* if it's a personal message, also write to the 'all' file */ |
---|
[7d4fbcd] | 385 | if (personal) { |
---|
[aac889a] | 386 | if (owl_message_is_type_zephyr(m)) { |
---|
[e6449bc] | 387 | char *tmp; |
---|
| 388 | |
---|
| 389 | tmp=short_zuser(owl_message_get_sender(m)); |
---|
[aac889a] | 390 | fprintf(allfile, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m)); |
---|
| 391 | if (strcmp(owl_message_get_opcode(m), "")) fprintf(allfile, " Opcode: %s", owl_message_get_opcode(m)); |
---|
| 392 | fprintf(allfile, "\n"); |
---|
| 393 | fprintf(allfile, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m)); |
---|
| 394 | fprintf(allfile, "From: %s <%s>\n\n", buff, tmp); |
---|
[269ed34] | 395 | fprintf(allfile, "%s\n\n", owl_message_get_body(m)); |
---|
[e6449bc] | 396 | owl_free(tmp); |
---|
[79a0e82] | 397 | } else if (owl_message_is_type_aim(m) && !owl_message_is_loginout(m)) { |
---|
| 398 | fprintf(allfile, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); |
---|
| 399 | fprintf(allfile, "Time: %s\n\n", owl_message_get_timestr(m)); |
---|
| 400 | fprintf(allfile, "%s\n\n", owl_message_get_body(m)); |
---|
| 401 | } else if (owl_message_is_type_aim(m) && owl_message_is_loginout(m)) { |
---|
| 402 | fprintf(allfile, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); |
---|
| 403 | fprintf(allfile, "Time: %s\n\n", owl_message_get_timestr(m)); |
---|
| 404 | if (owl_message_is_login(m)) fprintf(allfile, "LOGIN\n\n"); |
---|
| 405 | if (owl_message_is_logout(m)) fprintf(allfile, "LOGOUT\n\n"); |
---|
[37eab7f] | 406 | } else { |
---|
[eec69e1] | 407 | fprintf(allfile, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); |
---|
| 408 | fprintf(allfile, "Time: %s\n\n", owl_message_get_timestr(m)); |
---|
| 409 | fprintf(allfile, "%s\n\n", owl_message_get_body(m)); |
---|
[aac889a] | 410 | } |
---|
[723c427] | 411 | fclose(allfile); |
---|
[7d4fbcd] | 412 | } |
---|
| 413 | |
---|
[aac889a] | 414 | if (owl_message_is_type_zephyr(m)) { |
---|
| 415 | owl_free(buff); |
---|
| 416 | } |
---|
[7d4fbcd] | 417 | owl_free(frombuff); |
---|
| 418 | } |
---|