annotate src/prpl.c @ 11193:e865bdbbf91d

[gaim-migrate @ 13316] Default Environmental proxy to the IE http proxy. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 06 Aug 2005 04:05:09 +0000
parents b75ce371c812
children 90be432e8385
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_account_warning_level(GaimAccount *account, const char *username,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
189 unsigned int level)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
190 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
191 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
192 unsigned int old_level;
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
193 gchar *buf;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
194
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
195 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
196
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
197 presence = gaim_account_get_presence(account);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
198
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
199 gaim_signal_emit(gaim_accounts_get_handle(), "account-warned",
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
200 account, username, level);
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 old_level = gaim_presence_get_warning_level(presence);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
203 gaim_presence_set_warning_level(presence, level);
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 if (old_level >= level)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
206 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
207
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
208 if (username == NULL)
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
209 buf = g_strdup_printf(_("%s has just been warned by an anonymous "
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
210 "person.\nYour new warning level is %d%%"),
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
211 gaim_account_get_username(account),
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
212 level);
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
213 else
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
214 buf = g_strdup_printf(_("%s has just been warned by %s.\n"
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
215 "Your new warning level is %d%%"),
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
216 gaim_account_get_username(account),
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
217 username, level);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
218
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
219 gaim_notify_info(NULL, NULL, buf, NULL);
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
220
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
221 g_free(buf);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
222 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
223
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
224 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
225 gaim_prpl_got_user_idle(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
226 gboolean idle, time_t idle_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
227 {
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
228 GSList *l;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
229
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
230 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
231 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
232 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
233
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
234 for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
235 {
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
236 GaimBuddy *buddy;
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
237 GaimPresence *presence;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
238
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
239 buddy = (GaimBuddy *)l->data;
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
240
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
241 presence = gaim_buddy_get_presence(buddy);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
242
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
243 gaim_presence_set_idle(presence, idle, idle_time);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
244 }
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
245 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
246
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
247 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
248 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
249 time_t login_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
250 {
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
251 GSList *l;
9949
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 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
254 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
255
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
256 for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
257 {
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
258 GaimBuddy *buddy;
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
259 GaimPresence *presence;
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
260
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
261 buddy = (GaimBuddy *)l->data;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
262
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
263 if (login_time == 0)
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
264 login_time = time(NULL);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
265
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
266 presence = gaim_buddy_get_presence(buddy);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
267
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
268 gaim_presence_set_login_time(presence, login_time);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
269 }
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
270 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
271
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
272 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
273 gaim_prpl_got_user_status(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
274 const char *status_id, const char *attr_id, ...)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
275 {
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
276 GSList *l;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
277
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
278 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
279 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
280 g_return_if_fail(status_id != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
281 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
282
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
283 for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
284 {
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
285 GaimBuddy *buddy;
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
286 GaimPresence *presence;
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
287 GaimStatus *status;
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
288 GaimStatus *old_status;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
289
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
290 buddy = (GaimBuddy *)l->data;
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
291 presence = gaim_buddy_get_presence(buddy);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
292 status = gaim_presence_get_status(presence, status_id);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
293
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
294 g_return_if_fail(status != NULL);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
295
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
296 if (attr_id != NULL)
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
297 {
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
298 va_list args;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
299
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
300 va_start(args, attr_id);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
301
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
302 while (attr_id != NULL)
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
303 {
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
304 set_value_from_arg(status, attr_id, &args);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
305
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
306 attr_id = va_arg(args, char *);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
307 }
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
308
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
309 va_end(args);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
310 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
311
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
312 old_status = gaim_presence_get_active_status(presence);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
313 gaim_presence_set_status_active(presence, status_id, TRUE);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
314 gaim_blist_update_buddy_status(buddy, old_status);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
315 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
316 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
317
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
318 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
319 gaim_prpl_got_user_warning_level(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
320 unsigned int level)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
321 {
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
322 GSList *l;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
323
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
324 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
325 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
326
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
327 for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
328 {
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
329 GaimBuddy *buddy;
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
330 GaimPresence *presence;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
331
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
332 buddy = (GaimBuddy *)l->data;
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
333
10554
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
334 presence = gaim_buddy_get_presence(buddy);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
335
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
336 gaim_presence_set_warning_level(presence, level);
0ad82505bde8 [gaim-migrate @ 11931]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10447
diff changeset
337 }
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
338 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
339
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
340 void
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
341 gaim_prpl_change_account_status(GaimAccount *account,
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
342 GaimStatus *old_status, GaimStatus *new_status)
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
343 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
344 GaimPlugin *prpl;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
345 GaimPluginProtocolInfo *prpl_info;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
346
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
347 g_return_if_fail(account != NULL);
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
348 g_return_if_fail(old_status != NULL);
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
349 g_return_if_fail(new_status != NULL);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
350
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
351 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
352
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
353 if (prpl == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
354 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
355
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
356 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
357
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
358 if (prpl_info->set_status != NULL)
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
359 prpl_info->set_status(account, new_status);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
360 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
361
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
362 GList *
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
363 gaim_prpl_get_statuses(GaimAccount *account, GaimPresence *presence)
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 GaimPlugin *prpl;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
366 GaimPluginProtocolInfo *prpl_info;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
367 GList *statuses = NULL;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
368 GList *l;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
369 GaimStatus *status;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
370
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10052
diff changeset
371 g_return_val_if_fail(account != NULL, NULL);
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
372 g_return_val_if_fail(presence != NULL, NULL);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
373
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
374 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
375
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
376 if (prpl == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
377 return NULL;
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
378
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
379 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
380 if (prpl_info == NULL || prpl_info->status_types == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
381 return NULL;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
382
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
383 for (l = prpl_info->status_types(account); l != NULL; l = l->next)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
384 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
385 status = gaim_status_new((GaimStatusType *)l->data, presence);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
386 statuses = g_list_append(statuses, status);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
387 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
388
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
389 return statuses;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
390 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
391
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
392
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
393 /**************************************************************************
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
394 * Protocol Plugin Subsystem API
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
395 **************************************************************************/
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
396
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
397 GaimPlugin *
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7650
diff changeset
398 gaim_find_prpl(const char *id)
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399 {
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
400 GList *l;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
401 GaimPlugin *plugin;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402
10036
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
403 g_return_val_if_fail(id != NULL, NULL);
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
404
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
405 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
406 plugin = (GaimPlugin *)l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
407
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
408 /* Just In Case (TM) */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
409 if (GAIM_IS_PROTOCOL_PLUGIN(plugin)) {
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7650
diff changeset
410 if (!strcmp(plugin->info->id, id))
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
411 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
412 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 return NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 }