annotate src/prpl.c @ 19809:b488205ad0bc

[gaim-migrate @ 16884] chat function ok debugging the multiple soap request in one ssl connection not stable. comitted by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sat, 19 Aug 2006 14:12:41 +0000
parents 1ca4a579eb57
children 8bda65b88e49
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 {
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
126 GSList *list, *iter;
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);
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
153 for (iter = list; iter != NULL; iter = iter->next)
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
154 {
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
155 buddy = (GaimBuddy *)iter->data;
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
156 gaim_blist_update_buddy_status(buddy, old_status);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
157 }
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
158 g_slist_free(list);
12654
ccd0fa854471 [gaim-migrate @ 14997]
Mark Doliner <mark@kingant.net>
parents: 12377
diff changeset
159
ccd0fa854471 [gaim-migrate @ 14997]
Mark Doliner <mark@kingant.net>
parents: 12377
diff changeset
160 if (!gaim_status_is_online(status))
ccd0fa854471 [gaim-migrate @ 14997]
Mark Doliner <mark@kingant.net>
parents: 12377
diff changeset
161 serv_got_typing_stopped(gaim_account_get_connection(account), name);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
162 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
163
12304
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
164 static void
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
165 do_prpl_change_account_status(GaimAccount *account,
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
166 GaimStatus *old_status, GaimStatus *new_status)
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
167 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
168 GaimPlugin *prpl;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
169 GaimPluginProtocolInfo *prpl_info;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
170
11718
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
171 if (gaim_status_is_online(new_status) &&
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
172 gaim_account_is_disconnected(account))
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 gaim_account_connect(account);
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
175 return;
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
176 }
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
177
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
178
12108
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
179 if (gaim_account_is_connecting(account))
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 * 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
182 * the PRPL will take care of setting its status during the
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
183 * connection process.
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
184 */
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
185 return;
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
186
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
187 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
188
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
189 if (prpl == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
190 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
191
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
192 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
193
13334
99d081c638f6 [gaim-migrate @ 15704]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13330
diff changeset
194 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
195 {
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
196 prpl_info->set_status(account, new_status);
11628
e1e47878d0ed [gaim-migrate @ 13903]
Tim Ringenbach <marv@pidgin.im>
parents: 11257
diff changeset
197 }
13330
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
198
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
199 if (!gaim_status_is_online(new_status))
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
200 {
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
201 if (!gaim_account_is_disconnected(account))
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
202 gaim_account_disconnect(account);
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
203 return;
e9cf00a30b49 [gaim-migrate @ 15700]
Nathan Walp <nwalp@pidgin.im>
parents: 12654
diff changeset
204 }
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
205 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
206
12304
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
207 void
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
208 gaim_prpl_change_account_status(GaimAccount *account,
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
209 GaimStatus *old_status, GaimStatus *new_status)
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 g_return_if_fail(account != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
212 g_return_if_fail(old_status != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
213 g_return_if_fail(new_status != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
214
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
215 do_prpl_change_account_status(account, old_status, new_status);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
216
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
217 gaim_signal_emit(gaim_accounts_get_handle(), "account-status-changed",
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
218 account, old_status, new_status);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
219 }
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
220
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
221 GList *
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
222 gaim_prpl_get_statuses(GaimAccount *account, GaimPresence *presence)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
223 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
224 GaimPlugin *prpl;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
225 GaimPluginProtocolInfo *prpl_info;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
226 GList *statuses = NULL;
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
227 GList *l, *list;
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
228 GaimStatus *status;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
229
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
230 g_return_val_if_fail(account != NULL, NULL);
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
231 g_return_val_if_fail(presence != NULL, NULL);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
232
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
233 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
234
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
235 if (prpl == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
236 return NULL;
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
237
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
238 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
239 if (prpl_info == NULL || prpl_info->status_types == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
240 return NULL;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
241
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
242 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
243 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
244 status = gaim_status_new((GaimStatusType *)l->data, presence);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
245 statuses = g_list_append(statuses, status);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
246 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
247
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
248 g_list_free(list);
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
249
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
250 return statuses;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
251 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
252
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
253
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
254 /**************************************************************************
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
255 * Protocol Plugin Subsystem API
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
256 **************************************************************************/
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
257
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
258 GaimPlugin *
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7650
diff changeset
259 gaim_find_prpl(const char *id)
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 {
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
261 GList *l;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
262 GaimPlugin *plugin;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263
10036
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
264 g_return_val_if_fail(id != NULL, NULL);
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
265
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
266 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
267 plugin = (GaimPlugin *)l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
268
11948
fd456a3275a8 [gaim-migrate @ 14239]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
269 if (!strcmp(plugin->info->id, id))
fd456a3275a8 [gaim-migrate @ 14239]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
270 return plugin;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 return NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 }