comparison src/oscar.c @ 338:9d258a0aa560

[gaim-migrate @ 348] Whoa, all kinds of things happened here. The applet looks better. The preferences dialog changes based on your compile-time options (oscar, gnome). Whispering works again. libfaim got updated; it can almost do RVOUS stuff, and hopefully soon can make requests too. The applet doesn't need to have its sounds go through GNOME, although it still can. There is code to facilitate SOCKS5 support (all that needs to be done is to actually write the code to communicate with the proxy server). committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 06 Jun 2000 09:55:30 +0000
parents 71be288e7578
children b402a23f35df
comparison
equal deleted inserted replaced
337:f5b199e20d12 338:9d258a0aa560
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 <faim/aim.h> 38 #include <aim.h>
39 #include "gnome_applet_mgr.h" 39 #include "gnome_applet_mgr.h"
40 40
41 static int inpa = -1; 41 static int inpa = -1;
42 static int paspa = -1; 42 static int paspa = -1;
43 struct aim_session_t *gaim_sess; 43 struct aim_session_t *gaim_sess;
76 static int gaim_chat_join (struct aim_session_t *, struct command_rx_struct *, ...); 76 static int gaim_chat_join (struct aim_session_t *, struct command_rx_struct *, ...);
77 static int gaim_chat_leave (struct aim_session_t *, struct command_rx_struct *, ...); 77 static int gaim_chat_leave (struct aim_session_t *, struct command_rx_struct *, ...);
78 static int gaim_chat_info_update (struct aim_session_t *, struct command_rx_struct *, ...); 78 static int gaim_chat_info_update (struct aim_session_t *, struct command_rx_struct *, ...);
79 static int gaim_chat_incoming_msg(struct aim_session_t *, struct command_rx_struct *, ...); 79 static int gaim_chat_incoming_msg(struct aim_session_t *, struct command_rx_struct *, ...);
80 80
81 extern void auth_failed();
82
81 static void oscar_callback(gpointer data, gint source, 83 static void oscar_callback(gpointer data, gint source,
82 GdkInputCondition condition) { 84 GdkInputCondition condition) {
83 struct aim_conn_t *conn = (struct aim_conn_t *)data; 85 struct aim_conn_t *conn = (struct aim_conn_t *)data;
84 86
85 if (condition & GDK_INPUT_EXCEPTION) { 87 if (condition & GDK_INPUT_EXCEPTION) {
86 signoff(); 88 signoff();
87 hide_login_progress("Disconnected."); 89 hide_login_progress("Disconnected.");
88 aim_logoff(gaim_sess); 90 aim_logoff(gaim_sess);
89 gdk_input_remove(inpa); 91 gdk_input_remove(inpa);
92 auth_failed();
90 return; 93 return;
91 } 94 }
92 if (condition & GDK_INPUT_READ) { 95 if (condition & GDK_INPUT_READ) {
93 if (aim_get_command(gaim_sess, conn) < 0) { 96 if (aim_get_command(gaim_sess, conn) < 0) {
94 debug_print("connection error!\n"); 97 debug_print("connection error!\n");
95 signoff(); 98 signoff();
96 hide_login_progress("Disconnected."); 99 hide_login_progress("Disconnected.");
97 aim_logoff(gaim_sess); 100 aim_logoff(gaim_sess);
101 auth_failed();
98 gdk_input_remove(inpa); 102 gdk_input_remove(inpa);
99 } else { 103 } else {
100 aim_rxdispatch(gaim_sess); 104 aim_rxdispatch(gaim_sess);
101 } 105 }
102 } 106 }
190 inpa = -1; 194 inpa = -1;
191 aim_logoff(gaim_sess); 195 aim_logoff(gaim_sess);
192 debug_print("Signed off.\n"); 196 debug_print("Signed off.\n");
193 } 197 }
194 198
195 extern void auth_failed();
196
197 int gaim_parse_auth_resp(struct aim_session_t *sess, 199 int gaim_parse_auth_resp(struct aim_session_t *sess,
198 struct command_rx_struct *command, ...) { 200 struct command_rx_struct *command, ...) {
199 struct aim_conn_t *bosconn = NULL; 201 struct aim_conn_t *bosconn = NULL;
200 sprintf(debug_buff, "inside auth_resp (Screen name: %s)\n", 202 sprintf(debug_buff, "inside auth_resp (Screen name: %s)\n",
201 sess->logininfo.screen_name); 203 sess->logininfo.screen_name);
223 setUserState(offline); 225 setUserState(offline);
224 #endif 226 #endif
225 set_state(STATE_OFFLINE); 227 set_state(STATE_OFFLINE);
226 hide_login_progress("Authentication Failed"); 228 hide_login_progress("Authentication Failed");
227 gdk_input_remove(inpa); 229 gdk_input_remove(inpa);
228 aim_conn_close(command->conn); 230 aim_conn_kill(sess, &command->conn);
229 auth_failed(); 231 auth_failed();
230 return 0; 232 return 0;
231 } 233 }
232 234
233 235
234 sprintf(debug_buff, "Email: %s\n", sess->logininfo.email); 236 sprintf(debug_buff, "Email: %s\n", sess->logininfo.email);
235 debug_print(debug_buff); 237 debug_print(debug_buff);
236 sprintf(debug_buff, "Closing auth connection...\n"); 238 sprintf(debug_buff, "Closing auth connection...\n");
237 debug_print(debug_buff); 239 debug_print(debug_buff);
238 gdk_input_remove(inpa); 240 gdk_input_remove(inpa);
239 aim_conn_close(command->conn); 241 aim_conn_kill(sess, &command->conn);
240 242
241 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, sess->logininfo.BOSIP); 243 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, sess->logininfo.BOSIP);
242 if (bosconn == NULL) { 244 if (bosconn == NULL) {
243 #ifdef USE_APPLET 245 #ifdef USE_APPLET
244 setUserState(offline); 246 setUserState(offline);
245 #endif 247 #endif
246 set_state(STATE_OFFLINE); 248 set_state(STATE_OFFLINE);
247 hide_login_progress("Internal Error"); 249 hide_login_progress("Internal Error");
250 auth_failed();
248 return -1; 251 return -1;
249 } else if (bosconn->status != 0) { 252 } else if (bosconn->status != 0) {
250 #ifdef USE_APPLET 253 #ifdef USE_APPLET
251 setUserState(offline); 254 setUserState(offline);
252 #endif 255 #endif
253 set_state(STATE_OFFLINE); 256 set_state(STATE_OFFLINE);
254 hide_login_progress("Could Not Connect"); 257 hide_login_progress("Could Not Connect");
258 auth_failed();
255 return -1; 259 return -1;
256 } 260 }
257 261
258 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); 262 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0);
259 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, gaim_server_ready, 0); 263 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, gaim_server_ready, 0);
548 552
549 serv_got_chat_invite(roominfo->name, 553 serv_got_chat_invite(roominfo->name,
550 roominfo->instance, 554 roominfo->instance,
551 userinfo->sn, 555 userinfo->sn,
552 msg); 556 msg);
553 } else if (rendtype == 1) { 557 } else if (rendtype == AIM_RENDEZVOUS_FILETRANSFER) {
554 /* voice chat */ 558 /* libfaim won't tell us that we got this just yet */
559 } else if (rendtype == AIM_RENDEZVOUS_FILETRANSFER_GET) {
560 /* nor will it tell us this. but it's still there */
555 } else { 561 } else {
556 sprintf(debug_buff, "Unknown rendtype %d\n", rendtype); 562 sprintf(debug_buff, "Unknown rendtype %d\n", rendtype);
557 debug_print(debug_buff); 563 debug_print(debug_buff);
558 } 564 }
559 /* libfaim doesn't do file transfer yet, from what i can tell */
560 } 565 }
561 566
562 return 1; 567 return 1;
563 } 568 }
564 569
682 exchanges[i].lang1); 687 exchanges[i].lang1);
683 debug_print(debug_buff); 688 debug_print(debug_buff);
684 i++; 689 i++;
685 } 690 }
686 } 691 }
687 aim_conn_close(command->conn); 692 aim_conn_kill(sess, &command->conn);
688 break; 693 break;
689 default: 694 default:
690 va_end(ap); 695 va_end(ap);
691 sprintf(debug_buff, "chatnav info: unknown type (%04x)\n", type); 696 sprintf(debug_buff, "chatnav info: unknown type (%04x)\n", type);
692 debug_print(debug_buff); 697 debug_print(debug_buff);