annotate src/dbus-useful.c @ 13606:c1157497b32c

[gaim-migrate @ 15992] Change a few functions to return gboolean instead of int committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 10 Apr 2006 02:38:33 +0000
parents c9312177821a
children 8bda65b88e49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
1 #include <string.h>
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
2 #include <glib.h>
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
3
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
4 #include "dbus-useful.h"
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
5 #include "conversation.h"
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
6 #include "util.h"
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
7
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
8
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
9 GaimAccount *
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
10 gaim_accounts_find_ext(const char *name, const char *protocol_id,
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
11 gboolean (*account_test)(const GaimAccount *account))
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
12 {
11903
c9312177821a [gaim-migrate @ 14194]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11331
diff changeset
13 GaimAccount *result = NULL;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
14 GList *l;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
15 char *who;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
16
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
17 if (name)
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
18 who = g_strdup(gaim_normalize(NULL, name));
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
19 else
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
20 who = NULL;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
21
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
22 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
23 GaimAccount *account = (GaimAccount *)l->data;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
24
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
25 if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who))
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
26 continue;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
27
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
28 if (protocol_id && strcmp(account->protocol_id, protocol_id))
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
29 continue;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
30
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
31 if (account_test && !account_test(account))
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
32 continue;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
33
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
34 result = account;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
35 break;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
36 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
37
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
38 g_free(who);
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
39
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
40 return result;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
41 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
42
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
43 GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol)
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
44 {
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
45 return gaim_accounts_find_ext(name, protocol, NULL);
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
46 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
47
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
48 GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol)
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
49 {
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
50 return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected);
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
51 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
52
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
53