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