# HG changeset patch # User Mikael Berthe # Date 1134672979 -3600 # Node ID 0e8247cf2bd182b1d92d6dbe4e576f6ee3113805 # Parent 85648a0f963ebae9609feea2ac57a89d4f41ff1b Consider buddies as offline when they have cancelled our subscription diff -r 85648a0f963e -r 0e8247cf2bd1 mcabber/src/jabglue.c --- a/mcabber/src/jabglue.c Thu Dec 15 18:51:06 2005 +0100 +++ b/mcabber/src/jabglue.c Thu Dec 15 19:56:19 2005 +0100 @@ -1256,6 +1256,7 @@ } else if (!strcmp(type, "unsubscribed")) { scr_LogPrint(LPRINT_LOGNORM, "<%s> has unsubscribed from your presence " "updates", from); + roster_unsubscribed(from); } else { scr_LogPrint(LPRINT_LOGNORM, "Received (un)subscription packet from <%s>" " (type=%s)", from, (type ? type : "")); diff -r 85648a0f963e -r 0e8247cf2bd1 mcabber/src/roster.c --- a/mcabber/src/roster.c Thu Dec 15 18:51:06 2005 +0100 +++ b/mcabber/src/roster.c Thu Dec 15 19:56:19 2005 +0100 @@ -595,6 +595,22 @@ return roster_usr->type; } +// roster_unsubscribed() +// We have lost buddy's presence updates; this function clears the status +// message, sets the buddy offline and frees the resources +void roster_unsubscribed(const char *jid) +{ + GSList *sl_user; + roster *roster_usr; + + sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT); + if (sl_user == NULL) + return; + + roster_usr = (roster*)sl_user->data; + free_all_resources(&roster_usr->resource); +} + /* ### BuddyList functions ### */ diff -r 85648a0f963e -r 0e8247cf2bd1 mcabber/src/roster.h --- a/mcabber/src/roster.h Thu Dec 15 18:51:06 2005 +0100 +++ b/mcabber/src/roster.h Thu Dec 15 19:56:19 2005 +0100 @@ -96,6 +96,7 @@ enum imstatus roster_getstatus(const char *jid, const char *resname); const char *roster_getstatusmsg(const char *jid, const char *resname); guint roster_gettype(const char *jid); +void roster_unsubscribed(const char *jid); void buddylist_build(void); void buddy_hide_group(gpointer rosterdata, int hide);