comparison src/oscar.c @ 237:6ced2f1c8b24

[gaim-migrate @ 247] How cool is this, libfaim is making a comeback. I completely redid everything, as was necessary because of the updates to libfaim since gaim 0.9.7. You can sign on and send/recv IMs, but there's a bad lag between display updates that I haven't figured out how to fix yet. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 20 May 2000 00:30:53 +0000
parents bfdc427b936d
children 14fc16f579c8
comparison
equal deleted inserted replaced
236:62d470738cc7 237:6ced2f1c8b24
33 #include <stdio.h> 33 #include <stdio.h>
34 #include <time.h> 34 #include <time.h>
35 #include <sys/socket.h> 35 #include <sys/socket.h>
36 #include <sys/stat.h> 36 #include <sys/stat.h>
37 #include "gaim.h" 37 #include "gaim.h"
38 #include <aim.h> 38 #include "aim.h"
39 #include "gnome_applet_mgr.h" 39 #include "gnome_applet_mgr.h"
40 40
41 struct aim_conn_t *gaim_conn = NULL;
42 static int inpa = -1; 41 static int inpa = -1;
43 42 static struct aim_session_t *gaim_sess;
44 int gaim_auth_failure(struct command_rx_struct *command, ...); 43 static struct aim_conn_t *gaim_conn;
45 int gaim_auth_success(struct command_rx_struct *command, ...); 44
46 int gaim_serverready_handle(struct command_rx_struct *command, ...); 45 static int gaim_parse_auth_resp (struct aim_session_t *, struct command_rx_struct *, ...);
47 int gaim_redirect_handle(struct command_rx_struct *command, ...); 46 static int gaim_auth_server_ready(struct aim_session_t *, struct command_rx_struct *, ...);
48 int gaim_im_handle(struct command_rx_struct *command, ...); 47 static int gaim_server_ready (struct aim_session_t *, struct command_rx_struct *, ...);
49 48 static int gaim_handle_redirect (struct aim_session_t *, struct command_rx_struct *, ...);
50 rxcallback_t gaim_callbacks[] = { 49 static int gaim_parse_oncoming (struct aim_session_t *, struct command_rx_struct *, ...);
51 gaim_im_handle, /* incoming IM */ 50 static int gaim_parse_offgoing (struct aim_session_t *, struct command_rx_struct *, ...);
52 NULL,/*gaim_buddy_coming, oncoming buddy */ 51 static int gaim_parse_incoming_im(struct aim_session_t *, struct command_rx_struct *, ...);
53 NULL,/*gaim_buddy_going, offgoing buddy */ 52 static int gaim_parse_misses (struct aim_session_t *, struct command_rx_struct *, ...);
54 NULL, /* last IM was missed 1 */ 53 static int gaim_parse_user_info (struct aim_session_t *, struct command_rx_struct *, ...);
55 NULL, /* last IM was missed 2 */ 54 static int gaim_parse_unknown (struct aim_session_t *, struct command_rx_struct *, ...);
56 NULL, /* UNUSED */ 55 static int gaim_parse_motd (struct aim_session_t *, struct command_rx_struct *, ...);
57 NULL, /* UNUSED */ 56
58 NULL, /* UNUSED */ 57 static void oscar_callback(gpointer data, gint source,
59 gaim_serverready_handle, /* server ready */ 58 GdkInputCondition condition) {
60 NULL, /* UNUSED */ 59 struct aim_session_t *sess = (struct aim_session_t *)data;
61 NULL, /* UNUSED */ 60 struct aim_conn_t *conn = NULL;
62 NULL, /* UNUSED */ 61 struct timeval tv;
63 NULL, /* UNUSED */ 62 int selstat;
64 NULL, /* UNUSED */ 63
65 NULL, /* UNUSED */ 64 /* FIXME : There's gotta be a better way of getting this to not
66 gaim_redirect_handle, /* redirect */ 65 * either hang until a message is received or only update every
67 NULL, /* last command bad */ 66 * 2 seconds. If someone can tell me what it is, let me know. */
68 NULL, /* missed some messages */ 67 tv.tv_sec = 2;
69 NULL, /* completely unknown command */ 68 tv.tv_usec = 0;
70 NULL, /*gaim_userinfo_handler, User Info Response */ 69 conn = aim_select(sess, &tv, &selstat);
71 NULL, /* Address search response */ 70
72 NULL, /* Name search response */ 71 switch(selstat) {
73 NULL, /* User Search fail */ 72 case -1: /* error */
74 gaim_auth_failure, /* auth error */ 73 signoff();
75 gaim_auth_success, /* auth success */ 74 hide_login_progress("Disconnected.");
76 NULL, /* auth server ready */ 75 aim_logoff(sess);
77 NULL, /* ? */ 76 gdk_input_remove(inpa);
78 NULL, /* password change done */ 77 break;
79 gaim_serverready_handle, /* server ready */ 78 case 0: /* this should never happen because of the gdk_input */
80 0x00 79 gdk_input_remove(inpa);
81 }; 80 while (gtk_events_pending())
82 81 gtk_main_iteration();
83 struct client_info_s cinfo; 82 inpa = gdk_input_add(gaim_conn->fd,
84 83 GDK_INPUT_READ | GDK_INPUT_WRITE |
85 84 GDK_INPUT_EXCEPTION,
86 void oscar_close() 85 oscar_callback, sess);
87 { 86 break;
88 #ifdef USE_APPLET 87 case 1: /* outgoing data pending */
89 setUserState(offline); 88 aim_tx_flushqueue(sess);
90 #endif /* USE_APPLET */ 89 break;
91 set_state(STATE_OFFLINE); 90 case 2: /* incoming data pending */
92 aim_conn_close(gaim_conn); 91 if (aim_get_command(sess, conn) < 0)
93 if (inpa > 0) 92 debug_print("connection error!\n");
94 gdk_input_remove(inpa); 93 else
95 inpa=-1; 94 aim_rxdispatch(sess);
96 } 95 break;
97 96 }
98 97 }
99 void oscar_callback(gpointer data, gint source, GdkInputCondition condition) 98
100 { 99 int oscar_login(char *username, char *password) {
101 if (aim_get_command() < 0) { 100 struct aim_session_t *sess;
102 signoff(); 101 struct aim_conn_t *conn;
103 hide_login_progress("Connection Closed"); 102 struct client_info_s info = {"Gaim/Faim", 3, 5, 1670, "us", "en"};
104 return; 103 char buf[256];
105 } else 104
106 aim_rxdispatch(); 105 sess = g_new0(struct aim_session_t, 1);
107 106 aim_session_init(sess);
108 } 107
109 108 sprintf(buf, "Looking up %s", FAIM_LOGIN_SERVER);
110 int oscar_login(char *username, char *password) 109 set_login_progress(1, buf);
111 { 110 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, FAIM_LOGIN_SERVER);
112 char buf[256]; 111
113 struct timeval timeout; 112 if (conn == NULL) {
114 time_t lastcycle=0; 113 debug_print("internal connection error\n");
115 114 #ifdef USE_APPLET
116 aim_connrst(); 115 setUserState(offline);
117 aim_register_callbacks(gaim_callbacks); 116 #endif
118 117 set_state(STATE_OFFLINE);
119 aim_conn_getnext()->fd = STDIN_FILENO; 118 hide_login_progress("Unable to login to AIM");
120 119 return -1;
121 spintf(buf, "Looking up %s", login_host); 120 } else if (conn->fd == -1) {
122 set_login_progress(1, buf); 121 #ifdef USE_APPLET
123 122 setUserState(offline);
124 gaim_conn = aim_newconn(AIM_CONN_TYPE_AUTH, login_host); 123 #endif
125 124 set_state(STATE_OFFLINE);
126 if (!gaim_conn) { 125 if (conn->status & AIM_CONN_STATUS_RESOLVERR) {
127 #ifdef USE_APPLET 126 sprintf(debug_buff, "couldn't resolve host\n");
128 setUserState(offline); 127 debug_print(debug_buff);
129 #endif /* USE_APPLET */ 128 hide_login_progress(debug_buff);
130 set_state(STATE_OFFLINE); 129 } else if (conn->status & AIM_CONN_STATUS_CONNERR) {
131 hide_login_progress("Unable to login to AIM"); 130 sprintf(debug_buff, "couldn't connect to host\n");
132 return -1; 131 debug_print(debug_buff);
133 } else if (gaim_conn->fd == -1) { 132 hide_login_progress(debug_buff);
134 #ifdef USE_APPLET 133 }
135 setUserState(offline); 134 return -1;
136 #endif /* USE_APPLET */ 135 }
137 set_state(STATE_OFFLINE); 136 g_snprintf(buf, sizeof(buf), "Signon: %s", username);
138 137 set_login_progress(2, buf);
139 if (gaim_conn->status & AIM_CONN_STATUS_RESOLVERR) { 138
140 sprintf(buf, "Unable to lookup %s", login_host); 139 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL,
141 hide_login_progress(buf); 140 AIM_CB_SPECIAL_AUTHSUCCESS,
142 } else if (gaim_conn->status & AIM_CONN_STATUS_CONNERR) { 141 gaim_parse_auth_resp, 0);
143 sprintf(buf, "Unable to connect to %s", login_host); 142 aim_conn_addhandler(sess, conn, AIM_CB_FAM_GEN,
144 hide_login_progress(buf); 143 AIM_CB_GEN_SERVERREADY,
145 } 144 gaim_auth_server_ready, 0);
146 return -1; 145 aim_send_login(sess, conn, username, password, &info);
147 } 146
148 147 inpa = gdk_input_add(conn->fd,
149 g_snprintf(buf, sizeof(buf), "Signon: %s",username); 148 GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
150 149 oscar_callback, sess);
151 set_login_progress(2, buf); 150
152 151 if (!current_user) {
153 strcpy(cinfo.clientstring, "libfaim/GAIM, jimduchek@ou.edu, see at http://www.marko.net/gaim"); 152 current_user = g_new0(struct aim_user, 1);
154 cinfo.major = 0; 153 g_snprintf(current_user->username, sizeof(current_user->username),
155 cinfo.minor = 9; 154 DEFAULT_INFO);
156 cinfo.build = 7; 155 aim_users = g_list_append(aim_users, current_user);
157 strcpy(cinfo.country, "us"); 156 }
158 strcpy(cinfo.lang, "en"); 157 g_snprintf(current_user->username, sizeof(current_user->username),
159 158 "%s", username);
160 aim_send_login(gaim_conn, username, password, &cinfo); 159 g_snprintf(current_user->password, sizeof(current_user->password),
161 160 "%s", password);
162 if (!current_user) { 161 save_prefs();
163 current_user = g_new0(struct aim_user, 1); 162
164 g_snprintf(current_user->username, sizeof(current_user->username), DEFAULT_INFO); 163 return 0;
165 aim_users = g_list_append(aim_users, current_user); 164 }
166 } 165
167 166 int oscar_send_im(char *name, char *msg, int away) {
168 g_snprintf(current_user->username, sizeof(current_user->username), "%s", username); 167 if (away)
169 g_snprintf(current_user->password, sizeof(current_user->password), "%s", password); 168 aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, msg);
170 169 else
171 save_prefs(); 170 aim_send_im(gaim_sess, gaim_conn, name, 0, msg);
172 171 }
173 inpa = gdk_input_add(gaim_conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, NULL); 172
174 173 int gaim_parse_auth_resp(struct aim_session_t *sess,
175 return 0; 174 struct command_rx_struct *command, ...) {
176 } 175 struct aim_conn_t *bosconn = NULL;
177 176 sprintf(debug_buff, "inside auth_resp (Screen name: %s)\n",
178 int gaim_auth_success(struct command_rx_struct *command, ...) 177 sess->logininfo.screen_name);
179 { 178 debug_print(debug_buff);
180 va_list ap; 179
181 struct login_phase1_struct *logininfo; 180 if (sess->logininfo.errorcode) {
182 struct aim_conn_t *bosconn = NULL; 181 sprintf(debug_buff, "Login Error Code 0x%04x\n",
183 char buf[128]; 182 sess->logininfo.errorcode);
184 183 debug_print(debug_buff);
185 va_start(ap, command); 184 sprintf(debug_buff, "Error URL: %s\n",
186 logininfo = va_arg(ap, struct login_phase1_struct *); 185 sess->logininfo.errorurl);
187 va_end(ap); 186 debug_print(debug_buff);
188 187 #ifdef USE_APPLET
189 g_snprintf(buf, sizeof(buf), "Auth successful, logging in to %s:", logininfo->BOSIP); 188 setUserState(offline);
190 set_login_progress(3, buf); 189 #endif
191 190 set_state(STATE_OFFLINE);
192 printf(" Screen name: %s\n", logininfo->screen_name); 191 hide_login_progress("Authentication Failed");
193 printf(" Email addresss: %s\n", logininfo->email); 192 gdk_input_remove(inpa);
194 printf(" Registration status: %02i\n", logininfo->regstatus); 193 aim_conn_close(command->conn);
195 printf("Connecting to %s, closing auth connection.\n", 194 return 0;
196 logininfo->BOSIP); 195 }
197 196
198 aim_conn_close(command->conn); 197
199 198 sprintf(debug_buff, "Email: %s\n", sess->logininfo.email);
200 gdk_input_remove(inpa); 199 debug_print(debug_buff);
201 200 sprintf(debug_buff, "Closing auth connection...\n");
202 if ((bosconn = aim_newconn(AIM_CONN_TYPE_BOS, logininfo->BOSIP)) 201 debug_print(debug_buff);
203 == NULL) { 202 gdk_input_remove(inpa);
204 #ifdef USE_APPLET 203 aim_conn_close(command->conn);
205 setUserState(offline); 204
206 #endif /* USE_APPLET */ 205 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, sess->logininfo.BOSIP);
207 set_state(STATE_OFFLINE); 206 if (bosconn == NULL) {
208 207 #ifdef USE_APPLET
209 hide_login_progress("Could not connect to BOS: internal error"); 208 setUserState(offline);
210 return(-1); 209 #endif
211 } else if (bosconn->status != 0) { 210 set_state(STATE_OFFLINE);
212 #ifdef USE_APPLET 211 hide_login_progress("Internal Error");
213 setUserState(offline); 212 return -1;
214 #endif /* USE_APPLET */ 213 } else if (bosconn->status != 0) {
215 set_state(STATE_OFFLINE); 214 #ifdef USE_APPLET
216 215 setUserState(offline);
217 hide_login_progress("Could not connect to BOS"); 216 #endif
218 return(-1); 217 set_state(STATE_OFFLINE);
219 } else { 218 hide_login_progress("Could Not Connect");
220 aim_auth_sendcookie(bosconn, logininfo->cookie); 219 return -1;
221 inpa = gdk_input_add(bosconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, NULL); 220 }
222 set_login_progress(4, "BOS connection established, cookie sent."); 221
223 return(1); 222 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0);
224 } 223 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, gaim_server_ready, 0);
225 } 224 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATEINFO, NULL, 0);
226 225 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0);
227 int gaim_auth_failure(struct command_rx_struct *command, ...) 226 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_STS, AIM_CB_STS_SETREPORTINTERVAL, NULL, 0);
228 { 227 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0);
229 va_list ap; 228 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0);
230 struct login_phase1_struct *logininfo; 229 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0);
231 char *errorurl; 230 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_misses, 0);
232 short errorcode; 231 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0);
233 232 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_misses, 0);
234 va_start(ap, command); 233 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_misses, 0);
235 logininfo = va_arg(ap, struct login_phase1_struct *); 234 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0);
236 printf("Screen name: %s\n", logininfo->screen_name); 235 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_CTN, AIM_CB_CTN_DEFAULT, gaim_parse_unknown, 0);
237 errorurl = va_arg(ap, char *); 236 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEFAULT, gaim_parse_unknown, 0);
238 printf("Error URL: %s\n", errorurl); 237 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0);
239 errorcode = va_arg(ap, short); 238
240 printf("Error code: 0x%02x\n", errorcode); 239 aim_auth_sendcookie(sess, bosconn, sess->logininfo.cookie);
241 va_end(ap); 240 inpa = gdk_input_add(bosconn->fd,
242 #ifdef USE_APPLET 241 GDK_INPUT_READ | GDK_INPUT_WRITE | GDK_INPUT_EXCEPTION,
243 setUserState(offline); 242 oscar_callback, sess);
244 #endif /* USE_APPLET */ 243 set_login_progress(4, "Connection established, cookie sent");
245 set_state(STATE_OFFLINE); 244 return 1;
246 hide_login_progress("Authentication Failed"); 245 }
247 246
248 aim_conn_close(aim_getconn_type(AIM_CONN_TYPE_AUTH)); 247 int gaim_auth_server_ready(struct aim_session_t *sess,
249 248 struct command_rx_struct *command, ...) {
250 return 1; 249 aim_auth_clientready(sess, command->conn);
251 } 250 return 1;
252 251 }
253 int gaim_serverready_handle(struct command_rx_struct *command, ...) 252
254 { 253 int gaim_server_ready(struct aim_session_t *sess,
255 switch (command->conn->type) { 254 struct command_rx_struct *command, ...) {
256 case AIM_CONN_TYPE_BOS: 255 switch (command->conn->type) {
257 aim_bos_reqrate(command->conn); 256 case AIM_CONN_TYPE_BOS:
258 aim_bos_ackrateresp(command->conn); 257 aim_bos_reqrate(sess, command->conn);
259 aim_bos_setprivacyflags(command->conn, 0x00000003); 258 aim_bos_ackrateresp(sess, command->conn);
260 aim_bos_reqservice(command->conn, AIM_CONN_TYPE_ADS); 259 aim_bos_setprivacyflags(sess, command->conn, 0x00000003);
261 aim_bos_setgroupperm(NULL, 0x1f); 260 aim_bos_reqservice(sess, command->conn, AIM_CONN_TYPE_ADS);
262 break; 261 aim_setversions(sess, command->conn);
263 case AIM_CONN_TYPE_CHATNAV: 262 aim_bos_setgroupperm(sess, command->conn, 0x1f);
264 break; 263 debug_print("done with BOS ServerReady\n");
265 default: 264 break;
266 printf("Unknown connection type on serverready\n"); 265 case AIM_CONN_TYPE_CHATNAV:
267 break; 266 break;
268 } 267 case AIM_CONN_TYPE_CHAT:
269 return(1); 268 break;
270 269 default: /* huh? */
271 } 270 break;
272 271 }
273 int gaim_redirect_handle(struct command_rx_struct *command, ...) 272 return 1;
274 { 273 }
275 va_list ap; 274
276 int serviceid; 275 int gaim_handle_redirect(struct aim_session_t *sess,
277 char *ip, *cookie; 276 struct command_rx_struct *command, ...) {
278 277 va_list ap;
279 va_start(ap, command); 278 int serviceid;
280 serviceid = va_arg(ap, int); 279 char *ip;
281 ip = va_arg(ap, char *); 280 char *cookie;
282 cookie = va_arg(ap, char *); 281
283 va_end(ap); 282 /* FIXME */
284 283 char buddies[] = "EWarmenhoven&RobFlynn&Zilding&FlynOrange&";
285 switch(serviceid) { 284 char profile[] = "Hello";
286 case 0x0005: { 285
287 char *buf; 286 va_start(ap, command);
288 char *buf2; 287 serviceid = va_arg(ap, int);
289 char file[1024]; 288 ip = va_arg(ap, char *);
290 FILE *f; 289 cookie = va_arg(ap, char *);
291 290
292 g_snprintf(file, sizeof(file), "%s/.gaimbuddy", getenv("HOME")); 291 switch(serviceid) {
293 292 case 0x0005: /* Ads */
294 if (!(f = fopen(file,"r"))) { 293 aim_bos_setbuddylist(sess, command->conn, buddies);
295 } else { 294 aim_bos_setprofile(sess, command->conn, profile, NULL, AIM_CAPS_CHAT);
296 buf = g_malloc(BUF_LONG); 295
297 fread(buf, BUF_LONG, 1, f); 296 aim_bos_clientready(sess, command->conn);
298 297
299 parse_toc_buddy_list(buf); 298 gaim_sess = sess;
300 299 gaim_conn = command->conn;
301 build_edit_tree(); 300
302 build_permit_tree(); 301 debug_print("Roger that, all systems go\n");
303 302 #ifdef USE_APPLET
304 303 make_buddy();
305 g_free(buf);
306 }
307
308
309
310 aim_bos_clientready(command->conn);
311
312 set_login_progress(5, "Logged in.\n");
313 #ifdef USE_APPLET
314 if (general_options & OPT_GEN_APP_BUDDY_SHOW) { 304 if (general_options & OPT_GEN_APP_BUDDY_SHOW) {
315 show_buddy_list(); 305 gnome_buddy_show();
316 refresh_buddy_window(); 306 createOnlinePopup();
307 set_applet_draw_open();
317 } else { 308 } else {
309 gnome_buddy_hide();
310 set_applet_draw_closed();
318 } 311 }
319
320 set_applet_draw_closed();
321 setUserState(online); 312 setUserState(online);
313 gtk_widget_hide(mainwindow);
322 #else 314 #else
323 gtk_widget_hide(mainwindow); 315 gtk_widget_hide(mainwindow);
324 show_buddy_list(); 316 show_buddy_list();
325 refresh_buddy_window(); 317 refresh_buddy_window();
326 #endif 318 #endif
327 serv_finish_login(); 319 break;
328 gaim_conn = command->conn; 320 case 0x7: /* Authorizer */
329 321 {
330 break; 322 struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, ip);
331 } 323 if (tstconn == NULL || tstconn->status >= AIM_CONN_STATUS_RESOLVERR)
332 case 0x0007: { 324 debug_print("unable to reconnect with authorizer\n");
333 struct aim_conn_t *tstconn;
334
335 tstconn = aim_newconn(AIM_CONN_TYPE_AUTH, ip);
336 if ((tstconn == NULL) ||
337 (tstconn->status >= AIM_CONN_STATUS_RESOLVERR)) {
338 #ifdef USE_APPLET
339 setUserState(offline);
340 #endif /* USE_APPLET */
341 set_state(STATE_OFFLINE);
342 hide_login_progress("Unable to reconnect to authorizer");
343 } else
344 aim_auth_sendcookie(tstconn, cookie);
345 break;
346 }
347 case 0x000d: {
348 struct aim_conn_t *tstconn;
349
350 tstconn = aim_newconn(AIM_CONN_TYPE_CHATNAV, ip);
351 if ((tstconn == NULL) ||
352 (tstconn->status >= AIM_CONN_STATUS_RESOLVERR))
353 printf("Unable to connect to chatnav server\n");
354 else 325 else
355 aim_auth_sendcookie( 326 aim_auth_sendcookie(sess, tstconn, cookie);
356 aim_getconn_type(AIM_CONN_TYPE_CHATNAV), 327 }
357 cookie); 328 break;
358 break; 329 case 0xd: /* ChatNav */
359 } 330 break;
360 case 0x000e: 331 case 0xe: /* Chat */
361 printf("CHAT is not yet supported :(\n"); 332 break;
362 break; 333 default: /* huh? */
363 default: 334 sprintf(debug_buff, "got redirect for unknown service 0x%04x\n",
364 printf("Unknown redirect %#04X\n", serviceid); 335 serviceid);
365 break; 336 debug_print(debug_buff);
366 } 337 break;
367 return(1); 338 }
368 339
369 } 340 va_end(ap);
370 341
371 342 return 1;
372 343 }
373 int gaim_im_handle(struct command_rx_struct *command, ...) 344
374 { 345 int gaim_parse_oncoming(struct aim_session_t *sess,
375 time_t t = 0; 346 struct command_rx_struct *command, ...) {
376 char *screenname, *msg; 347 return 1;
377 int warninglevel, class, idletime, isautoreply; 348 }
378 ulong membersince, onsince; 349
379 va_list ap; 350 int gaim_parse_offgoing(struct aim_session_t *sess,
380 351 struct command_rx_struct *command, ...) {
381 va_start(ap, command); 352 return 1;
382 screenname = va_arg(ap, char *); 353 }
354
355 int gaim_parse_incoming_im(struct aim_session_t *sess,
356 struct command_rx_struct *command, ...) {
357 int channel;
358 va_list ap;
359
360 va_start(ap, command);
361 channel = va_arg(ap, int);
362
363 /* channel 1: standard message */
364 if (channel == 1) {
365 struct aim_userinfo_s *userinfo;
366 char *msg = NULL;
367 u_int icbmflags = 0;
368 char *tmpstr = NULL;
369 u_short flag1, flag2;
370
371 userinfo = va_arg(ap, struct aim_userinfo_s *);
372 msg = va_arg(ap, char *);
373 icbmflags = va_arg(ap, u_int);
374 flag1 = va_arg(ap, u_short);
375 flag2 = va_arg(ap, u_short);
376 va_end(ap);
377
378 serv_got_im(userinfo->sn, msg, icbmflags & AIM_IMFLAGS_AWAY);
379 }
380
381 return 1;
382 }
383
384 int gaim_parse_misses(struct aim_session_t *sess,
385 struct command_rx_struct *command, ...) {
386 return 1;
387 }
388
389 int gaim_parse_user_info(struct aim_session_t *sess,
390 struct command_rx_struct *command, ...) {
391 return 1;
392 }
393
394 int gaim_parse_unknown(struct aim_session_t *sess,
395 struct command_rx_struct *command, ...) {
396 return 1;
397 }
398
399 int gaim_parse_motd(struct aim_session_t *sess,
400 struct command_rx_struct *command, ...) {
401 char *msg;
402 u_short id;
403 va_list ap;
404
405 va_start(ap, command);
406 id = va_arg(ap, u_short);
383 msg = va_arg(ap, char *); 407 msg = va_arg(ap, char *);
384 warninglevel = va_arg(ap, int); 408 va_end(ap);
385 class = va_arg(ap, int); 409
386 membersince = va_arg(ap, ulong); 410 sprintf(debug_buff, "MOTD: %s\n", msg);
387 onsince = va_arg(ap, ulong); 411 debug_print(debug_buff);
388 idletime = va_arg(ap, int); 412
389 isautoreply = va_arg(ap, int); 413 return 1;
390 va_end(ap); 414 }
391 415
392 printf("'%s'\n", msg); 416 #endif /* USE_OSCAR */
393
394 serv_got_im(screenname, msg, isautoreply);
395
396 return(1);
397
398
399 }
400
401 #endif