# HG changeset patch # User Mikael Berthe # Date 1267362587 -3600 # Node ID 15e6b21df60692242490846d109d49335a239c50 # Parent 98917ddcbaabd999ab04bd63fd6dbff45aaab860 Add helper function roster_getprio() diff -r 98917ddcbaab -r 15e6b21df606 mcabber/mcabber/roster.c --- a/mcabber/mcabber/roster.c Sun Feb 28 13:46:46 2010 +0100 +++ b/mcabber/mcabber/roster.c Sun Feb 28 14:09:47 2010 +0100 @@ -758,6 +758,23 @@ return roster_usr->offline_status_message; } +char roster_getprio(const char *jid, const char *resname) +{ + GSList *sl_user; + roster *roster_usr; + res *p_res; + + sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT); + if (sl_user == NULL) + return offline; // Not in the roster, anyway... + + roster_usr = (roster*)sl_user->data; + p_res = get_resource(roster_usr, resname); + if (p_res) + return p_res->prio; + return 0; +} + guint roster_gettype(const char *jid) { GSList *sl_user; diff -r 98917ddcbaab -r 15e6b21df606 mcabber/mcabber/roster.h --- a/mcabber/mcabber/roster.h Sun Feb 28 13:46:46 2010 +0100 +++ b/mcabber/mcabber/roster.h Sun Feb 28 14:09:47 2010 +0100 @@ -171,6 +171,7 @@ void roster_settype(const char *jid, guint type); enum imstatus roster_getstatus(const char *jid, const char *resname); const char *roster_getstatusmsg(const char *jid, const char *resname); +char roster_getprio(const char *jid, const char *resname); guint roster_gettype(const char *jid); guint roster_getsubscription(const char *jid); void roster_unsubscribed(const char *jid);