Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/roster.c @ 1839:f0a07658e009
Update UNREAD event data
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 27 Mar 2010 18:42:37 +0100 |
parents | 5dbb3ebbc466 |
children | e45d13074721 |
comparison
equal
deleted
inserted
replaced
1838:d10c291d31a7 | 1839:f0a07658e009 |
---|---|
588 roster_usr->flags |= flags; | 588 roster_usr->flags |= flags; |
589 else | 589 else |
590 roster_usr->flags &= ~flags; | 590 roster_usr->flags &= ~flags; |
591 } | 591 } |
592 | 592 |
593 // roster_unread_count() | 593 // roster_unread_check() |
594 guint roster_unread_count(void) | 594 static void roster_unread_check(void) |
595 { | 595 { |
596 guint unread_count = 0; | 596 guint unread_count = 0; |
597 #ifdef MODULES_ENABLE | |
598 gpointer unread_ptr, first_unread; | 597 gpointer unread_ptr, first_unread; |
599 guint muc_unread = 0, muc_attention = 0; | 598 guint muc_unread = 0, muc_attention = 0; |
600 guint attention_count = 0; | 599 guint attention_count = 0; |
601 | 600 |
602 unread_ptr = first_unread = unread_msg(NULL); | 601 unread_ptr = first_unread = unread_msg(NULL); |
617 } while (unread_ptr && unread_ptr != first_unread); | 616 } while (unread_ptr && unread_ptr != first_unread); |
618 } | 617 } |
619 | 618 |
620 hk_unread_list_change(unread_count, attention_count, | 619 hk_unread_list_change(unread_count, attention_count, |
621 muc_unread, muc_attention); | 620 muc_unread, muc_attention); |
622 #endif | |
623 return unread_count; | |
624 } | 621 } |
625 | 622 |
626 // roster_msg_setflag() | 623 // roster_msg_setflag() |
627 // Set the ROSTER_FLAG_MSG to the given value for the given jid. | 624 // Set the ROSTER_FLAG_MSG to the given value for the given jid. |
628 // It will update the buddy's group message flag. | 625 // It will update the buddy's group message flag. |
718 if (buddylist && (new_roster_item || !g_list_find(buddylist, roster_usr))) | 715 if (buddylist && (new_roster_item || !g_list_find(buddylist, roster_usr))) |
719 buddylist_build(); | 716 buddylist_build(); |
720 | 717 |
721 roster_msg_setflag_return: | 718 roster_msg_setflag_return: |
722 if (unread_list_modified) { | 719 if (unread_list_modified) { |
723 guint unread_count; | |
724 hlog_save_state(); | 720 hlog_save_state(); |
725 | 721 roster_unread_check(); |
726 #ifdef MODULES_ENABLE | |
727 unread_count = roster_unread_count(); | |
728 #else | |
729 unread_count = g_slist_length(unread_list); | |
730 #endif | |
731 | |
732 /* Call external command */ | |
733 hk_ext_cmd("", 'U', (guchar)MIN(255, unread_count), NULL); | |
734 } | 722 } |
735 } | 723 } |
736 | 724 |
737 // roster_setuiprio(jid, special, prio_value, action) | 725 // roster_setuiprio(jid, special, prio_value, action) |
738 // Set the "attention" priority value for the given roster item. | 726 // Set the "attention" priority value for the given roster item. |
763 newval = value; | 751 newval = value; |
764 | 752 |
765 roster_usr->ui_prio = newval; | 753 roster_usr->ui_prio = newval; |
766 unread_list = g_slist_sort(unread_list, | 754 unread_list = g_slist_sort(unread_list, |
767 (GCompareFunc)&_roster_compare_uiprio); | 755 (GCompareFunc)&_roster_compare_uiprio); |
768 roster_unread_count(); | 756 roster_unread_check(); |
769 } | 757 } |
770 | 758 |
771 guint roster_getuiprio(const char *jid, guint special) | 759 guint roster_getuiprio(const char *jid, guint special) |
772 { | 760 { |
773 roster *roster_usr; | 761 roster *roster_usr; |