changeset 1727:15e6b21df606

Add helper function roster_getprio()
author Mikael Berthe <mikael@lilotux.net>
date Sun, 28 Feb 2010 14:09:47 +0100
parents 98917ddcbaab
children 15b3834cbe5f
files mcabber/mcabber/roster.c mcabber/mcabber/roster.h
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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);