Mercurial > pidgin
annotate src/protocols/oscar/oscar.c @ 2774:6fab04e257a5
[gaim-migrate @ 2787]
>>Comment By: Decklin
> I'm also curious as to why you didn't want the POINT_SIZE
> macro...
i just didn't see it before :)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 20 Nov 2001 01:22:16 +0000 |
parents | a0fd8f91e294 |
children | e8a2f3b92348 |
rev | line source |
---|---|
2086 | 1 /* |
2 * gaim | |
3 * | |
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx> | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
24 #include <config.h> |
2086 | 25 #endif |
26 | |
27 | |
28 #include <netdb.h> | |
29 #include <unistd.h> | |
30 #include <errno.h> | |
31 #include <netinet/in.h> | |
32 #include <arpa/inet.h> | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
33 #include <ctype.h> |
2086 | 34 #include <string.h> |
35 #include <stdlib.h> | |
36 #include <stdio.h> | |
37 #include <time.h> | |
38 #include <sys/socket.h> | |
39 #include <sys/stat.h> | |
40 #include "multi.h" | |
41 #include "prpl.h" | |
42 #include "gaim.h" | |
43 #include "aim.h" | |
44 #include "proxy.h" | |
45 | |
2315
7ec21662ffc2
[gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
46 #include "pixmaps/ab.xpm" |
2086 | 47 #include "pixmaps/admin_icon.xpm" |
48 #include "pixmaps/aol_icon.xpm" | |
49 #include "pixmaps/away_icon.xpm" | |
50 #include "pixmaps/dt_icon.xpm" | |
51 #include "pixmaps/free_icon.xpm" | |
52 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
53 #include "pixmaps/gnomeicu-online.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
54 #include "pixmaps/gnomeicu-offline.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
55 #include "pixmaps/gnomeicu-away.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
56 #include "pixmaps/gnomeicu-dnd.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
57 #include "pixmaps/gnomeicu-na.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
58 #include "pixmaps/gnomeicu-occ.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
59 #include "pixmaps/gnomeicu-ffc.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
60 |
2086 | 61 /* constants to identify proto_opts */ |
62 #define USEROPT_AUTH 0 | |
63 #define USEROPT_AUTHPORT 1 | |
64 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
65 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
66 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
67 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
68 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
69 #define UC_AB 0x20 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
70 |
2086 | 71 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
72 | |
73 static int gaim_caps = AIM_CAPS_CHAT | | |
74 AIM_CAPS_BUDDYICON | | |
75 AIM_CAPS_IMIMAGE; | |
2308
a90be9567452
[gaim-migrate @ 2318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2305
diff
changeset
|
76 static fu8_t gaim_features[] = {0x01, 0x01, 0x01, 0x02}; |
2086 | 77 |
78 struct oscar_data { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
79 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
80 aim_conn_t *conn; |
2086 | 81 |
82 guint cnpa; | |
83 guint paspa; | |
84 | |
85 int create_exchange; | |
86 char *create_name; | |
87 | |
88 gboolean conf; | |
89 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
90 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
91 char *email; |
2086 | 92 gboolean chpass; |
93 char *oldp; | |
94 char *newp; | |
95 | |
96 GSList *oscar_chats; | |
97 GSList *direct_ims; | |
98 GSList *hasicons; | |
99 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
100 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
101 gboolean icq; |
2086 | 102 }; |
103 | |
104 struct chat_connection { | |
105 char *name; | |
106 char *show; /* AOL did something funny to us */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
107 fu16_t exchange; /* XXX should have instance here too */ |
2086 | 108 int fd; /* this is redundant since we have the conn below */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
109 aim_conn_t *conn; |
2086 | 110 int inpa; |
111 int id; | |
112 struct gaim_connection *gc; /* i hate this. */ | |
113 struct conversation *cnv; /* bah. */ | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
114 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
115 int maxvis; |
2086 | 116 }; |
117 | |
118 struct direct_im { | |
119 struct gaim_connection *gc; | |
120 char name[80]; | |
121 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
122 aim_conn_t *conn; |
2086 | 123 }; |
124 | |
125 struct ask_direct { | |
126 struct gaim_connection *gc; | |
127 char *sn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
128 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
129 fu8_t cookie[8]; |
2086 | 130 }; |
131 | |
132 struct icon_req { | |
133 char *user; | |
134 time_t timestamp; | |
2196
016c5307f26b
[gaim-migrate @ 2206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2194
diff
changeset
|
135 unsigned long length; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2172
diff
changeset
|
136 unsigned long checksum; |
2086 | 137 gboolean request; |
138 }; | |
139 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
140 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { |
2086 | 141 GSList *d = od->direct_ims; |
142 char *n = g_strdup(normalize(who)); | |
143 struct direct_im *m = NULL; | |
144 | |
145 while (d) { | |
146 m = (struct direct_im *)d->data; | |
147 if (!strcmp(n, normalize(m->name))) | |
148 break; | |
149 m = NULL; | |
150 d = d->next; | |
151 } | |
152 | |
153 g_free(n); | |
154 return m; | |
155 } | |
156 | |
157 static char *extract_name(char *name) { | |
158 char *tmp; | |
159 int i, j; | |
160 char *x = strchr(name, '-'); | |
161 if (!x) return NULL; | |
162 x = strchr(++x, '-'); | |
163 if (!x) return NULL; | |
164 tmp = g_strdup(++x); | |
165 | |
166 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
167 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
168 if (x[i] != '%') { |
2086 | 169 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
170 continue; |
2086 | 171 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
172 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
173 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
174 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 175 } |
176 | |
177 tmp[j] = 0; | |
178 return tmp; | |
179 } | |
180 | |
181 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) { | |
182 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; | |
183 struct chat_connection *c = NULL; | |
184 | |
185 while (g) { | |
186 c = (struct chat_connection *)g->data; | |
187 if (c->id == id) | |
188 break; | |
189 g = g->next; | |
190 c = NULL; | |
191 } | |
192 | |
193 return c; | |
194 } | |
195 | |
196 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc, | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
197 aim_conn_t *conn) { |
2086 | 198 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
199 struct chat_connection *c = NULL; | |
200 | |
201 while (g) { | |
202 c = (struct chat_connection *)g->data; | |
203 if (c->conn == conn) | |
204 break; | |
205 g = g->next; | |
206 c = NULL; | |
207 } | |
208 | |
209 return c; | |
210 } | |
211 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
212 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
213 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
214 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
215 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
216 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
217 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
218 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
219 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
220 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
221 static int gaim_parse_user_info (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
222 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
223 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
224 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
225 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
226 static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
227 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
228 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
229 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
230 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
231 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
232 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
233 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
234 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
235 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
236 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
237 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
238 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
239 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
240 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
241 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
242 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
243 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
244 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
245 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
246 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
247 static int gaim_simpleinfo (aim_session_t *, aim_frame_t *, ...); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
248 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
249 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
250 static int gaim_directim_initiate(aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
251 static int gaim_directim_incoming(aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
252 static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...); |
2086 | 253 |
254 static char *msgerrreason[] = { | |
255 "Invalid error", | |
256 "Invalid SNAC", | |
257 "Rate to host", | |
258 "Rate to client", | |
259 "Not logged in", | |
260 "Service unavailable", | |
261 "Service not defined", | |
262 "Obsolete SNAC", | |
263 "Not supported by host", | |
264 "Not supported by client", | |
265 "Refused by client", | |
266 "Reply too big", | |
267 "Responses lost", | |
268 "Request denied", | |
269 "Busted SNAC payload", | |
270 "Insufficient rights", | |
271 "In local permit/deny", | |
272 "Too evil (sender)", | |
273 "Too evil (receiver)", | |
274 "User temporarily unavailable", | |
275 "No match", | |
276 "List overflow", | |
277 "Request ambiguous", | |
278 "Queue full", | |
279 "Not while on AOL" | |
280 }; | |
281 static int msgerrreasonlen = 25; | |
282 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
283 static void gaim_directim_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
284 struct gaim_connection *gc = sess->aux_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
285 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
286 struct conversation *cnv; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
287 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
288 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
289 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
290 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
291 sn = g_strdup(aim_directim_getsn(conn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
292 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
293 debug_printf("%s disconnected Direct IM.\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
294 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
295 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
296 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
297 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
298 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
299 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
300 if ((cnv = find_conversation(sn))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
301 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
302 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
303 g_free(dim); /* I guess? I don't see it anywhere else... -- mid */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
304 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
305 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
306 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
307 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
308 |
2086 | 309 static void oscar_callback(gpointer data, gint source, |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
310 GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
311 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
312 aim_session_t *sess = aim_conn_getsess(conn); |
2086 | 313 struct gaim_connection *gc = sess ? sess->aux_data : NULL; |
314 struct oscar_data *odata; | |
315 | |
316 if (!gc) { | |
317 /* gc is null. we return, else we seg SIGSEG on next line. */ | |
318 debug_printf("oscar callback for closed connection (1).\n"); | |
319 return; | |
320 } | |
321 | |
322 odata = (struct oscar_data *)gc->proto_data; | |
323 | |
324 if (!g_slist_find(connections, gc)) { | |
325 /* oh boy. this is probably bad. i guess the only thing we | |
326 * can really do is return? */ | |
327 debug_printf("oscar callback for closed connection (2).\n"); | |
328 return; | |
329 } | |
330 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
331 if (condition & GAIM_INPUT_READ) { |
2086 | 332 if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) { |
333 debug_printf("got information on rendezvous\n"); | |
334 if (aim_handlerendconnect(odata->sess, conn) < 0) { | |
335 debug_printf(_("connection error (rend)\n")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
336 aim_conn_kill(odata->sess, &conn); |
2086 | 337 } |
338 } else { | |
339 if (aim_get_command(odata->sess, conn) >= 0) { | |
340 aim_rxdispatch(odata->sess); | |
341 if (odata->killme) | |
342 signoff(gc); | |
343 } else { | |
344 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
345 !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { | |
346 debug_printf(_("major connection error\n")); | |
347 hide_login_progress(gc, _("Disconnected.")); | |
348 signoff(gc); | |
349 } else if (conn->type == AIM_CONN_TYPE_CHAT) { | |
350 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
351 char buf[BUF_LONG]; | |
352 debug_printf("disconnected from chat room %s\n", c->name); | |
353 c->conn = NULL; | |
354 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
355 gaim_input_remove(c->inpa); |
2086 | 356 c->inpa = 0; |
357 c->fd = -1; | |
358 aim_conn_kill(odata->sess, &conn); | |
359 sprintf(buf, _("You have been disconnected from chat room %s."), c->name); | |
360 do_error_dialog(buf, _("Chat Error!")); | |
361 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { | |
362 if (odata->cnpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
363 gaim_input_remove(odata->cnpa); |
2086 | 364 odata->cnpa = 0; |
365 debug_printf("removing chatnav input watcher\n"); | |
366 if (odata->create_exchange) { | |
367 odata->create_exchange = 0; | |
368 g_free(odata->create_name); | |
369 odata->create_name = NULL; | |
370 do_error_dialog(_("Chat is currently unavailable"), | |
371 _("Gaim - Chat")); | |
372 } | |
373 aim_conn_kill(odata->sess, &conn); | |
374 } else if (conn->type == AIM_CONN_TYPE_AUTH) { | |
375 if (odata->paspa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
376 gaim_input_remove(odata->paspa); |
2086 | 377 odata->paspa = 0; |
378 debug_printf("removing authconn input watcher\n"); | |
379 aim_conn_kill(odata->sess, &conn); | |
380 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
381 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
382 gaim_directim_disconnect(odata->sess, conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
383 else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
384 debug_printf("No handler for rendezvous disconnect (%d).\n", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
385 source); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
386 } |
2086 | 387 aim_conn_kill(odata->sess, &conn); |
388 } else { | |
389 debug_printf("holy crap! generic connection error! %d\n", | |
390 conn->type); | |
391 aim_conn_kill(odata->sess, &conn); | |
392 } | |
393 } | |
394 } | |
395 } | |
396 } | |
397 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
398 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
2086 | 399 char *s = g_strdup_vprintf(format, va); |
400 char buf[256]; | |
401 char *t; | |
402 struct gaim_connection *gc = sess->aux_data; | |
403 | |
404 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level); | |
405 t = g_strconcat(buf, s, NULL); | |
406 debug_printf(t); | |
407 if (t[strlen(t)-1] != '\n') | |
408 debug_printf("\n"); | |
409 g_free(t); | |
410 g_free(s); | |
411 } | |
412 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
413 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 414 { |
415 struct gaim_connection *gc = data; | |
416 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
417 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
418 aim_conn_t *conn; |
2086 | 419 |
420 if (!g_slist_find(connections, gc)) { | |
421 close(source); | |
422 return; | |
423 } | |
424 | |
425 odata = gc->proto_data; | |
426 sess = odata->sess; | |
427 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); | |
428 | |
429 if (source < 0) { | |
430 hide_login_progress(gc, _("Couldn't connect to host")); | |
431 signoff(gc); | |
432 return; | |
433 } | |
434 | |
435 aim_conn_completeconnect(sess, conn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
436 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, |
2086 | 437 oscar_callback, conn); |
438 debug_printf(_("Password sent, waiting for response\n")); | |
439 } | |
440 | |
441 static void oscar_login(struct aim_user *user) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
442 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
443 aim_conn_t *conn; |
2086 | 444 char buf[256]; |
445 struct gaim_connection *gc = new_gaim_conn(user); | |
446 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); | |
447 odata->create_exchange = 0; | |
448 | |
2589
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
449 if (isdigit(*user->username)) { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
450 odata->icq = TRUE; |
2589
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
451 /* this is odd but it's necessary for a proper do_import and do_export */ |
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
452 gc->protocol = PROTO_ICQ; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
453 gc->checkbox = _("Send offline message"); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
454 } else { |
2590
2dd86a1af92b
[gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2589
diff
changeset
|
455 gc->protocol = PROTO_TOC; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
456 gc->flags |= OPT_CONN_HTML; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
457 } |
2086 | 458 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
459 sess = g_new0(aim_session_t, 1); |
2086 | 460 |
461 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); | |
462 aim_setdebuggingcb(sess, oscar_debug); | |
463 | |
464 /* we need an immediate queue because we don't use a while-loop to | |
465 * see if things need to be sent. */ | |
466 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); | |
467 odata->sess = sess; | |
468 sess->aux_data = gc; | |
469 | |
470 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
471 if (conn == NULL) { | |
472 debug_printf(_("internal connection error\n")); | |
473 hide_login_progress(gc, _("Unable to login to AIM")); | |
474 signoff(gc); | |
475 return; | |
476 } | |
477 | |
478 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); | |
479 set_login_progress(gc, 2, buf); | |
480 | |
481 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); | |
482 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
483 | |
484 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
485 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? | |
486 user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER, | |
487 user->proto_opt[USEROPT_AUTHPORT][0] ? | |
488 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
489 oscar_login_connect, gc); | |
490 if (conn->fd < 0) { | |
491 hide_login_progress(gc, _("Couldn't connect to host")); | |
492 signoff(gc); | |
493 return; | |
494 } | |
495 aim_request_login(sess, conn, gc->username); | |
496 } | |
497 | |
498 static void oscar_close(struct gaim_connection *gc) { | |
499 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
500 | |
501 while (odata->oscar_chats) { | |
502 struct chat_connection *n = odata->oscar_chats->data; | |
503 if (n->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
504 gaim_input_remove(n->inpa); |
2086 | 505 g_free(n->name); |
506 g_free(n->show); | |
507 odata->oscar_chats = g_slist_remove(odata->oscar_chats, n); | |
508 g_free(n); | |
509 } | |
510 while (odata->direct_ims) { | |
511 struct direct_im *n = odata->direct_ims->data; | |
512 if (n->watcher > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
513 gaim_input_remove(n->watcher); |
2086 | 514 odata->direct_ims = g_slist_remove(odata->direct_ims, n); |
515 g_free(n); | |
516 } | |
517 while (odata->hasicons) { | |
518 struct icon_req *n = odata->hasicons->data; | |
519 g_free(n->user); | |
520 odata->hasicons = g_slist_remove(odata->hasicons, n); | |
521 g_free(n); | |
522 } | |
2754
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
523 if (odata->create_name) |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
524 g_free(odata->create_name); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
525 if (odata->email) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
526 g_free(odata->email); |
2754
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
527 if (odata->newp) |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
528 g_free(odata->newp); |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
529 if (odata->oldp) |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
530 g_free(odata->oldp); |
2086 | 531 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
532 gaim_input_remove(gc->inpa); |
2086 | 533 if (odata->cnpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
534 gaim_input_remove(odata->cnpa); |
2086 | 535 if (odata->paspa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
536 gaim_input_remove(odata->paspa); |
2086 | 537 aim_session_kill(odata->sess); |
538 g_free(odata->sess); | |
539 odata->sess = NULL; | |
540 g_free(gc->proto_data); | |
541 gc->proto_data = NULL; | |
542 debug_printf(_("Signed off.\n")); | |
543 } | |
544 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
545 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 546 struct gaim_connection *gc = data; |
547 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
548 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
549 aim_conn_t *bosconn; |
2086 | 550 |
551 if (!g_slist_find(connections, gc)) { | |
552 close(source); | |
553 return; | |
554 } | |
555 | |
556 odata = gc->proto_data; | |
557 sess = odata->sess; | |
558 bosconn = odata->conn; | |
559 | |
560 if (source < 0) { | |
561 hide_login_progress(gc, _("Could Not Connect")); | |
562 signoff(gc); | |
563 return; | |
564 } | |
565 | |
566 aim_conn_completeconnect(sess, bosconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
567 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, |
2086 | 568 oscar_callback, bosconn); |
569 set_login_progress(gc, 4, _("Connection established, cookie sent")); | |
570 } | |
571 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
572 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 573 va_list ap; |
2704 | 574 struct aim_authresp_info *info; |
2086 | 575 int i; char *host; int port; |
576 struct aim_user *user; | |
2704 | 577 aim_conn_t *bosconn; |
2086 | 578 |
579 struct gaim_connection *gc = sess->aux_data; | |
580 struct oscar_data *od = gc->proto_data; | |
581 user = gc->user; | |
582 port = user->proto_opt[USEROPT_AUTHPORT][0] ? | |
583 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
584 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
585 va_start(ap, fr); |
2704 | 586 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 587 va_end(ap); |
588 | |
2704 | 589 debug_printf("inside auth_resp (Screen name: %s)\n", info->sn); |
590 | |
591 if (info->errorcode || !info->bosip || !info->cookie) { | |
592 switch (info->errorcode) { | |
2086 | 593 case 0x05: |
594 /* Incorrect nick/password */ | |
595 hide_login_progress(gc, _("Incorrect nickname or password.")); | |
596 plugin_event(event_error, (void *)980, 0, 0, 0); | |
597 break; | |
598 case 0x11: | |
599 /* Suspended account */ | |
600 hide_login_progress(gc, _("Your account is currently suspended.")); | |
601 break; | |
602 case 0x18: | |
603 /* connecting too frequently */ | |
604 hide_login_progress(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); | |
605 plugin_event(event_error, (void *)983, 0, 0, 0); | |
606 break; | |
607 case 0x1c: | |
608 /* client too old */ | |
609 hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE)); | |
610 plugin_event(event_error, (void *)989, 0, 0, 0); | |
611 break; | |
612 default: | |
613 hide_login_progress(gc, _("Authentication Failed")); | |
614 break; | |
615 } | |
2704 | 616 debug_printf("Login Error Code 0x%04x\n", info->errorcode); |
617 debug_printf("Error URL: %s\n", info->errorurl); | |
2086 | 618 od->killme = TRUE; |
619 return 1; | |
620 } | |
621 | |
622 | |
2704 | 623 debug_printf("Reg status: %d\n", info->regstatus); |
624 if (info->email) { | |
625 debug_printf("Email: %s\n", info->email); | |
2086 | 626 } else { |
627 debug_printf("Email is NULL\n"); | |
628 } | |
2704 | 629 debug_printf("BOSIP: %s\n", info->bosip); |
2086 | 630 debug_printf("Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
631 aim_conn_kill(sess, &fr->conn); |
2086 | 632 |
633 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
634 if (bosconn == NULL) { | |
635 hide_login_progress(gc, _("Internal Error")); | |
636 od->killme = TRUE; | |
637 return 0; | |
638 } | |
639 | |
2675 | 640 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 641 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
642 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
643 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
644 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); | |
645 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
646 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
647 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
648 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
649 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
650 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); | |
651 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
652 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
653 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
654 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
655 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0); | |
656 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); | |
657 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
658 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 659 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
660 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
661 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
662 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
663 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
664 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
665 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
666 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
667 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_SIMPLEINFO, gaim_simpleinfo, 0); |
2086 | 668 |
669 ((struct oscar_data *)gc->proto_data)->conn = bosconn; | |
2704 | 670 for (i = 0; i < (int)strlen(info->bosip); i++) { |
671 if (info->bosip[i] == ':') { | |
672 port = atoi(&(info->bosip[i+1])); | |
2086 | 673 break; |
674 } | |
675 } | |
2704 | 676 host = g_strndup(info->bosip, i); |
2086 | 677 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
678 bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc); | |
679 g_free(host); | |
680 if (bosconn->fd < 0) { | |
681 hide_login_progress(gc, _("Could Not Connect")); | |
682 od->killme = TRUE; | |
683 return 0; | |
684 } | |
2704 | 685 aim_sendcookie(sess, bosconn, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
686 gaim_input_remove(gc->inpa); |
2704 | 687 |
2086 | 688 return 1; |
689 } | |
690 | |
691 struct pieceofcrap { | |
692 struct gaim_connection *gc; | |
693 unsigned long offset; | |
694 unsigned long len; | |
695 char *modname; | |
696 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
697 aim_conn_t *conn; |
2086 | 698 unsigned int inpa; |
699 }; | |
700 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
701 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 702 { |
703 struct pieceofcrap *pos = data; | |
704 struct oscar_data *od = pos->gc->proto_data; | |
705 char in = '\0'; | |
706 int x = 0; | |
707 unsigned char m[17]; | |
708 | |
709 while (read(pos->fd, &in, 1) == 1) { | |
710 if (in == '\n') | |
711 x++; | |
712 else if (in != '\r') | |
713 x = 0; | |
714 if (x == 2) | |
715 break; | |
716 in = '\0'; | |
717 } | |
718 if (in != '\n') { | |
719 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM." | |
720 " You may be disconnected shortly.", "Login Error"); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
721 gaim_input_remove(pos->inpa); |
2086 | 722 close(pos->fd); |
723 g_free(pos); | |
724 return; | |
725 } | |
726 read(pos->fd, m, 16); | |
727 m[16] = '\0'; | |
728 debug_printf("Sending hash: "); | |
729 for (x = 0; x < 16; x++) | |
730 debug_printf("%02x ", (unsigned char)m[x]); | |
731 debug_printf("\n"); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
732 gaim_input_remove(pos->inpa); |
2086 | 733 close(pos->fd); |
734 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
735 g_free(pos); | |
736 } | |
737 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
738 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 739 struct pieceofcrap *pos = data; |
740 char buf[BUF_LONG]; | |
741 | |
742 if (source < 0) { | |
743 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM." | |
744 " You may be disconnected shortly.", "Login Error"); | |
745 if (pos->modname) | |
746 g_free(pos->modname); | |
747 g_free(pos); | |
748 return; | |
749 } | |
750 | |
751 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA | |
752 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", | |
753 pos->offset, pos->len, pos->modname ? pos->modname : ""); | |
754 write(pos->fd, buf, strlen(buf)); | |
755 if (pos->modname) | |
756 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
757 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 758 return; |
759 } | |
760 | |
761 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
762 #define AIM_MAX_FILE_SIZE 98304 | |
763 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
764 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 765 va_list ap; |
766 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
767 fu32_t offset, len; |
2086 | 768 char *modname; |
769 int fd; | |
770 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
771 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
772 offset = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
773 len = (fu32_t)va_arg(ap, unsigned long); |
2086 | 774 modname = va_arg(ap, char *); |
775 va_end(ap); | |
776 | |
777 debug_printf("offset: %d, len: %d, file: %s\n", offset, len, modname ? modname : "aim.exe"); | |
778 if (len == 0) { | |
779 debug_printf("len is 0, hashing NULL\n"); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
780 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 781 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
782 return 1; | |
783 } | |
784 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
785 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
786 char *buf; | |
787 int i = 8; | |
788 if (modname) | |
789 i += strlen(modname); | |
790 buf = g_malloc(i); | |
791 i = 0; | |
792 if (modname) { | |
793 memcpy(buf, modname, strlen(modname)); | |
794 i += strlen(modname); | |
795 } | |
796 buf[i++] = offset & 0xff; | |
797 buf[i++] = (offset >> 8) & 0xff; | |
798 buf[i++] = (offset >> 16) & 0xff; | |
799 buf[i++] = (offset >> 24) & 0xff; | |
800 buf[i++] = len & 0xff; | |
801 buf[i++] = (len >> 8) & 0xff; | |
802 buf[i++] = (len >> 16) & 0xff; | |
803 buf[i++] = (len >> 24) & 0xff; | |
804 debug_printf("len + offset is invalid, hashing request\n"); | |
805 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); | |
806 g_free(buf); | |
807 return 1; | |
808 } | |
809 */ | |
810 | |
811 pos = g_new0(struct pieceofcrap, 1); | |
812 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
813 pos->conn = fr->conn; |
2086 | 814 |
815 pos->offset = offset; | |
816 pos->len = len; | |
817 pos->modname = modname ? g_strdup(modname) : NULL; | |
818 | |
819 fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos); | |
820 if (fd < 0) { | |
821 if (pos->modname) | |
822 g_free(pos->modname); | |
823 g_free(pos); | |
824 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM." | |
825 " You may be disconnected shortly.", "Login Error"); | |
826 } | |
827 pos->fd = fd; | |
828 | |
829 return 1; | |
830 } | |
831 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
832 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 833 #if 0 |
834 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; | |
835 #else | |
836 struct client_info_s info = AIM_CLIENTINFO_KNOWNGOOD; | |
837 #endif | |
838 char *key; | |
839 va_list ap; | |
840 struct gaim_connection *gc = sess->aux_data; | |
841 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
842 va_start(ap, fr); |
2086 | 843 key = va_arg(ap, char *); |
844 va_end(ap); | |
845 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
846 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
847 |
2086 | 848 return 1; |
849 } | |
850 | |
2675 | 851 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
2647 | 852 struct gaim_connection *gc = sess->aux_data; |
853 struct chat_connection *chatcon; | |
854 static int id = 1; | |
855 | |
2675 | 856 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
857 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0); | |
858 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); | |
859 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0); | |
860 | |
2672 | 861 aim_clientready(sess, fr->conn); |
2675 | 862 |
2647 | 863 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
864 chatcon->id = id; | |
865 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
866 | |
867 return 1; | |
868 } | |
869 | |
2675 | 870 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
871 | |
2647 | 872 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 873 |
874 aim_clientready(sess, fr->conn); | |
875 | |
876 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
877 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
878 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
879 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
880 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
881 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 882 struct gaim_connection *gc = data; |
883 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
884 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
885 aim_conn_t *tstconn; |
2086 | 886 |
887 if (!g_slist_find(connections, gc)) { | |
888 close(source); | |
889 return; | |
890 } | |
891 | |
892 odata = gc->proto_data; | |
893 sess = odata->sess; | |
894 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); | |
895 | |
896 if (source < 0) { | |
897 aim_conn_kill(sess, &tstconn); | |
898 debug_printf("unable to connect to chatnav server\n"); | |
899 return; | |
900 } | |
901 | |
902 aim_conn_completeconnect(sess, tstconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
903 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
904 oscar_callback, tstconn); |
2086 | 905 debug_printf("chatnav: connected\n"); |
906 } | |
907 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
908 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 909 { |
910 struct gaim_connection *gc = data; | |
911 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
912 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
913 aim_conn_t *tstconn; |
2086 | 914 |
915 if (!g_slist_find(connections, gc)) { | |
916 close(source); | |
917 return; | |
918 } | |
919 | |
920 odata = gc->proto_data; | |
921 sess = odata->sess; | |
922 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); | |
923 | |
924 if (source < 0) { | |
925 aim_conn_kill(sess, &tstconn); | |
926 debug_printf("unable to connect to authorizer\n"); | |
927 return; | |
928 } | |
929 | |
930 aim_conn_completeconnect(sess, tstconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
931 odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, |
2086 | 932 oscar_callback, tstconn); |
933 debug_printf("chatnav: connected\n"); | |
934 } | |
935 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
936 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 937 { |
938 struct chat_connection *ccon = data; | |
939 struct gaim_connection *gc = ccon->gc; | |
940 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
941 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
942 aim_conn_t *tstconn; |
2086 | 943 |
944 if (!g_slist_find(connections, gc)) { | |
945 close(source); | |
946 g_free(ccon->show); | |
947 g_free(ccon->name); | |
948 g_free(ccon); | |
949 return; | |
950 } | |
951 | |
952 odata = gc->proto_data; | |
953 sess = odata->sess; | |
954 tstconn = ccon->conn; | |
955 | |
956 if (source < 0) { | |
957 aim_conn_kill(sess, &tstconn); | |
958 g_free(ccon->show); | |
959 g_free(ccon->name); | |
960 g_free(ccon); | |
961 return; | |
962 } | |
963 | |
964 aim_conn_completeconnect(sess, ccon->conn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
965 ccon->inpa = gaim_input_add(tstconn->fd, |
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
966 GAIM_INPUT_READ, |
2086 | 967 oscar_callback, tstconn); |
968 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); | |
969 aim_chat_attachname(tstconn, ccon->name); | |
970 } | |
971 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
972 /* Hrmph. I don't know how to make this look better. --mid */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
973 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 974 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
975 fu16_t serviceid; |
2086 | 976 char *ip; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
977 fu8_t *cookie; |
2086 | 978 struct gaim_connection *gc = sess->aux_data; |
979 struct aim_user *user = gc->user; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
980 aim_conn_t *tstconn; |
2086 | 981 int i; |
982 char *host; | |
983 int port; | |
984 | |
985 port = user->proto_opt[USEROPT_AUTHPORT][0] ? | |
986 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
987 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
988 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
989 serviceid = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
990 ip = va_arg(ap, char *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
991 cookie = (fu8_t *)va_arg(ap, unsigned char *); |
2086 | 992 |
993 for (i = 0; i < (int)strlen(ip); i++) { | |
994 if (ip[i] == ':') { | |
995 port = atoi(&(ip[i+1])); | |
996 break; | |
997 } | |
998 } | |
999 host = g_strndup(ip, i); | |
1000 | |
1001 switch(serviceid) { | |
1002 case 0x7: /* Authorizer */ | |
1003 debug_printf("Reconnecting with authorizor...\n"); | |
1004 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
1005 if (tstconn == NULL) { | |
1006 debug_printf("unable to reconnect with authorizer\n"); | |
1007 g_free(host); | |
1008 return 1; | |
1009 } | |
2675 | 1010 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1011 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0); |
1012 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0); | |
1013 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0); | |
1014 | |
1015 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1016 tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc); | |
1017 if (tstconn->fd < 0) { | |
1018 aim_conn_kill(sess, &tstconn); | |
1019 debug_printf("unable to reconnect with authorizer\n"); | |
1020 g_free(host); | |
1021 return 1; | |
1022 } | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
1023 aim_sendcookie(sess, tstconn, cookie); |
2086 | 1024 break; |
1025 case 0xd: /* ChatNav */ | |
1026 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1027 if (tstconn == NULL) { | |
1028 debug_printf("unable to connect to chatnav server\n"); | |
1029 g_free(host); | |
1030 return 1; | |
1031 } | |
2675 | 1032 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1033 |
1034 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1035 tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc); | |
1036 if (tstconn->fd < 0) { | |
1037 aim_conn_kill(sess, &tstconn); | |
1038 debug_printf("unable to connect to chatnav server\n"); | |
1039 g_free(host); | |
1040 return 1; | |
1041 } | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
1042 aim_sendcookie(sess, tstconn, cookie); |
2086 | 1043 break; |
1044 case 0xe: /* Chat */ | |
1045 { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1046 char *roomname; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1047 fu16_t exchange; |
2086 | 1048 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1049 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1050 roomname = va_arg(ap, char *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1051 exchange = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1052 |
2086 | 1053 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1054 if (tstconn == NULL) { | |
1055 debug_printf("unable to connect to chat server\n"); | |
1056 g_free(host); | |
1057 return 1; | |
1058 } | |
1059 | |
2675 | 1060 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1061 | |
2086 | 1062 ccon = g_new0(struct chat_connection, 1); |
1063 ccon->conn = tstconn; | |
1064 ccon->gc = gc; | |
1065 ccon->fd = -1; | |
1066 ccon->name = g_strdup(roomname); | |
1067 ccon->exchange = exchange; | |
1068 ccon->show = extract_name(roomname); | |
1069 | |
1070 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1071 ccon->conn->fd = proxy_connect(host, port, oscar_chat_connect, ccon); | |
1072 if (ccon->conn->fd < 0) { | |
1073 aim_conn_kill(sess, &tstconn); | |
1074 debug_printf("unable to connect to chat server\n"); | |
1075 g_free(host); | |
1076 g_free(ccon->show); | |
1077 g_free(ccon->name); | |
1078 g_free(ccon); | |
1079 return 1; | |
1080 } | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
1081 aim_sendcookie(sess, tstconn, cookie); |
2086 | 1082 debug_printf("Connected to chat room %s exchange %d\n", roomname, exchange); |
1083 } | |
1084 break; | |
1085 default: /* huh? */ | |
1086 debug_printf("got redirect for unknown service 0x%04x\n", serviceid); | |
1087 break; | |
1088 } | |
1089 | |
1090 va_end(ap); | |
1091 | |
1092 g_free(host); | |
1093 return 1; | |
1094 } | |
1095 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1096 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1097 aim_userinfo_t *info; |
2086 | 1098 time_t time_idle; |
1099 int type = 0; | |
1100 struct gaim_connection *gc = sess->aux_data; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1101 struct oscar_data *od = gc->proto_data; |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1102 char *tmp; |
2713
34ddcb44a4d2
[gaim-migrate @ 2726]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
1103 int caps; |
2086 | 1104 |
1105 va_list ap; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1106 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1107 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1108 va_end(ap); |
1109 | |
2713
34ddcb44a4d2
[gaim-migrate @ 2726]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
1110 caps = info->capabilities; |
34ddcb44a4d2
[gaim-migrate @ 2726]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
1111 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1112 if (!od->icq) { |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1113 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1114 type |= UC_AB; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1115 if (info->flags & AIM_FLAG_UNCONFIRMED) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1116 type |= UC_UNCONFIRMED; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1117 if (info->flags & AIM_FLAG_ADMINISTRATOR) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1118 type |= UC_ADMIN; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1119 if (info->flags & AIM_FLAG_AOL) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1120 type |= UC_AOL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1121 if (info->flags & AIM_FLAG_FREE) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1122 type |= UC_NORMAL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1123 if (info->flags & AIM_FLAG_AWAY) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1124 type |= UC_UNAVAILABLE; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1125 } else { |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1126 if (info->icqinfo.status) { |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1127 type = (info->icqinfo.status << 6); |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1128 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT)) |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1129 type |= UC_UNAVAILABLE; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1130 } |
2734
9fc65bb80596
[gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2717
diff
changeset
|
1131 if (caps & AIM_CAPS_ICQ) |
9fc65bb80596
[gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2717
diff
changeset
|
1132 caps ^= AIM_CAPS_ICQ; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1133 debug_printf("icq status: %d\n", info->icqinfo.status); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1134 } |
2086 | 1135 |
1136 if (info->idletime) { | |
1137 time(&time_idle); | |
1138 time_idle -= info->idletime*60; | |
1139 } else | |
1140 time_idle = 0; | |
1141 | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1142 tmp = g_strdup(normalize(gc->username)); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1143 if (!strcmp(tmp, normalize(info->sn))) |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1144 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1145 g_free(tmp); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1146 |
2698
e80f4b4f840f
[gaim-migrate @ 2711]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2689
diff
changeset
|
1147 serv_got_update(gc, info->sn, 1, info->warnlevel/10, time(NULL) - info->sessionlen, |
2713
34ddcb44a4d2
[gaim-migrate @ 2726]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
1148 time_idle, type, caps); |
2086 | 1149 |
1150 return 1; | |
1151 } | |
1152 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1153 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1154 aim_userinfo_t *info; |
2086 | 1155 va_list ap; |
1156 struct gaim_connection *gc = sess->aux_data; | |
1157 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1158 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1159 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1160 va_end(ap); |
1161 | |
1162 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0); | |
1163 | |
1164 return 1; | |
1165 } | |
1166 | |
1167 static void cancel_direct_im(gpointer w, struct ask_direct *d) { | |
1168 debug_printf("Freeing DirectIM prompts.\n"); | |
1169 | |
1170 g_free(d->sn); | |
1171 g_free(d); | |
1172 } | |
1173 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1174 static void oscar_directim_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1175 struct direct_im *dim = data; |
1176 struct gaim_connection *gc = dim->gc; | |
1177 struct oscar_data *od = gc->proto_data; | |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
1178 struct conversation *cnv; |
2086 | 1179 char buf[256]; |
1180 | |
1181 if (!g_slist_find(connections, gc)) { | |
1182 g_free(dim); | |
1183 return; | |
1184 } | |
1185 | |
1186 if (source < 0) { | |
1187 g_free(dim); | |
1188 return; | |
1189 } | |
1190 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1191 if (dim->conn->fd != source) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1192 dim->conn->fd = source; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1193 |
2086 | 1194 aim_conn_completeconnect(od->sess, dim->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1195 if (!(cnv = find_conversation(dim->name))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1196 cnv = new_conversation(dim->name); |
2086 | 1197 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
1198 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); |
2086 | 1199 |
1200 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
1201 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1202 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 1203 oscar_callback, dim->conn); |
1204 } | |
1205 | |
1206 static int accept_direct_im(gpointer w, struct ask_direct *d) { | |
1207 struct gaim_connection *gc = d->gc; | |
1208 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
1209 struct direct_im *dim; | |
1210 char *host; int port = FAIM_LOGIN_PORT; | |
1211 int i; | |
1212 | |
1213 debug_printf("Accepted DirectIM.\n"); | |
1214 | |
1215 dim = find_direct_im(od, d->sn); | |
1216 if (dim) { | |
1217 cancel_direct_im(w, d); /* 40 */ | |
1218 return TRUE; | |
1219 } | |
1220 dim = g_new0(struct direct_im, 1); | |
1221 dim->gc = d->gc; | |
1222 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
1223 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1224 dim->conn = aim_directim_connect(od->sess, d->sn, NULL, d->cookie); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1225 if (!dim->conn) { |
2086 | 1226 g_free(dim); |
1227 cancel_direct_im(w, d); | |
1228 return TRUE; | |
1229 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1230 |
2086 | 1231 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
1232 gaim_directim_incoming, 0); | |
1233 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, | |
1234 gaim_directim_typing, 0); | |
1235 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1236 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1237 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1238 port = atoi(&(d->ip[i+1])); |
2086 | 1239 break; |
1240 } | |
1241 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1242 host = g_strndup(d->ip, i); |
2086 | 1243 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
1244 dim->conn->fd = proxy_connect(host, port, oscar_directim_callback, dim); | |
1245 g_free(host); | |
1246 if (dim->conn->fd < 0) { | |
1247 aim_conn_kill(od->sess, &dim->conn); | |
1248 g_free(dim); | |
1249 cancel_direct_im(w, d); | |
1250 return TRUE; | |
1251 } | |
1252 | |
1253 cancel_direct_im(w, d); | |
1254 | |
1255 return TRUE; | |
1256 } | |
1257 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1258 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1259 char *tmp = g_malloc(BUF_LONG); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1260 struct gaim_connection *gc = sess->aux_data; |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1261 int flags = 0; |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1262 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1263 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1264 flags |= IM_FLAG_AWAY; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1265 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1266 if (args->icbmflags & AIM_IMFLAGS_HASICON) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1267 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1268 struct icon_req *ir = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1269 GSList *h = od->hasicons; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1270 char *who = normalize(userinfo->sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1271 debug_printf("%s has an icon\n", userinfo->sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1272 while (h) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1273 ir = h->data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1274 if (!strcmp(ir->user, who)) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1275 break; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1276 h = h->next; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1277 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1278 if (!h) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1279 ir = g_new0(struct icon_req, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1280 ir->user = g_strdup(who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1281 od->hasicons = g_slist_append(od->hasicons, ir); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1282 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1283 if ((args->iconlen != ir->length) || |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1284 (args->iconsum != ir->checksum) || |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1285 (args->iconstamp != ir->timestamp)) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1286 ir->request = TRUE; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1287 ir->length = args->iconlen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1288 ir->checksum = args->iconsum; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1289 ir->timestamp = args->iconstamp; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1290 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1291 |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1292 if (gc->user->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1293 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1294 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1295 |
2248
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
1296 if (!stat(gc->user->iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1297 char *buf = g_malloc(st.st_size); |
2248
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
1298 file = fopen(gc->user->iconfile, "r"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1299 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
1300 int len = fread(buf, 1, st.st_size, file); |
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
1301 debug_printf("Sending buddy icon to %s (%d bytes, %d reported)\n", |
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
1302 userinfo->sn, len, st.st_size); |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
1303 aim_send_icon(sess, userinfo->sn, buf, st.st_size, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1304 st.st_mtime, aim_iconsum(buf, st.st_size)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1305 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1306 } else |
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1307 debug_printf("Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1308 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1309 } else |
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1310 debug_printf("Can't stat buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1311 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1312 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1313 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1314 * Quickly convert it to eight bit format, replacing |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1315 * non-ASCII UNICODE characters with their equivelent |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1316 * HTML entity. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1317 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1318 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1319 int i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1320 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1321 for (i = 0, tmp[0] = '\0'; i < args->msglen; i += 2) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1322 unsigned short uni; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1323 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1324 uni = ((args->msg[i] & 0xff) << 8) | (args->msg[i+1] & 0xff); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1325 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1326 if ((uni < 128) || ((uni >= 160) && (uni <= 255))) { /* ISO 8859-1 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1327 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1328 g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "%c", uni); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1329 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1330 } else { /* something else, do UNICODE entity */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1331 g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "&#%04x;", uni); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1332 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1333 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1334 } else |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1335 g_snprintf(tmp, BUF_LONG, "%s", args->msg); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1336 |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1337 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1338 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1339 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1340 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1341 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1342 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1343 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1344 struct gaim_connection *gc = sess->aux_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1345 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1346 if (args->reqclass & AIM_CAPS_CHAT) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1347 char *name = extract_name(args->info.chat.roominfo.name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1348 int *exch = g_new0(int, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1349 GList *m = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1350 m = g_list_append(m, g_strdup(name ? name : args->info.chat.roominfo.name)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1351 *exch = args->info.chat.roominfo.exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1352 m = g_list_append(m, exch); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1353 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1354 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1355 userinfo->sn, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1356 args->info.chat.msg, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1357 m); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1358 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1359 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1360 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1361 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1362 } else if (args->reqclass & AIM_CAPS_VOICE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1363 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1364 set_icon_data(gc, normalize(userinfo->sn), args->info.icon.icon, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1365 args->info.icon.length); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1366 } else if (args->reqclass & AIM_CAPS_IMIMAGE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1367 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1368 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1369 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1370 debug_printf("%s received direct im request from %s (%s)\n", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1371 gc->username, userinfo->sn, args->info.imimage.ip); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1372 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1373 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1374 d->sn = g_strdup(userinfo->sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1375 strncpy(d->ip, args->info.imimage.ip, sizeof(d->ip)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1376 memcpy(d->cookie, args->cookie, 8); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1377 g_snprintf(buf, sizeof buf, "%s has just asked to directly connect to %s.", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1378 userinfo->sn, gc->username); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1379 do_ask_dialog(buf, d, accept_direct_im, cancel_direct_im); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1380 } else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1381 debug_printf("Unknown reqclass %d\n", args->reqclass); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1382 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1383 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1384 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1385 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1386 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1387 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1388 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1389 int channel, ret = 0; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1390 aim_userinfo_t *userinfo; |
2086 | 1391 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1392 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1393 va_start(ap, fr); |
2086 | 1394 channel = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1395 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 1396 |
1397 /* channel 1: standard message */ | |
1398 if (channel == 1) { | |
1399 struct aim_incomingim_ch1_args *args; | |
1400 | |
1401 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1402 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1403 ret = incomingim_chan1(sess, fr->conn, userinfo, args); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1404 |
2086 | 1405 } else if (channel == 2) { |
1406 struct aim_incomingim_ch2_args *args; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1407 |
2086 | 1408 args = va_arg(ap, struct aim_incomingim_ch2_args *); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1409 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1410 ret = incomingim_chan2(sess, fr->conn, userinfo, args); |
2086 | 1411 } |
1412 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1413 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1414 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1415 return ret; |
2086 | 1416 } |
1417 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1418 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1419 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1420 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1421 aim_userinfo_t *userinfo; |
2086 | 1422 char buf[1024]; |
1423 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1424 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1425 chan = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1426 userinfo = va_arg(ap, aim_userinfo_t *); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1427 nummissed = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1428 reason = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1429 va_end(ap); |
1430 | |
1431 switch(reason) { | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1432 case 0: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1433 /* Invalid (0) */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1434 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1435 sizeof(buf), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1436 _("You missed %d message%s from %s because %s invalid."), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1437 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1438 nummissed == 1 ? "" : "s", |
2432
2a4a50036e25
[gaim-migrate @ 2445]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2427
diff
changeset
|
1439 userinfo->sn, |
2a4a50036e25
[gaim-migrate @ 2445]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2427
diff
changeset
|
1440 nummissed == 1 ? "it was" : "they were"); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1441 break; |
2086 | 1442 case 1: |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1443 /* Message too large */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1444 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1445 sizeof(buf), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1446 _("You missed %d message%s from %s because %s too large."), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1447 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1448 nummissed == 1 ? "" : "s", |
2432
2a4a50036e25
[gaim-migrate @ 2445]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2427
diff
changeset
|
1449 userinfo->sn, |
2a4a50036e25
[gaim-migrate @ 2445]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2427
diff
changeset
|
1450 nummissed == 1 ? "it was" : "they were"); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1451 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1452 case 2: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1453 /* Rate exceeded */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1454 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1455 sizeof(buf), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1456 _("You missed %d message%s from %s because the rate limit has been exceeded."), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1457 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1458 nummissed == 1 ? "" : "s", |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1459 userinfo->sn); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1460 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1461 case 3: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1462 /* Evil Sender */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1463 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1464 sizeof(buf), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1465 _("You missed %d message%s from %s because they are too evil."), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1466 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1467 nummissed == 1 ? "" : "s", |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1468 userinfo->sn); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1469 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1470 case 4: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1471 /* Evil Receiver */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1472 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1473 sizeof(buf), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1474 _("You missed %d message%s from %s because you are too evil."), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1475 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1476 nummissed == 1 ? "" : "s", |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1477 userinfo->sn); |
2086 | 1478 break; |
1479 default: | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1480 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1481 sizeof(buf), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1482 _("You missed %d message%s from %s for unknown reasons."), |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1483 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1484 nummissed == 1 ? "" : "s", |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1485 userinfo->sn); |
2086 | 1486 break; |
1487 } | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1488 do_error_dialog(buf, _("Gaim - Error")); |
2086 | 1489 |
1490 return 1; | |
1491 } | |
1492 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1493 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1494 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1495 fu16_t reason; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1496 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1497 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1498 reason = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1499 va_end(ap); |
1500 | |
1501 debug_printf("snac threw error (reason 0x%04x: %s\n", reason, | |
1502 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); | |
1503 | |
1504 return 1; | |
1505 } | |
1506 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1507 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1508 va_list ap; |
1509 char *destn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1510 fu16_t reason; |
2086 | 1511 char buf[1024]; |
1512 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1513 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1514 reason = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1515 destn = va_arg(ap, char *); |
1516 va_end(ap); | |
1517 | |
1518 sprintf(buf, _("Your message to %s did not get sent: %s"), destn, | |
1519 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); | |
1520 do_error_dialog(buf, _("Gaim - Error")); | |
1521 | |
1522 return 1; | |
1523 } | |
1524 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1525 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1526 va_list ap; |
1527 char *destn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1528 fu16_t reason; |
2086 | 1529 char buf[1024]; |
1530 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1531 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1532 reason = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1533 destn = va_arg(ap, char *); |
1534 va_end(ap); | |
1535 | |
1536 sprintf(buf, _("User information for %s unavailable: %s"), destn, | |
1537 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); | |
1538 do_error_dialog(buf, _("Gaim - Error")); | |
1539 | |
1540 return 1; | |
1541 } | |
1542 | |
1543 static char *images(int flags) { | |
1544 static char buf[1024]; | |
2679 | 1545 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s", |
1546 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", | |
2086 | 1547 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
1548 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
1549 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", | |
1550 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : ""); | |
1551 return buf; | |
1552 } | |
1553 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1554 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1555 aim_userinfo_t *info; |
2086 | 1556 char *prof_enc = NULL, *prof = NULL; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1557 fu16_t infotype; |
2086 | 1558 char buf[BUF_LONG]; |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
1559 char legend[BUF_LONG]; |
2086 | 1560 struct gaim_connection *gc = sess->aux_data; |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1561 gboolean away; |
2086 | 1562 va_list ap; |
1563 char *asc; | |
1564 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1565 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1566 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1567 prof_enc = va_arg(ap, char *); |
1568 prof = va_arg(ap, char *); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1569 infotype = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1570 va_end(ap); |
1571 | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1572 g_snprintf(legend, sizeof legend, |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1573 _("<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>" |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1574 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>" |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1575 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>" |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1576 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>" |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1577 "<IMG SRC=\"admin_icon.gif\"> : Administrator")); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1578 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1579 away = infotype != AIM_GETINFO_GENERALINFO; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1580 if (away && (!prof || !*prof)) { |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1581 g_show_info_text(gc, info->sn, away, legend, NULL); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1582 return 1; |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1583 } |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1584 |
2086 | 1585 if (info->membersince) |
1586 asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n", | |
1587 asctime(localtime(&info->membersince))); | |
1588 else | |
1589 asc = g_strdup(""); | |
1590 g_snprintf(buf, sizeof buf, | |
1591 _("Username : <B>%s</B> %s <BR>\n" | |
1592 "%s" | |
1593 "Warning Level : <B>%d %%</B><BR>\n" | |
1594 "Online Since : <B>%s</B><BR>\n" | |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
1595 "Idle Minutes : <B>%d</B>\n<BR>\n<HR><BR>\n"), |
2086 | 1596 info->sn, images(info->flags), |
1597 asc, | |
1598 info->warnlevel/10, | |
1599 asctime(localtime(&info->onlinesince)), | |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
1600 info->idletime); |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1601 g_free(asc); |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1602 |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1603 g_show_info_text(gc, info->sn, away, away ? "<br><hr>" : buf, |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
1604 (prof && strlen(prof)) ? |
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
1605 away_subs(prof, gc->username) |
2086 | 1606 : |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1607 away ? |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1608 _("<i>User has no away message</i>") : |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1609 _("<i>No Information Provided</i>"), |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1610 away ? legend : NULL, |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
1611 NULL); |
2086 | 1612 |
1613 return 1; | |
1614 } | |
1615 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1616 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1617 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1618 fu16_t id; |
2086 | 1619 va_list ap; |
1620 char buildbuf[150]; | |
1621 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1622 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1623 id = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1624 msg = va_arg(ap, char *); |
1625 va_end(ap); | |
1626 | |
1627 aim_getbuildstring(buildbuf, sizeof(buildbuf)); | |
1628 | |
1629 debug_printf("MOTD: %s (%d)\n", msg ? msg : "Unknown", id); | |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
1630 if (id < 4) |
2086 | 1631 do_error_dialog(_("Your connection may be lost."), |
1632 _("AOL error")); | |
1633 | |
1634 return 1; | |
1635 } | |
1636 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1637 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1638 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1639 fu16_t type; |
2086 | 1640 struct gaim_connection *gc = sess->aux_data; |
1641 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
1642 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1643 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1644 type = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1645 |
1646 switch(type) { | |
1647 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1648 fu8_t maxrooms; |
2086 | 1649 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1650 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1651 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1652 maxrooms = (fu8_t)va_arg(ap, unsigned int); |
2086 | 1653 exchangecount = va_arg(ap, int); |
1654 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
1655 va_end(ap); | |
1656 | |
1657 debug_printf("chat info: Chat Rights:\n"); | |
1658 debug_printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms); | |
1659 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1660 for (i = 0; i < exchangecount; i++) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1661 debug_printf("chat info: \t\t%d\n", exchanges[i].number); |
2086 | 1662 if (odata->create_exchange) { |
1663 debug_printf("creating room %s\n", odata->create_name); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1664 aim_chatnav_createroom(sess, fr->conn, odata->create_name, |
2086 | 1665 odata->create_exchange); |
1666 odata->create_exchange = 0; | |
1667 g_free(odata->create_name); | |
1668 odata->create_name = NULL; | |
1669 } | |
1670 } | |
1671 break; | |
1672 case 0x0008: { | |
1673 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1674 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1675 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1676 fu32_t createtime; |
2086 | 1677 |
1678 fqcn = va_arg(ap, char *); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1679 instance = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1680 exchange = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1681 flags = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1682 createtime = va_arg(ap, fu32_t); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1683 maxmsglen = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1684 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1685 createperms = (fu8_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1686 unknown = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1687 name = va_arg(ap, char *); |
1688 ck = va_arg(ap, char *); | |
1689 va_end(ap); | |
1690 | |
1691 debug_printf("created room: %s %d %d %d %lu %d %d %d %d %s %s\n", | |
1692 fqcn, | |
1693 exchange, instance, flags, | |
1694 createtime, | |
1695 maxmsglen, maxoccupancy, createperms, unknown, | |
1696 name, ck); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1697 aim_chat_join(odata->sess, odata->conn, exchange, ck, instance); |
2086 | 1698 } |
1699 break; | |
1700 default: | |
1701 va_end(ap); | |
1702 debug_printf("chatnav info: unknown type (%04x)\n", type); | |
1703 break; | |
1704 } | |
1705 return 1; | |
1706 } | |
1707 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1708 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1709 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1710 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1711 aim_userinfo_t *info; |
2086 | 1712 struct gaim_connection *g = sess->aux_data; |
1713 | |
1714 struct chat_connection *c = NULL; | |
1715 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1716 va_start(ap, fr); |
2086 | 1717 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1718 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1719 va_end(ap); |
1720 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1721 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 1722 if (!c) |
1723 return 1; | |
1724 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1725 for (i = 0; i < count; i++) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1726 add_chat_buddy(c->cnv, info[i].sn); |
2086 | 1727 |
1728 return 1; | |
1729 } | |
1730 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1731 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1732 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1733 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1734 aim_userinfo_t *info; |
2086 | 1735 struct gaim_connection *g = sess->aux_data; |
1736 | |
1737 struct chat_connection *c = NULL; | |
1738 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1739 va_start(ap, fr); |
2086 | 1740 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1741 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1742 va_end(ap); |
1743 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1744 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 1745 if (!c) |
1746 return 1; | |
1747 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1748 for (i = 0; i < count; i++) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1749 remove_chat_buddy(c->cnv, info[i].sn); |
2086 | 1750 |
1751 return 1; | |
1752 } | |
1753 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1754 static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1755 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1756 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1757 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1758 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1759 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1760 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1761 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1762 fu32_t creationtime; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1763 struct gaim_connection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1764 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1765 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1766 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1767 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1768 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1769 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1770 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1771 roomdesc = va_arg(ap, char *); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1772 unknown_c9 = (fu16_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1773 creationtime = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1774 maxmsglen = (fu16_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1775 unknown_d2 = (fu16_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1776 unknown_d5 = (fu16_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1777 maxvisiblemsglen = (fu16_t)va_arg(ap, int); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1778 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1779 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1780 debug_printf("inside chat_info_update (maxmsglen = %d, maxvislen = %d)\n", |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1781 maxmsglen, maxvisiblemsglen); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1782 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1783 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1784 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1785 |
2086 | 1786 return 1; |
1787 } | |
1788 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1789 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1790 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1791 aim_userinfo_t *info; |
2086 | 1792 char *msg; |
1793 struct gaim_connection *gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1794 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
2086 | 1795 char *tmp; |
1796 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1797 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1798 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1799 msg = va_arg(ap, char *); |
1800 | |
1801 tmp = g_malloc(BUF_LONG); | |
1802 g_snprintf(tmp, BUF_LONG, "%s", msg); | |
1803 serv_got_chat_in(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL)); | |
1804 g_free(tmp); | |
1805 | |
1806 return 1; | |
1807 } | |
1808 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1809 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1810 * Recieved in response to an IM sent with the AIM_IMFLAGS_ACK option. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1811 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1812 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1813 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1814 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1815 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1816 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1817 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1818 type = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1819 sn = va_arg(ap, char *); |
1820 va_end(ap); | |
1821 | |
1822 debug_printf("Sent message to %s.\n", sn); | |
1823 | |
1824 return 1; | |
1825 } | |
1826 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1827 static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1828 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1829 "invalid", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1830 "change", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1831 "warning", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1832 "limit", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1833 "limit cleared", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1834 }; |
2086 | 1835 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1836 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1837 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1838 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1839 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1840 code = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1841 rateclass= (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1842 windowsize = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1843 clear = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1844 alert = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1845 limit = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1846 disconnect = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1847 currentavg = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1848 maxavg = (fu32_t)va_arg(ap, unsigned long); |
2086 | 1849 va_end(ap); |
1850 | |
1851 debug_printf("rate %s (paramid 0x%04lx): curavg = %ld, maxavg = %ld, alert at %ld, " | |
1852 "clear warning at %ld, limit at %ld, disconnect at %ld (window size = %ld)\n", | |
1853 (code < 5) ? codes[code] : codes[0], | |
1854 rateclass, | |
1855 currentavg, maxavg, | |
1856 alert, clear, | |
1857 limit, disconnect, | |
1858 windowsize); | |
1859 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1860 /* XXX fix these values */ |
2086 | 1861 if (code == AIM_RATE_CODE_CHANGE) { |
1862 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1863 aim_conn_setlatency(fr->conn, 0); |
2086 | 1864 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1865 aim_conn_setlatency(fr->conn, windowsize/4); |
2086 | 1866 } else if (code == AIM_RATE_CODE_LIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1867 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 1868 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1869 aim_conn_setlatency(fr->conn, 0); |
2086 | 1870 } |
1871 | |
1872 return 1; | |
1873 } | |
1874 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1875 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1876 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1877 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1878 aim_userinfo_t *userinfo; |
2086 | 1879 struct gaim_connection *gc = sess->aux_data; |
1880 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1881 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1882 newevil = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1883 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 1884 va_end(ap); |
1885 | |
1886 serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, newevil / 10); | |
1887 | |
1888 return 1; | |
1889 } | |
1890 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1891 static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1892 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1893 aim_userinfo_t *info; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1894 struct gaim_connection *gc = sess->aux_data; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1895 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1896 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1897 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1898 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1899 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1900 gc->evil = info->warnlevel/10; |
2698
e80f4b4f840f
[gaim-migrate @ 2711]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2689
diff
changeset
|
1901 /* gc->correction_time = (info->onlinesince - gc->login_time); */ |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1902 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1903 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1904 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1905 |
2675 | 1906 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1907 struct gaim_connection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1908 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
1909 aim_reqpersonalinfo(sess, fr->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1910 aim_bos_reqlocaterights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1911 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1912 aim_bos_reqbuddyrights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1913 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1914 account_online(gc); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1915 serv_finish_login(gc); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1916 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1917 if (bud_list_cache_exists(gc)) |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2361
diff
changeset
|
1918 do_import(gc, NULL); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1919 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1920 debug_printf("buddy list loaded\n"); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1921 |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
1922 aim_reqicbmparams(sess); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1923 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1924 aim_bos_reqrights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1925 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1926 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1927 AIM_PRIVFLAGS_ALLOWMEMBERSINCE); |
2086 | 1928 |
1929 return 1; | |
1930 } | |
1931 | |
2675 | 1932 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
2647 | 1933 struct gaim_connection *gc = sess->aux_data; |
1934 struct oscar_data *od = gc->proto_data; | |
1935 | |
2672 | 1936 aim_clientready(sess, fr->conn); |
2675 | 1937 debug_printf("connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1938 |
2647 | 1939 if (od->chpass) { |
1940 debug_printf("changing password\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
1941 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 1942 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1943 od->oldp = NULL; |
2647 | 1944 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1945 od->newp = NULL; |
2647 | 1946 od->chpass = FALSE; |
1947 } | |
1948 if (od->conf) { | |
1949 debug_printf("confirming account\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
1950 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 1951 od->conf = FALSE; |
1952 } | |
1953 if (od->reqemail) { | |
1954 debug_printf("requesting email\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
1955 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 1956 od->reqemail = FALSE; |
1957 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1958 if (od->setemail) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1959 debug_printf("setting email\n"); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1960 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1961 g_free(od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1962 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1963 } |
2647 | 1964 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1965 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1966 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1967 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1968 static int gaim_icbm_param_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1969 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1970 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1971 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1972 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1973 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1974 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1975 |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
1976 /* evidently this crashes on solaris. i have no clue why |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1977 debug_printf("ICBM Parameters: maxchannel = %d, default flags = 0x%08lx, max msg len = %d, " |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1978 "max sender evil = %f, max receiver evil = %f, min msg interval = %ld\n", |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1979 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1980 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1981 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
1982 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1983 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1984 /* Maybe senderwarn and recverwarn should be user preferences... */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1985 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1986 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1987 |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
1988 aim_seticbmparam(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1989 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1990 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1991 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1992 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1993 /* XXX this is frivelous... do you really want to know this info? */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1994 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1995 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1996 fu16_t maxbuddies, maxwatchers; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1997 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1998 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1999 maxbuddies = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2000 maxwatchers = (fu16_t)va_arg(ap, unsigned int); |
2086 | 2001 va_end(ap); |
2002 | |
2003 debug_printf("buddy list rights: Max buddies = %d / Max watchers = %d\n", maxbuddies, maxwatchers); | |
2004 | |
2005 return 1; | |
2006 } | |
2007 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2008 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2009 fu16_t maxpermits, maxdenies; |
2086 | 2010 va_list ap; |
2011 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2012 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2013 maxpermits = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2014 maxdenies = (fu16_t)va_arg(ap, unsigned int); |
2086 | 2015 va_end(ap); |
2016 | |
2017 debug_printf("BOS rights: Max permit = %d / Max deny = %d\n", maxpermits, maxdenies); | |
2018 | |
2672 | 2019 aim_clientready(sess, fr->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2020 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2021 aim_icq_reqofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2022 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2023 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
2086 | 2024 |
2025 return 1; | |
2026 } | |
2027 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2028 static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2029 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2030 struct aim_icq_offlinemsg *msg; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2031 struct gaim_connection *gc = sess->aux_data; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2032 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2033 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2034 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2035 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2036 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2037 if (msg->type == 0x0001) { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2038 char sender[32]; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2039 time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2040 g_snprintf(sender, sizeof(sender), "%lu", msg->sender); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2041 serv_got_im(gc, sender, msg->msg, 0, t); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2042 } else { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2043 debug_printf("unknown offline message type 0x%04x\n", msg->type); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2044 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2045 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2046 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2047 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2048 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2049 static int gaim_offlinemsgdone(aim_session_t *sess, aim_frame_t *fr, ...) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2050 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2051 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2052 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2053 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2054 |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2055 static int gaim_simpleinfo(aim_session_t *sess, aim_frame_t *fr, ...) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2056 { |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2057 struct gaim_connection *gc = sess->aux_data; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2058 va_list ap; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2059 struct aim_icq_simpleinfo *info; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2060 char buf[16 * 1024]; |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2061 char who[16]; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2062 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2063 va_start(ap, fr); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2064 info = va_arg(ap, struct aim_icq_simpleinfo *); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2065 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2066 |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2067 g_snprintf(who, sizeof who, "%lu", info->uin); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2068 g_snprintf(buf, sizeof buf, |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2069 "<B>UIN:</B> %lu<BR>" |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2070 "<B>Nick:</B> %s<BR>" |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2071 "<B>Name:</B> %s %s<BR>" |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2072 "<B>Email:</B> %s\n", |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2073 info->uin, |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2074 info->nick, |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2075 info->first, info->last, |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2076 info->email); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2077 |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2078 g_show_info_text(gc, who, FALSE, buf, NULL); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2079 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2080 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2081 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2082 |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2083 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2084 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2085 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2086 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2087 va_list ap; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2088 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2089 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2090 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2091 url = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2092 wid = (fu16_t)va_arg(ap, int); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2093 hei = (fu16_t)va_arg(ap, int); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2094 delay = (fu16_t)va_arg(ap, int); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2095 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2096 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2097 serv_got_popup(msg, url, wid, hei); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2098 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2099 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2100 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2101 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2102 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2103 va_list ap; |
2104 char *address, *SNs; | |
2105 int i, num; | |
2106 char *buf; | |
2107 int at = 0, len; | |
2108 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2109 va_start(ap, fr); |
2086 | 2110 address = va_arg(ap, char *); |
2111 num = va_arg(ap, int); | |
2112 SNs = va_arg(ap, char *); | |
2113 va_end(ap); | |
2114 | |
2115 len = num * (MAXSNLEN + 1) + 1024; | |
2116 buf = g_malloc(len); | |
2117 at += g_snprintf(buf + at, len - at, "<B>%s has the following screen names:</B><BR>", address); | |
2118 for (i = 0; i < num; i++) | |
2119 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]); | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2120 g_show_info_text(NULL, NULL, FALSE, buf, NULL); |
2086 | 2121 g_free(buf); |
2122 | |
2123 return 1; | |
2124 } | |
2125 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2126 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2127 va_list ap; |
2128 char *address; | |
2129 char buf[BUF_LONG]; | |
2130 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2131 va_start(ap, fr); |
2086 | 2132 address = va_arg(ap, char *); |
2133 va_end(ap); | |
2134 | |
2135 g_snprintf(buf, sizeof(buf), "No results found for email address %s", address); | |
2136 do_error_dialog(buf, _("Error")); | |
2137 | |
2138 return 1; | |
2139 } | |
2140 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2141 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2142 fu16_t status; |
2086 | 2143 va_list ap; |
2144 char msg[256]; | |
2145 struct gaim_connection *gc = sess->aux_data; | |
2146 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2147 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2148 status = (fu16_t)va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 2149 va_end(ap); |
2150 | |
2151 debug_printf("account confirmation returned status 0x%04x (%s)\n", status, | |
2152 status ? "email sent" : "unknown"); | |
2153 if (status) { | |
2154 g_snprintf(msg, sizeof(msg), "You should receive an email asking to confirm %s.", | |
2155 gc->username); | |
2156 do_error_dialog(msg, "Confirm"); | |
2157 } | |
2158 | |
2159 return 1; | |
2160 } | |
2161 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2162 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2163 int change, str; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2164 fu16_t perms, type, length; |
2086 | 2165 char *val; |
2166 va_list ap; | |
2167 char buf[BUF_LONG]; | |
2168 struct gaim_connection *gc = sess->aux_data; | |
2169 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2170 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2171 change = va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2172 perms = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2173 type = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2174 length = (fu16_t)va_arg(ap, unsigned int); |
2086 | 2175 val = va_arg(ap, char *); |
2176 str = va_arg(ap, int); | |
2177 va_end(ap); | |
2178 | |
2179 debug_printf("info%s: perms = %d, type = %x, length = %d, val = %s\n", | |
2180 change ? " change" : "", perms, type, length, str ? val : "(not string)"); | |
2181 | |
2182 if ((type == 0x0011) && str) { | |
2183 g_snprintf(buf, sizeof(buf), "The email address for %s is %s", gc->username, val); | |
2184 do_error_dialog(buf, "Email"); | |
2185 } | |
2186 | |
2187 return 1; | |
2188 } | |
2189 | |
2190 static void oscar_keepalive(struct gaim_connection *gc) { | |
2191 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
2192 aim_flap_nop(odata->sess, odata->conn); | |
2193 } | |
2194 | |
2195 static char *oscar_name() { | |
2196 return "Oscar"; | |
2197 } | |
2198 | |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2205
diff
changeset
|
2199 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int imflags) { |
2086 | 2200 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; |
2201 struct direct_im *dim = find_direct_im(odata, name); | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2202 int ret = 0; |
2086 | 2203 if (dim) { |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2204 ret = aim_send_im_direct(odata->sess, dim->conn, message); |
2086 | 2205 } else { |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2206 if (imflags & IM_FLAG_AWAY) { |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
2207 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2208 } else if (imflags & IM_FLAG_CHECKBOX) { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2209 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_OFFLINE, message); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2210 } else { |
2197
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2211 struct aim_sendimext_args args; |
2086 | 2212 GSList *h = odata->hasicons; |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
2213 struct icon_req *ir = NULL; |
2086 | 2214 char *who = normalize(name); |
2197
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2215 struct stat st; |
2248
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
2216 |
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
2217 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
2218 |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2219 args.features = gaim_features; |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2220 args.featureslen = sizeof(gaim_features); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2221 |
2086 | 2222 while (h) { |
2223 ir = h->data; | |
2224 if (ir->request && !strcmp(who, ir->user)) | |
2225 break; | |
2226 h = h->next; | |
2227 } | |
2228 if (h) { | |
2229 ir->request = FALSE; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2230 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
2086 | 2231 debug_printf("sending buddy icon request with message\n"); |
2232 } | |
2197
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2233 |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2234 if (gc->user->iconfile[0] && !stat(gc->user->iconfile, &st)) { |
2248
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
2235 FILE *file = fopen(gc->user->iconfile, "r"); |
2197
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2236 if (file) { |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2237 char *buf = g_malloc(st.st_size); |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2238 fread(buf, 1, st.st_size, file); |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2239 |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2240 args.iconlen = st.st_size; |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2241 args.iconsum = aim_iconsum(buf, st.st_size); |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2242 args.iconstamp = st.st_mtime; |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2243 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2244 args.flags |= AIM_IMFLAGS_HASICON; |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2245 debug_printf("Claiming to have an icon.\n"); |
2197
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2246 |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2247 fclose(file); |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2248 g_free(buf); |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2249 } |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2250 } |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2251 |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2252 args.destsn = name; |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2253 args.msg = message; |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2254 args.msglen = strlen(message); |
8f1ca76e46f5
[gaim-migrate @ 2207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2196
diff
changeset
|
2255 |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
2256 ret = aim_send_im_ext(odata->sess, &args); |
2086 | 2257 } |
2258 } | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2259 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2260 return 1; |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2261 return ret; |
2086 | 2262 } |
2263 | |
2264 static void oscar_get_info(struct gaim_connection *g, char *name) { | |
2265 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2266 if (odata->icq) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2267 aim_icq_getsimpleinfo(odata->sess, name); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2268 else |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2269 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO); |
2086 | 2270 } |
2271 | |
2272 static void oscar_get_away_msg(struct gaim_connection *g, char *name) { | |
2273 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2274 if (!odata->icq) |
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2275 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE); |
2086 | 2276 } |
2277 | |
2278 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, | |
2279 char *maiden, char *city, char *state, char *country, int web) { | |
2280 /* FIXME : some of these things are wrong, but i'm lazy */ | |
2281 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2282 aim_setdirectoryinfo(odata->sess, odata->conn, first, middle, last, | |
2283 maiden, NULL, NULL, city, state, NULL, 0, web); | |
2284 } | |
2285 | |
2286 | |
2287 static void oscar_set_idle(struct gaim_connection *g, int time) { | |
2288 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2289 aim_bos_setidle(odata->sess, odata->conn, time); | |
2290 } | |
2291 | |
2292 static void oscar_set_info(struct gaim_connection *g, char *info) { | |
2293 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2294 char inforeal[1025], away[1025]; | |
2295 g_snprintf(inforeal, sizeof(inforeal), "%s", info); | |
2296 if (g->away) | |
2297 g_snprintf(away, sizeof(away), "%s", g->away); | |
2298 if (strlen(info) > 1024) | |
2299 do_error_dialog("Maximum info length (1024) exceeded, truncating", "Info Too Long"); | |
2300 aim_bos_setprofile(odata->sess, odata->conn, inforeal, g->away ? NULL : "", gaim_caps); | |
2301 } | |
2302 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2303 static void oscar_set_away(struct gaim_connection *gc, char *state, char *message) { |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2304 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2305 char away[1025]; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2306 if (!od->icq) { |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2307 if (message) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2308 g_snprintf(away, sizeof(away), "%s", message); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2309 aim_bos_setprofile(od->sess, od->conn, NULL, message ? away : "", gaim_caps); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2310 if (gc->away) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2311 g_free (gc->away); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2312 gc->away = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2313 if (message) { |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2314 if (strlen(message) > 1024) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2315 do_error_dialog("Maximum away length (1024) exceeded, truncating", |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2316 "Info Too Long"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2317 gc->away = g_strdup (message); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2318 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2319 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2320 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2321 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2322 if (gc->away) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2323 gc->away = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2324 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2325 if (!strcmp(state, "Online")) |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2326 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_ONLINE); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2327 else if (!strcmp(state, "Away")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2328 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2329 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2330 } else if (!strcmp(state, "Do Not Disturb")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2331 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_DND); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2332 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2333 } else if (!strcmp(state, "Not Available")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2334 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NA); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2335 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2336 } else if (!strcmp(state, "Occupied")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2337 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OCCUPIED); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2338 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2339 } else if (!strcmp(state, "Free For Chat")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2340 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2341 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2342 } else if (!strcmp(state, "Invisible")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2343 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2344 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2345 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2346 if (message) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2347 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NA); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2348 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2349 } else { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2350 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_ONLINE); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2351 } |
2086 | 2352 } |
2353 } | |
2354 | |
2355 static void oscar_warn(struct gaim_connection *g, char *name, int anon) { | |
2356 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2113 | 2357 aim_send_warning(odata->sess, odata->conn, name, anon ? AIM_WARN_ANON : 0); |
2086 | 2358 } |
2359 | |
2360 static void oscar_dir_search(struct gaim_connection *g, char *first, char *middle, char *last, | |
2361 char *maiden, char *city, char *state, char *country, char *email) { | |
2362 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2363 if (strlen(email)) | |
2364 aim_usersearch_address(odata->sess, odata->conn, email); | |
2365 } | |
2366 | |
2367 static void oscar_add_buddy(struct gaim_connection *g, char *name) { | |
2368 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2369 aim_add_buddy(odata->sess, odata->conn, name); | |
2370 } | |
2371 | |
2372 static void oscar_add_buddies(struct gaim_connection *g, GList *buddies) { | |
2373 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2374 char buf[MSG_LEN]; | |
2375 int n = 0; | |
2376 while (buddies) { | |
2377 if (n > MSG_LEN - 18) { | |
2378 aim_bos_setbuddylist(odata->sess, odata->conn, buf); | |
2379 n = 0; | |
2380 } | |
2381 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); | |
2382 buddies = buddies->next; | |
2383 } | |
2384 aim_bos_setbuddylist(odata->sess, odata->conn, buf); | |
2385 } | |
2386 | |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2679
diff
changeset
|
2387 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) { |
2086 | 2388 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2389 aim_remove_buddy(odata->sess, odata->conn, name); | |
2390 } | |
2391 | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2392 static GList *oscar_chat_info(struct gaim_connection *gc) { |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2393 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2394 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2395 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2396 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2397 pce->label = _("Join what group:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2398 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2399 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2400 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2401 pce->label = _("Exchange:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2402 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2403 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2404 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2405 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2406 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2407 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2408 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2409 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2410 static void oscar_join_chat(struct gaim_connection *g, GList *data) { |
2086 | 2411 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2412 aim_conn_t *cur; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2413 char *name; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2414 int *exchange; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2415 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2416 if (!data || !data->next) |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2417 return; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2418 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2419 name = data->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2420 exchange = data->next->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2421 |
2086 | 2422 debug_printf("Attempting to join chat room %s.\n", name); |
2423 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) { | |
2424 debug_printf("chatnav exists, creating room\n"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2425 aim_chatnav_createroom(odata->sess, cur, name, *exchange); |
2086 | 2426 } else { |
2427 /* this gets tricky */ | |
2428 debug_printf("chatnav does not exist, opening chatnav\n"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2429 odata->create_exchange = *exchange; |
2086 | 2430 odata->create_name = g_strdup(name); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2431 aim_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV); |
2086 | 2432 } |
2433 } | |
2434 | |
2435 static void oscar_chat_invite(struct gaim_connection *g, int id, char *message, char *name) { | |
2436 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2437 struct chat_connection *ccon = find_oscar_chat(g, id); | |
2438 | |
2439 if (!ccon) | |
2440 return; | |
2441 | |
2442 aim_chat_invite(odata->sess, odata->conn, name, message ? message : "", | |
2443 ccon->exchange, ccon->name, 0x0); | |
2444 } | |
2445 | |
2446 static void oscar_chat_leave(struct gaim_connection *g, int id) { | |
2447 struct oscar_data *odata = g ? (struct oscar_data *)g->proto_data : NULL; | |
2448 GSList *bcs = g->buddy_chats; | |
2449 struct conversation *b = NULL; | |
2450 struct chat_connection *c = NULL; | |
2451 int count = 0; | |
2452 | |
2453 while (bcs) { | |
2454 count++; | |
2455 b = (struct conversation *)bcs->data; | |
2456 if (id == b->id) | |
2457 break; | |
2458 bcs = bcs->next; | |
2459 b = NULL; | |
2460 } | |
2461 | |
2462 if (!b) | |
2463 return; | |
2464 | |
2465 debug_printf("Attempting to leave room %s (currently in %d rooms)\n", b->name, count); | |
2466 | |
2467 c = find_oscar_chat(g, b->id); | |
2468 if (c != NULL) { | |
2469 if (odata) | |
2470 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c); | |
2471 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2472 gaim_input_remove(c->inpa); |
2086 | 2473 if (g && odata->sess) |
2474 aim_conn_kill(odata->sess, &c->conn); | |
2475 g_free(c->name); | |
2476 g_free(c->show); | |
2477 g_free(c); | |
2478 } | |
2479 /* we do this because with Oscar it doesn't tell us we left */ | |
2480 serv_got_chat_left(g, b->id); | |
2481 } | |
2482 | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2483 static int oscar_chat_send(struct gaim_connection *g, int id, char *message) { |
2086 | 2484 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2485 GSList *bcs = g->buddy_chats; | |
2486 struct conversation *b = NULL; | |
2487 struct chat_connection *c = NULL; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2488 char *buf, *buf2; |
2086 | 2489 int i, j; |
2490 | |
2491 while (bcs) { | |
2492 b = (struct conversation *)bcs->data; | |
2493 if (id == b->id) | |
2494 break; | |
2495 bcs = bcs->next; | |
2496 b = NULL; | |
2497 } | |
2498 if (!b) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2499 return -EINVAL; |
2086 | 2500 |
2501 bcs = odata->oscar_chats; | |
2502 while (bcs) { | |
2503 c = (struct chat_connection *)bcs->data; | |
2504 if (b == c->cnv) | |
2505 break; | |
2506 bcs = bcs->next; | |
2507 c = NULL; | |
2508 } | |
2509 if (!c) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2510 return -EINVAL; |
2086 | 2511 |
2512 buf = g_malloc(strlen(message) * 4 + 1); | |
2513 for (i = 0, j = 0; i < strlen(message); i++) { | |
2514 if (message[i] == '\n') { | |
2515 buf[j++] = '<'; | |
2516 buf[j++] = 'B'; | |
2517 buf[j++] = 'R'; | |
2518 buf[j++] = '>'; | |
2519 } else { | |
2520 buf[j++] = message[i]; | |
2521 } | |
2522 } | |
2523 buf[j] = '\0'; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2524 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2525 if (strlen(buf) > c->maxlen) |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2526 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2527 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2528 buf2 = strip_html(buf); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2529 if (strlen(buf2) > c->maxvis) { |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2530 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2531 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2532 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2533 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2534 |
2086 | 2535 aim_chat_send_im(odata->sess, c->conn, 0, buf, strlen(buf)); |
2536 g_free(buf); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2537 return 0; |
2086 | 2538 } |
2539 | |
2540 static char **oscar_list_icon(int uc) { | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2541 if (uc == 0) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2542 return (char **)icon_online_xpm; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2543 if (uc & 0x7fc0) { |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2544 uc >>= 6; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2545 if (uc & AIM_ICQ_STATE_AWAY) |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2546 return icon_away_xpm; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2547 if (uc & AIM_ICQ_STATE_DND) |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2548 return icon_dnd_xpm; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2549 if (uc & AIM_ICQ_STATE_NA) |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2550 return icon_na_xpm; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2551 if (uc & AIM_ICQ_STATE_OCCUPIED) |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2552 return icon_occ_xpm; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2553 if (uc & AIM_ICQ_STATE_CHAT) |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2554 return icon_ffc_xpm; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2555 if (uc & AIM_ICQ_STATE_INVISIBLE) |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2556 return icon_offline_xpm; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2557 return icon_online_xpm; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2558 } |
2086 | 2559 if (uc & UC_UNAVAILABLE) |
2560 return (char **)away_icon_xpm; | |
2689 | 2561 if (uc & UC_AB) |
2679 | 2562 return (char **)ab_xpm; |
2086 | 2563 if (uc & UC_AOL) |
2564 return (char **)aol_icon_xpm; | |
2565 if (uc & UC_ADMIN) | |
2566 return (char **)admin_icon_xpm; | |
2567 if (uc & UC_UNCONFIRMED) | |
2568 return (char **)dt_icon_xpm; | |
2297
a0f6ead876ca
[gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2288
diff
changeset
|
2569 if (uc & UC_NORMAL) |
a0f6ead876ca
[gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2288
diff
changeset
|
2570 return (char **)free_icon_xpm; |
2086 | 2571 return NULL; |
2572 } | |
2573 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2574 static int gaim_directim_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2575 va_list ap; |
2576 struct gaim_connection *gc = sess->aux_data; | |
2577 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2578 aim_conn_t *newconn, *listenerconn; |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
2579 struct conversation *cnv; |
2086 | 2580 struct direct_im *dim; |
2581 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2582 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2583 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2584 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2585 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2586 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 2587 va_end(ap); |
2588 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2589 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2590 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2591 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2592 sn = g_strdup(aim_directim_getsn(newconn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2593 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2594 debug_printf("DirectIM: initiate success to %s\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2595 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2596 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2597 if (!(cnv = find_conversation(sn))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2598 cnv = new_conversation(sn); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2599 gaim_input_remove(dim->watcher); |
2086 | 2600 dim->conn = newconn; |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2601 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 2602 oscar_callback, dim->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2603 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2604 g_free(sn); |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
2605 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); |
2086 | 2606 |
2607 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, | |
2608 gaim_directim_incoming, 0); | |
2609 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, | |
2610 gaim_directim_typing, 0); | |
2611 | |
2612 return 1; | |
2613 } | |
2614 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2615 static int gaim_directim_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2616 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2617 char *msg, *sn; |
2086 | 2618 struct gaim_connection *gc = sess->aux_data; |
2619 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2620 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2621 sn = va_arg(ap, char *); |
2086 | 2622 msg = va_arg(ap, char *); |
2623 va_end(ap); | |
2624 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2625 debug_printf("Got DirectIM message from %s\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2626 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2627 serv_got_im(gc, sn, msg, 0, time((time_t)NULL)); |
2086 | 2628 |
2629 return 1; | |
2630 } | |
2631 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2632 static int gaim_directim_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2633 va_list ap; |
2634 char *sn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2635 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2636 va_start(ap, fr); |
2086 | 2637 sn = va_arg(ap, char *); |
2638 va_end(ap); | |
2639 | |
2640 /* I had to leave this. It's just too funny. It reminds me of my sister. */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2641 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); |
2086 | 2642 |
2643 return 1; | |
2644 } | |
2645 | |
2646 struct ask_do_dir_im { | |
2647 char *who; | |
2648 struct gaim_connection *gc; | |
2649 }; | |
2650 | |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
2651 static void oscar_cancel_direct_im(gpointer obj, struct ask_do_dir_im *data) { |
2086 | 2652 g_free(data); |
2653 } | |
2654 | |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
2655 static void oscar_direct_im(gpointer obj, struct ask_do_dir_im *data) { |
2086 | 2656 struct gaim_connection *gc = data->gc; |
2657 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
2658 struct direct_im *dim; | |
2659 | |
2660 dim = find_direct_im(od, data->who); | |
2661 if (dim) { | |
2662 do_error_dialog("Direct IM request already pending.", "Unable"); | |
2663 return; | |
2664 } | |
2665 dim = g_new0(struct direct_im, 1); | |
2666 dim->gc = gc; | |
2667 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
2668 | |
2717
03bf072c6238
[gaim-migrate @ 2730]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2713
diff
changeset
|
2669 dim->conn = aim_directim_initiate(od->sess, data->who); |
2086 | 2670 if (dim->conn != NULL) { |
2671 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2672 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 2673 oscar_callback, dim->conn); |
2674 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE, | |
2675 gaim_directim_initiate, 0); | |
2676 } else { | |
2677 do_error_dialog(_("Unable to open Direct IM"), _("Error")); | |
2678 g_free(dim); | |
2679 } | |
2680 } | |
2681 | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2682 static void oscar_ask_direct_im(struct gaim_connection *gc, gchar *who) { |
2086 | 2683 char buf[BUF_LONG]; |
2684 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); | |
2685 data->who = who; | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2686 data->gc = gc; |
2086 | 2687 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s." |
2688 " Doing this will let them see your IP address, and may be" | |
2689 " a security risk. Do you wish to continue?"), who); | |
2690 do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im); | |
2691 } | |
2692 | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2693 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) { |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2694 GList *m = NULL; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2695 struct proto_buddy_menu *pbm; |
2086 | 2696 char *n = g_strdup(normalize(gc->username)); |
2697 | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2698 pbm = g_new0(struct proto_buddy_menu, 1); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2699 pbm->label = _("Get Info"); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2700 pbm->callback = oscar_get_info; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2701 pbm->gc = gc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2702 m = g_list_append(m, pbm); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2703 |
2086 | 2704 if (strcmp(n, normalize(who))) { |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2705 pbm = g_new0(struct proto_buddy_menu, 1); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2706 pbm->label = _("Direct IM"); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2707 pbm->callback = oscar_ask_direct_im; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2708 pbm->gc = gc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2709 m = g_list_append(m, pbm); |
2086 | 2710 } |
2711 g_free(n); | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2712 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2713 return m; |
2086 | 2714 } |
2715 | |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2716 static GList *oscar_user_opts() |
2086 | 2717 { |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2718 GList *m = NULL; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2719 struct proto_user_opt *puo; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2720 |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2721 puo = g_new0(struct proto_user_opt, 1); |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2722 puo->label = "Auth Host:"; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2723 puo->def = "login.oscar.aol.com"; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2724 puo->pos = USEROPT_AUTH; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2725 m = g_list_append(m, puo); |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2726 |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2727 puo = g_new0(struct proto_user_opt, 1); |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2728 puo->label = "Auth Port:"; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2729 puo->def = "5190"; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2730 puo->pos = USEROPT_AUTHPORT; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2731 m = g_list_append(m, puo); |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2732 |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
2733 return m; |
2086 | 2734 } |
2735 | |
2736 static void oscar_set_permit_deny(struct gaim_connection *gc) { | |
2737 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
2738 GSList *list; | |
2739 char buf[MAXMSGLEN]; | |
2740 int at; | |
2741 | |
2742 switch(gc->permdeny) { | |
2743 case 1: | |
2744 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username); | |
2745 break; | |
2746 case 2: | |
2747 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username); | |
2748 break; | |
2749 case 3: | |
2750 list = gc->permit; | |
2751 at = 0; | |
2752 while (list) { | |
2753 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
2754 list = list->next; | |
2755 } | |
2756 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
2757 break; | |
2758 case 4: | |
2759 list = gc->deny; | |
2760 at = 0; | |
2761 while (list) { | |
2762 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
2763 list = list->next; | |
2764 } | |
2765 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
2766 break; | |
2767 default: | |
2768 break; | |
2769 } | |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
2770 signoff_blocked(gc); |
2086 | 2771 } |
2772 | |
2773 static void oscar_add_permit(struct gaim_connection *gc, char *who) { | |
2774 if (gc->permdeny != 3) return; | |
2775 oscar_set_permit_deny(gc); | |
2776 } | |
2777 | |
2778 static void oscar_add_deny(struct gaim_connection *gc, char *who) { | |
2779 if (gc->permdeny != 4) return; | |
2780 oscar_set_permit_deny(gc); | |
2781 } | |
2782 | |
2783 static void oscar_rem_permit(struct gaim_connection *gc, char *who) { | |
2784 if (gc->permdeny != 3) return; | |
2785 oscar_set_permit_deny(gc); | |
2786 } | |
2787 | |
2788 static void oscar_rem_deny(struct gaim_connection *gc, char *who) { | |
2789 if (gc->permdeny != 4) return; | |
2790 oscar_set_permit_deny(gc); | |
2791 } | |
2792 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2793 static GList *oscar_away_states(struct gaim_connection *gc) |
2086 | 2794 { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2795 struct oscar_data *od = gc->proto_data; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2796 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2797 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2798 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2799 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2800 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2801 m = g_list_append(m, "Online"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2802 m = g_list_append(m, "Away"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2803 m = g_list_append(m, "Do Not Disturb"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2804 m = g_list_append(m, "Not Available"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2805 m = g_list_append(m, "Occupied"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2806 m = g_list_append(m, "Free For Chat"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2807 m = g_list_append(m, "Invisible"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2808 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2809 return m; |
2086 | 2810 } |
2811 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2812 static void oscar_change_email(struct gaim_connection *gc, char *email) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2813 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2814 struct oscar_data *od = gc->proto_data; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2815 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2816 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2817 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2818 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2819 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2820 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2821 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2822 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2823 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2824 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2825 |
2086 | 2826 static void oscar_do_action(struct gaim_connection *gc, char *act) |
2827 { | |
2828 struct oscar_data *od = gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2829 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
2086 | 2830 |
2831 if (!strcmp(act, "Set User Info")) { | |
2832 show_set_info(gc); | |
2833 } else if (!strcmp(act, "Change Password")) { | |
2834 show_change_passwd(gc); | |
2835 } else if (!strcmp(act, "Confirm Account")) { | |
2836 if (!conn) { | |
2837 od->conf = TRUE; | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2838 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 2839 } else |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2840 aim_admin_reqconfirm(od->sess, conn); |
2086 | 2841 } else if (!strcmp(act, "Display Current Registered Address")) { |
2842 if (!conn) { | |
2843 od->reqemail = TRUE; | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2844 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 2845 } else |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2846 aim_admin_getinfo(od->sess, conn, 0x11); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2847 } else if (!strcmp(act, "Change Current Registered Address")) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2848 do_prompt_dialog("Change Address To: ", NULL, gc, oscar_change_email, NULL); |
2086 | 2849 } else if (!strcmp(act, "Search for Buddy by Email")) { |
2850 show_find_email(gc); | |
2851 } | |
2852 } | |
2853 | |
2854 static GList *oscar_actions() | |
2855 { | |
2856 GList *m = NULL; | |
2857 | |
2858 m = g_list_append(m, "Set User Info"); | |
2859 m = g_list_append(m, NULL); | |
2860 m = g_list_append(m, "Change Password"); | |
2861 m = g_list_append(m, "Confirm Account"); | |
2862 m = g_list_append(m, "Display Current Registered Address"); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2863 m = g_list_append(m, "Change Current Registered Address"); |
2086 | 2864 m = g_list_append(m, NULL); |
2865 m = g_list_append(m, "Search for Buddy by Email"); | |
2866 | |
2867 return m; | |
2868 } | |
2869 | |
2870 static void oscar_change_passwd(struct gaim_connection *gc, char *old, char *new) | |
2871 { | |
2872 struct oscar_data *od = gc->proto_data; | |
2873 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { | |
2874 od->chpass = TRUE; | |
2875 od->oldp = g_strdup(old); | |
2876 od->newp = g_strdup(new); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2877 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 2878 } else { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2879 aim_admin_changepasswd(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), |
2086 | 2880 new, old); |
2881 } | |
2882 } | |
2883 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2884 static void oscar_convo_closed(struct gaim_connection *gc, char *who) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2885 { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2886 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2887 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2888 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2889 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2890 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2891 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2892 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2893 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2894 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2895 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2896 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2897 |
2086 | 2898 static struct prpl *my_protocol = NULL; |
2899 | |
2900 void oscar_init(struct prpl *ret) { | |
2901 ret->protocol = PROTO_OSCAR; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2902 ret->options = OPT_PROTO_BUDDY_ICON; |
2086 | 2903 ret->name = oscar_name; |
2904 ret->list_icon = oscar_list_icon; | |
2905 ret->away_states = oscar_away_states; | |
2906 ret->actions = oscar_actions; | |
2907 ret->do_action = oscar_do_action; | |
2908 ret->buddy_menu = oscar_buddy_menu; | |
2909 ret->user_opts = oscar_user_opts; | |
2910 ret->login = oscar_login; | |
2911 ret->close = oscar_close; | |
2912 ret->send_im = oscar_send_im; | |
2913 ret->set_info = oscar_set_info; | |
2914 ret->get_info = oscar_get_info; | |
2915 ret->set_away = oscar_set_away; | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2916 ret->get_away = oscar_get_away_msg; |
2086 | 2917 ret->set_dir = oscar_set_dir; |
2918 ret->get_dir = NULL; /* Oscar really doesn't have this */ | |
2919 ret->dir_search = oscar_dir_search; | |
2920 ret->set_idle = oscar_set_idle; | |
2921 ret->change_passwd = oscar_change_passwd; | |
2922 ret->add_buddy = oscar_add_buddy; | |
2923 ret->add_buddies = oscar_add_buddies; | |
2924 ret->remove_buddy = oscar_remove_buddy; | |
2925 ret->add_permit = oscar_add_permit; | |
2926 ret->add_deny = oscar_add_deny; | |
2927 ret->rem_permit = oscar_rem_permit; | |
2928 ret->rem_deny = oscar_rem_deny; | |
2929 ret->set_permit_deny = oscar_set_permit_deny; | |
2930 ret->warn = oscar_warn; | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
2931 ret->chat_info = oscar_chat_info; |
2086 | 2932 ret->join_chat = oscar_join_chat; |
2933 ret->chat_invite = oscar_chat_invite; | |
2934 ret->chat_leave = oscar_chat_leave; | |
2935 ret->chat_whisper = NULL; | |
2936 ret->chat_send = oscar_chat_send; | |
2937 ret->keepalive = oscar_keepalive; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2938 ret->convo_closed = oscar_convo_closed; |
2086 | 2939 |
2940 my_protocol = ret; | |
2941 } | |
2942 | |
2943 #ifndef STATIC | |
2944 | |
2945 char *gaim_plugin_init(GModule *handle) | |
2946 { | |
2947 load_protocol(oscar_init, sizeof(struct prpl)); | |
2948 return NULL; | |
2949 } | |
2950 | |
2951 void gaim_plugin_remove() | |
2952 { | |
2953 struct prpl *p = find_prpl(PROTO_OSCAR); | |
2954 if (p == my_protocol) | |
2955 unload_protocol(p); | |
2956 } | |
2957 | |
2958 char *name() | |
2959 { | |
2960 return "Oscar"; | |
2961 } | |
2962 | |
2963 char *description() | |
2964 { | |
2162
a464da684307
[gaim-migrate @ 2172]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2154
diff
changeset
|
2965 return PRPL_DESC("Oscar"); |
2086 | 2966 } |
2967 | |
2968 #endif |