comparison mcabber/mcabber/hbuf.c @ 1965:ec737f5f1d6f

Couple of readmark-related bugfixes
author Mikael Berthe <mikael@lilotux.net>
date Fri, 18 Mar 2011 12:29:57 +0100
parents 39021fd6b0e1
children 88dafee4ee49
comparison
equal deleted inserted replaced
1964:306ddec07d63 1965:ec737f5f1d6f
345 (*array_elt)->timestamp = blk->prefix.timestamp; 345 (*array_elt)->timestamp = blk->prefix.timestamp;
346 (*array_elt)->flags = blk->prefix.flags; 346 (*array_elt)->flags = blk->prefix.flags;
347 (*array_elt)->mucnicklen = blk->prefix.mucnicklen; 347 (*array_elt)->mucnicklen = blk->prefix.mucnicklen;
348 (*array_elt)->text = g_strndup(blk->ptr, maxlen); 348 (*array_elt)->text = g_strndup(blk->ptr, maxlen);
349 349
350 if ((blk->flags & HBB_FLAG_PERSISTENT) && blk->prefix.flags) { 350 if ((blk->flags & HBB_FLAG_PERSISTENT) &&
351 (blk->prefix.flags & ~HBB_PREFIX_READMARK)) {
352 // This is a new message: persistent block flag and no prefix flag
353 // (except a possible readmark flag)
351 last_persist_prefixflags = blk->prefix.flags; 354 last_persist_prefixflags = blk->prefix.flags;
352 } else { 355 } else {
353 // Propagate highlighting flags 356 // Propagate highlighting flags
354 (*array_elt)->flags |= last_persist_prefixflags & 357 (*array_elt)->flags |= last_persist_prefixflags &
355 (HBB_PREFIX_HLIGHT_OUT | HBB_PREFIX_HLIGHT | 358 (HBB_PREFIX_HLIGHT_OUT | HBB_PREFIX_HLIGHT |
530 { 533 {
531 hbuf_block *blk; 534 hbuf_block *blk;
532 535
533 if (!hbuf) return; 536 if (!hbuf) return;
534 537
535 hbuf = g_list_last(hbuf); 538 hbuf = hbuf_previous_persistent(g_list_last(hbuf));
536 539
537 if (action) { 540 if (action) {
538 // Add a readmark flag 541 // Add a readmark flag
539 blk = (hbuf_block*)(hbuf->data); 542 blk = (hbuf_block*)(hbuf->data);
540 blk->prefix.flags ^= HBB_PREFIX_READMARK; 543 blk->prefix.flags |= HBB_PREFIX_READMARK;
544
541 // Shift hbuf in order to remove previous flags 545 // Shift hbuf in order to remove previous flags
542 // (maybe it can be optimized out, if there's no risk 546 // (maybe it can be optimized out, if there's no risk
543 // we have several marks) 547 // we have several marks)
544 hbuf = g_list_previous(hbuf); 548 hbuf = g_list_previous(hbuf);
545 } 549 }