Mercurial > pidgin
annotate src/protocols/oscar/oscar.c @ 3214:f1ac8b51ec6b
[gaim-migrate @ 3231]
I really should make sure these things compile before committing them
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 05 May 2002 19:20:18 +0000 |
parents | 56746b0868db |
children | 5947e31a01c0 |
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" | |
3079 | 52 #include "pixmaps/wireless_icon.xpm" |
2086 | 53 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
54 #include "pixmaps/gnomeicu-online.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
55 #include "pixmaps/gnomeicu-offline.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
56 #include "pixmaps/gnomeicu-away.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
57 #include "pixmaps/gnomeicu-dnd.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
58 #include "pixmaps/gnomeicu-na.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
59 #include "pixmaps/gnomeicu-occ.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
60 #include "pixmaps/gnomeicu-ffc.xpm" |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
61 |
2086 | 62 /* constants to identify proto_opts */ |
63 #define USEROPT_AUTH 0 | |
64 #define USEROPT_AUTHPORT 1 | |
65 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
66 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
67 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
68 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
69 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
70 #define UC_AB 0x20 |
3079 | 71 #define UC_WIRELESS 0x40 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
72 |
2086 | 73 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
74 | |
75 static int gaim_caps = AIM_CAPS_CHAT | | |
76 AIM_CAPS_BUDDYICON | | |
77 AIM_CAPS_IMIMAGE; | |
2308
a90be9567452
[gaim-migrate @ 2318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2305
diff
changeset
|
78 static fu8_t gaim_features[] = {0x01, 0x01, 0x01, 0x02}; |
2086 | 79 |
80 struct oscar_data { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
81 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
82 aim_conn_t *conn; |
2086 | 83 |
84 guint cnpa; | |
85 guint paspa; | |
86 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
87 GSList *create_rooms; |
2086 | 88 |
89 gboolean conf; | |
90 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
91 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
92 char *email; |
2979 | 93 gboolean setnick; |
94 char *newsn; | |
2086 | 95 gboolean chpass; |
96 char *oldp; | |
97 char *newp; | |
98 | |
99 GSList *oscar_chats; | |
100 GSList *direct_ims; | |
101 GSList *hasicons; | |
102 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
103 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
104 gboolean icq; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
105 GSList *evilhack; |
2993 | 106 |
107 struct { | |
108 guint maxbuddies; /* max users you can watch */ | |
109 guint maxwatchers; /* max users who can watch you */ | |
110 guint maxpermits; /* max users on permit list */ | |
111 guint maxdenies; /* max users on deny list */ | |
112 guint maxsiglen; /* max size (bytes) of profile */ | |
113 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
114 } rights; | |
2086 | 115 }; |
116 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
117 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
118 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
119 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
120 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
121 |
2086 | 122 struct chat_connection { |
123 char *name; | |
124 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
125 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
126 fu16_t instance; |
2086 | 127 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
|
128 aim_conn_t *conn; |
2086 | 129 int inpa; |
130 int id; | |
131 struct gaim_connection *gc; /* i hate this. */ | |
132 struct conversation *cnv; /* bah. */ | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
133 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
134 int maxvis; |
2086 | 135 }; |
136 | |
137 struct direct_im { | |
138 struct gaim_connection *gc; | |
139 char name[80]; | |
140 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
141 aim_conn_t *conn; |
3008 | 142 gboolean connected; |
2086 | 143 }; |
144 | |
145 struct ask_direct { | |
146 struct gaim_connection *gc; | |
147 char *sn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
148 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
149 fu8_t cookie[8]; |
2086 | 150 }; |
151 | |
152 struct icon_req { | |
153 char *user; | |
154 time_t timestamp; | |
2196
016c5307f26b
[gaim-migrate @ 2206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2194
diff
changeset
|
155 unsigned long length; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2172
diff
changeset
|
156 unsigned long checksum; |
2086 | 157 gboolean request; |
158 }; | |
159 | |
3141 | 160 struct icq_auth { |
161 struct gaim_connection *gc; | |
162 fu32_t uin; | |
163 }; | |
164 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
165 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { |
2086 | 166 GSList *d = od->direct_ims; |
167 char *n = g_strdup(normalize(who)); | |
168 struct direct_im *m = NULL; | |
169 | |
170 while (d) { | |
171 m = (struct direct_im *)d->data; | |
172 if (!strcmp(n, normalize(m->name))) | |
173 break; | |
174 m = NULL; | |
175 d = d->next; | |
176 } | |
177 | |
178 g_free(n); | |
179 return m; | |
180 } | |
181 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
182 static char *extract_name(const char *name) { |
2086 | 183 char *tmp; |
184 int i, j; | |
185 char *x = strchr(name, '-'); | |
186 if (!x) return NULL; | |
187 x = strchr(++x, '-'); | |
188 if (!x) return NULL; | |
189 tmp = g_strdup(++x); | |
190 | |
191 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
192 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
193 if (x[i] != '%') { |
2086 | 194 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
195 continue; |
2086 | 196 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
197 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
198 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
199 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 200 } |
201 | |
202 tmp[j] = 0; | |
203 return tmp; | |
204 } | |
205 | |
206 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) { | |
207 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; | |
208 struct chat_connection *c = NULL; | |
209 | |
210 while (g) { | |
211 c = (struct chat_connection *)g->data; | |
212 if (c->id == id) | |
213 break; | |
214 g = g->next; | |
215 c = NULL; | |
216 } | |
217 | |
218 return c; | |
219 } | |
220 | |
221 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
|
222 aim_conn_t *conn) { |
2086 | 223 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
224 struct chat_connection *c = NULL; | |
225 | |
226 while (g) { | |
227 c = (struct chat_connection *)g->data; | |
228 if (c->conn == conn) | |
229 break; | |
230 g = g->next; | |
231 c = NULL; | |
232 } | |
233 | |
234 return c; | |
235 } | |
236 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
237 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
|
238 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
239 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
240 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
241 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
242 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
243 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
244 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
|
245 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); |
3212 | 246 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
247 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
|
248 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
249 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
250 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
251 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
252 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
|
253 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
|
254 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
255 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
256 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
257 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
258 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
259 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
260 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
261 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
262 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
263 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
264 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); |
2993 | 265 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
266 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
267 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
268 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
|
269 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
270 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
271 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
272 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
273 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
274 static int gaim_simpleinfo (aim_session_t *, aim_frame_t *, ...); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
275 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); |
2991 | 276 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); |
277 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
278 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
279 static int gaim_directim_initiate(aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
280 static int gaim_directim_incoming(aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
281 static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...); |
2993 | 282 static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...); |
2086 | 283 |
284 static char *msgerrreason[] = { | |
285 "Invalid error", | |
286 "Invalid SNAC", | |
287 "Rate to host", | |
288 "Rate to client", | |
289 "Not logged in", | |
290 "Service unavailable", | |
291 "Service not defined", | |
292 "Obsolete SNAC", | |
293 "Not supported by host", | |
294 "Not supported by client", | |
295 "Refused by client", | |
296 "Reply too big", | |
297 "Responses lost", | |
298 "Request denied", | |
299 "Busted SNAC payload", | |
300 "Insufficient rights", | |
301 "In local permit/deny", | |
302 "Too evil (sender)", | |
303 "Too evil (receiver)", | |
304 "User temporarily unavailable", | |
305 "No match", | |
306 "List overflow", | |
307 "Request ambiguous", | |
308 "Queue full", | |
309 "Not while on AOL" | |
310 }; | |
311 static int msgerrreasonlen = 25; | |
312 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
313 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
|
314 struct gaim_connection *gc = sess->aux_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
315 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
316 struct conversation *cnv; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
317 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
318 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
319 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
320 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
321 sn = g_strdup(aim_directim_getsn(conn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
322 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
323 debug_printf("%s disconnected Direct IM.\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
324 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
325 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
326 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
327 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
328 |
3008 | 329 if (dim->connected) |
330 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
331 else | |
332 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); | |
333 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
334 if ((cnv = find_conversation(sn))) |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2833
diff
changeset
|
335 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1); |
2993 | 336 update_progress(cnv, 100); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
337 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
338 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
|
339 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
340 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
341 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
342 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
343 |
2086 | 344 static void oscar_callback(gpointer data, gint source, |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
345 GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
346 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
347 aim_session_t *sess = aim_conn_getsess(conn); |
2086 | 348 struct gaim_connection *gc = sess ? sess->aux_data : NULL; |
349 struct oscar_data *odata; | |
350 | |
351 if (!gc) { | |
352 /* gc is null. we return, else we seg SIGSEG on next line. */ | |
353 debug_printf("oscar callback for closed connection (1).\n"); | |
354 return; | |
355 } | |
356 | |
357 odata = (struct oscar_data *)gc->proto_data; | |
358 | |
359 if (!g_slist_find(connections, gc)) { | |
360 /* oh boy. this is probably bad. i guess the only thing we | |
361 * can really do is return? */ | |
362 debug_printf("oscar callback for closed connection (2).\n"); | |
363 return; | |
364 } | |
365 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
366 if (condition & GAIM_INPUT_READ) { |
2086 | 367 if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) { |
368 debug_printf("got information on rendezvous\n"); | |
369 if (aim_handlerendconnect(odata->sess, conn) < 0) { | |
370 debug_printf(_("connection error (rend)\n")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
371 aim_conn_kill(odata->sess, &conn); |
2086 | 372 } |
373 } else { | |
374 if (aim_get_command(odata->sess, conn) >= 0) { | |
375 aim_rxdispatch(odata->sess); | |
376 if (odata->killme) | |
377 signoff(gc); | |
378 } else { | |
379 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
380 !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { | |
381 debug_printf(_("major connection error\n")); | |
3074 | 382 hide_login_progress_error(gc, _("Disconnected.")); |
2086 | 383 signoff(gc); |
384 } else if (conn->type == AIM_CONN_TYPE_CHAT) { | |
385 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
386 char buf[BUF_LONG]; | |
387 debug_printf("disconnected from chat room %s\n", c->name); | |
388 c->conn = NULL; | |
389 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
390 gaim_input_remove(c->inpa); |
2086 | 391 c->inpa = 0; |
392 c->fd = -1; | |
393 aim_conn_kill(odata->sess, &conn); | |
394 sprintf(buf, _("You have been disconnected from chat room %s."), c->name); | |
395 do_error_dialog(buf, _("Chat Error!")); | |
396 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { | |
397 if (odata->cnpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
398 gaim_input_remove(odata->cnpa); |
2086 | 399 odata->cnpa = 0; |
400 debug_printf("removing chatnav input watcher\n"); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
401 while (odata->create_rooms) { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
402 struct create_room *cr = odata->create_rooms->data; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
403 g_free(cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
404 odata->create_rooms = |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
405 g_slist_remove(odata->create_rooms, cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
406 g_free(cr); |
2086 | 407 do_error_dialog(_("Chat is currently unavailable"), |
408 _("Gaim - Chat")); | |
409 } | |
410 aim_conn_kill(odata->sess, &conn); | |
411 } else if (conn->type == AIM_CONN_TYPE_AUTH) { | |
412 if (odata->paspa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
413 gaim_input_remove(odata->paspa); |
2086 | 414 odata->paspa = 0; |
415 debug_printf("removing authconn input watcher\n"); | |
416 aim_conn_kill(odata->sess, &conn); | |
417 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
418 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
419 gaim_directim_disconnect(odata->sess, conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
420 else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
421 debug_printf("No handler for rendezvous disconnect (%d).\n", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
422 source); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
423 } |
2086 | 424 aim_conn_kill(odata->sess, &conn); |
425 } else { | |
426 debug_printf("holy crap! generic connection error! %d\n", | |
427 conn->type); | |
428 aim_conn_kill(odata->sess, &conn); | |
429 } | |
430 } | |
431 } | |
432 } | |
433 } | |
434 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
435 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
2086 | 436 char *s = g_strdup_vprintf(format, va); |
437 char buf[256]; | |
438 char *t; | |
439 struct gaim_connection *gc = sess->aux_data; | |
440 | |
441 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level); | |
442 t = g_strconcat(buf, s, NULL); | |
443 debug_printf(t); | |
444 if (t[strlen(t)-1] != '\n') | |
445 debug_printf("\n"); | |
446 g_free(t); | |
447 g_free(s); | |
448 } | |
449 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
450 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 451 { |
452 struct gaim_connection *gc = data; | |
453 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
454 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
455 aim_conn_t *conn; |
2086 | 456 |
457 if (!g_slist_find(connections, gc)) { | |
458 close(source); | |
459 return; | |
460 } | |
461 | |
462 odata = gc->proto_data; | |
463 sess = odata->sess; | |
464 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); | |
465 | |
466 if (source < 0) { | |
467 hide_login_progress(gc, _("Couldn't connect to host")); | |
468 signoff(gc); | |
469 return; | |
470 } | |
471 | |
472 aim_conn_completeconnect(sess, conn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
473 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, |
2086 | 474 oscar_callback, conn); |
475 debug_printf(_("Password sent, waiting for response\n")); | |
476 } | |
477 | |
478 static void oscar_login(struct aim_user *user) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
479 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
480 aim_conn_t *conn; |
2086 | 481 char buf[256]; |
482 struct gaim_connection *gc = new_gaim_conn(user); | |
483 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); | |
484 | |
2589
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
485 if (isdigit(*user->username)) { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
486 odata->icq = TRUE; |
2589
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
487 /* this is odd but it's necessary for a proper do_import and do_export */ |
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
488 gc->protocol = PROTO_ICQ; |
3064 | 489 gc->password[8] = 0; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
490 } else { |
2590
2dd86a1af92b
[gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2589
diff
changeset
|
491 gc->protocol = PROTO_TOC; |
2918
4df759d607f3
[gaim-migrate @ 2931]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2916
diff
changeset
|
492 gc->flags |= OPT_CONN_HTML; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
493 } |
2086 | 494 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
495 sess = g_new0(aim_session_t, 1); |
2086 | 496 |
497 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); | |
498 aim_setdebuggingcb(sess, oscar_debug); | |
499 | |
500 /* we need an immediate queue because we don't use a while-loop to | |
501 * see if things need to be sent. */ | |
502 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); | |
503 odata->sess = sess; | |
504 sess->aux_data = gc; | |
505 | |
506 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
507 if (conn == NULL) { | |
508 debug_printf(_("internal connection error\n")); | |
509 hide_login_progress(gc, _("Unable to login to AIM")); | |
510 signoff(gc); | |
511 return; | |
512 } | |
513 | |
514 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); | |
515 set_login_progress(gc, 2, buf); | |
516 | |
517 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); | |
518 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
519 | |
520 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
521 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? | |
522 user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER, | |
523 user->proto_opt[USEROPT_AUTHPORT][0] ? | |
524 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
525 oscar_login_connect, gc); | |
526 if (conn->fd < 0) { | |
527 hide_login_progress(gc, _("Couldn't connect to host")); | |
528 signoff(gc); | |
529 return; | |
530 } | |
531 aim_request_login(sess, conn, gc->username); | |
532 } | |
533 | |
534 static void oscar_close(struct gaim_connection *gc) { | |
535 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
536 | |
537 while (odata->oscar_chats) { | |
538 struct chat_connection *n = odata->oscar_chats->data; | |
539 if (n->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
540 gaim_input_remove(n->inpa); |
2086 | 541 g_free(n->name); |
542 g_free(n->show); | |
543 odata->oscar_chats = g_slist_remove(odata->oscar_chats, n); | |
544 g_free(n); | |
545 } | |
546 while (odata->direct_ims) { | |
547 struct direct_im *n = odata->direct_ims->data; | |
548 if (n->watcher > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
549 gaim_input_remove(n->watcher); |
2086 | 550 odata->direct_ims = g_slist_remove(odata->direct_ims, n); |
551 g_free(n); | |
552 } | |
553 while (odata->hasicons) { | |
554 struct icon_req *n = odata->hasicons->data; | |
555 g_free(n->user); | |
556 odata->hasicons = g_slist_remove(odata->hasicons, n); | |
557 g_free(n); | |
558 } | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
559 while (odata->evilhack) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
560 g_free(odata->evilhack->data); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
561 odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
562 } |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
563 while (odata->create_rooms) { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
564 struct create_room *cr = odata->create_rooms->data; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
565 g_free(cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
566 odata->create_rooms = g_slist_remove(odata->create_rooms, cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
567 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
568 } |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
569 if (odata->email) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
570 g_free(odata->email); |
2754
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
571 if (odata->newp) |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
572 g_free(odata->newp); |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
573 if (odata->oldp) |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
574 g_free(odata->oldp); |
2086 | 575 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
576 gaim_input_remove(gc->inpa); |
2086 | 577 if (odata->cnpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
578 gaim_input_remove(odata->cnpa); |
2086 | 579 if (odata->paspa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
580 gaim_input_remove(odata->paspa); |
2086 | 581 aim_session_kill(odata->sess); |
582 g_free(odata->sess); | |
583 odata->sess = NULL; | |
584 g_free(gc->proto_data); | |
585 gc->proto_data = NULL; | |
586 debug_printf(_("Signed off.\n")); | |
587 } | |
588 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
589 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 590 struct gaim_connection *gc = data; |
591 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
592 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
593 aim_conn_t *bosconn; |
2086 | 594 |
595 if (!g_slist_find(connections, gc)) { | |
596 close(source); | |
597 return; | |
598 } | |
599 | |
600 odata = gc->proto_data; | |
601 sess = odata->sess; | |
602 bosconn = odata->conn; | |
603 | |
604 if (source < 0) { | |
605 hide_login_progress(gc, _("Could Not Connect")); | |
606 signoff(gc); | |
607 return; | |
608 } | |
609 | |
610 aim_conn_completeconnect(sess, bosconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
611 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, |
2086 | 612 oscar_callback, bosconn); |
613 set_login_progress(gc, 4, _("Connection established, cookie sent")); | |
614 } | |
615 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
616 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 617 va_list ap; |
2704 | 618 struct aim_authresp_info *info; |
2086 | 619 int i; char *host; int port; |
620 struct aim_user *user; | |
2704 | 621 aim_conn_t *bosconn; |
2086 | 622 |
623 struct gaim_connection *gc = sess->aux_data; | |
624 struct oscar_data *od = gc->proto_data; | |
625 user = gc->user; | |
626 port = user->proto_opt[USEROPT_AUTHPORT][0] ? | |
627 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
628 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
629 va_start(ap, fr); |
2704 | 630 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 631 va_end(ap); |
632 | |
2704 | 633 debug_printf("inside auth_resp (Screen name: %s)\n", info->sn); |
634 | |
635 if (info->errorcode || !info->bosip || !info->cookie) { | |
636 switch (info->errorcode) { | |
2086 | 637 case 0x05: |
638 /* Incorrect nick/password */ | |
639 hide_login_progress(gc, _("Incorrect nickname or password.")); | |
640 plugin_event(event_error, (void *)980, 0, 0, 0); | |
641 break; | |
642 case 0x11: | |
643 /* Suspended account */ | |
644 hide_login_progress(gc, _("Your account is currently suspended.")); | |
645 break; | |
646 case 0x18: | |
647 /* connecting too frequently */ | |
648 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.")); | |
649 plugin_event(event_error, (void *)983, 0, 0, 0); | |
650 break; | |
651 case 0x1c: | |
652 /* client too old */ | |
653 hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE)); | |
654 plugin_event(event_error, (void *)989, 0, 0, 0); | |
655 break; | |
656 default: | |
657 hide_login_progress(gc, _("Authentication Failed")); | |
658 break; | |
659 } | |
2704 | 660 debug_printf("Login Error Code 0x%04x\n", info->errorcode); |
661 debug_printf("Error URL: %s\n", info->errorurl); | |
2086 | 662 od->killme = TRUE; |
663 return 1; | |
664 } | |
665 | |
666 | |
2704 | 667 debug_printf("Reg status: %d\n", info->regstatus); |
668 if (info->email) { | |
669 debug_printf("Email: %s\n", info->email); | |
2086 | 670 } else { |
671 debug_printf("Email is NULL\n"); | |
672 } | |
2704 | 673 debug_printf("BOSIP: %s\n", info->bosip); |
2086 | 674 debug_printf("Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
675 aim_conn_kill(sess, &fr->conn); |
2086 | 676 |
677 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
678 if (bosconn == NULL) { | |
679 hide_login_progress(gc, _("Internal Error")); | |
680 od->killme = TRUE; | |
681 return 0; | |
682 } | |
683 | |
2675 | 684 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 685 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
686 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
687 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 688 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 689 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
690 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
691 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
692 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
693 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
694 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 695 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 696 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
697 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
698 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
699 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
700 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
701 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0); | |
702 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); | |
703 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
|
704 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 705 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
706 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
707 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
708 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
709 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
710 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
711 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
712 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
713 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_SIMPLEINFO, gaim_simpleinfo, 0); |
2991 | 714 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
715 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
716 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
2086 | 717 |
718 ((struct oscar_data *)gc->proto_data)->conn = bosconn; | |
2704 | 719 for (i = 0; i < (int)strlen(info->bosip); i++) { |
720 if (info->bosip[i] == ':') { | |
721 port = atoi(&(info->bosip[i+1])); | |
2086 | 722 break; |
723 } | |
724 } | |
2704 | 725 host = g_strndup(info->bosip, i); |
2086 | 726 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
727 bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc); | |
728 g_free(host); | |
729 if (bosconn->fd < 0) { | |
730 hide_login_progress(gc, _("Could Not Connect")); | |
731 od->killme = TRUE; | |
732 return 0; | |
733 } | |
2704 | 734 aim_sendcookie(sess, bosconn, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
735 gaim_input_remove(gc->inpa); |
2704 | 736 |
2086 | 737 return 1; |
738 } | |
739 | |
740 struct pieceofcrap { | |
741 struct gaim_connection *gc; | |
742 unsigned long offset; | |
743 unsigned long len; | |
744 char *modname; | |
745 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
746 aim_conn_t *conn; |
2086 | 747 unsigned int inpa; |
748 }; | |
749 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
750 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 751 { |
752 struct pieceofcrap *pos = data; | |
753 struct oscar_data *od = pos->gc->proto_data; | |
754 char in = '\0'; | |
755 int x = 0; | |
756 unsigned char m[17]; | |
757 | |
758 while (read(pos->fd, &in, 1) == 1) { | |
759 if (in == '\n') | |
760 x++; | |
761 else if (in != '\r') | |
762 x = 0; | |
763 if (x == 2) | |
764 break; | |
765 in = '\0'; | |
766 } | |
767 if (in != '\n') { | |
768 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM." | |
769 " You may be disconnected shortly.", "Login Error"); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
770 gaim_input_remove(pos->inpa); |
2086 | 771 close(pos->fd); |
772 g_free(pos); | |
773 return; | |
774 } | |
775 read(pos->fd, m, 16); | |
776 m[16] = '\0'; | |
777 debug_printf("Sending hash: "); | |
778 for (x = 0; x < 16; x++) | |
779 debug_printf("%02x ", (unsigned char)m[x]); | |
780 debug_printf("\n"); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
781 gaim_input_remove(pos->inpa); |
2086 | 782 close(pos->fd); |
783 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
784 g_free(pos); | |
785 } | |
786 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
787 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 788 struct pieceofcrap *pos = data; |
789 char buf[BUF_LONG]; | |
790 | |
791 if (source < 0) { | |
792 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM." | |
793 " You may be disconnected shortly.", "Login Error"); | |
794 if (pos->modname) | |
795 g_free(pos->modname); | |
796 g_free(pos); | |
797 return; | |
798 } | |
799 | |
800 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA | |
801 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", | |
802 pos->offset, pos->len, pos->modname ? pos->modname : ""); | |
803 write(pos->fd, buf, strlen(buf)); | |
804 if (pos->modname) | |
805 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
806 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 807 return; |
808 } | |
809 | |
810 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
811 #define AIM_MAX_FILE_SIZE 98304 | |
812 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
813 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 814 va_list ap; |
815 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
816 fu32_t offset, len; |
2086 | 817 char *modname; |
818 int fd; | |
819 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
820 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
821 offset = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
822 len = (fu32_t)va_arg(ap, unsigned long); |
2086 | 823 modname = va_arg(ap, char *); |
824 va_end(ap); | |
825 | |
826 debug_printf("offset: %d, len: %d, file: %s\n", offset, len, modname ? modname : "aim.exe"); | |
827 if (len == 0) { | |
828 debug_printf("len is 0, hashing NULL\n"); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
829 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 830 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
831 return 1; | |
832 } | |
833 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
834 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
835 char *buf; | |
836 int i = 8; | |
837 if (modname) | |
838 i += strlen(modname); | |
839 buf = g_malloc(i); | |
840 i = 0; | |
841 if (modname) { | |
842 memcpy(buf, modname, strlen(modname)); | |
843 i += strlen(modname); | |
844 } | |
845 buf[i++] = offset & 0xff; | |
846 buf[i++] = (offset >> 8) & 0xff; | |
847 buf[i++] = (offset >> 16) & 0xff; | |
848 buf[i++] = (offset >> 24) & 0xff; | |
849 buf[i++] = len & 0xff; | |
850 buf[i++] = (len >> 8) & 0xff; | |
851 buf[i++] = (len >> 16) & 0xff; | |
852 buf[i++] = (len >> 24) & 0xff; | |
853 debug_printf("len + offset is invalid, hashing request\n"); | |
854 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); | |
855 g_free(buf); | |
856 return 1; | |
857 } | |
858 */ | |
859 | |
860 pos = g_new0(struct pieceofcrap, 1); | |
861 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
862 pos->conn = fr->conn; |
2086 | 863 |
864 pos->offset = offset; | |
865 pos->len = len; | |
866 pos->modname = modname ? g_strdup(modname) : NULL; | |
867 | |
868 fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos); | |
869 if (fd < 0) { | |
870 if (pos->modname) | |
871 g_free(pos->modname); | |
872 g_free(pos); | |
873 do_error_dialog("Gaim was unable to get a valid hash for logging into AIM." | |
874 " You may be disconnected shortly.", "Login Error"); | |
875 } | |
876 pos->fd = fd; | |
877 | |
878 return 1; | |
879 } | |
880 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
881 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 882 #if 0 |
883 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; | |
884 #else | |
885 struct client_info_s info = AIM_CLIENTINFO_KNOWNGOOD; | |
886 #endif | |
887 char *key; | |
888 va_list ap; | |
889 struct gaim_connection *gc = sess->aux_data; | |
890 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
891 va_start(ap, fr); |
2086 | 892 key = va_arg(ap, char *); |
893 va_end(ap); | |
894 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
895 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
|
896 |
2086 | 897 return 1; |
898 } | |
899 | |
2675 | 900 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
2647 | 901 struct gaim_connection *gc = sess->aux_data; |
902 struct chat_connection *chatcon; | |
903 static int id = 1; | |
904 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
905 aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0); |
2675 | 906 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
907 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0); | |
908 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); | |
909 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0); | |
910 | |
2672 | 911 aim_clientready(sess, fr->conn); |
2675 | 912 |
2647 | 913 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
914 chatcon->id = id; | |
915 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
916 | |
917 return 1; | |
918 } | |
919 | |
2675 | 920 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
921 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
922 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 923 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 924 |
925 aim_clientready(sess, fr->conn); | |
926 | |
927 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
928 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
929 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
930 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
931 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
932 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 933 struct gaim_connection *gc = data; |
934 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
935 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
936 aim_conn_t *tstconn; |
2086 | 937 |
938 if (!g_slist_find(connections, gc)) { | |
939 close(source); | |
940 return; | |
941 } | |
942 | |
943 odata = gc->proto_data; | |
944 sess = odata->sess; | |
945 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); | |
946 | |
947 if (source < 0) { | |
948 aim_conn_kill(sess, &tstconn); | |
949 debug_printf("unable to connect to chatnav server\n"); | |
950 return; | |
951 } | |
952 | |
953 aim_conn_completeconnect(sess, tstconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
954 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
955 oscar_callback, tstconn); |
2086 | 956 debug_printf("chatnav: connected\n"); |
957 } | |
958 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
959 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 960 { |
961 struct gaim_connection *gc = data; | |
962 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
963 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
964 aim_conn_t *tstconn; |
2086 | 965 |
966 if (!g_slist_find(connections, gc)) { | |
967 close(source); | |
968 return; | |
969 } | |
970 | |
971 odata = gc->proto_data; | |
972 sess = odata->sess; | |
973 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); | |
974 | |
975 if (source < 0) { | |
976 aim_conn_kill(sess, &tstconn); | |
977 debug_printf("unable to connect to authorizer\n"); | |
978 return; | |
979 } | |
980 | |
981 aim_conn_completeconnect(sess, tstconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
982 odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, |
2086 | 983 oscar_callback, tstconn); |
984 debug_printf("chatnav: connected\n"); | |
985 } | |
986 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
987 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 988 { |
989 struct chat_connection *ccon = data; | |
990 struct gaim_connection *gc = ccon->gc; | |
991 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
992 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
993 aim_conn_t *tstconn; |
2086 | 994 |
995 if (!g_slist_find(connections, gc)) { | |
996 close(source); | |
997 g_free(ccon->show); | |
998 g_free(ccon->name); | |
999 g_free(ccon); | |
1000 return; | |
1001 } | |
1002 | |
1003 odata = gc->proto_data; | |
1004 sess = odata->sess; | |
1005 tstconn = ccon->conn; | |
1006 | |
1007 if (source < 0) { | |
1008 aim_conn_kill(sess, &tstconn); | |
1009 g_free(ccon->show); | |
1010 g_free(ccon->name); | |
1011 g_free(ccon); | |
1012 return; | |
1013 } | |
1014 | |
1015 aim_conn_completeconnect(sess, ccon->conn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1016 ccon->inpa = gaim_input_add(tstconn->fd, |
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1017 GAIM_INPUT_READ, |
2086 | 1018 oscar_callback, tstconn); |
1019 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); | |
1020 } | |
1021 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1022 /* 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
|
1023 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1024 va_list ap; |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1025 struct aim_redirect_data *redir; |
2086 | 1026 struct gaim_connection *gc = sess->aux_data; |
1027 struct aim_user *user = gc->user; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1028 aim_conn_t *tstconn; |
2086 | 1029 int i; |
1030 char *host; | |
1031 int port; | |
1032 | |
1033 port = user->proto_opt[USEROPT_AUTHPORT][0] ? | |
1034 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
1035 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1036 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1037 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1038 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1039 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1040 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1041 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1042 port = atoi(&(redir->ip[i+1])); |
2086 | 1043 break; |
1044 } | |
1045 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1046 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1047 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1048 switch(redir->group) { |
2086 | 1049 case 0x7: /* Authorizer */ |
1050 debug_printf("Reconnecting with authorizor...\n"); | |
1051 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
1052 if (tstconn == NULL) { | |
1053 debug_printf("unable to reconnect with authorizer\n"); | |
1054 g_free(host); | |
1055 return 1; | |
1056 } | |
2675 | 1057 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1058 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0); |
1059 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0); | |
1060 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0); | |
1061 | |
1062 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1063 tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc); | |
1064 if (tstconn->fd < 0) { | |
1065 aim_conn_kill(sess, &tstconn); | |
1066 debug_printf("unable to reconnect with authorizer\n"); | |
1067 g_free(host); | |
1068 return 1; | |
1069 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1070 aim_sendcookie(sess, tstconn, redir->cookie); |
2086 | 1071 break; |
1072 case 0xd: /* ChatNav */ | |
1073 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1074 if (tstconn == NULL) { | |
1075 debug_printf("unable to connect to chatnav server\n"); | |
1076 g_free(host); | |
1077 return 1; | |
1078 } | |
2675 | 1079 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1080 |
1081 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1082 tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc); | |
1083 if (tstconn->fd < 0) { | |
1084 aim_conn_kill(sess, &tstconn); | |
1085 debug_printf("unable to connect to chatnav server\n"); | |
1086 g_free(host); | |
1087 return 1; | |
1088 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1089 aim_sendcookie(sess, tstconn, redir->cookie); |
2086 | 1090 break; |
1091 case 0xe: /* Chat */ | |
1092 { | |
1093 struct chat_connection *ccon; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1094 |
2086 | 1095 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1096 if (tstconn == NULL) { | |
1097 debug_printf("unable to connect to chat server\n"); | |
1098 g_free(host); | |
1099 return 1; | |
1100 } | |
1101 | |
2675 | 1102 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1103 | |
2086 | 1104 ccon = g_new0(struct chat_connection, 1); |
1105 ccon->conn = tstconn; | |
1106 ccon->gc = gc; | |
1107 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1108 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1109 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1110 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1111 ccon->show = extract_name(redir->chat.room); |
2086 | 1112 |
1113 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1114 ccon->conn->fd = proxy_connect(host, port, oscar_chat_connect, ccon); | |
1115 if (ccon->conn->fd < 0) { | |
1116 aim_conn_kill(sess, &tstconn); | |
1117 debug_printf("unable to connect to chat server\n"); | |
1118 g_free(host); | |
1119 g_free(ccon->show); | |
1120 g_free(ccon->name); | |
1121 g_free(ccon); | |
1122 return 1; | |
1123 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1124 aim_sendcookie(sess, tstconn, redir->cookie); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1125 debug_printf("Connected to chat room %s exchange %d\n", ccon->name, ccon->exchange); |
2086 | 1126 } |
1127 break; | |
1128 default: /* huh? */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1129 debug_printf("got redirect for unknown service 0x%04x\n", redir->group); |
2086 | 1130 break; |
1131 } | |
1132 | |
1133 g_free(host); | |
1134 return 1; | |
1135 } | |
1136 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1137 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1138 struct gaim_connection *gc = sess->aux_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1139 struct oscar_data *od = gc->proto_data; |
2993 | 1140 aim_userinfo_t *info; |
1141 time_t time_idle = 0, signon = 0; | |
1142 int type = 0; | |
1143 int caps = 0; | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1144 char *tmp; |
2086 | 1145 |
1146 va_list ap; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1147 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1148 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1149 va_end(ap); |
1150 | |
2993 | 1151 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
1152 caps = info->capabilities; | |
1153 | |
1154 if (!od->icq && (info->present & AIM_USERINFO_PRESENT_FLAGS)) { | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1155 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1156 type |= UC_AB; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1157 if (info->flags & AIM_FLAG_UNCONFIRMED) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1158 type |= UC_UNCONFIRMED; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1159 if (info->flags & AIM_FLAG_ADMINISTRATOR) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1160 type |= UC_ADMIN; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1161 if (info->flags & AIM_FLAG_AOL) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1162 type |= UC_AOL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1163 if (info->flags & AIM_FLAG_FREE) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1164 type |= UC_NORMAL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1165 if (info->flags & AIM_FLAG_AWAY) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1166 type |= UC_UNAVAILABLE; |
3079 | 1167 if (info->flags & AIM_FLAG_WIRELESS) |
1168 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1169 } |
2993 | 1170 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3079 | 1171 type = (info->icqinfo.status << 7); |
3013 | 1172 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
1173 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 1174 type |= UC_UNAVAILABLE; |
3013 | 1175 } |
2993 | 1176 } |
1177 | |
1178 if (caps & AIM_CAPS_ICQ) | |
1179 caps ^= AIM_CAPS_ICQ; | |
1180 | |
1181 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 1182 time(&time_idle); |
1183 time_idle -= info->idletime*60; | |
2993 | 1184 } |
1185 | |
1186 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
1187 signon = time(NULL) - info->sessionlen; | |
2086 | 1188 |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1189 tmp = g_strdup(normalize(gc->username)); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1190 if (!strcmp(tmp, normalize(info->sn))) |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1191 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1192 g_free(tmp); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1193 |
2993 | 1194 serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon, |
2713
34ddcb44a4d2
[gaim-migrate @ 2726]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
1195 time_idle, type, caps); |
2086 | 1196 |
1197 return 1; | |
1198 } | |
1199 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1200 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
|
1201 aim_userinfo_t *info; |
2086 | 1202 va_list ap; |
1203 struct gaim_connection *gc = sess->aux_data; | |
1204 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1205 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1206 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1207 va_end(ap); |
1208 | |
1209 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0); | |
1210 | |
1211 return 1; | |
1212 } | |
1213 | |
1214 static void cancel_direct_im(gpointer w, struct ask_direct *d) { | |
1215 debug_printf("Freeing DirectIM prompts.\n"); | |
1216 | |
1217 g_free(d->sn); | |
1218 g_free(d); | |
1219 } | |
1220 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1221 static void oscar_directim_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1222 struct direct_im *dim = data; |
1223 struct gaim_connection *gc = dim->gc; | |
1224 struct oscar_data *od = gc->proto_data; | |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
1225 struct conversation *cnv; |
2086 | 1226 char buf[256]; |
3008 | 1227 struct sockaddr name; |
1228 socklen_t name_len = 1; | |
1229 | |
2086 | 1230 if (!g_slist_find(connections, gc)) { |
1231 g_free(dim); | |
1232 return; | |
1233 } | |
1234 | |
1235 if (source < 0) { | |
1236 g_free(dim); | |
1237 return; | |
1238 } | |
1239 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1240 if (dim->conn->fd != source) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1241 dim->conn->fd = source; |
2086 | 1242 aim_conn_completeconnect(od->sess, dim->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1243 if (!(cnv = find_conversation(dim->name))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1244 cnv = new_conversation(dim->name); |
3008 | 1245 |
1246 /* This is the best way to see if we're connected or not */ | |
1247 if (getpeername(source, &name, &name_len) == 0) { | |
1248 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
1249 dim->connected = TRUE; | |
1250 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1); | |
1251 } | |
2086 | 1252 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 1253 |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1254 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
3008 | 1255 oscar_callback, dim->conn); |
2086 | 1256 } |
1257 | |
1258 static int accept_direct_im(gpointer w, struct ask_direct *d) { | |
1259 struct gaim_connection *gc = d->gc; | |
1260 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
1261 struct direct_im *dim; | |
2945 | 1262 char *host; int port = 4443; |
2086 | 1263 int i; |
1264 | |
1265 debug_printf("Accepted DirectIM.\n"); | |
1266 | |
1267 dim = find_direct_im(od, d->sn); | |
1268 if (dim) { | |
1269 cancel_direct_im(w, d); /* 40 */ | |
1270 return TRUE; | |
1271 } | |
1272 dim = g_new0(struct direct_im, 1); | |
1273 dim->gc = d->gc; | |
1274 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
1275 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1276 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
|
1277 if (!dim->conn) { |
2086 | 1278 g_free(dim); |
1279 cancel_direct_im(w, d); | |
1280 return TRUE; | |
1281 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1282 |
2086 | 1283 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
1284 gaim_directim_incoming, 0); | |
1285 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, | |
1286 gaim_directim_typing, 0); | |
3033 | 1287 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
2993 | 1288 gaim_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1289 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1290 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1291 port = atoi(&(d->ip[i+1])); |
2086 | 1292 break; |
1293 } | |
1294 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1295 host = g_strndup(d->ip, i); |
2086 | 1296 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
1297 dim->conn->fd = proxy_connect(host, port, oscar_directim_callback, dim); | |
1298 g_free(host); | |
1299 if (dim->conn->fd < 0) { | |
1300 aim_conn_kill(od->sess, &dim->conn); | |
1301 g_free(dim); | |
1302 cancel_direct_im(w, d); | |
1303 return TRUE; | |
1304 } | |
1305 | |
1306 cancel_direct_im(w, d); | |
1307 | |
1308 return TRUE; | |
1309 } | |
1310 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1311 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
|
1312 char *tmp = g_malloc(BUF_LONG); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1313 struct gaim_connection *gc = sess->aux_data; |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1314 int flags = 0; |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1315 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1316 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1317 flags |= IM_FLAG_AWAY; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1318 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1319 if (args->icbmflags & AIM_IMFLAGS_HASICON) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1320 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1321 struct icon_req *ir = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1322 GSList *h = od->hasicons; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1323 char *who = normalize(userinfo->sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1324 debug_printf("%s has an icon\n", userinfo->sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1325 while (h) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1326 ir = h->data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1327 if (!strcmp(ir->user, who)) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1328 break; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1329 h = h->next; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1330 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1331 if (!h) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1332 ir = g_new0(struct icon_req, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1333 ir->user = g_strdup(who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1334 od->hasicons = g_slist_append(od->hasicons, ir); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1335 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1336 if ((args->iconlen != ir->length) || |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1337 (args->iconsum != ir->checksum) || |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1338 (args->iconstamp != ir->timestamp)) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1339 ir->request = TRUE; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1340 ir->length = args->iconlen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1341 ir->checksum = args->iconsum; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1342 ir->timestamp = args->iconstamp; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1343 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1344 |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1345 if (gc->user->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1346 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1347 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1348 |
2248
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
1349 if (!stat(gc->user->iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1350 char *buf = g_malloc(st.st_size); |
2248
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
1351 file = fopen(gc->user->iconfile, "r"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1352 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
1353 int len = fread(buf, 1, st.st_size, file); |
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
1354 debug_printf("Sending buddy icon to %s (%d bytes, %d reported)\n", |
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
1355 userinfo->sn, len, st.st_size); |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
1356 aim_send_icon(sess, userinfo->sn, buf, st.st_size, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1357 st.st_mtime, aim_iconsum(buf, st.st_size)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1358 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1359 } else |
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1360 debug_printf("Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1361 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1362 } else |
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1363 debug_printf("Can't stat buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1364 } |
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 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1367 * Quickly convert it to eight bit format, replacing |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1368 * non-ASCII UNICODE characters with their equivelent |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1369 * HTML entity. |
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 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1372 int i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1373 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1374 for (i = 0, tmp[0] = '\0'; i < args->msglen; i += 2) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1375 unsigned short uni; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1376 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1377 uni = ((args->msg[i] & 0xff) << 8) | (args->msg[i+1] & 0xff); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1378 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1379 if ((uni < 128) || ((uni >= 160) && (uni <= 255))) { /* ISO 8859-1 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1380 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1381 g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "%c", uni); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1382 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1383 } else { /* something else, do UNICODE entity */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1384 g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "&#%04x;", uni); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1385 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1386 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1387 } else |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1388 g_snprintf(tmp, BUF_LONG, "%s", args->msg); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1389 |
2817
8ceb67d1645e
[gaim-migrate @ 2830]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2799
diff
changeset
|
1390 strip_linefeed(tmp); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2833
diff
changeset
|
1391 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1392 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1393 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1394 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1395 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1396 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1397 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
|
1398 struct gaim_connection *gc = sess->aux_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1399 |
2869 | 1400 debug_printf("rendezvous status %d (%s)\n", args->status, userinfo->sn); |
1401 | |
1402 if (args->status != AIM_RENDEZVOUS_PROPOSE) | |
1403 return 1; | |
1404 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1405 if (args->reqclass & AIM_CAPS_CHAT) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1406 char *name = extract_name(args->info.chat.roominfo.name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1407 int *exch = g_new0(int, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1408 GList *m = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1409 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
|
1410 *exch = args->info.chat.roominfo.exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1411 m = g_list_append(m, exch); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1412 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1413 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1414 userinfo->sn, |
2869 | 1415 (char *)args->msg, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1416 m); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1417 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1418 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1419 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1420 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1421 } else if (args->reqclass & AIM_CAPS_VOICE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1422 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1423 set_icon_data(gc, normalize(userinfo->sn), args->info.icon.icon, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1424 args->info.icon.length); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1425 } else if (args->reqclass & AIM_CAPS_IMIMAGE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1426 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1427 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1428 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1429 debug_printf("%s received direct im request from %s (%s)\n", |
2869 | 1430 gc->username, userinfo->sn, args->verifiedip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1431 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1432 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1433 d->sn = g_strdup(userinfo->sn); |
2869 | 1434 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1435 memcpy(d->cookie, args->cookie, 8); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1436 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
|
1437 userinfo->sn, gc->username); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1438 do_ask_dialog(buf, d, accept_direct_im, cancel_direct_im); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1439 } else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1440 debug_printf("Unknown reqclass %d\n", args->reqclass); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1441 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1442 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1443 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1444 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1445 |
3141 | 1446 static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { |
1447 char *uin, message; | |
1448 struct oscar_data *od = (struct oscar_data *)data->gc->proto_data; | |
3159 | 1449 uin = g_strdup_printf("%lu", data->uin); |
3141 | 1450 message = 0; |
1451 aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); | |
1452 show_got_added(data->gc, NULL, uin, NULL, NULL); | |
1453 g_free(uin); | |
1454 data->uin = 0; | |
1455 } | |
1456 | |
1457 static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) { | |
1458 if (data->uin) { | |
1459 char *uin, *message; | |
1460 struct oscar_data *od = (struct oscar_data *)data->gc->proto_data; | |
3159 | 1461 uin = g_strdup_printf("%lu", data->uin); |
3141 | 1462 message = g_strdup_printf("No reason given."); |
1463 aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHDENIED, message); | |
1464 g_free(uin); | |
1465 g_free(message); | |
1466 } | |
1467 g_free(data); | |
1468 } | |
1469 | |
1470 /* | |
1471 * For when other people ask you for authorization | |
1472 */ | |
1473 static void gaim_icq_authask(struct gaim_connection *gc, fu32_t uin, char *msg) { | |
1474 struct icq_auth *data = g_new(struct icq_auth, 1); | |
1475 /* The first 6 chars of the message are some type of alien gibberish, so skip them */ | |
3159 | 1476 char *dialog_msg = g_strdup_printf("The user %lu wants to add you to their buddy list for the following reason:\n\n%s", uin, (msg && strlen(msg)>6) ? msg+6 : "No reason given."); |
1477 debug_printf("Received an authorization request from UIN %lu\n", uin); | |
3141 | 1478 data->gc = gc; |
1479 data->uin = uin; | |
1480 do_ask_dialog(dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny); | |
1481 g_free(dialog_msg); | |
1482 } | |
1483 | |
1484 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args) { | |
1485 struct gaim_connection *gc = sess->aux_data; | |
1486 | |
1487 switch (args->type) { | |
1488 case 0x0006: { /* Someone requested authorization */ | |
1489 gaim_icq_authask(gc, args->uin, args->msg); | |
1490 } break; | |
1491 | |
1492 case 0x0007: { /* Someone has denied you authorization */ | |
1493 char *dialog_msg; | |
3159 | 1494 dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, args->msg ? args->msg : _("No reason given.")); |
3141 | 1495 do_error_dialog(dialog_msg, _("Gaim - ICQ Authorization Denied")); |
1496 g_free(dialog_msg); | |
1497 } break; | |
1498 | |
1499 case 0x0008: { /* Someone has granted you authorization */ | |
1500 char *dialog_msg; | |
3159 | 1501 dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), args->uin); |
3141 | 1502 do_error_dialog(dialog_msg, _("Gaim - ICQ Authorization Granted")); |
1503 g_free(dialog_msg); | |
1504 } break; | |
1505 | |
1506 case 0x0012: { | |
1507 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ | |
1508 } break; | |
1509 | |
1510 default: { | |
1511 debug_printf("Received a channel 4 message of unknown type (type 0x%04d).\n", args->type); | |
1512 } break; | |
1513 } | |
1514 | |
1515 return 1; | |
1516 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1517 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1518 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
|
1519 int channel, ret = 0; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1520 aim_userinfo_t *userinfo; |
2086 | 1521 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1522 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1523 va_start(ap, fr); |
2086 | 1524 channel = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1525 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 1526 |
3141 | 1527 switch (channel) { |
1528 case 1: { /* standard message */ | |
1529 struct aim_incomingim_ch1_args *args; | |
1530 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
1531 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
1532 } break; | |
1533 | |
1534 case 2: { /* rendevous */ | |
1535 struct aim_incomingim_ch2_args *args; | |
1536 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
1537 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
1538 } break; | |
1539 | |
1540 case 4: { /* ICQ */ | |
1541 struct aim_incomingim_ch4_args *args; | |
1542 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
1543 ret = incomingim_chan4(sess, fr->conn, userinfo, args); | |
1544 } break; | |
1545 | |
1546 default: { | |
1547 debug_printf("ICBM received on unsupported channel (channel 0x%04d).", channel); | |
1548 } break; | |
2086 | 1549 } |
1550 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1551 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1552 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1553 return ret; |
2086 | 1554 } |
1555 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1556 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1557 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1558 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1559 aim_userinfo_t *userinfo; |
2086 | 1560 char buf[1024]; |
1561 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1562 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1563 chan = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1564 userinfo = va_arg(ap, aim_userinfo_t *); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1565 nummissed = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1566 reason = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1567 va_end(ap); |
1568 | |
1569 switch(reason) { | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1570 case 0: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1571 /* Invalid (0) */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1572 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1573 sizeof(buf), |
2946 | 1574 nummissed == 1 ? |
2947 | 1575 _("You missed %d message from %s because it was invalid.") : |
1576 _("You missed %d messages from %s because they were invalid."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1577 nummissed, |
2947 | 1578 userinfo->sn); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1579 break; |
2086 | 1580 case 1: |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1581 /* Message too large */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1582 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1583 sizeof(buf), |
2943 | 1584 nummissed == 1 ? |
1585 _("You missed %d message from %s because it was too large.") : | |
2946 | 1586 _("You missed %d messages from %s because they were too large."), |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1587 nummissed, |
2943 | 1588 userinfo->sn); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1589 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1590 case 2: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1591 /* Rate exceeded */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1592 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1593 sizeof(buf), |
2943 | 1594 nummissed == 1 ? |
1595 _("You missed %d message from %s because the rate limit has been exceeded.") : | |
1596 _("You missed %d messages from %s because the rate limit has been exceeded."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1597 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1598 userinfo->sn); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1599 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1600 case 3: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1601 /* Evil Sender */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1602 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1603 sizeof(buf), |
2943 | 1604 nummissed == 1 ? |
2947 | 1605 _("You missed %d message from %s because it was too evil.") : |
2943 | 1606 _("You missed %d messages from %s because they are too evil."), |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1607 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1608 userinfo->sn); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1609 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1610 case 4: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1611 /* Evil Receiver */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1612 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1613 sizeof(buf), |
2943 | 1614 nummissed == 1 ? |
1615 _("You missed %d message from %s because you are too evil.") : | |
1616 _("You missed %d messages from %s because you are too evil."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1617 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1618 userinfo->sn); |
2086 | 1619 break; |
1620 default: | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1621 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1622 sizeof(buf), |
2943 | 1623 nummissed == 1 ? |
1624 _("You missed %d message from %s for unknown reasons.") : | |
1625 _("You missed %d messages from %s for unknown reasons."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1626 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1627 userinfo->sn); |
2086 | 1628 break; |
1629 } | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1630 do_error_dialog(buf, _("Gaim - Error")); |
2086 | 1631 |
1632 return 1; | |
1633 } | |
1634 | |
3212 | 1635 static char *gaim_icq_status(int state) { |
1636 /* Make a cute little string that shows the status of the dude or dudet */ | |
1637 if (state & AIM_ICQ_STATE_CHAT) | |
1638 return g_strdup_printf("Free For Chat"); | |
1639 else if (state & AIM_ICQ_STATE_DND) | |
1640 return g_strdup_printf("Do Not Disturb"); | |
1641 else if (state & AIM_ICQ_STATE_OUT) | |
1642 return g_strdup_printf("Not Available"); | |
1643 else if (state & AIM_ICQ_STATE_BUSY) | |
1644 return g_strdup_printf("Occupied"); | |
1645 else if (state & AIM_ICQ_STATE_AWAY) | |
1646 return g_strdup_printf("Away"); | |
1647 else if (state & AIM_ICQ_STATE_WEBAWARE) | |
1648 return g_strdup_printf("Web Aware"); | |
1649 else if (state & AIM_ICQ_STATE_INVISIBLE) | |
1650 return g_strdup_printf("Invisible"); | |
1651 else | |
1652 return g_strdup_printf("Online"); | |
1653 } | |
1654 | |
1655 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { | |
1656 struct gaim_connection *gc = sess->aux_data; | |
1657 va_list ap; | |
1658 fu16_t chan, reason; | |
1659 char *who; | |
1660 | |
1661 va_start(ap, fr); | |
1662 chan = (fu16_t)va_arg(ap, unsigned int); | |
1663 who = va_arg(ap, char *); | |
1664 reason = (fu16_t)va_arg(ap, unsigned int); | |
1665 | |
1666 switch(reason) { | |
1667 case 0x0003: { /* Reply from an ICQ status message request */ | |
1668 int state = (int)va_arg(ap, fu32_t); | |
1669 char *msg = va_arg(ap, char *); | |
1670 char *status_msg = gaim_icq_status(state); | |
1671 char *dialog_msg, **splitmsg; | |
1672 struct oscar_data *od = gc->proto_data; | |
1673 GSList *l = od->evilhack; | |
1674 gboolean evilhack = FALSE; | |
1675 | |
1676 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
1677 splitmsg = g_strsplit(msg, "\r\n", 0); | |
1678 | |
1679 /* If who is in od->evilhack, then we're just getting the away message, otherwise this | |
1680 * will just get appended to the info box (which is already showing). */ | |
1681 while (l) { | |
1682 char *x = l->data; | |
1683 if (!strcmp(x, normalize(who))) { | |
1684 evilhack = TRUE; | |
1685 g_free(x); | |
1686 od->evilhack = g_slist_remove(od->evilhack, x); | |
1687 break; | |
1688 } | |
1689 l = l->next; | |
1690 } | |
1691 | |
1692 if (evilhack) | |
1693 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><BR>%s<BR>"), who, status_msg, g_strjoinv("<BR>", splitmsg)); | |
1694 else | |
1695 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<BR><HR><BR>%s<BR>"), status_msg, g_strjoinv("<BR>", splitmsg)); | |
1696 g_show_info_text(gc, who, 2, dialog_msg, NULL); | |
1697 | |
1698 g_free(status_msg); | |
1699 g_free(dialog_msg); | |
1700 g_strfreev(splitmsg); | |
1701 } break; | |
1702 | |
1703 default: { | |
1704 debug_printf("Received an unknown client auto-response from %s. Type 0x%04x\n", who, reason); | |
1705 } break; | |
1706 } | |
1707 va_end(ap); | |
1708 | |
1709 return 1; | |
1710 } | |
1711 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1712 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1713 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1714 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
1715 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1716 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1717 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1718 reason = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1719 va_end(ap); |
1720 | |
2864
e22c09351e67
[gaim-migrate @ 2877]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
1721 debug_printf("snac threw error (reason 0x%04x: %s)\n", reason, |
2086 | 1722 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
1723 | |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
1724 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
1725 reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error"); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
1726 do_error_dialog(m, _("Gaim - Oscar SNAC Error")); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
1727 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
1728 |
2086 | 1729 return 1; |
1730 } | |
1731 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1732 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1733 va_list ap; |
1734 char *destn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1735 fu16_t reason; |
2086 | 1736 char buf[1024]; |
1737 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1738 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1739 reason = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1740 destn = va_arg(ap, char *); |
1741 va_end(ap); | |
1742 | |
1743 sprintf(buf, _("Your message to %s did not get sent: %s"), destn, | |
1744 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); | |
1745 do_error_dialog(buf, _("Gaim - Error")); | |
1746 | |
1747 return 1; | |
1748 } | |
1749 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1750 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1751 va_list ap; |
1752 char *destn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1753 fu16_t reason; |
2086 | 1754 char buf[1024]; |
1755 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1756 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1757 reason = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1758 destn = va_arg(ap, char *); |
1759 va_end(ap); | |
1760 | |
1761 sprintf(buf, _("User information for %s unavailable: %s"), destn, | |
1762 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); | |
1763 do_error_dialog(buf, _("Gaim - Error")); | |
1764 | |
1765 return 1; | |
1766 } | |
1767 | |
1768 static char *images(int flags) { | |
1769 static char buf[1024]; | |
3101 | 1770 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
2679 | 1771 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
2086 | 1772 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
1773 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
3101 | 1774 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
2086 | 1775 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
3079 | 1776 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
1777 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); | |
2086 | 1778 return buf; |
1779 } | |
1780 | |
3101 | 1781 |
2920 | 1782 /* XXX This is horribly copied from ../../buddy.c. */ |
1783 static char *caps_string(guint caps) | |
1784 { | |
1785 static char buf[512], *tmp; | |
1786 int count = 0, i = 0; | |
1787 guint bit = 1; | |
1788 while (bit <= 0x10000) { | |
1789 if (bit & caps) { | |
1790 switch (bit) { | |
1791 case 0x1: | |
1792 tmp = _("Buddy Icon"); | |
1793 break; | |
1794 case 0x2: | |
1795 tmp = _("Voice"); | |
1796 break; | |
1797 case 0x4: | |
1798 tmp = _("IM Image"); | |
1799 break; | |
1800 case 0x8: | |
1801 tmp = _("Chat"); | |
1802 break; | |
1803 case 0x10: | |
1804 tmp = _("Get File"); | |
1805 break; | |
1806 case 0x20: | |
1807 tmp = _("Send File"); | |
1808 break; | |
1809 case 0x40: | |
1810 case 0x200: | |
1811 tmp = _("Games"); | |
1812 break; | |
1813 case 0x80: | |
1814 tmp = _("Stocks"); | |
1815 break; | |
1816 case 0x100: | |
1817 tmp = _("Send Buddy List"); | |
1818 break; | |
1819 case 0x400: | |
1820 tmp = _("EveryBuddy Bug"); | |
1821 break; | |
1822 case 0x800: | |
1823 tmp = _("AP User"); | |
1824 break; | |
1825 case 0x1000: | |
1826 tmp = _("ICQ RTF"); | |
1827 break; | |
1828 case 0x2000: | |
1829 tmp = _("Nihilist"); | |
1830 break; | |
1831 case 0x4000: | |
1832 tmp = _("ICQ Server Relay"); | |
1833 break; | |
1834 case 0x8000: | |
1835 tmp = _("ICQ Unknown"); | |
1836 break; | |
1837 case 0x10000: | |
1838 tmp = _("Trillian Encryption"); | |
1839 break; | |
1840 default: | |
1841 tmp = NULL; | |
1842 break; | |
1843 } | |
1844 if (tmp) | |
1845 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
1846 tmp); | |
1847 count++; | |
1848 } | |
1849 bit <<= 1; | |
1850 } | |
1851 return buf; | |
1852 } | |
1853 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1854 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
|
1855 aim_userinfo_t *info; |
2086 | 1856 char *prof_enc = NULL, *prof = NULL; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1857 fu16_t infotype; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1858 char header[BUF_LONG]; |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
1859 char legend[BUF_LONG]; |
2086 | 1860 struct gaim_connection *gc = sess->aux_data; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1861 struct oscar_data *od = gc->proto_data; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1862 GSList *l = od->evilhack; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1863 gboolean evilhack = FALSE; |
2086 | 1864 va_list ap; |
2993 | 1865 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; |
2086 | 1866 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1867 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1868 info = va_arg(ap, aim_userinfo_t *); |
2920 | 1869 infotype = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1870 prof_enc = va_arg(ap, char *); |
1871 prof = va_arg(ap, char *); | |
1872 va_end(ap); | |
1873 | |
3101 | 1874 if (!od->icq) { |
1875 g_snprintf(legend, sizeof legend, | |
1876 _("<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>" | |
1877 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>" | |
1878 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>" | |
1879 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>" | |
1880 "<IMG SRC=\"admin_icon.gif\"> : Administrator <br>" | |
1881 "<IMG SRC=\"ab_icon.gif\"> : ActiveBuddy Interactive Agent<br>" | |
1882 "<IMG SRC=\"wireless_icon.gif\"> : Wireless Device User<br>")); | |
3106 | 1883 } else { |
1884 legend[0] = 0; | |
3101 | 1885 } |
1886 | |
2993 | 1887 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) { |
1888 onlinesince = g_strdup_printf("Online Since : <B>%s</B><BR>\n", | |
1889 asctime(localtime(&info->onlinesince))); | |
1890 } | |
1891 | |
1892 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { | |
1893 membersince = g_strdup_printf("Member Since : <B>%s</B><BR>\n", | |
1894 asctime(localtime(&info->membersince))); | |
1895 } | |
1896 | |
1897 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
1898 idle = g_strdup_printf("Idle : <B>%d minutes</B>", | |
1899 info->idletime); | |
1900 } else | |
1901 idle = g_strdup("Idle: <B>Active</B>"); | |
1902 | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1903 g_snprintf(header, sizeof header, |
2086 | 1904 _("Username : <B>%s</B> %s <BR>\n" |
2993 | 1905 "Warning Level : <B>%d %%</B><BR>\n" |
2086 | 1906 "%s" |
2993 | 1907 "%s" |
1908 "%s<BR>\n" | |
1909 "<HR><BR>\n"), | |
2086 | 1910 info->sn, images(info->flags), |
1911 info->warnlevel/10, | |
2993 | 1912 onlinesince ? onlinesince : "", |
1913 membersince ? membersince : "", | |
1914 idle ? idle : ""); | |
1915 | |
1916 g_free(onlinesince); | |
1917 g_free(membersince); | |
1918 g_free(idle); | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
1919 |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1920 while (l) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1921 char *x = l->data; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1922 if (!strcmp(x, normalize(info->sn))) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1923 evilhack = TRUE; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1924 g_free(x); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1925 od->evilhack = g_slist_remove(od->evilhack, x); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1926 break; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1927 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1928 l = l->next; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1929 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1930 |
2920 | 1931 if (infotype == AIM_GETINFO_AWAYMESSAGE) { |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1932 if (evilhack) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1933 g_show_info_text(gc, info->sn, 2, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1934 header, |
2797
ccb5b2f05d16
[gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1935 (prof && *prof) ? away_subs(prof, gc->username) : |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1936 _("<i>User has no away message</i>"), |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1937 legend, NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1938 } else { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1939 g_show_info_text(gc, info->sn, 0, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1940 header, |
2797
ccb5b2f05d16
[gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1941 (prof && *prof) ? away_subs(prof, gc->username) : NULL, |
2799
72357bddb0f3
[gaim-migrate @ 2812]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2797
diff
changeset
|
1942 (prof && *prof) ? "<BR><HR><BR>" : NULL, |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1943 NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1944 } |
2920 | 1945 } else if (infotype == AIM_GETINFO_CAPABILITIES) { |
1946 g_show_info_text(gc, info->sn, 2, | |
1947 header, | |
1948 "<i>", _("Client Capabilities: "), | |
1949 caps_string(info->capabilities), | |
1950 "</i>", | |
1951 legend, | |
1952 NULL); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1953 } else { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1954 g_show_info_text(gc, info->sn, 1, |
2797
ccb5b2f05d16
[gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1955 (prof && *prof) ? away_subs(prof, gc->username) : |
ccb5b2f05d16
[gaim-migrate @ 2810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1956 _("<i>No Information Provided</i>"), |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1957 legend, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1958 NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
1959 } |
2086 | 1960 |
1961 return 1; | |
1962 } | |
1963 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1964 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1965 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1966 fu16_t id; |
2086 | 1967 va_list ap; |
1968 char buildbuf[150]; | |
1969 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1970 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1971 id = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1972 msg = va_arg(ap, char *); |
1973 va_end(ap); | |
1974 | |
1975 aim_getbuildstring(buildbuf, sizeof(buildbuf)); | |
1976 | |
1977 debug_printf("MOTD: %s (%d)\n", msg ? msg : "Unknown", id); | |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
1978 if (id < 4) |
2086 | 1979 do_error_dialog(_("Your connection may be lost."), |
1980 _("AOL error")); | |
1981 | |
1982 return 1; | |
1983 } | |
1984 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1985 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1986 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1987 fu16_t type; |
2086 | 1988 struct gaim_connection *gc = sess->aux_data; |
1989 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
1990 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1991 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1992 type = (fu16_t)va_arg(ap, unsigned int); |
2086 | 1993 |
1994 switch(type) { | |
1995 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1996 fu8_t maxrooms; |
2086 | 1997 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1998 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1999 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2000 maxrooms = (fu8_t)va_arg(ap, unsigned int); |
2086 | 2001 exchangecount = va_arg(ap, int); |
2002 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
2003 va_end(ap); | |
2004 | |
2005 debug_printf("chat info: Chat Rights:\n"); | |
2006 debug_printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms); | |
2007 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2008 for (i = 0; i < exchangecount; i++) |
2931 | 2009 debug_printf("chat info: \t\t%d %s\n", exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2010 while (odata->create_rooms) { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2011 struct create_room *cr = odata->create_rooms->data; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2012 debug_printf("creating room %s\n", cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2013 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2014 g_free(cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2015 odata->create_rooms = g_slist_remove(odata->create_rooms, cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2016 g_free(cr); |
2086 | 2017 } |
2018 } | |
2019 break; | |
2020 case 0x0008: { | |
2021 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2022 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2023 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2024 fu32_t createtime; |
2086 | 2025 |
2026 fqcn = va_arg(ap, char *); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2027 instance = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2028 exchange = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2029 flags = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2030 createtime = va_arg(ap, fu32_t); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2031 maxmsglen = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2032 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2033 createperms = (fu8_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2034 unknown = (fu16_t)va_arg(ap, unsigned int); |
2086 | 2035 name = va_arg(ap, char *); |
2036 ck = va_arg(ap, char *); | |
2037 va_end(ap); | |
2038 | |
2039 debug_printf("created room: %s %d %d %d %lu %d %d %d %d %s %s\n", | |
2040 fqcn, | |
2041 exchange, instance, flags, | |
2042 createtime, | |
2043 maxmsglen, maxoccupancy, createperms, unknown, | |
2044 name, ck); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2045 aim_chat_join(odata->sess, odata->conn, exchange, ck, instance); |
2086 | 2046 } |
2047 break; | |
2048 default: | |
2049 va_end(ap); | |
2050 debug_printf("chatnav info: unknown type (%04x)\n", type); | |
2051 break; | |
2052 } | |
2053 return 1; | |
2054 } | |
2055 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2056 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2057 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2058 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2059 aim_userinfo_t *info; |
2086 | 2060 struct gaim_connection *g = sess->aux_data; |
2061 | |
2062 struct chat_connection *c = NULL; | |
2063 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2064 va_start(ap, fr); |
2086 | 2065 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2066 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2067 va_end(ap); |
2068 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2069 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 2070 if (!c) |
2071 return 1; | |
2072 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2073 for (i = 0; i < count; i++) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2074 add_chat_buddy(c->cnv, info[i].sn); |
2086 | 2075 |
2076 return 1; | |
2077 } | |
2078 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2079 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2080 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2081 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2082 aim_userinfo_t *info; |
2086 | 2083 struct gaim_connection *g = sess->aux_data; |
2084 | |
2085 struct chat_connection *c = NULL; | |
2086 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2087 va_start(ap, fr); |
2086 | 2088 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2089 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2090 va_end(ap); |
2091 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2092 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 2093 if (!c) |
2094 return 1; | |
2095 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2096 for (i = 0; i < count; i++) |
2820
b917845dad3c
[gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2817
diff
changeset
|
2097 remove_chat_buddy(c->cnv, info[i].sn, NULL); |
2086 | 2098 |
2099 return 1; | |
2100 } | |
2101 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2102 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
|
2103 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2104 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2105 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2106 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2107 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2108 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2109 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2110 fu32_t creationtime; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2111 struct gaim_connection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2112 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
|
2113 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2114 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2115 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2116 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2117 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2118 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2119 roomdesc = va_arg(ap, char *); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2120 unknown_c9 = (fu16_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2121 creationtime = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2122 maxmsglen = (fu16_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2123 unknown_d2 = (fu16_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2124 unknown_d5 = (fu16_t)va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2125 maxvisiblemsglen = (fu16_t)va_arg(ap, int); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2126 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2127 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2128 debug_printf("inside chat_info_update (maxmsglen = %d, maxvislen = %d)\n", |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2129 maxmsglen, maxvisiblemsglen); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2130 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2131 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2132 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2133 |
2086 | 2134 return 1; |
2135 } | |
2136 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2137 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2138 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2139 aim_userinfo_t *info; |
2086 | 2140 char *msg; |
2141 struct gaim_connection *gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2142 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
2086 | 2143 char *tmp; |
2144 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2145 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2146 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2147 msg = va_arg(ap, char *); |
2148 | |
2149 tmp = g_malloc(BUF_LONG); | |
2150 g_snprintf(tmp, BUF_LONG, "%s", msg); | |
2151 serv_got_chat_in(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL)); | |
2152 g_free(tmp); | |
2153 | |
2154 return 1; | |
2155 } | |
2156 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2157 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2158 * 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
|
2159 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2160 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2161 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2162 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2163 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2164 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2165 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2166 type = (fu16_t)va_arg(ap, unsigned int); |
2086 | 2167 sn = va_arg(ap, char *); |
2168 va_end(ap); | |
2169 | |
2170 debug_printf("Sent message to %s.\n", sn); | |
2171 | |
2172 return 1; | |
2173 } | |
2174 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2175 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
|
2176 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2177 "invalid", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2178 "change", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2179 "warning", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2180 "limit", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2181 "limit cleared", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2182 }; |
2086 | 2183 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2184 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2185 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2186 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2187 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2188 code = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2189 rateclass= (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2190 windowsize = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2191 clear = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2192 alert = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2193 limit = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2194 disconnect = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2195 currentavg = (fu32_t)va_arg(ap, unsigned long); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2196 maxavg = (fu32_t)va_arg(ap, unsigned long); |
2086 | 2197 va_end(ap); |
2198 | |
2199 debug_printf("rate %s (paramid 0x%04lx): curavg = %ld, maxavg = %ld, alert at %ld, " | |
2200 "clear warning at %ld, limit at %ld, disconnect at %ld (window size = %ld)\n", | |
2201 (code < 5) ? codes[code] : codes[0], | |
2202 rateclass, | |
2203 currentavg, maxavg, | |
2204 alert, clear, | |
2205 limit, disconnect, | |
2206 windowsize); | |
2207 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2208 /* XXX fix these values */ |
2086 | 2209 if (code == AIM_RATE_CODE_CHANGE) { |
2210 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2211 aim_conn_setlatency(fr->conn, 0); |
2086 | 2212 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2213 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
2214 } else if (code == AIM_RATE_CODE_LIMIT) { |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2869
diff
changeset
|
2215 do_error_dialog(_("The last message was not sent because you are over the rate limit. " |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2869
diff
changeset
|
2216 "Please wait 10 seconds and try again."), _("Gaim - Error")); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2217 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 2218 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2219 aim_conn_setlatency(fr->conn, 0); |
2086 | 2220 } |
2221 | |
2222 return 1; | |
2223 } | |
2224 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2225 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2226 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2227 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2228 aim_userinfo_t *userinfo; |
2086 | 2229 struct gaim_connection *gc = sess->aux_data; |
2230 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2231 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2232 newevil = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2233 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 2234 va_end(ap); |
2235 | |
2236 serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, newevil / 10); | |
2237 | |
2238 return 1; | |
2239 } | |
2240 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2241 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
|
2242 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2243 aim_userinfo_t *info; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2244 struct gaim_connection *gc = sess->aux_data; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2245 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2246 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2247 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2248 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2249 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2250 gc->evil = info->warnlevel/10; |
2698
e80f4b4f840f
[gaim-migrate @ 2711]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2689
diff
changeset
|
2251 /* gc->correction_time = (info->onlinesince - gc->login_time); */ |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2252 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2253 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2254 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2255 |
2675 | 2256 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2257 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2258 aim_reqpersonalinfo(sess, fr->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2259 aim_bos_reqlocaterights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2260 aim_bos_reqbuddyrights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2261 |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
2262 aim_reqicbmparams(sess); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2263 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2264 aim_bos_reqrights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2265 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2266 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2267 AIM_PRIVFLAGS_ALLOWMEMBERSINCE); |
2086 | 2268 |
2269 return 1; | |
2270 } | |
2271 | |
2675 | 2272 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
2647 | 2273 struct gaim_connection *gc = sess->aux_data; |
2274 struct oscar_data *od = gc->proto_data; | |
2275 | |
2672 | 2276 aim_clientready(sess, fr->conn); |
2675 | 2277 debug_printf("connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2278 |
2647 | 2279 if (od->chpass) { |
2280 debug_printf("changing password\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2281 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 2282 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2283 od->oldp = NULL; |
2647 | 2284 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2285 od->newp = NULL; |
2647 | 2286 od->chpass = FALSE; |
2287 } | |
2979 | 2288 if (od->setnick) { |
2289 debug_printf("formatting screenname\n"); | |
2290 aim_admin_setnick(sess, fr->conn, od->newsn); | |
2291 g_free(od->newsn); | |
2292 od->newsn = NULL; | |
2293 od->setnick = FALSE; | |
2294 } | |
2647 | 2295 if (od->conf) { |
2296 debug_printf("confirming account\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2297 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 2298 od->conf = FALSE; |
2299 } | |
2300 if (od->reqemail) { | |
2301 debug_printf("requesting email\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2302 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 2303 od->reqemail = FALSE; |
2304 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2305 if (od->setemail) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2306 debug_printf("setting email\n"); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2307 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2308 g_free(od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2309 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2310 } |
2647 | 2311 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2312 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2313 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2314 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2315 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
|
2316 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2317 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2318 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2319 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2320 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2321 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2322 |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
2323 /* evidently this crashes on solaris. i have no clue why |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2324 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
|
2325 "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
|
2326 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2327 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2328 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
2329 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2330 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2331 /* Maybe senderwarn and recverwarn should be user preferences... */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2332 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2333 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2334 |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
2335 aim_seticbmparam(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2336 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2337 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2338 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2339 |
2993 | 2340 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
2341 { | |
2342 va_list ap; | |
2343 fu16_t maxsiglen; | |
2344 struct gaim_connection *gc = sess->aux_data; | |
2345 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
2346 | |
2347 va_start(ap, fr); | |
2348 maxsiglen = va_arg(ap, int); | |
2349 va_end(ap); | |
2350 | |
2351 debug_printf("locate rights: max sig len = %d\n", maxsiglen); | |
2352 | |
2353 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; | |
2354 | |
2355 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); | |
2356 | |
2357 return 1; | |
2358 } | |
2359 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2360 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
|
2361 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2362 fu16_t maxbuddies, maxwatchers; |
2993 | 2363 struct gaim_connection *gc = sess->aux_data; |
2364 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2365 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2366 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2367 maxbuddies = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2368 maxwatchers = (fu16_t)va_arg(ap, unsigned int); |
2086 | 2369 va_end(ap); |
2370 | |
2371 debug_printf("buddy list rights: Max buddies = %d / Max watchers = %d\n", maxbuddies, maxwatchers); | |
2372 | |
2993 | 2373 odata->rights.maxbuddies = (guint)maxbuddies; |
2374 odata->rights.maxwatchers = (guint)maxwatchers; | |
2375 | |
2086 | 2376 return 1; |
2377 } | |
2378 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2379 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
|
2380 fu16_t maxpermits, maxdenies; |
2086 | 2381 va_list ap; |
2993 | 2382 struct gaim_connection *gc = sess->aux_data; |
2383 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
2086 | 2384 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2385 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2386 maxpermits = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2387 maxdenies = (fu16_t)va_arg(ap, unsigned int); |
2086 | 2388 va_end(ap); |
2389 | |
2390 debug_printf("BOS rights: Max permit = %d / Max deny = %d\n", maxpermits, maxdenies); | |
2391 | |
2993 | 2392 odata->rights.maxpermits = (guint)maxpermits; |
2393 odata->rights.maxdenies = (guint)maxdenies; | |
2394 | |
2395 account_online(gc); | |
2396 serv_finish_login(gc); | |
2397 | |
2398 if (bud_list_cache_exists(gc)) | |
2399 do_import(gc, NULL); | |
2400 | |
2401 debug_printf("buddy list loaded\n"); | |
2402 | |
2672 | 2403 aim_clientready(sess, fr->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2404 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2405 aim_icq_reqofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2406 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2407 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
2086 | 2408 |
3109 | 2409 if (!odata->icq) { |
2410 debug_printf("ssi: requesting ssi list\n"); | |
3092 | 2411 aim_ssi_reqrights(sess, fr->conn); |
3109 | 2412 aim_ssi_reqdata(sess, fr->conn, sess->ssi.timestamp, sess->ssi.revision); |
2413 } | |
2991 | 2414 |
2086 | 2415 return 1; |
2416 } | |
2417 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2418 static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2419 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2420 struct aim_icq_offlinemsg *msg; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2421 struct gaim_connection *gc = sess->aux_data; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2422 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2423 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2424 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2425 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2426 |
3141 | 2427 debug_printf("Received offline message of type 0x%04x\n", msg->type); |
2428 | |
2429 switch (msg->type) { | |
2430 case 0x0001: { /* Basic offline message */ | |
2431 char sender[32]; | |
2432 char *dialog_msg = g_strdup(msg->msg); | |
2433 time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); | |
2434 g_snprintf(sender, sizeof(sender), "%lu", msg->sender); | |
2435 strip_linefeed(dialog_msg); | |
2436 serv_got_im(gc, sender, dialog_msg, 0, t, -1); | |
2437 g_free(dialog_msg); | |
2438 } break; | |
2439 | |
2440 case 0x0006: { /* Authorization request */ | |
2441 gaim_icq_authask(gc, msg->sender, msg->msg); | |
2442 } break; | |
2443 | |
2444 case 0x0007: { /* Someone has denied you authorization */ | |
2445 char *dialog_msg; | |
3159 | 2446 dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), msg->sender, msg->msg ? msg->msg : _("No reason given.")); |
3141 | 2447 do_error_dialog(dialog_msg, _("Gaim - ICQ Authorization Denied")); |
2448 g_free(dialog_msg); | |
2449 } break; | |
2450 | |
2451 case 0x0008: { /* Someone has granted you authorization */ | |
2452 char *dialog_msg; | |
3159 | 2453 dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), msg->sender); |
3141 | 2454 do_error_dialog(dialog_msg, _("Gaim - ICQ Authorization Granted")); |
2455 g_free(dialog_msg); | |
2456 } break; | |
2457 | |
2458 case 0x0012: { | |
2459 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ | |
2460 } break; | |
2461 | |
2462 default: { | |
2463 debug_printf("unknown offline message type 0x%04x\n", msg->type); | |
2464 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2465 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2466 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2467 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2468 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2469 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2470 static int gaim_offlinemsgdone(aim_session_t *sess, aim_frame_t *fr, ...) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2471 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2472 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2473 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2474 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
2475 |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2476 static int gaim_simpleinfo(aim_session_t *sess, aim_frame_t *fr, ...) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2477 { |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2478 struct gaim_connection *gc = sess->aux_data; |
3212 | 2479 struct buddy *budlight; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2480 va_list ap; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2481 struct aim_icq_simpleinfo *info; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2482 char buf[16 * 1024]; |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2483 char who[16]; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2484 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2485 va_start(ap, fr); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2486 info = va_arg(ap, struct aim_icq_simpleinfo *); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2487 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2488 |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2489 g_snprintf(who, sizeof who, "%lu", info->uin); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2490 g_snprintf(buf, sizeof buf, |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2491 "<B>UIN:</B> %lu<BR>" |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2492 "<B>Nick:</B> %s<BR>" |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2493 "<B>Name:</B> %s %s<BR>" |
3212 | 2494 "<B>Email:</B> %s<BR>\n", |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2495 info->uin, |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2496 info->nick, |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2497 info->first, info->last, |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2498 info->email); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2499 |
3212 | 2500 /* If the contact is away, then we also want to get their status message |
2501 * and show it in the same window as info. g_show_info_text gets the status | |
2502 * message if the third arg is 0 (this seems really gross to me). The | |
2503 * parse-icq-status-message function knows if it is putting it's message in | |
2504 * an info window because the name will _not_ be in od->evilhack. For getting | |
2505 * only the away message the contact's UIN is put in od->evilhack. */ | |
2506 if ((budlight = find_buddy(gc, who)) && ((budlight->uc >> 7) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT))) { | |
2507 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) | |
2508 g_show_info_text(gc, who, 0, buf, NULL); | |
2509 else { | |
2510 char *state_msg = gaim_icq_status((budlight->uc & 0xff80) >> 7); | |
2511 g_show_info_text(gc, who, 2, buf, "<B>Status:</B> ", state_msg, "<BR>\n<HR><BR><I>Remote client does not support sending status messages.</I><BR>\n", NULL); | |
2512 free(state_msg); | |
2513 } | |
2514 } else { | |
2515 char *state_msg = gaim_icq_status((budlight->uc & 0xff80) >> 7); | |
2516 g_show_info_text(gc, who, 2, buf, "<B>Status:</B> ", state_msg, NULL); | |
2517 free(state_msg); | |
2518 } | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2519 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2520 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2521 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2522 |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2523 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2524 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2525 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2526 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2527 va_list ap; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2528 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2529 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2530 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2531 url = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2532 wid = (fu16_t)va_arg(ap, int); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2533 hei = (fu16_t)va_arg(ap, int); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2534 delay = (fu16_t)va_arg(ap, int); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2535 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2536 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2537 serv_got_popup(msg, url, wid, hei); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2538 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2539 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2540 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
2541 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2542 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2543 va_list ap; |
2544 char *address, *SNs; | |
2545 int i, num; | |
2546 char *buf; | |
2547 int at = 0, len; | |
2548 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2549 va_start(ap, fr); |
2086 | 2550 address = va_arg(ap, char *); |
2551 num = va_arg(ap, int); | |
2552 SNs = va_arg(ap, char *); | |
2553 va_end(ap); | |
2554 | |
2555 len = num * (MAXSNLEN + 1) + 1024; | |
2556 buf = g_malloc(len); | |
2557 at += g_snprintf(buf + at, len - at, "<B>%s has the following screen names:</B><BR>", address); | |
2558 for (i = 0; i < num; i++) | |
2559 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]); | |
3212 | 2560 g_show_info_text(NULL, NULL, 2, buf, NULL); |
2086 | 2561 g_free(buf); |
2562 | |
2563 return 1; | |
2564 } | |
2565 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2566 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2567 va_list ap; |
2568 char *address; | |
2569 char buf[BUF_LONG]; | |
2570 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2571 va_start(ap, fr); |
2086 | 2572 address = va_arg(ap, char *); |
2573 va_end(ap); | |
2574 | |
2575 g_snprintf(buf, sizeof(buf), "No results found for email address %s", address); | |
2576 do_error_dialog(buf, _("Error")); | |
2577 | |
2578 return 1; | |
2579 } | |
2580 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2581 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
|
2582 fu16_t status; |
2086 | 2583 va_list ap; |
2584 char msg[256]; | |
2585 struct gaim_connection *gc = sess->aux_data; | |
2586 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2587 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2588 status = (fu16_t)va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 2589 va_end(ap); |
2590 | |
2591 debug_printf("account confirmation returned status 0x%04x (%s)\n", status, | |
2592 status ? "email sent" : "unknown"); | |
2593 if (status) { | |
2594 g_snprintf(msg, sizeof(msg), "You should receive an email asking to confirm %s.", | |
2595 gc->username); | |
2596 do_error_dialog(msg, "Confirm"); | |
2597 } | |
2598 | |
2599 return 1; | |
2600 } | |
2601 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2602 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
|
2603 int change, str; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2604 fu16_t perms, type, length; |
2086 | 2605 char *val; |
2606 va_list ap; | |
2607 char buf[BUF_LONG]; | |
2608 struct gaim_connection *gc = sess->aux_data; | |
2609 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2610 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2611 change = va_arg(ap, int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2612 perms = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2613 type = (fu16_t)va_arg(ap, unsigned int); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2614 length = (fu16_t)va_arg(ap, unsigned int); |
2086 | 2615 val = va_arg(ap, char *); |
2616 str = va_arg(ap, int); | |
2617 va_end(ap); | |
2618 | |
2619 debug_printf("info%s: perms = %d, type = %x, length = %d, val = %s\n", | |
2620 change ? " change" : "", perms, type, length, str ? val : "(not string)"); | |
2621 | |
3186 | 2622 /* XXX Do something for other types too. */ |
2623 if ((type == 0x0011) && str && length) { | |
2086 | 2624 g_snprintf(buf, sizeof(buf), "The email address for %s is %s", gc->username, val); |
2625 do_error_dialog(buf, "Email"); | |
2626 } | |
2627 | |
2628 return 1; | |
2629 } | |
2630 | |
2631 static void oscar_keepalive(struct gaim_connection *gc) { | |
2632 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
2633 aim_flap_nop(odata->sess, odata->conn); | |
2634 } | |
2635 | |
2636 static char *oscar_name() { | |
3089 | 2637 return "AIM / ICQ"; |
2086 | 2638 } |
2639 | |
3001 | 2640 static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) { |
2993 | 2641 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; |
2642 struct direct_im *dim = find_direct_im(odata, name); | |
2643 if (!dim) | |
2998 | 2644 return 0; |
3001 | 2645 aim_send_typing(odata->sess, dim->conn, typing); |
2993 | 2646 return 0; |
2647 } | |
3048 | 2648 static void oscar_ask_direct_im(struct gaim_connection *gc, char *name); |
2993 | 2649 |
3033 | 2650 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) { |
2086 | 2651 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; |
2652 struct direct_im *dim = find_direct_im(odata, name); | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2653 int ret = 0; |
2086 | 2654 if (dim) { |
3009 | 2655 if (dim->connected) { /* If we're not connected yet, send through server */ |
3034 | 2656 ret = aim_send_im_direct(odata->sess, dim->conn, message, len == -1 ? strlen(message) : len); |
3009 | 2657 if (ret == 0) |
2658 return 1; | |
2659 else return ret; | |
2660 } | |
3008 | 2661 debug_printf("Direct IM pending, but not connected; sending through server\n"); |
3044 | 2662 } else if (len != -1) { |
2663 /* Trying to send an IM image outside of a direct connection. */ | |
2664 oscar_ask_direct_im(gc, name); | |
2665 return -ENOTCONN; | |
2666 } | |
3008 | 2667 if (imflags & IM_FLAG_AWAY) { |
2668 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); | |
2086 | 2669 } else { |
3008 | 2670 struct aim_sendimext_args args; |
2671 GSList *h = odata->hasicons; | |
2672 struct icon_req *ir = NULL; | |
2673 char *who = normalize(name); | |
2674 struct stat st; | |
2675 | |
2676 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; | |
2677 if (odata->icq) | |
2678 args.flags |= AIM_IMFLAGS_OFFLINE; | |
2679 | |
2680 args.features = gaim_features; | |
2681 args.featureslen = sizeof(gaim_features); | |
2682 | |
2683 while (h) { | |
2684 ir = h->data; | |
2685 if (ir->request && !strcmp(who, ir->user)) | |
2686 break; | |
2687 h = h->next; | |
2086 | 2688 } |
3008 | 2689 if (h) { |
2690 ir->request = FALSE; | |
2691 args.flags |= AIM_IMFLAGS_BUDDYREQ; | |
2692 debug_printf("sending buddy icon request with message\n"); | |
2693 } | |
2694 | |
2695 if (gc->user->iconfile[0] && !stat(gc->user->iconfile, &st)) { | |
2696 FILE *file = fopen(gc->user->iconfile, "r"); | |
2697 if (file) { | |
2698 char *buf = g_malloc(st.st_size); | |
2699 fread(buf, 1, st.st_size, file); | |
2700 | |
2701 args.iconlen = st.st_size; | |
2702 args.iconsum = aim_iconsum(buf, st.st_size); | |
2703 args.iconstamp = st.st_mtime; | |
2704 | |
2705 args.flags |= AIM_IMFLAGS_HASICON; | |
2706 debug_printf("Claiming to have an icon.\n"); | |
2707 | |
2708 fclose(file); | |
2709 g_free(buf); | |
2086 | 2710 } |
2711 } | |
3008 | 2712 |
2713 args.destsn = name; | |
2714 args.msg = message; | |
2715 args.msglen = strlen(message); | |
2716 | |
2717 ret = aim_send_im_ext(odata->sess, &args); | |
2718 | |
2086 | 2719 } |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2720 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2721 return 1; |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
2722 return ret; |
2086 | 2723 } |
2724 | |
2725 static void oscar_get_info(struct gaim_connection *g, char *name) { | |
2726 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2727 if (odata->icq) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2728 aim_icq_getsimpleinfo(odata->sess, name); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
2729 else |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2730 /* people want the away message on the top, so we get the away message |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2731 * first and then get the regular info, since it's too difficult to |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2732 * insert in the middle. i hate people. */ |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2733 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2734 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2735 |
3212 | 2736 static void oscar_get_away(struct gaim_connection *g, char *who) { |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2737 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
3212 | 2738 if (odata->icq) { |
2739 struct buddy *budlight = find_buddy(g, who); | |
2740 if (budlight) | |
2741 if ((budlight->uc & 0xff80) >> 7) | |
2742 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) | |
2743 aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xff80) >> 7); | |
2744 else | |
2745 debug_printf("Error: Remote client does not support retrieval of status messages.\n"); | |
2746 else | |
2747 debug_printf("Error: The user %s has no status message, therefore not requesting.\n", who); | |
2748 else | |
2749 debug_printf("Error: Could not find %s in local contact list, therefore unable to request status message.\n", who); | |
2750 } else | |
2751 aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_GENERALINFO); | |
2086 | 2752 } |
2753 | |
2920 | 2754 static void oscar_get_caps(struct gaim_connection *g, char *name) { |
2755 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2756 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_CAPABILITIES); | |
2757 } | |
2758 | |
2086 | 2759 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, |
2760 char *maiden, char *city, char *state, char *country, int web) { | |
2761 /* FIXME : some of these things are wrong, but i'm lazy */ | |
2762 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2763 aim_setdirectoryinfo(odata->sess, odata->conn, first, middle, last, | |
2764 maiden, NULL, NULL, city, state, NULL, 0, web); | |
2765 } | |
2766 | |
2767 | |
2768 static void oscar_set_idle(struct gaim_connection *g, int time) { | |
2769 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2770 aim_bos_setidle(odata->sess, odata->conn, time); | |
2771 } | |
2772 | |
2773 static void oscar_set_info(struct gaim_connection *g, char *info) { | |
2774 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2993 | 2775 gchar *inforeal; |
2776 | |
2777 if (odata->rights.maxsiglen == 0) | |
2778 do_error_dialog("oscar_set_info called before locate rights received", "Protocol Error"); | |
2779 | |
2780 if (strlen(info) > odata->rights.maxsiglen) { | |
2781 gchar *errstr; | |
2782 | |
2783 errstr = g_strdup_printf("Maximum info length of %d bytes exceeded, truncating", odata->rights.maxsiglen); | |
2784 | |
2785 do_error_dialog(errstr, "Info Too Long"); | |
2786 | |
2787 g_free(errstr); | |
2788 } | |
2789 | |
2790 inforeal = g_strndup(info, odata->rights.maxsiglen); | |
2791 | |
2792 aim_bos_setprofile(odata->sess, odata->conn, inforeal, NULL, gaim_caps); | |
2793 | |
2794 g_free(inforeal); | |
2795 | |
2796 return; | |
2086 | 2797 } |
2798 | |
2993 | 2799 static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *message) |
2800 { | |
2801 | |
2802 if (od->rights.maxawaymsglen == 0) | |
2803 do_error_dialog("oscar_set_away_aim called before locate rights received", "Protocol Error"); | |
2804 | |
2805 if (gc->away) | |
2806 g_free(gc->away); | |
2807 gc->away = NULL; | |
2808 | |
2809 if (!message) { | |
2810 aim_bos_setprofile(od->sess, od->conn, NULL, "", gaim_caps); | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2811 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2812 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2813 |
2993 | 2814 if (strlen(message) > od->rights.maxawaymsglen) { |
2815 gchar *errstr; | |
2816 | |
2817 errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); | |
2818 | |
2819 do_error_dialog(errstr, "Away Message Too Long"); | |
2820 | |
2821 g_free(errstr); | |
2822 } | |
2823 | |
2824 gc->away = g_strndup(message, od->rights.maxawaymsglen); | |
2825 aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, gaim_caps); | |
2826 | |
2827 return; | |
2828 } | |
2829 | |
2830 static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message) | |
2831 { | |
2832 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2833 if (gc->away) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2834 gc->away = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2835 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2836 if (!strcmp(state, "Online")) |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2865
diff
changeset
|
2837 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2838 else if (!strcmp(state, "Away")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2839 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2840 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2841 } else if (!strcmp(state, "Do Not Disturb")) { |
3212 | 2842 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2843 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2844 } else if (!strcmp(state, "Not Available")) { |
3101 | 2845 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2846 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2847 } else if (!strcmp(state, "Occupied")) { |
3212 | 2848 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2849 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2850 } else if (!strcmp(state, "Free For Chat")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2851 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2852 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2853 } else if (!strcmp(state, "Invisible")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
2854 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2855 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2856 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 2857 if (message) { |
3101 | 2858 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2859 gc->away = ""; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2860 } else { |
3013 | 2861 |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2865
diff
changeset
|
2862 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2863 } |
2086 | 2864 } |
2993 | 2865 |
2866 return; | |
2867 } | |
2868 | |
2869 static void oscar_set_away(struct gaim_connection *gc, char *state, char *message) | |
2870 { | |
2871 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
2872 | |
2873 if (od->icq) | |
2874 oscar_set_away_icq(gc, od, state, message); | |
2875 else | |
2876 oscar_set_away_aim(gc, od, message); | |
2877 | |
2878 return; | |
2086 | 2879 } |
2880 | |
2881 static void oscar_warn(struct gaim_connection *g, char *name, int anon) { | |
2882 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2113 | 2883 aim_send_warning(odata->sess, odata->conn, name, anon ? AIM_WARN_ANON : 0); |
2086 | 2884 } |
2885 | |
2886 static void oscar_dir_search(struct gaim_connection *g, char *first, char *middle, char *last, | |
2887 char *maiden, char *city, char *state, char *country, char *email) { | |
2888 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2889 if (strlen(email)) | |
2890 aim_usersearch_address(odata->sess, odata->conn, email); | |
2891 } | |
2892 | |
2893 static void oscar_add_buddy(struct gaim_connection *g, char *name) { | |
2894 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3092 | 2895 if (odata->icq) { |
2896 aim_add_buddy(odata->sess, odata->conn, name); | |
2897 } else { | |
3210 | 2898 if ((odata->sess->ssi.received_data) && !(aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, name, 0x0000))) { |
2995 | 2899 debug_printf("ssi: adding buddy %s to group %s\n", name, find_group_by_buddy(g, name)->name); |
2900 aim_ssi_addbuddies(odata->sess, odata->conn, find_group_by_buddy(g, name)->name, &name, 1); | |
3092 | 2901 } |
2991 | 2902 } |
2086 | 2903 } |
2904 | |
2905 static void oscar_add_buddies(struct gaim_connection *g, GList *buddies) { | |
2906 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3092 | 2907 if (odata->icq) { |
2908 char buf[MSG_LEN]; | |
2909 int n=0; | |
2910 while (buddies) { | |
2911 if (n > MSG_LEN - 18) { | |
2912 aim_bos_setbuddylist(odata->sess, odata->conn, buf); | |
2913 n = 0; | |
2914 } | |
2915 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); | |
2916 buddies = buddies->next; | |
2917 } | |
2918 aim_bos_setbuddylist(odata->sess, odata->conn, buf); | |
2919 } else { | |
2920 if (odata->sess->ssi.received_data) { | |
2921 int tmp; | |
2922 GSList *curgrp, *curbud; | |
2923 for (curgrp=g->groups; curgrp; curgrp=g_slist_next(curgrp)) { | |
2995 | 2924 tmp = 0; |
2925 for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next) | |
3210 | 2926 if (!aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) |
2995 | 2927 tmp++; |
3092 | 2928 if (tmp) { |
2929 char **sns = (char **)malloc(tmp*sizeof(char*)); | |
2930 tmp = 0; | |
2931 for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next) | |
3210 | 2932 if (!aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) { |
3092 | 2933 debug_printf("ssi: adding buddy %s to group %s\n", ((struct buddy*)curbud->data)->name, ((struct group*)curgrp->data)->name); |
2934 sns[tmp] = (char *)((struct buddy*)curbud->data)->name; | |
2935 tmp++; | |
2936 } | |
2937 aim_ssi_addbuddies(odata->sess, odata->conn, ((struct group*)curgrp->data)->name, sns, tmp); | |
2938 free(sns); | |
2995 | 2939 } |
3092 | 2940 } |
2995 | 2941 } |
2942 } | |
2943 } | |
2944 | |
3140 | 2945 static void oscar_move_buddy(struct gaim_connection *g, char *name, char *old_group, char *new_group) { |
2946 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2947 if (!odata->icq) | |
2948 if (odata->sess->ssi.received_data) { | |
2949 aim_ssi_movebuddy(odata->sess, odata->conn, old_group, new_group, name); | |
2950 debug_printf("ssi: moved buddy %s from group %s to group %s\n", name, old_group, new_group); | |
2951 } | |
2952 } | |
2953 | |
2995 | 2954 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) { |
2955 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3092 | 2956 if (odata->icq) { |
2957 aim_remove_buddy(odata->sess, odata->conn, name); | |
2958 } else { | |
2959 if (odata->sess->ssi.received_data) { | |
3210 | 2960 struct aim_ssi_item *ssigroup; |
2961 while (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, name, 0x0000) && (ssigroup = aim_ssi_itemlist_findparent(odata->sess->ssi.items, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup->name, &name, 1)) | |
3092 | 2962 debug_printf("ssi: deleted buddy %s from group %s\n", name, group); |
2963 } | |
2995 | 2964 } |
2965 } | |
2966 | |
2967 static void oscar_remove_buddies(struct gaim_connection *g, GList *buddies, char *group) { | |
2968 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3092 | 2969 if (odata->icq) { |
2995 | 2970 GList *cur; |
2971 for (cur=buddies; cur; cur=cur->next) | |
3092 | 2972 aim_remove_buddy(odata->sess, odata->conn, cur->data); |
2973 } else { | |
2974 if (odata->sess->ssi.received_data) { | |
2975 GList *cur; | |
2976 int tmp = 0; | |
2995 | 2977 for (cur=buddies; cur; cur=cur->next) |
3210 | 2978 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, cur->data, 0x0000)) |
2991 | 2979 tmp++; |
3092 | 2980 if (tmp) { |
2981 char **sns; | |
2982 sns = (char **)malloc(tmp*sizeof(char*)); | |
2983 tmp = 0; | |
2984 for (cur=buddies; cur; cur=cur->next) | |
3210 | 2985 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, cur->data, 0x0000)) { |
3092 | 2986 debug_printf("ssi: deleting buddy %s from group %s\n", cur->data, group); |
2987 sns[tmp] = cur->data; | |
2988 tmp++; | |
2989 } | |
2990 aim_ssi_delbuddies(odata->sess, odata->conn, group, sns, tmp); | |
2991 free(sns); | |
2992 } | |
2991 | 2993 } |
2994 } | |
2995 } | |
2996 | |
2997 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { | |
2998 /* XXX - Fix parsing of the ssi rights packet and pass us the data | |
2999 fu16_t maxbuddies, maxgroups, maxpermits, maxdenies; | |
3000 va_list ap; | |
3001 | |
3002 va_start(ap, fr); | |
3003 maxbuddies = (fu16_t)va_arg(ap, unsigned int); | |
3004 maxgroupss = (fu16_t)va_arg(ap, unsigned int); | |
3005 maxpermits = (fu16_t)va_arg(ap, unsigned int); | |
3006 maxdenies = (fu16_t)va_arg(ap, unsigned int); | |
3007 va_end(ap); | |
3008 | |
3009 debug_printf("ssi rights: Max buddies = %d / Max groups = %d / Max permits = %d / Max denies = %d\n", maxbuddies, maxgroups, maxpermits, maxdenies); | |
3010 */ | |
3011 | |
3012 return 1; | |
3013 } | |
3014 | |
3015 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
3016 struct gaim_connection *gc = sess->aux_data; | |
2995 | 3017 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; |
3018 struct aim_ssi_item *curitem; | |
2991 | 3019 int tmp; |
3020 char **sns; | |
3021 | |
3022 debug_printf("ssi: syncing local list and server list\n"); | |
3023 | |
3109 | 3024 if (odata->icq) |
3092 | 3025 return 1; |
3026 | |
2991 | 3027 /* Activate SSI */ |
3028 debug_printf("ssi: activating server-stored buddy list\n"); | |
3029 aim_ssi_enable(sess, fr->conn); | |
3030 | |
3031 /* Clean the buddy list */ | |
3210 | 3032 aim_ssi_cleanlist(sess, fr->conn); |
2991 | 3033 |
3034 /* Add from server list to local list */ | |
3035 tmp = 0; | |
3036 for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { | |
3037 switch (curitem->type) { | |
3038 case 0x0000: /* Buddy */ | |
3039 if ((curitem->name) && (!find_buddy(gc, curitem->name))) { | |
2995 | 3040 struct aim_ssi_item *curgroup = sess->ssi.items; |
2991 | 3041 while (curgroup) { |
3042 if ((curgroup->type == 0x0001) && (curgroup->gid == curitem->gid) && (curgroup->name)) { | |
2995 | 3043 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, curgroup->name); |
2991 | 3044 add_buddy(gc, curgroup->name, curitem->name, 0); |
3045 tmp++; | |
3046 } | |
3047 curgroup = curgroup->next; | |
3048 } | |
3049 } | |
3050 break; | |
3051 | |
2995 | 3052 case 0x0002: /* Permit buddy */ |
2991 | 3053 if (curitem->name) { |
3054 GSList *list; | |
3055 for (list=gc->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); | |
3056 if (!list) { | |
3057 char *name; | |
2995 | 3058 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name); |
2991 | 3059 name = g_strdup(normalize(curitem->name)); |
3060 gc->permit = g_slist_append(gc->permit, name); | |
3061 build_allow_list(); | |
3062 tmp++; | |
3063 } | |
3064 } | |
3065 break; | |
3066 | |
2995 | 3067 case 0x0003: /* Deny buddy */ |
2991 | 3068 if (curitem->name) { |
3069 GSList *list; | |
3070 for (list=gc->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); | |
3071 if (!list) { | |
3072 char *name; | |
2995 | 3073 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name); |
2991 | 3074 name = g_strdup(normalize(curitem->name)); |
3075 gc->deny = g_slist_append(gc->deny, name); | |
3076 build_block_list(); | |
3077 tmp++; | |
3078 } | |
3079 } | |
3080 break; | |
3081 | |
2995 | 3082 case 0x0004: /* Permit/deny setting */ |
2991 | 3083 if (curitem->data) { |
3084 fu8_t permdeny; | |
3210 | 3085 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) { |
2991 | 3086 debug_printf("ssi: changing permdeny from %d to %d\n", gc->permdeny, permdeny); |
3087 gc->permdeny = permdeny; | |
2995 | 3088 tmp++; |
2991 | 3089 } |
3090 } | |
3091 break; | |
3109 | 3092 |
3093 case 0x0005: /* Presence setting */ | |
3094 /* We don't want to change Gaim's setting because it applies to all accounts */ | |
3095 break; | |
2991 | 3096 } /* End of switch on curitem->type */ |
3097 } /* End of for loop */ | |
3098 if (tmp) | |
3099 do_export(gc); | |
3100 | |
3101 /* Add from local list to server list */ | |
3102 if (gc) { | |
3017 | 3103 GSList *cur; |
3104 | |
2991 | 3105 /* Buddies */ |
3017 | 3106 cur = gc->groups; |
3107 while (cur) { | |
3108 GSList *curbud; | |
2991 | 3109 tmp = 0; |
3017 | 3110 for (curbud=((struct group*)cur->data)->members; curbud; curbud=curbud->next) |
3210 | 3111 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) |
2991 | 3112 tmp++; |
3113 if (tmp) { | |
3017 | 3114 sns = (char **)malloc(tmp*sizeof(char*)); |
3115 tmp = 0; | |
3116 for (curbud=((struct group*)cur->data)->members; curbud; curbud=curbud->next) | |
3210 | 3117 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) { |
3017 | 3118 debug_printf("ssi: adding buddy %s from local list to server list\n", ((struct buddy*)curbud->data)->name); |
3119 sns[tmp] = ((char *)((struct buddy*)curbud->data)->name); | |
3120 tmp++; | |
3121 } | |
3122 aim_ssi_addbuddies(sess, fr->conn, ((struct group*)cur->data)->name, sns, tmp); | |
2991 | 3123 free(sns); |
3124 } | |
3017 | 3125 cur = g_slist_next(cur); |
2991 | 3126 } |
3127 | |
3128 /* Permit list */ | |
3129 if (gc->permit) { | |
3130 tmp = 0; | |
3017 | 3131 for (cur=gc->permit; cur; cur=cur->next) |
3210 | 3132 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0002)) |
2991 | 3133 tmp++; |
3134 if (tmp) { | |
3017 | 3135 sns = (char **)malloc(tmp*sizeof(char*)); |
3136 tmp = 0; | |
3137 for (cur=gc->permit; cur; cur=cur->next) | |
3210 | 3138 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0002)) { |
3017 | 3139 debug_printf("ssi: adding permit %s from local list to server list\n", cur->data); |
3140 sns[tmp] = cur->data; | |
3141 tmp++; | |
3142 } | |
3143 aim_ssi_addpord(sess, fr->conn, sns, tmp, AIM_SSI_TYPE_PERMIT); | |
2991 | 3144 free(sns); |
3145 } | |
3146 } | |
3147 | |
3148 /* Deny list */ | |
3149 if (gc->deny) { | |
3150 tmp = 0; | |
3017 | 3151 for (cur=gc->deny; cur; cur=cur->next) |
3210 | 3152 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0003)) |
2991 | 3153 tmp++; |
3154 if (tmp) { | |
3017 | 3155 sns = (char **)malloc(tmp*sizeof(char*)); |
3156 tmp = 0; | |
3157 for (cur=gc->deny; cur; cur=cur->next) | |
3210 | 3158 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0003)) { |
3017 | 3159 debug_printf("ssi: adding deny %s from local list to server list\n", cur->data); |
3160 sns[tmp] = cur->data; | |
3161 tmp++; | |
3162 } | |
3163 aim_ssi_addpord(sess, fr->conn, sns, tmp, AIM_SSI_TYPE_DENY); | |
2991 | 3164 free(sns); |
3165 } | |
3166 } | |
3109 | 3167 |
3168 /* Presence settings (idle time visibility) */ | |
3210 | 3169 if ((tmp = aim_ssi_getpresence(sess->ssi.items)) != 0xFFFFFFFF) |
3109 | 3170 if (report_idle && !(tmp & 0x400)) |
3171 aim_ssi_setpresence(sess, fr->conn, tmp | 0x400); | |
3210 | 3172 |
3173 /* Check for maximum number of buddies */ | |
3174 for (cur=gc->groups, tmp=0; cur; cur=g_slist_next(cur)) { | |
3214 | 3175 struct group* gr = (struct group*)cur->data; |
3176 tmp = tmp + g_slist_length(gr->members); | |
3177 } | |
3210 | 3178 if (tmp > odata->rights.maxbuddies) { |
3179 char *dialog_msg = g_strdup_printf(_("The maximum number of buddies allowed in your buddy list is %d, and you have %d." | |
3180 " Until you are below the limit, some buddies will not show up as online."), | |
3181 odata->rights.maxbuddies, tmp); | |
3182 do_error_dialog(dialog_msg, _("Gaim - Warning")); | |
3183 g_free(dialog_msg); | |
3184 } | |
3214 | 3185 |
3210 | 3186 } /* end if (gc) */ |
3092 | 3187 |
2991 | 3188 return 1; |
2086 | 3189 } |
3190 | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3191 static GList *oscar_chat_info(struct gaim_connection *gc) { |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3192 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3193 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3194 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3195 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3196 pce->label = _("Join what group:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3197 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3198 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3199 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3200 pce->label = _("Exchange:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3201 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3202 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3203 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3204 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3205 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3206 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3207 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3208 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3209 static void oscar_join_chat(struct gaim_connection *g, GList *data) { |
2086 | 3210 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3211 aim_conn_t *cur; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3212 char *name; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3213 int *exchange; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3214 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3215 if (!data || !data->next) |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3216 return; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3217 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3218 name = data->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3219 exchange = data->next->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3220 |
2086 | 3221 debug_printf("Attempting to join chat room %s.\n", name); |
3222 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) { | |
3223 debug_printf("chatnav exists, creating room\n"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3224 aim_chatnav_createroom(odata->sess, cur, name, *exchange); |
2086 | 3225 } else { |
3226 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3227 struct create_room *cr = g_new0(struct create_room, 1); |
2086 | 3228 debug_printf("chatnav does not exist, opening chatnav\n"); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3229 cr->exchange = *exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3230 cr->name = g_strdup(name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3231 odata->create_rooms = g_slist_append(odata->create_rooms, cr); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3232 aim_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV); |
2086 | 3233 } |
3234 } | |
3235 | |
3236 static void oscar_chat_invite(struct gaim_connection *g, int id, char *message, char *name) { | |
3237 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3238 struct chat_connection *ccon = find_oscar_chat(g, id); | |
3239 | |
3240 if (!ccon) | |
3241 return; | |
3242 | |
3243 aim_chat_invite(odata->sess, odata->conn, name, message ? message : "", | |
3244 ccon->exchange, ccon->name, 0x0); | |
3245 } | |
3246 | |
3247 static void oscar_chat_leave(struct gaim_connection *g, int id) { | |
3248 struct oscar_data *odata = g ? (struct oscar_data *)g->proto_data : NULL; | |
3249 GSList *bcs = g->buddy_chats; | |
3250 struct conversation *b = NULL; | |
3251 struct chat_connection *c = NULL; | |
3252 int count = 0; | |
3253 | |
3254 while (bcs) { | |
3255 count++; | |
3256 b = (struct conversation *)bcs->data; | |
3257 if (id == b->id) | |
3258 break; | |
3259 bcs = bcs->next; | |
3260 b = NULL; | |
3261 } | |
3262 | |
3263 if (!b) | |
3264 return; | |
3265 | |
3266 debug_printf("Attempting to leave room %s (currently in %d rooms)\n", b->name, count); | |
3267 | |
3268 c = find_oscar_chat(g, b->id); | |
3269 if (c != NULL) { | |
3270 if (odata) | |
3271 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c); | |
3272 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
3273 gaim_input_remove(c->inpa); |
2086 | 3274 if (g && odata->sess) |
3275 aim_conn_kill(odata->sess, &c->conn); | |
3276 g_free(c->name); | |
3277 g_free(c->show); | |
3278 g_free(c); | |
3279 } | |
3280 /* we do this because with Oscar it doesn't tell us we left */ | |
3281 serv_got_chat_left(g, b->id); | |
3282 } | |
3283 | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3284 static int oscar_chat_send(struct gaim_connection *g, int id, char *message) { |
2086 | 3285 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
3286 GSList *bcs = g->buddy_chats; | |
3287 struct conversation *b = NULL; | |
3288 struct chat_connection *c = NULL; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3289 char *buf, *buf2; |
2086 | 3290 int i, j; |
3291 | |
3292 while (bcs) { | |
3293 b = (struct conversation *)bcs->data; | |
3294 if (id == b->id) | |
3295 break; | |
3296 bcs = bcs->next; | |
3297 b = NULL; | |
3298 } | |
3299 if (!b) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3300 return -EINVAL; |
2086 | 3301 |
3302 bcs = odata->oscar_chats; | |
3303 while (bcs) { | |
3304 c = (struct chat_connection *)bcs->data; | |
3305 if (b == c->cnv) | |
3306 break; | |
3307 bcs = bcs->next; | |
3308 c = NULL; | |
3309 } | |
3310 if (!c) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3311 return -EINVAL; |
2086 | 3312 |
3313 buf = g_malloc(strlen(message) * 4 + 1); | |
3314 for (i = 0, j = 0; i < strlen(message); i++) { | |
3315 if (message[i] == '\n') { | |
3316 buf[j++] = '<'; | |
3317 buf[j++] = 'B'; | |
3318 buf[j++] = 'R'; | |
3319 buf[j++] = '>'; | |
3320 } else { | |
3321 buf[j++] = message[i]; | |
3322 } | |
3323 } | |
3324 buf[j] = '\0'; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3325 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3326 if (strlen(buf) > c->maxlen) |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3327 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3328 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3329 buf2 = strip_html(buf); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3330 if (strlen(buf2) > c->maxvis) { |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3331 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3332 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3333 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3334 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3335 |
2086 | 3336 aim_chat_send_im(odata->sess, c->conn, 0, buf, strlen(buf)); |
3337 g_free(buf); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3338 return 0; |
2086 | 3339 } |
3340 | |
3341 static char **oscar_list_icon(int uc) { | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3342 if (uc == 0) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3343 return (char **)icon_online_xpm; |
3079 | 3344 if (uc & 0xff80) { |
3345 uc >>= 7; | |
3101 | 3346 if (uc & AIM_ICQ_STATE_INVISIBLE) |
3347 return icon_offline_xpm; | |
3348 if (uc & AIM_ICQ_STATE_CHAT) | |
3349 return icon_ffc_xpm; | |
3212 | 3350 if (uc & AIM_ICQ_STATE_DND) |
3351 return icon_dnd_xpm; | |
3352 if (uc & AIM_ICQ_STATE_OUT) | |
3353 return icon_na_xpm; | |
3101 | 3354 if (uc & AIM_ICQ_STATE_BUSY) |
3355 return icon_occ_xpm; | |
3356 if (uc & AIM_ICQ_STATE_AWAY) | |
3357 return icon_away_xpm; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3358 return icon_online_xpm; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3359 } |
3101 | 3360 if (uc & UC_UNAVAILABLE) |
3361 return (char **)away_icon_xpm; | |
3079 | 3362 if (uc & UC_WIRELESS) |
3363 return (char **)wireless_icon_xpm; | |
2689 | 3364 if (uc & UC_AB) |
2679 | 3365 return (char **)ab_xpm; |
2086 | 3366 if (uc & UC_AOL) |
3367 return (char **)aol_icon_xpm; | |
3368 if (uc & UC_ADMIN) | |
3369 return (char **)admin_icon_xpm; | |
3370 if (uc & UC_UNCONFIRMED) | |
3371 return (char **)dt_icon_xpm; | |
2297
a0f6ead876ca
[gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2288
diff
changeset
|
3372 if (uc & UC_NORMAL) |
a0f6ead876ca
[gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2288
diff
changeset
|
3373 return (char **)free_icon_xpm; |
2086 | 3374 return NULL; |
3375 } | |
3376 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3377 static int gaim_directim_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3378 va_list ap; |
3379 struct gaim_connection *gc = sess->aux_data; | |
3380 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3381 aim_conn_t *newconn, *listenerconn; |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
3382 struct conversation *cnv; |
2086 | 3383 struct direct_im *dim; |
3384 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3385 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3386 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3387 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3388 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3389 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 3390 va_end(ap); |
3391 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3392 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3393 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3394 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3395 sn = g_strdup(aim_directim_getsn(newconn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3396 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3397 debug_printf("DirectIM: initiate success to %s\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3398 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3399 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3400 if (!(cnv = find_conversation(sn))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3401 cnv = new_conversation(sn); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
3402 gaim_input_remove(dim->watcher); |
2086 | 3403 dim->conn = newconn; |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
3404 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 3405 oscar_callback, dim->conn); |
3008 | 3406 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3407 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3408 g_free(sn); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2833
diff
changeset
|
3409 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1); |
2086 | 3410 |
3411 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, | |
3412 gaim_directim_incoming, 0); | |
3413 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, | |
3414 gaim_directim_typing, 0); | |
3033 | 3415 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
2993 | 3416 gaim_update_ui, 0); |
3417 return 1; | |
3418 } | |
3419 | |
3420 static int gaim_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
3421 va_list ap; | |
3422 char *sn; | |
3423 double percent; | |
3424 struct gaim_connection *gc = sess->aux_data; | |
3425 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
3426 struct conversation *c; | |
3427 struct direct_im *dim; | |
3428 | |
3429 va_start(ap, fr); | |
3430 sn = va_arg(ap, char *); | |
3431 percent = va_arg(ap, double); | |
3432 va_end(ap); | |
3433 | |
2994 | 3434 if (!(dim = find_direct_im(od, sn))) |
3435 return 1; | |
3059 | 3436 if (dim->watcher) { |
3437 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
3438 dim->watcher = 0; | |
3439 } | |
3044 | 3440 while (gtk_events_pending()) |
3441 gtk_main_iteration(); | |
3442 | |
2993 | 3443 if ((c = find_conversation(sn))) |
3444 update_progress(c, percent); | |
3445 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, | |
3446 oscar_callback, dim->conn); | |
2086 | 3447 |
3448 return 1; | |
3449 } | |
3450 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3451 static int gaim_directim_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3452 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3453 char *msg, *sn; |
2993 | 3454 int len; |
2086 | 3455 struct gaim_connection *gc = sess->aux_data; |
3456 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3457 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3458 sn = va_arg(ap, char *); |
2086 | 3459 msg = va_arg(ap, char *); |
2993 | 3460 len = va_arg(ap, int); |
2086 | 3461 va_end(ap); |
3462 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3463 debug_printf("Got DirectIM message from %s\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3464 |
2993 | 3465 serv_got_im(gc, sn, msg, 0, time(NULL), len); |
2086 | 3466 |
3467 return 1; | |
3468 } | |
3469 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3470 static int gaim_directim_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3471 va_list ap; |
3472 char *sn; | |
2993 | 3473 int typing; |
3474 struct gaim_connection *gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3475 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3476 va_start(ap, fr); |
2086 | 3477 sn = va_arg(ap, char *); |
2993 | 3478 typing = va_arg(ap, int); |
2086 | 3479 va_end(ap); |
3480 | |
2993 | 3481 if (typing) { |
3482 /* I had to leave this. It's just too funny. It reminds me of my sister. */ | |
3483 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); | |
3484 serv_got_typing(gc,sn,0); | |
3485 } else | |
3486 serv_got_typing_stopped(gc,sn); | |
2086 | 3487 return 1; |
3488 } | |
3489 | |
3490 struct ask_do_dir_im { | |
3491 char *who; | |
3492 struct gaim_connection *gc; | |
3493 }; | |
3494 | |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
3495 static void oscar_cancel_direct_im(gpointer obj, struct ask_do_dir_im *data) { |
2086 | 3496 g_free(data); |
3497 } | |
3498 | |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
3499 static void oscar_direct_im(gpointer obj, struct ask_do_dir_im *data) { |
2086 | 3500 struct gaim_connection *gc = data->gc; |
3501 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
3502 struct direct_im *dim; | |
3503 | |
3504 dim = find_direct_im(od, data->who); | |
3505 if (dim) { | |
3008 | 3506 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
3507 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
3508 gaim_input_remove(dim->watcher); | |
3509 g_free(dim); | |
3510 debug_printf("Gave up on old direct IM, trying again\n"); | |
3511 } else { | |
3512 do_error_dialog("DirectIM already open.", "Gaim"); | |
3513 return; | |
3514 } | |
2086 | 3515 } |
3516 dim = g_new0(struct direct_im, 1); | |
3517 dim->gc = gc; | |
3518 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
3519 | |
2717
03bf072c6238
[gaim-migrate @ 2730]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2713
diff
changeset
|
3520 dim->conn = aim_directim_initiate(od->sess, data->who); |
2086 | 3521 if (dim->conn != NULL) { |
3522 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
3523 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 3524 oscar_callback, dim->conn); |
3525 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE, | |
3526 gaim_directim_initiate, 0); | |
3527 } else { | |
3528 do_error_dialog(_("Unable to open Direct IM"), _("Error")); | |
3529 g_free(dim); | |
3530 } | |
3531 } | |
3532 | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3533 static void oscar_ask_direct_im(struct gaim_connection *gc, gchar *who) { |
2086 | 3534 char buf[BUF_LONG]; |
3535 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); | |
3536 data->who = who; | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3537 data->gc = gc; |
2086 | 3538 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s." |
3539 " Doing this will let them see your IP address, and may be" | |
3540 " a security risk. Do you wish to continue?"), who); | |
3541 do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im); | |
3542 } | |
3543 | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3544 static void oscar_get_away_msg(struct gaim_connection *gc, char *who) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3545 struct oscar_data *od = gc->proto_data; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3546 od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who))); |
3212 | 3547 if (od->icq) { |
3548 struct buddy *budlight = find_buddy(gc, who); | |
3549 if (budlight) | |
3550 if ((budlight->uc >> 7) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT)) | |
3551 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) | |
3552 aim_send_im_ch2_geticqmessage(od->sess, who, (budlight->uc & 0xff80) >> 7); | |
3553 else { | |
3554 char *state_msg = gaim_icq_status((budlight->uc & 0xff80) >> 7); | |
3555 char *dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><BR><I>Remote client does not support sending status messages.</I><BR>"), who, state_msg); | |
3556 g_show_info_text(gc, who, 2, dialog_msg, NULL); | |
3557 free(state_msg); | |
3558 free(dialog_msg); | |
3559 } | |
3560 else { | |
3561 char *state_msg = gaim_icq_status((budlight->uc & 0xff80) >> 7); | |
3562 char *dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><BR><I>User has no status message.</I><BR>"), who, state_msg); | |
3563 g_show_info_text(gc, who, 2, dialog_msg, NULL); | |
3564 free(state_msg); | |
3565 free(dialog_msg); | |
3566 } | |
3567 else | |
3568 do_error_dialog("Could not find contact in local list, therefore unable to request status message.\n", "Gaim - Error"); | |
3569 } else | |
3570 oscar_get_info(gc, who); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3571 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3572 |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3573 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) { |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3574 GList *m = NULL; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3575 struct proto_buddy_menu *pbm; |
2086 | 3576 char *n = g_strdup(normalize(gc->username)); |
2833
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3577 struct oscar_data *odata = gc->proto_data; |
2086 | 3578 |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3579 pbm = g_new0(struct proto_buddy_menu, 1); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3580 pbm->label = _("Get Info"); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3581 pbm->callback = oscar_get_info; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3582 pbm->gc = gc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3583 m = g_list_append(m, pbm); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3584 |
3212 | 3585 if (odata->icq) { |
3586 pbm = g_new0(struct proto_buddy_menu, 1); | |
3587 pbm->label = _("Get Status Msg"); | |
3588 pbm->callback = oscar_get_away_msg; | |
3589 pbm->gc = gc; | |
3590 m = g_list_append(m, pbm); | |
3591 } else { | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3592 pbm = g_new0(struct proto_buddy_menu, 1); |
2833
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3593 pbm->label = _("Get Away Msg"); |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3594 pbm->callback = oscar_get_away_msg; |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3595 pbm->gc = gc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3596 m = g_list_append(m, pbm); |
2833
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3597 |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3598 if (strcmp(n, normalize(who))) { |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3599 pbm = g_new0(struct proto_buddy_menu, 1); |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3600 pbm->label = _("Direct IM"); |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3601 pbm->callback = oscar_ask_direct_im; |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3602 pbm->gc = gc; |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3603 m = g_list_append(m, pbm); |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
3604 } |
2086 | 3605 } |
2920 | 3606 |
3607 pbm = g_new0(struct proto_buddy_menu, 1); | |
3608 pbm->label = _("Get Capabilities"); | |
3609 pbm->callback = oscar_get_caps; | |
3610 pbm->gc = gc; | |
3611 m = g_list_append(m, pbm); | |
3612 | |
2086 | 3613 g_free(n); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3614 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3615 return m; |
2086 | 3616 } |
3617 | |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3618 static GList *oscar_user_opts() |
2086 | 3619 { |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3620 GList *m = NULL; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3621 struct proto_user_opt *puo; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3622 |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3623 puo = g_new0(struct proto_user_opt, 1); |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3624 puo->label = "Auth Host:"; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3625 puo->def = "login.oscar.aol.com"; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3626 puo->pos = USEROPT_AUTH; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3627 m = g_list_append(m, puo); |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3628 |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3629 puo = g_new0(struct proto_user_opt, 1); |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3630 puo->label = "Auth Port:"; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3631 puo->def = "5190"; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3632 puo->pos = USEROPT_AUTHPORT; |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3633 m = g_list_append(m, puo); |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3634 |
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2141
diff
changeset
|
3635 return m; |
2086 | 3636 } |
3637 | |
3638 static void oscar_set_permit_deny(struct gaim_connection *gc) { | |
3639 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
2995 | 3640 if (od->icq) { |
3641 GSList *list; | |
3642 char buf[MAXMSGLEN]; | |
3643 int at; | |
3644 | |
3645 switch(gc->permdeny) { | |
3646 case 1: | |
3647 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username); | |
3648 break; | |
3649 case 2: | |
3650 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username); | |
3651 break; | |
3652 case 3: | |
3653 list = gc->permit; | |
3654 at = 0; | |
3655 while (list) { | |
3656 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
3657 list = list->next; | |
3658 } | |
3659 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
3660 break; | |
3661 case 4: | |
3662 list = gc->deny; | |
3663 at = 0; | |
3664 while (list) { | |
3665 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
3666 list = list->next; | |
3667 } | |
3668 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
3669 break; | |
3670 default: | |
3671 break; | |
2086 | 3672 } |
2995 | 3673 signoff_blocked(gc); |
3674 } else { | |
3675 if (od->sess->ssi.received_data) | |
3210 | 3676 aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff); |
2086 | 3677 } |
3678 } | |
3679 | |
3680 static void oscar_add_permit(struct gaim_connection *gc, char *who) { | |
2991 | 3681 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 3682 if (od->icq) { |
3683 if (gc->permdeny != 3) return; | |
3684 oscar_set_permit_deny(gc); | |
3685 } else { | |
3686 debug_printf("ssi: About to add a permit\n"); | |
3687 if (od->sess->ssi.received_data) | |
3017 | 3688 aim_ssi_addpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_PERMIT); |
2995 | 3689 } |
2086 | 3690 } |
3691 | |
3692 static void oscar_add_deny(struct gaim_connection *gc, char *who) { | |
2991 | 3693 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 3694 if (od->icq) { |
3695 if (gc->permdeny != 4) return; | |
3696 oscar_set_permit_deny(gc); | |
3697 } else { | |
3698 debug_printf("ssi: About to add a deny\n"); | |
3699 if (od->sess->ssi.received_data) | |
3017 | 3700 aim_ssi_addpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_DENY); |
2995 | 3701 } |
2086 | 3702 } |
3703 | |
3704 static void oscar_rem_permit(struct gaim_connection *gc, char *who) { | |
2991 | 3705 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 3706 if (od->icq) { |
3707 if (gc->permdeny != 3) return; | |
3708 oscar_set_permit_deny(gc); | |
3709 } else { | |
3710 debug_printf("ssi: About to delete a permit\n"); | |
3711 if (od->sess->ssi.received_data) | |
3017 | 3712 aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_PERMIT); |
2995 | 3713 } |
2086 | 3714 } |
3715 | |
3716 static void oscar_rem_deny(struct gaim_connection *gc, char *who) { | |
2991 | 3717 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 3718 if (od->icq) { |
3719 if (gc->permdeny != 4) return; | |
3720 oscar_set_permit_deny(gc); | |
3721 } else { | |
3722 debug_printf("ssi: About to delete a deny\n"); | |
3723 if (od->sess->ssi.received_data) | |
3017 | 3724 aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_DENY); |
2995 | 3725 } |
2086 | 3726 } |
3727 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3728 static GList *oscar_away_states(struct gaim_connection *gc) |
2086 | 3729 { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3730 struct oscar_data *od = gc->proto_data; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3731 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3732 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3733 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3734 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3735 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3736 m = g_list_append(m, "Online"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3737 m = g_list_append(m, "Away"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3738 m = g_list_append(m, "Do Not Disturb"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3739 m = g_list_append(m, "Not Available"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3740 m = g_list_append(m, "Occupied"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3741 m = g_list_append(m, "Free For Chat"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3742 m = g_list_append(m, "Invisible"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3743 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3744 return m; |
2086 | 3745 } |
3746 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3747 static void oscar_change_email(struct gaim_connection *gc, char *email) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3748 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3749 struct oscar_data *od = gc->proto_data; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3750 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3751 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3752 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3753 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3754 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3755 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3756 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3757 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3758 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3759 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3760 |
2979 | 3761 static void oscar_format_screenname(struct gaim_connection *gc, char *nick) { |
3762 struct oscar_data *od = gc->proto_data; | |
3031 | 3763 if (!strcmp(normalize(nick), normalize(gc->username))) { |
2979 | 3764 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
3765 od->setnick = TRUE; | |
3766 od->newsn = g_strdup(nick); | |
3767 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
3768 } else { | |
3769 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
3770 } | |
3771 } else { | |
3772 do_error_dialog("The new formatting is invalid.", "Gaim"); | |
3773 } | |
3774 } | |
3775 | |
2086 | 3776 static void oscar_do_action(struct gaim_connection *gc, char *act) |
3777 { | |
3778 struct oscar_data *od = gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3779 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
2086 | 3780 |
3781 if (!strcmp(act, "Set User Info")) { | |
3782 show_set_info(gc); | |
3783 } else if (!strcmp(act, "Change Password")) { | |
3784 show_change_passwd(gc); | |
2979 | 3785 } else if (!strcmp(act, "Format Screenname")) { |
3786 do_prompt_dialog("New screenname formatting:", | |
3787 gc->displayname, gc, oscar_format_screenname, NULL); | |
2086 | 3788 } else if (!strcmp(act, "Confirm Account")) { |
3789 if (!conn) { | |
3790 od->conf = TRUE; | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3791 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 3792 } else |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3793 aim_admin_reqconfirm(od->sess, conn); |
2086 | 3794 } else if (!strcmp(act, "Display Current Registered Address")) { |
3795 if (!conn) { | |
3796 od->reqemail = TRUE; | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3797 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 3798 } else |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3799 aim_admin_getinfo(od->sess, conn, 0x11); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3800 } else if (!strcmp(act, "Change Current Registered Address")) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3801 do_prompt_dialog("Change Address To: ", NULL, gc, oscar_change_email, NULL); |
2086 | 3802 } else if (!strcmp(act, "Search for Buddy by Email")) { |
3803 show_find_email(gc); | |
3804 } | |
3805 } | |
3806 | |
3807 static GList *oscar_actions() | |
3808 { | |
3809 GList *m = NULL; | |
3810 | |
3811 m = g_list_append(m, "Set User Info"); | |
3812 m = g_list_append(m, NULL); | |
3813 m = g_list_append(m, "Change Password"); | |
2979 | 3814 m = g_list_append(m, "Format Screenname"); |
2086 | 3815 m = g_list_append(m, "Confirm Account"); |
3816 m = g_list_append(m, "Display Current Registered Address"); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3817 m = g_list_append(m, "Change Current Registered Address"); |
2086 | 3818 m = g_list_append(m, NULL); |
3819 m = g_list_append(m, "Search for Buddy by Email"); | |
3820 | |
3821 return m; | |
3822 } | |
3823 | |
3824 static void oscar_change_passwd(struct gaim_connection *gc, char *old, char *new) | |
3825 { | |
3826 struct oscar_data *od = gc->proto_data; | |
3827 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { | |
3828 od->chpass = TRUE; | |
3829 od->oldp = g_strdup(old); | |
3830 od->newp = g_strdup(new); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3831 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 3832 } else { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3833 aim_admin_changepasswd(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), |
2086 | 3834 new, old); |
3835 } | |
3836 } | |
3837 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3838 static void oscar_convo_closed(struct gaim_connection *gc, char *who) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3839 { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3840 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3841 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3842 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3843 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3844 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3845 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3846 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3847 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3848 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3849 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3850 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3851 |
3035 | 3852 |
3853 | |
2086 | 3854 static struct prpl *my_protocol = NULL; |
3855 | |
3856 void oscar_init(struct prpl *ret) { | |
3857 ret->protocol = PROTO_OSCAR; | |
3044 | 3858 ret->options = OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE; |
2086 | 3859 ret->name = oscar_name; |
3860 ret->list_icon = oscar_list_icon; | |
3861 ret->away_states = oscar_away_states; | |
3862 ret->actions = oscar_actions; | |
3863 ret->do_action = oscar_do_action; | |
3864 ret->buddy_menu = oscar_buddy_menu; | |
3865 ret->user_opts = oscar_user_opts; | |
3866 ret->login = oscar_login; | |
3867 ret->close = oscar_close; | |
3868 ret->send_im = oscar_send_im; | |
2993 | 3869 ret->send_typing = oscar_send_typing; |
2086 | 3870 ret->set_info = oscar_set_info; |
3871 ret->get_info = oscar_get_info; | |
3872 ret->set_away = oscar_set_away; | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3873 ret->get_away = oscar_get_away; |
2086 | 3874 ret->set_dir = oscar_set_dir; |
3875 ret->get_dir = NULL; /* Oscar really doesn't have this */ | |
3876 ret->dir_search = oscar_dir_search; | |
3877 ret->set_idle = oscar_set_idle; | |
3878 ret->change_passwd = oscar_change_passwd; | |
3879 ret->add_buddy = oscar_add_buddy; | |
3880 ret->add_buddies = oscar_add_buddies; | |
3140 | 3881 ret->group_buddy = oscar_move_buddy; |
2086 | 3882 ret->remove_buddy = oscar_remove_buddy; |
2991 | 3883 ret->remove_buddies = oscar_remove_buddies; |
2086 | 3884 ret->add_permit = oscar_add_permit; |
3885 ret->add_deny = oscar_add_deny; | |
3886 ret->rem_permit = oscar_rem_permit; | |
3887 ret->rem_deny = oscar_rem_deny; | |
3888 ret->set_permit_deny = oscar_set_permit_deny; | |
3889 ret->warn = oscar_warn; | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
3890 ret->chat_info = oscar_chat_info; |
2086 | 3891 ret->join_chat = oscar_join_chat; |
3892 ret->chat_invite = oscar_chat_invite; | |
3893 ret->chat_leave = oscar_chat_leave; | |
3894 ret->chat_whisper = NULL; | |
3895 ret->chat_send = oscar_chat_send; | |
3896 ret->keepalive = oscar_keepalive; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3897 ret->convo_closed = oscar_convo_closed; |
2086 | 3898 |
3899 my_protocol = ret; | |
3900 } | |
3901 | |
3902 #ifndef STATIC | |
3903 | |
3904 char *gaim_plugin_init(GModule *handle) | |
3905 { | |
3906 load_protocol(oscar_init, sizeof(struct prpl)); | |
3907 return NULL; | |
3908 } | |
3909 | |
3910 void gaim_plugin_remove() | |
3911 { | |
3912 struct prpl *p = find_prpl(PROTO_OSCAR); | |
3913 if (p == my_protocol) | |
3914 unload_protocol(p); | |
3915 } | |
3916 | |
3917 char *name() | |
3918 { | |
3919 return "Oscar"; | |
3920 } | |
3921 | |
3922 char *description() | |
3923 { | |
2162
a464da684307
[gaim-migrate @ 2172]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2154
diff
changeset
|
3924 return PRPL_DESC("Oscar"); |
2086 | 3925 } |
3926 | |
3927 #endif |