comparison libpurple/dbus-useful.c @ 15373:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children 32c366eeeb99
comparison
equal deleted inserted replaced
15372:f79e0f4df793 15373:5fe8042783c1
1 #include <string.h>
2 #include <glib.h>
3
4 #include "dbus-useful.h"
5 #include "conversation.h"
6 #include "util.h"
7
8
9 GaimAccount *
10 gaim_accounts_find_ext(const char *name, const char *protocol_id,
11 gboolean (*account_test)(const GaimAccount *account))
12 {
13 GaimAccount *result = NULL;
14 GList *l;
15 char *who;
16
17 if (name)
18 who = g_strdup(gaim_normalize(NULL, name));
19 else
20 who = NULL;
21
22 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
23 GaimAccount *account = (GaimAccount *)l->data;
24
25 if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who))
26 continue;
27
28 if (protocol_id && strcmp(account->protocol_id, protocol_id))
29 continue;
30
31 if (account_test && !account_test(account))
32 continue;
33
34 result = account;
35 break;
36 }
37
38 g_free(who);
39
40 return result;
41 }
42
43 GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol)
44 {
45 return gaim_accounts_find_ext(name, protocol, NULL);
46 }
47
48 GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol)
49 {
50 return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected);
51 }
52
53