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