annotate src/prpl.c @ 14047:c5bfede33622

[gaim-migrate @ 16660] A couple of minor adjustments, memory leak fixes. And request-ui is almost complete now. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 07 Aug 2006 02:15:58 +0000
parents 8bda65b88e49
children cef7f6a93592
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * gaim
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7956
diff changeset
6 * source distribution.
6460
ff4551719cc7 [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
7 *
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * (at your option) any later version.
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 *
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * GNU General Public License for more details.
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 *
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 *
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
23 #include "internal.h"
5945
2a18e7b5917e [gaim-migrate @ 6386]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
24 #include "conversation.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
25 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
26 #include "notify.h"
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 #include "prpl.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
28 #include "request.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
29 #include "util.h"
3738
10a60faad8d7 [gaim-migrate @ 3876]
Rob Flynn <gaim@robflynn.com>
parents: 3733
diff changeset
30
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
31 /**************************************************************************/
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
32 /** @name Protocol Plugin API */
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
33 /**************************************************************************/
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
34 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
35 gaim_prpl_got_account_idle(GaimAccount *account, gboolean idle,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
36 time_t idle_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
37 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
38 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
39 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
40
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
41 gaim_presence_set_idle(gaim_account_get_presence(account),
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
42 idle, idle_time);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
43 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
44
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
45 void
10870
b75ce371c812 [gaim-migrate @ 12557]
Mark Doliner <mark@kingant.net>
parents: 10554
diff changeset
46 gaim_prpl_got_account_login_time(GaimAccount *account, time_t login_time)
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
47 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
48 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
49
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
50 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
51 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
52
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
53 if (login_time == 0)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
54 login_time = time(NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
55
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
56 presence = gaim_account_get_presence(account);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
57
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
58 gaim_presence_set_login_time(presence, login_time);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
59 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
60
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
61 void
13373
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
62 gaim_prpl_got_account_status(GaimAccount *account, const char *status_id, ...)
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
63 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
64 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
65 GaimStatus *status;
13373
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
66 va_list args;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
67
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
68 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
69 g_return_if_fail(status_id != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
70 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
71
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
72 presence = gaim_account_get_presence(account);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
73 status = gaim_presence_get_status(presence, status_id);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
74
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
75 g_return_if_fail(status != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
76
13373
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
77 va_start(args, status_id);
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
78 gaim_status_set_active_with_attrs(status, TRUE, args);
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
79 va_end(args);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
80 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
81
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
82 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
83 gaim_prpl_got_user_idle(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
84 gboolean idle, time_t idle_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
85 {
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
86 GaimBuddy *buddy;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
87 GaimPresence *presence;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
88
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
89 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
90 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
91 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
92
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
93 if ((buddy = gaim_find_buddy(account, name)) == NULL)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
94 return;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
95
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
96 presence = gaim_buddy_get_presence(buddy);
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
97
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
98 gaim_presence_set_idle(presence, idle, idle_time);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
99 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
100
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
101 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
102 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
103 time_t login_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
104 {
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
105 GaimBuddy *buddy;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
106 GaimPresence *presence;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
107
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
108 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
109 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
110
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
111 if ((buddy = gaim_find_buddy(account, name)) == NULL)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
112 return;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
113
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
114 if (login_time == 0)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
115 login_time = time(NULL);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
116
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
117 presence = gaim_buddy_get_presence(buddy);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
118
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
119 gaim_presence_set_login_time(presence, login_time);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
120 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
121
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
122 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
123 gaim_prpl_got_user_status(GaimAccount *account, const char *name,
13373
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
124 const char *status_id, ...)
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
125 {
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 13373
diff changeset
126 GSList *list;
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
127 GaimBuddy *buddy;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
128 GaimPresence *presence;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
129 GaimStatus *status;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
130 GaimStatus *old_status;
13373
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
131 va_list args;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
132
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
133 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
134 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
135 g_return_if_fail(status_id != NULL);
12377
b94069a95be7 [gaim-migrate @ 14681]
Nathan Walp <nwalp@pidgin.im>
parents: 12304
diff changeset
136 g_return_if_fail(gaim_account_is_connected(account) || gaim_account_is_connecting(account));
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
137
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
138 if ((buddy = gaim_find_buddy(account, name)) == NULL)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
139 return;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
140
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
141 presence = gaim_buddy_get_presence(buddy);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
142 status = gaim_presence_get_status(presence, status_id);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
143
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
144 g_return_if_fail(status != NULL);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
145
13373
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
146 old_status = gaim_presence_get_active_status(presence);
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
147
13373
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
148 va_start(args, status_id);
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
149 gaim_status_set_active_with_attrs(status, TRUE, args);
1ca4a579eb57 [gaim-migrate @ 15746]
Mark Doliner <mark@kingant.net>
parents: 13334
diff changeset
150 va_end(args);
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
151
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
152 list = gaim_find_buddies(account, name);
14035
8bda65b88e49 [gaim-migrate @ 16638]
Mark Doliner <mark@kingant.net>
parents: 13373
diff changeset
153 g_slist_foreach(list, (GFunc)gaim_blist_update_buddy_status, old_status);
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
154 g_slist_free(list);
12654
ccd0fa854471 [gaim-migrate @ 14997]
Mark Doliner <mark@kingant.net>
parents: 12377
diff changeset
155
ccd0fa854471 [gaim-migrate @ 14997]
Mark Doliner <mark@kingant.net>
parents: 12377
diff changeset
156 if (!gaim_status_is_online(status))
ccd0fa854471 [gaim-migrate @ 14997]
Mark Doliner <mark@kingant.net>
parents: 12377
diff changeset
157 serv_got_typing_stopped(gaim_account_get_connection(account), name);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
158 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
159
12304
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
160 static void
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
161 do_prpl_change_account_status(GaimAccount *account,
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
162 GaimStatus *old_status, GaimStatus *new_status)
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
163 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
164 GaimPlugin *prpl;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
165 GaimPluginProtocolInfo *prpl_info;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
166
11718
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
167 if (gaim_status_is_online(new_status) &&
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
168 gaim_account_is_disconnected(account))
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
169 {
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
170 gaim_account_connect(account);
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
171 return;
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
172 }
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
173
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
174
12108
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
175 if (gaim_account_is_connecting(account))
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
176 /*
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
177 * We don't need to call the set_status PRPL function because
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
178 * the PRPL will take care of setting its status during the
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
179 * connection process.
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
180 */
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
181 return;
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
182
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
183 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
184
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
185 if (prpl == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
186 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
187
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
188 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
189
13334
99d081c638f6 [gaim-migrate @ 15704]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13330
diff changeset
190 if (!gaim_account_is_disconnected(account) && prpl_info->set_status != NULL)
11628
e1e47878d0ed [gaim-migrate @ 13903]
Tim Ringenbach <marv@pidgin.im>
parents: 11257
diff changeset
191 {
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
192 prpl_info->set_status(account, new_status);
11628
e1e47878d0ed [gaim-migrate @ 13903]
Tim Ringenbach <marv@pidgin.im>
parents: 11257
diff changeset
193 }
13330
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
194
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
195 if (!gaim_status_is_online(new_status))
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
196 {
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
197 if (!gaim_account_is_disconnected(account))
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
198 gaim_account_disconnect(account);
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
199 return;
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
200 }
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
201 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
202
12304
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
203 void
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
204 gaim_prpl_change_account_status(GaimAccount *account,
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
205 GaimStatus *old_status, GaimStatus *new_status)
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
206 {
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
207 g_return_if_fail(account != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
208 g_return_if_fail(old_status != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
209 g_return_if_fail(new_status != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
210
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
211 do_prpl_change_account_status(account, old_status, new_status);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
212
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
213 gaim_signal_emit(gaim_accounts_get_handle(), "account-status-changed",
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
214 account, old_status, new_status);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
215 }
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
216
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
217 GList *
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
218 gaim_prpl_get_statuses(GaimAccount *account, GaimPresence *presence)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
219 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
220 GaimPlugin *prpl;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
221 GaimPluginProtocolInfo *prpl_info;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
222 GList *statuses = NULL;
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
223 GList *l, *list;
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
224 GaimStatus *status;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
225
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
226 g_return_val_if_fail(account != NULL, NULL);
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
227 g_return_val_if_fail(presence != NULL, NULL);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
228
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
229 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
230
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
231 if (prpl == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
232 return NULL;
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
233
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
234 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
235 if (prpl_info == NULL || prpl_info->status_types == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
236 return NULL;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
237
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
238 for (l = list = prpl_info->status_types(account); l != NULL; l = l->next)
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
239 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
240 status = gaim_status_new((GaimStatusType *)l->data, presence);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
241 statuses = g_list_append(statuses, status);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
242 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
243
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
244 g_list_free(list);
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
245
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
246 return statuses;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
247 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
248
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
249
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
250 /**************************************************************************
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
251 * Protocol Plugin Subsystem API
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
252 **************************************************************************/
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
253
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
254 GaimPlugin *
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7650
diff changeset
255 gaim_find_prpl(const char *id)
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 {
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
257 GList *l;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
258 GaimPlugin *plugin;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259
10036
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
260 g_return_val_if_fail(id != NULL, NULL);
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
261
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
262 for (l = gaim_plugins_get_protocols(); l != NULL; l = l->next) {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
263 plugin = (GaimPlugin *)l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
264
11948
fd456a3275a8 [gaim-migrate @ 14239]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
265 if (!strcmp(plugin->info->id, id))
fd456a3275a8 [gaim-migrate @ 14239]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
266 return plugin;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 return NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 }