annotate src/dbus-useful.c @ 14165:b04e36dae7af

[gaim-migrate @ 16815] If g_open isn't a macro, we need to specify the mode variable committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 17 Aug 2006 14:07:20 +0000
parents 8bda65b88e49
children
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 *
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
10 gaim_accounts_find_ext(const char *name, const char *protocol_id,
11146
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 {
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
13 GaimAccount *result = NULL;
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
14 GList *l;
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
15 char *who;
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
16
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
17 if (name)
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
18 who = g_strdup(gaim_normalize(NULL, name));
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
19 else
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
20 who = NULL;
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
21
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
22 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
23 GaimAccount *account = (GaimAccount *)l->data;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
24
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
25 if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who))
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
26 continue;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
27
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
28 if (protocol_id && strcmp(account->protocol_id, protocol_id))
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
29 continue;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
30
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
31 if (account_test && !account_test(account))
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
32 continue;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
33
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
34 result = account;
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
35 break;
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
36 }
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
37
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
38 g_free(who);
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
39
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
40 return result;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
41 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
42
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
43 GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol)
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
44 {
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
45 return gaim_accounts_find_ext(name, protocol, NULL);
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
46 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
47
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
48 GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol)
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
49 {
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 11903
diff changeset
50 return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected);
11146
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