comparison src/oscar.c @ 288:6e609d42f767

[gaim-migrate @ 298] Hopefully signing on will work a little better now. At least I know what's causing it. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 31 May 2000 19:58:36 +0000
parents 0f14e6d8a51b
children 61894ab8c47e
comparison
equal deleted inserted replaced
287:8bbc269d5b8d 288:6e609d42f767
59 static int gaim_chat_info_update (struct aim_session_t *, struct command_rx_struct *, ...); 59 static int gaim_chat_info_update (struct aim_session_t *, struct command_rx_struct *, ...);
60 static int gaim_chat_incoming_msg(struct aim_session_t *, struct command_rx_struct *, ...); 60 static int gaim_chat_incoming_msg(struct aim_session_t *, struct command_rx_struct *, ...);
61 61
62 static void oscar_callback(gpointer data, gint source, 62 static void oscar_callback(gpointer data, gint source,
63 GdkInputCondition condition) { 63 GdkInputCondition condition) {
64 struct aim_session_t *sess = (struct aim_session_t *)data; 64 struct aim_conn_t *conn = (struct aim_conn_t *)data;
65 65
66 if (condition & GDK_INPUT_EXCEPTION) { 66 if (condition & GDK_INPUT_EXCEPTION) {
67 signoff(); 67 signoff();
68 hide_login_progress("Disconnected."); 68 hide_login_progress("Disconnected.");
69 aim_logoff(sess); 69 aim_logoff(gaim_sess);
70 gdk_input_remove(inpa); 70 gdk_input_remove(inpa);
71 return; 71 return;
72 } 72 }
73 if (condition & GDK_INPUT_READ) { 73 if (condition & GDK_INPUT_READ) {
74 if (aim_get_command(sess, gaim_conn) < 0) { 74 if (aim_get_command(gaim_sess, conn) < 0) {
75 debug_print("connection error!\n"); 75 debug_print("connection error!\n");
76 signoff(); 76 signoff();
77 hide_login_progress("Disconnected."); 77 hide_login_progress("Disconnected.");
78 aim_logoff(sess); 78 aim_logoff(gaim_sess);
79 gdk_input_remove(inpa); 79 gdk_input_remove(inpa);
80 } else { 80 } else {
81 aim_rxdispatch(sess); 81 aim_rxdispatch(gaim_sess);
82 } 82 }
83 } 83 }
84 } 84 }
85 85
86 int oscar_login(char *username, char *password) { 86 int oscar_login(char *username, char *password) {
134 aim_conn_addhandler(sess, conn, AIM_CB_FAM_GEN, 134 aim_conn_addhandler(sess, conn, AIM_CB_FAM_GEN,
135 AIM_CB_GEN_SERVERREADY, 135 AIM_CB_GEN_SERVERREADY,
136 gaim_auth_server_ready, 0); 136 gaim_auth_server_ready, 0);
137 aim_send_login(sess, conn, username, password, &info); 137 aim_send_login(sess, conn, username, password, &info);
138 138
139 gaim_conn = conn;
140 inpa = gdk_input_add(conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, 139 inpa = gdk_input_add(conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
141 oscar_callback, sess); 140 oscar_callback, conn);
142 141
143 u = find_user(username); 142 u = find_user(username);
144 143
145 if (!u) { 144 if (!u) {
146 u = g_new0(struct aim_user, 1); 145 u = g_new0(struct aim_user, 1);
224 #endif 223 #endif
225 set_state(STATE_OFFLINE); 224 set_state(STATE_OFFLINE);
226 hide_login_progress("Could Not Connect"); 225 hide_login_progress("Could Not Connect");
227 return -1; 226 return -1;
228 } 227 }
229 gaim_conn = bosconn;
230 228
231 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); 229 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0);
232 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, gaim_server_ready, 0); 230 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, gaim_server_ready, 0);
233 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATEINFO, NULL, 0); 231 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATEINFO, NULL, 0);
234 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); 232 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0);
244 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_CTN, AIM_CB_CTN_DEFAULT, aim_parse_unknown, 0); 242 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_CTN, AIM_CB_CTN_DEFAULT, aim_parse_unknown, 0);
245 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEFAULT, aim_parse_unknown, 0); 243 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEFAULT, aim_parse_unknown, 0);
246 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0); 244 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0);
247 245
248 aim_auth_sendcookie(sess, bosconn, sess->logininfo.cookie); 246 aim_auth_sendcookie(sess, bosconn, sess->logininfo.cookie);
247 gaim_conn = bosconn;
249 inpa = gdk_input_add(bosconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, 248 inpa = gdk_input_add(bosconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
250 oscar_callback, sess); 249 oscar_callback, bosconn);
251 set_login_progress(4, "Connection established, cookie sent"); 250 set_login_progress(4, "Connection established, cookie sent");
252 return 1; 251 return 1;
253 } 252 }
254 253
255 int gaim_auth_server_ready(struct aim_session_t *sess, 254 int gaim_auth_server_ready(struct aim_session_t *sess,
322 aim_seticbmparam(sess, command->conn); 321 aim_seticbmparam(sess, command->conn);
323 322
324 aim_bos_clientready(sess, command->conn); 323 aim_bos_clientready(sess, command->conn);
325 324
326 aim_bos_reqservice(sess, command->conn, AIM_CONN_TYPE_CHATNAV); 325 aim_bos_reqservice(sess, command->conn, AIM_CONN_TYPE_CHATNAV);
326 aim_conn_setlatency(command->conn, 1);
327 327
328 debug_print("Roger that, all systems go\n"); 328 debug_print("Roger that, all systems go\n");
329 #ifdef USE_APPLET 329 #ifdef USE_APPLET
330 make_buddy(); 330 make_buddy();
331 if (general_options & OPT_GEN_APP_BUDDY_SHOW) { 331 if (general_options & OPT_GEN_APP_BUDDY_SHOW) {
346 serv_finish_login(); 346 serv_finish_login();
347 gaim_setup(); 347 gaim_setup();
348 if (bud_list_cache_exists()) 348 if (bud_list_cache_exists())
349 do_import(NULL, 0); 349 do_import(NULL, 0);
350 350
351 aim_conn_setlatency(command->conn, 1);
352
353 break; 351 break;
354 case 0x7: /* Authorizer */ 352 case 0x7: /* Authorizer */
355 { 353 {
356 struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, ip); 354 struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, ip);
357 if (tstconn == NULL || tstconn->status >= AIM_CONN_STATUS_RESOLVERR) 355 if (tstconn == NULL || tstconn->status >= AIM_CONN_STATUS_RESOLVERR)