--- a/mcabber/src/roster.c Mon Oct 03 23:59:56 2005 +0200
+++ b/mcabber/src/roster.c Tue Oct 04 19:47:50 2005 +0200
@@ -175,7 +175,7 @@
// Comparison function used to search in the roster (compares jids and types)
static gint roster_compare_jid_type(roster *a, roster *b) {
if (! (a->type & b->type))
- return -1; // arbitrary (but should be != , of course)
+ return -1; // arbitrary (but should be != 0, of course)
return strcasecmp(a->jid, b->jid);
}
@@ -197,7 +197,7 @@
if (!jidname) return NULL;
if (!roster_type)
- roster_type = ROSTER_TYPE_USER | ROSTER_TYPE_ROOM |
+ roster_type = ROSTER_TYPE_USER | ROSTER_TYPE_ROOM |
ROSTER_TYPE_AGENT | ROSTER_TYPE_GROUP;
sample.type = roster_type;
@@ -893,6 +893,25 @@
return roster_usr->flags;
}
+// buddy_search_jid(jid)
+// Look for a buddy with specified jid.
+// Search begins at buddylist; if no match is found in the the buddylist,
+// return NULL;
+GList *buddy_search_jid(char *jid)
+{
+ GList *buddy;
+ roster *roster_usr;
+
+ if (!buddylist) return NULL;
+
+ for (buddy = buddylist; buddy; buddy = g_list_next(buddy)) {
+ roster_usr = (roster*)buddy->data;
+ if (roster_usr->jid && !strcasecmp(roster_usr->jid, jid))
+ return buddy;
+ }
+ return NULL;
+}
+
// buddy_search(string)
// Look for a buddy whose name or jid contains string.
// Search begins at current_buddy; if no match is found in the the buddylist,