changeset 7669:109a917692c1

[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. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 30 Nov 2003 08:07:59 +0000
parents 90ed8fcca27c
children 5076246a211b
files src/blist.c
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)
 {