annotate src/prpl.c @ 10361:f57369469684

[gaim-migrate @ 11579] if (0) this out in HEAD too until i figure out the real limit, or maybe just handle the errors yahoo sends us. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 13 Dec 2004 23:03:06 +0000
parents eaec201b2688
children 6feef0a9098a
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
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
46 gaim_prpl_got_account_login_time(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
47 time_t login_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
48 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
49 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
50
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
51 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
52 g_return_if_fail(name != NULL && *name != '\0');
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
53 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
54
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
55 if (login_time == 0)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
56 login_time = time(NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
57
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
58 presence = gaim_account_get_presence(account);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
59
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
60 gaim_presence_set_login_time(presence, login_time);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
61 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
62
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
63 static gboolean
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
64 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
65 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
66 GaimValue *value;
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 value = gaim_status_get_attr_value(status, id);
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 if (value == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
71 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
72 gaim_debug_error("prpl",
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
73 "Attempted to set an unknown attribute %s on "
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
74 "status %s\n",
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
75 id, gaim_status_get_id(status));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
76 return FALSE;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
77 }
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 switch (gaim_value_get_type(value))
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
80 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
81 case GAIM_TYPE_CHAR:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
82 gaim_value_set_char(value, (char)va_arg(*args, int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
83 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
84
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
85 case GAIM_TYPE_UCHAR:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
86 gaim_value_set_uchar(value,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
87 (unsigned char)va_arg(*args, unsigned int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
88 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
89
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
90 case GAIM_TYPE_BOOLEAN:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
91 gaim_value_set_boolean(value, va_arg(*args, gboolean));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
92 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
93
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
94 case GAIM_TYPE_SHORT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
95 gaim_value_set_short(value, (short)va_arg(*args, int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
96 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
97
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
98 case GAIM_TYPE_USHORT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
99 gaim_value_set_ushort(value,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
100 (unsigned short)va_arg(*args, unsigned int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
101 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
102
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
103 case GAIM_TYPE_INT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
104 gaim_value_set_int(value, va_arg(*args, int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
105 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
106
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
107 case GAIM_TYPE_UINT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
108 gaim_value_set_uint(value, va_arg(*args, unsigned int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
109 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
110
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
111 case GAIM_TYPE_LONG:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
112 gaim_value_set_long(value, va_arg(*args, long));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
113 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
114
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
115 case GAIM_TYPE_ULONG:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
116 gaim_value_set_ulong(value, va_arg(*args, unsigned long));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
117 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
118
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
119 case GAIM_TYPE_INT64:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
120 gaim_value_set_int64(value, va_arg(*args, gint64));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
121 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
122
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
123 case GAIM_TYPE_UINT64:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
124 gaim_value_set_uint64(value, va_arg(*args, guint64));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
125 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
126
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
127 case GAIM_TYPE_STRING:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
128 gaim_value_set_string(value, va_arg(*args, char *));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
129 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
130
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
131 case GAIM_TYPE_OBJECT:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
132 gaim_value_set_object(value, va_arg(*args, void *));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
133 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
134
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
135 case GAIM_TYPE_POINTER:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
136 gaim_value_set_pointer(value, va_arg(*args, void *));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
137 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
138
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
139 case GAIM_TYPE_ENUM:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
140 gaim_value_set_enum(value, va_arg(*args, int));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
141 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
142
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
143 case GAIM_TYPE_BOXED:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
144 gaim_value_set_boxed(value, va_arg(*args, void *));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
145 break;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
146
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
147 default:
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
148 return FALSE;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
149 }
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 return TRUE;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
152 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
153
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
154 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
155 gaim_prpl_got_account_status(GaimAccount *account, const char *status_id,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
156 const char *attr_id, ...)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
157 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
158 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
159 GaimStatus *status;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
160
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
161 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
162 g_return_if_fail(status_id != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
163 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
164
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
165 presence = gaim_account_get_presence(account);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
166 status = gaim_presence_get_status(presence, status_id);
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 g_return_if_fail(status != 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 if (attr_id != NULL)
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_list args;
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 va_start(args, attr_id);
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 while (attr_id != NULL)
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 set_value_from_arg(status, attr_id, &args);
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 attr_id = va_arg(args, char *);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
181 }
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 va_end(args);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
184 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
185
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
186 gaim_presence_set_status_active(presence, status_id, TRUE);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
187 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
188
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
189 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
190 gaim_prpl_got_account_warning_level(GaimAccount *account, const char *username,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
191 unsigned int level)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
192 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
193 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
194 unsigned int old_level;
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
195 gchar *buf;
9949
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 g_return_if_fail(account != NULL);
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 presence = gaim_account_get_presence(account);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
200
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
201 gaim_signal_emit(gaim_accounts_get_handle(), "account-warned",
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
202 account, username, level);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
203
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
204 old_level = gaim_presence_get_warning_level(presence);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
205 gaim_presence_set_warning_level(presence, level);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
206
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
207 if (old_level >= level)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
208 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
209
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
210 if (username == NULL)
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
211 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
212 "person.\nYour new warning level is %d%%"),
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
213 gaim_account_get_username(account),
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
214 level);
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
215 else
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
216 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
217 "Your new warning level is %d%%"),
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
218 gaim_account_get_username(account),
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
219 username, level);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
220
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
221 gaim_notify_info(NULL, NULL, buf, NULL);
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
222
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
223 g_free(buf);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
224 }
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 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
227 gaim_prpl_got_user_idle(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
228 gboolean idle, time_t idle_time)
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 GaimBuddy *buddy;
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
231 GaimPresence *presence;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
232
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
233 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
234 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
235 g_return_if_fail(gaim_account_is_connected(account));
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 if ((buddy = gaim_find_buddy(account, name)) == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
238 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
239
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
240 presence = gaim_buddy_get_presence(buddy);
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
241
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
242 gaim_presence_set_idle(presence, idle, idle_time);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
243 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
244
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
245 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
246 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
247 time_t login_time)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
248 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
249 GaimBuddy *buddy;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
250 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
251
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
252 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
253 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
254
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
255 if ((buddy = gaim_find_buddy(account, name)) == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
256 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
257
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
258 if (login_time == 0)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
259 login_time = time(NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
260
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
261 presence = gaim_buddy_get_presence(buddy);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
262
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
263 gaim_presence_set_login_time(presence, login_time);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
264 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
265
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
266 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
267 gaim_prpl_got_user_status(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
268 const char *status_id, const char *attr_id, ...)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
269 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
270 GaimBuddy *buddy;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
271 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
272 GaimStatus *status;
10052
eaec201b2688 [gaim-migrate @ 11013]
Mark Doliner <mark@kingant.net>
parents: 10046
diff changeset
273 GaimStatus *old_status;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
274
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
275 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
276 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
277 g_return_if_fail(status_id != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
278 g_return_if_fail(gaim_account_is_connected(account));
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
279
10052
eaec201b2688 [gaim-migrate @ 11013]
Mark Doliner <mark@kingant.net>
parents: 10046
diff changeset
280 buddy = gaim_find_buddy(account, name);
eaec201b2688 [gaim-migrate @ 11013]
Mark Doliner <mark@kingant.net>
parents: 10046
diff changeset
281 if (buddy == NULL)
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
282 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
283
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
284 presence = gaim_buddy_get_presence(buddy);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
285 status = gaim_presence_get_status(presence, status_id);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
286
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
287 g_return_if_fail(status != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
288
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
289 if (attr_id != NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
290 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
291 va_list args;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
292
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
293 va_start(args, attr_id);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
294
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
295 while (attr_id != NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
296 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
297 set_value_from_arg(status, attr_id, &args);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
298
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
299 attr_id = va_arg(args, char *);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
300 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
301
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
302 va_end(args);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
303 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
304
10052
eaec201b2688 [gaim-migrate @ 11013]
Mark Doliner <mark@kingant.net>
parents: 10046
diff changeset
305 old_status = gaim_presence_get_active_status(presence);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
306 gaim_presence_set_status_active(presence, status_id, TRUE);
10052
eaec201b2688 [gaim-migrate @ 11013]
Mark Doliner <mark@kingant.net>
parents: 10046
diff changeset
307 gaim_blist_update_buddy_status(buddy, old_status);
9949
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
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
310 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
311 gaim_prpl_got_user_warning_level(GaimAccount *account, const char *name,
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
312 unsigned int level)
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 GaimBuddy *buddy;
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
315 GaimPresence *presence;
9949
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 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
318 g_return_if_fail(name != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
319
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
320 if ((buddy = gaim_find_buddy(account, name)) == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
321 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
322
10007
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
323 presence = gaim_buddy_get_presence(buddy);
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
324
267a2b69e36e [gaim-migrate @ 10924]
Mark Doliner <mark@kingant.net>
parents: 10006
diff changeset
325 gaim_presence_set_warning_level(presence, level);
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
326 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
327
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
328 void
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
329 gaim_prpl_set_account_status(GaimAccount *account, GaimStatus *status)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
330 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
331 GaimPlugin *prpl;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
332 GaimPluginProtocolInfo *prpl_info;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
333
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
334 g_return_if_fail(account != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
335 g_return_if_fail(status != NULL);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
336
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
337 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
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 if (prpl == NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
340 return;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
341
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
342 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
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 if (prpl_info->set_status != NULL)
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
345 prpl_info->set_status(account, status);
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
346 }
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
347
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
348 GList *
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
349 gaim_prpl_get_statuses(GaimAccount *account, GaimPresence *presence)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
350 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
351 GaimPlugin *prpl;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
352 GaimPluginProtocolInfo *prpl_info;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
353 GList *statuses = NULL;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
354 GList *l;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
355 GaimStatus *status;
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 g_return_val_if_fail(account != NULL, NULL);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
358 g_return_val_if_fail(presence != NULL, NULL);
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 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
361
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
362 if (prpl == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
363 return NULL;
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
364
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
365 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
366 if (prpl_info == NULL || prpl_info->status_types == NULL)
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
367 return NULL;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
368
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
369 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
370 {
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
371 status = gaim_status_new((GaimStatusType *)l->data, presence);
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
372 statuses = g_list_append(statuses, status);
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
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
375 return statuses;
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
376 }
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9949
diff changeset
377
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
378
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
379 /**************************************************************************
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
380 * Protocol Plugin Subsystem API
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
381 **************************************************************************/
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
382
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
383 GaimPlugin *
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7650
diff changeset
384 gaim_find_prpl(const char *id)
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385 {
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
386 GList *l;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
387 GaimPlugin *plugin;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388
10036
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
389 g_return_val_if_fail(id != NULL, NULL);
0ddc38f8db4a [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
390
5573
5e7de337a053 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
391 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
392 plugin = (GaimPlugin *)l->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
393
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
394 /* Just In Case (TM) */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
395 if (GAIM_IS_PROTOCOL_PLUGIN(plugin)) {
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7650
diff changeset
396 if (!strcmp(plugin->info->id, id))
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
397 return plugin;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
398 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 return NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 }