[gaim-migrate @ 8313]

Sun, 30 Nov 2003 08:07:59 +0000

author
Christian Hammond <chipx86@chipx86.com>
date
Sun, 30 Nov 2003 08:07:59 +0000
changeset 7669
a3e4cdd678e2
parent 7668
5f89497942bf
child 7670
426d41a66c12

[gaim-migrate @ 8313]
I noticed that gaim_find_contact() was never actually implemented, so I
wrote this implementation. Nathan, this may not be want is wanted, but
you're very much idle right now, so feel free to rewrite it :) I just
needed something that worked for now.

src/blist.c file | annotate | diff | comparison | revisions
--- a/src/blist.c	Sun Nov 30 06:55:09 2003 +0000
+++ b/src/blist.c	Sun Nov 30 08:07:59 2003 +0000
@@ -1305,6 +1305,38 @@
 	return NULL;
 }
 
+GaimContact *
+gaim_find_contact(GaimGroup *group, const char *name)
+{
+	GaimBlistNode *node;
+
+	g_return_val_if_fail(gaim_get_blist() != NULL, NULL);
+	g_return_val_if_fail(name != NULL, NULL);
+
+	for (node = ((GaimBlistNode *)group)->child;
+		 node != NULL;
+		 node = node->next)
+	{
+		GaimContact *contact;
+		GaimBuddy *buddy;
+
+		if (!GAIM_BLIST_NODE_IS_CONTACT(node))
+			continue;
+
+		contact = (GaimContact *)node;
+
+		if (contact->alias != NULL && !strcmp(contact->alias, name))
+			return contact;
+
+		buddy = gaim_contact_get_priority_buddy(contact);
+
+		if (!strcmp(gaim_get_buddy_alias(buddy), name))
+			return contact;
+	}
+
+	return NULL;
+}
+
 GaimChat *
 gaim_blist_find_chat(GaimAccount *account, const char *name)
 {

mercurial