comparison mcabber/src/histolog.c @ 118:1e8f646e2c5b

[/trunk] Changeset 131 by mikael * Clean up * Fix /status offline * Change (slightly) history log line format
author mikael
date Mon, 25 Apr 2005 19:02:07 +0000
parents 8ac67e951eab
children 8a54d46e889a
comparison
equal deleted inserted replaced
117:e0168cdd9f59 118:1e8f646e2c5b
75 75
76 // Count number of extra lines 76 // Count number of extra lines
77 for (p=data ; *p ; p++) 77 for (p=data ; *p ; p++)
78 if (*p == '\n') len++; 78 if (*p == '\n') len++;
79 79
80 /* Line format: "T I DDDDDDDDDD LLL [data]" 80 /* Line format: "TI DDDDDDDDDD LLL [data]"
81 * T=Type, I=Info, D=date, LLL=0-padded-len 81 * T=Type, I=Info, DDDDDDDDDD=date, LLL=0-padded-len
82 * 82 *
83 * Types: 83 * Types:
84 * - M message Info: S (send) R (receive) 84 * - M message Info: S (send) R (receive)
85 * - S status Info: [oaifdcn] 85 * - S status Info: [oaifdcn]
86 * We don't check them, we'll trust the caller. 86 * We don't check them, we'll trust the caller.
87 */ 87 */
88 88
89 fp = fopen(filename, "a"); 89 fp = fopen(filename, "a");
90 if (!fp) 90 if (!fp)
91 return; 91 return;
92 fprintf(fp, "%c %c %10u %03d %s\n", type, info, (unsigned int)ts, len, data); 92 fprintf(fp, "%c%c %10u %03d %s\n", type, info, (unsigned int)ts, len, data);
93 fclose(fp); 93 fclose(fp);
94 } 94 }
95 95
96 // hlog_enable() 96 // hlog_enable()
97 // Enable logging to files. If root_dir is NULL, then $HOME/.mcabber is used. 97 // Enable logging to files. If root_dir is NULL, then $HOME/.mcabber is used.