comparison mcabber/src/hbuf.c @ 852:a3b8956db7bc

hbuf: minor fixes and typos
author Mikael Berthe <mikael@lilotux.net>
date Tue, 09 May 2006 23:48:41 +0200
parents d0781ca2dd08
children 92aaf2af786b
comparison
equal deleted inserted replaced
851:da03534e46c7 852:a3b8956db7bc
250 { 250 {
251 unsigned int i; 251 unsigned int i;
252 hbuf_block *blk; 252 hbuf_block *blk;
253 guchar last_persist_prefixflags = 0; 253 guchar last_persist_prefixflags = 0;
254 GList *last_persist; // last persistent flags 254 GList *last_persist; // last persistent flags
255 hbb_line **array, **array_elt;
255 256
256 // To be able to correctly highlight multi-line messages, 257 // To be able to correctly highlight multi-line messages,
257 // we need to look at the last non-null prefix, which should be the first 258 // we need to look at the last non-null prefix, which should be the first
258 // line of the message. 259 // line of the message.
259 last_persist = hbuf_previous_persistent(hbuf); 260 last_persist = hbuf_previous_persistent(hbuf);
264 break; 265 break;
265 } 266 }
266 last_persist = g_list_previous(last_persist); 267 last_persist = g_list_previous(last_persist);
267 } 268 }
268 269
269 hbb_line **array = g_new0(hbb_line*, n); 270 array = g_new0(hbb_line*, n);
270 hbb_line **array_elt = array; 271 array_elt = array;
271 272
272 for (i=0 ; i < n ; i++) { 273 for (i = 0 ; i < n ; i++) {
273 if (hbuf) { 274 if (hbuf) {
274 int maxlen; 275 int maxlen;
275 blk = (hbuf_block*)(hbuf->data); 276 blk = (hbuf_block*)(hbuf->data);
276 maxlen = blk->ptr_end - blk->ptr; 277 maxlen = blk->ptr_end - blk->ptr;
277 *array_elt = (hbb_line*)g_new(hbb_line, 1); 278 *array_elt = (hbb_line*)g_new(hbb_line, 1);
280 (*array_elt)->text = g_strndup(blk->ptr, maxlen); 281 (*array_elt)->text = g_strndup(blk->ptr, maxlen);
281 282
282 if ((blk->flags & HBB_FLAG_PERSISTENT) && blk->prefix.flags) { 283 if ((blk->flags & HBB_FLAG_PERSISTENT) && blk->prefix.flags) {
283 last_persist_prefixflags = blk->prefix.flags; 284 last_persist_prefixflags = blk->prefix.flags;
284 } else { 285 } else {
285 // Propagate hilighting flag 286 // Propagate highlighting flag
286 (*array_elt)->flags |= last_persist_prefixflags & HBB_PREFIX_HLIGHT; 287 (*array_elt)->flags |= last_persist_prefixflags & HBB_PREFIX_HLIGHT;
287 } 288 }
288 289
289 hbuf = g_list_next(hbuf); 290 hbuf = g_list_next(hbuf);
290 } else 291 } else