Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/histolog.c @ 1141:5be2408a6534
Add option "max_history_blocks"
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 06 Feb 2007 00:21:42 +0100 |
parents | 8e12137fab20 |
children | b8f5fe2d666a |
comparison
equal
deleted
inserted
replaced
1140:800bb1e9019c | 1141:5be2408a6534 |
---|---|
133 FILE *fp; | 133 FILE *fp; |
134 struct stat bufstat; | 134 struct stat bufstat; |
135 guint err = 0; | 135 guint err = 0; |
136 guint ln = 0; // line number | 136 guint ln = 0; // line number |
137 time_t starttime; | 137 time_t starttime; |
138 int max_num_of_blocks; | |
138 | 139 |
139 if (!FileLoadLogs) | 140 if (!FileLoadLogs) |
140 return; | 141 return; |
141 | 142 |
142 if ((roster_gettype(bjid) & ROSTER_TYPE_ROOM) && | 143 if ((roster_gettype(bjid) & ROSTER_TYPE_ROOM) && |
162 // (it can take a while...) | 163 // (it can take a while...) |
163 if (!fstat(fileno(fp), &bufstat)) { | 164 if (!fstat(fileno(fp), &bufstat)) { |
164 if (bufstat.st_size > 3145728) | 165 if (bufstat.st_size > 3145728) |
165 scr_LogPrint(LPRINT_LOGNORM, "Reading <%s> history file...", bjid); | 166 scr_LogPrint(LPRINT_LOGNORM, "Reading <%s> history file...", bjid); |
166 } | 167 } |
168 | |
169 max_num_of_blocks = get_max_history_blocks(); | |
167 | 170 |
168 starttime = 0L; | 171 starttime = 0L; |
169 if (settings_opt_get_int("max_history_age") > 0) { | 172 if (settings_opt_get_int("max_history_age") > 0) { |
170 int maxdays = settings_opt_get_int("max_history_age"); | 173 int maxdays = settings_opt_get_int("max_history_age"); |
171 time(&starttime); | 174 time(&starttime); |
250 else | 253 else |
251 prefix_flags = HBB_PREFIX_IN; | 254 prefix_flags = HBB_PREFIX_IN; |
252 converted = from_utf8(&data[dataoffset+1]); | 255 converted = from_utf8(&data[dataoffset+1]); |
253 if (converted) { | 256 if (converted) { |
254 xtext = ut_expand_tabs(converted); // Expand tabs | 257 xtext = ut_expand_tabs(converted); // Expand tabs |
255 hbuf_add_line(p_buddyhbuf, xtext, timestamp, prefix_flags, width); | 258 hbuf_add_line(p_buddyhbuf, xtext, timestamp, prefix_flags, width, |
259 max_num_of_blocks); | |
256 if (xtext != converted) | 260 if (xtext != converted) |
257 g_free(xtext); | 261 g_free(xtext); |
258 g_free(converted); | 262 g_free(converted); |
259 } | 263 } |
260 err = 0; | 264 err = 0; |