annotate src/prpl.c @ 12632:87f3542b3701

[gaim-migrate @ 14968] As discussed in #gaim, given the error dialog that appears if you have logging disabled and the history plugin enabled, the note in the plugin description is redundant. It also takes up a lot of space. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 22 Dec 2005 23:06:43 +0000
parents b94069a95be7
children ccd0fa854471
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 static gboolean
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
62 set_value_from_arg(GaimStatus *status, const char *id, va_list *args)
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 GaimValue *value;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
65
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
66 value = gaim_status_get_attr_value(status, id);
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 if (value == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
69 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
70 gaim_debug_error("prpl",
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
71 "Attempted to set an unknown attribute %s on "
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
72 "status %s\n",
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
73 id, gaim_status_get_id(status));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
74 return FALSE;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
75 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
76
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
77 switch (gaim_value_get_type(value))
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
78 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
79 case GAIM_TYPE_CHAR:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
80 gaim_value_set_char(value, (char)va_arg(*args, int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
81 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
82
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
83 case GAIM_TYPE_UCHAR:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
84 gaim_value_set_uchar(value,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
85 (unsigned char)va_arg(*args, unsigned int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
86 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
87
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
88 case GAIM_TYPE_BOOLEAN:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
89 gaim_value_set_boolean(value, va_arg(*args, gboolean));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
90 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
91
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
92 case GAIM_TYPE_SHORT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
93 gaim_value_set_short(value, (short)va_arg(*args, int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
94 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
95
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
96 case GAIM_TYPE_USHORT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
97 gaim_value_set_ushort(value,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
98 (unsigned short)va_arg(*args, unsigned int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
99 break;
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 case GAIM_TYPE_INT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
102 gaim_value_set_int(value, va_arg(*args, int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
103 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
104
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
105 case GAIM_TYPE_UINT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
106 gaim_value_set_uint(value, va_arg(*args, unsigned int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
107 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
108
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
109 case GAIM_TYPE_LONG:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
110 gaim_value_set_long(value, va_arg(*args, long));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
111 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
112
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
113 case GAIM_TYPE_ULONG:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
114 gaim_value_set_ulong(value, va_arg(*args, unsigned long));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
115 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
116
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
117 case GAIM_TYPE_INT64:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
118 gaim_value_set_int64(value, va_arg(*args, gint64));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
119 break;
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 case GAIM_TYPE_UINT64:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
122 gaim_value_set_uint64(value, va_arg(*args, guint64));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
123 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
124
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
125 case GAIM_TYPE_STRING:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
126 gaim_value_set_string(value, va_arg(*args, char *));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
127 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
128
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
129 case GAIM_TYPE_OBJECT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
130 gaim_value_set_object(value, va_arg(*args, void *));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
131 break;
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 case GAIM_TYPE_POINTER:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
134 gaim_value_set_pointer(value, va_arg(*args, void *));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
135 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
136
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
137 case GAIM_TYPE_ENUM:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
138 gaim_value_set_enum(value, va_arg(*args, int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
139 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
140
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
141 case GAIM_TYPE_BOXED:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
142 gaim_value_set_boxed(value, va_arg(*args, void *));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
143 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
144
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
145 default:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
146 return FALSE;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
147 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
148
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
149 return TRUE;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
150 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
151
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
152 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
153 gaim_prpl_got_account_status(GaimAccount *account, const char *status_id,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
154 const char *attr_id, ...)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
155 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
156 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
157 GaimStatus *status;
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 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
160 g_return_if_fail(status_id != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
161 g_return_if_fail(gaim_account_is_connected(account));
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 presence = gaim_account_get_presence(account);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
164 status = gaim_presence_get_status(presence, status_id);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
165
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
166 g_return_if_fail(status != NULL);
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 if (attr_id != NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
169 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
170 va_list args;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
171
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
172 va_start(args, attr_id);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
173
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
174 while (attr_id != NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
175 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
176 set_value_from_arg(status, attr_id, &args);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
177
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
178 attr_id = va_arg(args, char *);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
179 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
180
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
181 va_end(args);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
182 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
183
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
184 gaim_presence_set_status_active(presence, status_id, TRUE);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
185 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
186
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
187 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
188 gaim_prpl_got_user_idle(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
189 gboolean idle, time_t idle_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
190 {
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
191 GaimBuddy *buddy;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
192 GaimPresence *presence;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
193
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
194 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
195 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
196 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
197
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
198 if ((buddy = gaim_find_buddy(account, name)) == NULL)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
199 return;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
200
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
201 presence = gaim_buddy_get_presence(buddy);
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
202
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
203 gaim_presence_set_idle(presence, idle, idle_time);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
204 }
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 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
207 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
208 time_t login_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
209 {
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
210 GaimBuddy *buddy;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
211 GaimPresence *presence;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
212
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
213 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
214 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
215
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
216 if ((buddy = gaim_find_buddy(account, name)) == NULL)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
217 return;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
218
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
219 if (login_time == 0)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
220 login_time = time(NULL);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
221
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
222 presence = gaim_buddy_get_presence(buddy);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
223
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
224 gaim_presence_set_login_time(presence, login_time);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
225 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
226
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
227 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
228 gaim_prpl_got_user_status(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
229 const char *status_id, const char *attr_id, ...)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
230 {
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
231 GSList *list, *iter;
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
232 GaimBuddy *buddy;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
233 GaimPresence *presence;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
234 GaimStatus *status;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
235 GaimStatus *old_status;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
236
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
237 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
238 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
239 g_return_if_fail(status_id != NULL);
12377
b94069a95be7 [gaim-migrate @ 14681]
Nathan Walp <nwalp@pidgin.im>
parents: 12304
diff changeset
240 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
241
12176
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
242 if ((buddy = gaim_find_buddy(account, name)) == NULL)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
243 return;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
244
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
245 presence = gaim_buddy_get_presence(buddy);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
246 status = gaim_presence_get_status(presence, status_id);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
247
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
248 g_return_if_fail(status != NULL);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
249
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
250 if (attr_id != NULL)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
251 {
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
252 va_list args;
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
253
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
254 va_start(args, attr_id);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
255
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
256 while (attr_id != NULL)
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
257 {
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
258 set_value_from_arg(status, attr_id, &args);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
259
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
260 attr_id = va_arg(args, char *);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
261 }
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
262
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
263 va_end(args);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
264 }
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
265
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
266 old_status = gaim_presence_get_active_status(presence);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
267 gaim_presence_set_status_active(presence, status_id, TRUE);
6f41d8d33989 [gaim-migrate @ 14478]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12126
diff changeset
268
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
269 list = gaim_find_buddies(account, name);
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
270 for (iter = list; iter != NULL; iter = iter->next)
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
271 {
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
272 buddy = (GaimBuddy *)iter->data;
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
273 gaim_blist_update_buddy_status(buddy, old_status);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
274 }
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 12108
diff changeset
275 g_slist_free(list);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
276 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
277
12304
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
278 static void
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
279 do_prpl_change_account_status(GaimAccount *account,
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
280 GaimStatus *old_status, GaimStatus *new_status)
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
281 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
282 GaimPlugin *prpl;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
283 GaimPluginProtocolInfo *prpl_info;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
284
11718
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
285 if (gaim_status_is_online(new_status) &&
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
286 gaim_account_is_disconnected(account))
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
287 {
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
288 gaim_account_connect(account);
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
289 return;
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
290 }
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
291
11927
0d9c6d2ad64b [gaim-migrate @ 14218]
Mark Doliner <mark@kingant.net>
parents: 11730
diff changeset
292 if (!gaim_status_is_online(new_status))
11718
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
293 {
11927
0d9c6d2ad64b [gaim-migrate @ 14218]
Mark Doliner <mark@kingant.net>
parents: 11730
diff changeset
294 if (!gaim_account_is_disconnected(account))
0d9c6d2ad64b [gaim-migrate @ 14218]
Mark Doliner <mark@kingant.net>
parents: 11730
diff changeset
295 gaim_account_disconnect(account);
11718
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
296 return;
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
297 }
11e95968c9ff [gaim-migrate @ 14009]
Mark Doliner <mark@kingant.net>
parents: 11628
diff changeset
298
12108
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
299 if (gaim_account_is_connecting(account))
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
300 /*
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
301 * 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
302 * the PRPL will take care of setting its status during the
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
303 * connection process.
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
304 */
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
305 return;
1d4fbf553ce2 [gaim-migrate @ 14408]
Mark Doliner <mark@kingant.net>
parents: 11948
diff changeset
306
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
307 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
308
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
309 if (prpl == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
310 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
311
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
312 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
313
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
314 if (prpl_info->set_status != NULL)
11628
e1e47878d0ed [gaim-migrate @ 13903]
Tim Ringenbach <marv@pidgin.im>
parents: 11257
diff changeset
315 {
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
316 prpl_info->set_status(account, new_status);
11628
e1e47878d0ed [gaim-migrate @ 13903]
Tim Ringenbach <marv@pidgin.im>
parents: 11257
diff changeset
317 }
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
318 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
319
12304
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
320 void
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
321 gaim_prpl_change_account_status(GaimAccount *account,
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
322 GaimStatus *old_status, GaimStatus *new_status)
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
323 {
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
324 g_return_if_fail(account != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
325 g_return_if_fail(old_status != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
326 g_return_if_fail(new_status != NULL);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
327
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
328 do_prpl_change_account_status(account, old_status, new_status);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
329
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
330 gaim_signal_emit(gaim_accounts_get_handle(), "account-status-changed",
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
331 account, old_status, new_status);
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
332 }
ae190d00b06d [gaim-migrate @ 14608]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12176
diff changeset
333
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
334 GList *
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
335 gaim_prpl_get_statuses(GaimAccount *account, GaimPresence *presence)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
336 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
337 GaimPlugin *prpl;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
338 GaimPluginProtocolInfo *prpl_info;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
339 GList *statuses = NULL;
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
340 GList *l, *list;
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
341 GaimStatus *status;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
342
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
343 g_return_val_if_fail(account != NULL, NULL);
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
344 g_return_val_if_fail(presence != NULL, NULL);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
345
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
346 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
347
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
348 if (prpl == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
349 return NULL;
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
350
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
351 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
352 if (prpl_info == NULL || prpl_info->status_types == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
353 return NULL;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
354
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
355 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
356 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
357 status = gaim_status_new((GaimStatusType *)l->data, presence);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
358 statuses = g_list_append(statuses, status);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
359 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
360
11730
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
361 g_list_free(list);
ef57eccb9a3b [gaim-migrate @ 14021]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
362
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
363 return statuses;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
364 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
365
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
366
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
367 /**************************************************************************
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
368 * Protocol Plugin Subsystem API
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
369 **************************************************************************/
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
370
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
371 GaimPlugin *
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7650
diff changeset
372 gaim_find_prpl(const char *id)
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 {
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
374 GList *l;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
375 GaimPlugin *plugin;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376
10036
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
377 g_return_val_if_fail(id != NULL, NULL);
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
378
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
379 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
380 plugin = (GaimPlugin *)l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
381
11948
fd456a3275a8 [gaim-migrate @ 14239]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
382 if (!strcmp(plugin->info->id, id))
fd456a3275a8 [gaim-migrate @ 14239]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
383 return plugin;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 return NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 }