These changes are reuired to make the Windows installer build.
[pidgin-git.git] / libpurple / dbus-useful.c
blobb288887b1f11edd7b1f3c6f98b37941ab884a4e4
1 #include <string.h>
2 #include <glib.h>
4 #include "dbus-useful.h"
5 #include "conversation.h"
6 #include "util.h"
9 PurpleAccount *
10 purple_accounts_find_ext(const char *name, const char *protocol_id,
11 gboolean (*account_test)(const PurpleAccount *account))
13 PurpleAccount *result = NULL;
14 GList *l;
15 char *who;
17 if (name)
18 who = g_strdup(purple_normalize(NULL, name));
19 else
20 who = NULL;
22 for (l = purple_accounts_get_all(); l != NULL; l = l->next) {
23 PurpleAccount *account = (PurpleAccount *)l->data;
25 if (who && strcmp(purple_normalize(NULL, purple_account_get_username(account)), who))
26 continue;
28 if (protocol_id && strcmp(account->protocol_id, protocol_id))
29 continue;
31 if (account_test && !account_test(account))
32 continue;
34 result = account;
35 break;
38 g_free(who);
40 return result;
43 PurpleAccount *purple_accounts_find_any(const char *name, const char *protocol)
45 return purple_accounts_find_ext(name, protocol, NULL);
48 PurpleAccount *purple_accounts_find_connected(const char *name, const char *protocol)
50 return purple_accounts_find_ext(name, protocol, purple_account_is_connected);