comparison mcabber/src/roster.c @ 860:a8fadbd97858

Rebuild buddylist when setting a new message flag
author Mikael Berthe <mikael@lilotux.net>
date Sun, 21 May 2006 09:47:12 +0200
parents a9161d2dc414
children 4f1a93faffea
comparison
equal deleted inserted replaced
859:cb2a3a1d985f 860:a8fadbd97858
531 // Update the unread messages list too. 531 // Update the unread messages list too.
532 void roster_msg_setflag(const char *jid, guint value) 532 void roster_msg_setflag(const char *jid, guint value)
533 { 533 {
534 GSList *sl_user; 534 GSList *sl_user;
535 roster *roster_usr, *roster_grp; 535 roster *roster_usr, *roster_grp;
536 int new_roster_item = FALSE;
536 537
537 sl_user = roster_find(jid, jidsearch, 538 sl_user = roster_find(jid, jidsearch,
538 ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT); 539 ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT);
539 // If we can't find it, we add it 540 // If we can't find it, we add it
540 if (sl_user == NULL) { 541 if (sl_user == NULL) {
541 sl_user = roster_add_user(jid, NULL, NULL, ROSTER_TYPE_USER, sub_none); 542 sl_user = roster_add_user(jid, NULL, NULL, ROSTER_TYPE_USER, sub_none);
543 new_roster_item = TRUE;
542 } 544 }
543 545
544 roster_usr = (roster*)sl_user->data; 546 roster_usr = (roster*)sl_user->data;
545 roster_grp = (roster*)roster_usr->list->data; 547 roster_grp = (roster*)roster_usr->list->data;
546 if (value) { 548 if (value) {
577 else 579 else
578 roster_grp->flags |= ROSTER_FLAG_MSG; 580 roster_grp->flags |= ROSTER_FLAG_MSG;
579 // Actually the "else" part is useless, because the group 581 // Actually the "else" part is useless, because the group
580 // ROSTER_FLAG_MSG should already be set... 582 // ROSTER_FLAG_MSG should already be set...
581 } 583 }
584
585 if (buddylist && new_roster_item)
586 buddylist_build();
582 } 587 }
583 588
584 const char *roster_getname(const char *jid) 589 const char *roster_getname(const char *jid)
585 { 590 {
586 GSList *sl_user; 591 GSList *sl_user;