comparison src/toc.c @ 975:a45991891aba

[gaim-migrate @ 985] signin mods. still need a better UI, but it's getting there. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 11 Oct 2000 03:56:46 +0000
parents 26354cf6a362
children 2586b2a3725e
comparison
equal deleted inserted replaced
974:a57fbdc1a758 975:a45991891aba
37 #include <sys/socket.h> 37 #include <sys/socket.h>
38 #include "multi.h" 38 #include "multi.h"
39 #include "gaim.h" 39 #include "gaim.h"
40 #include "gnome_applet_mgr.h" 40 #include "gnome_applet_mgr.h"
41 41
42 #define REVISION "gaim:$Revision: 981 $" 42 #define REVISION "gaim:$Revision: 985 $"
43 43
44 44
45 static unsigned int peer_ver=0; 45 static unsigned int peer_ver=0;
46 #ifdef _WIN32 46 #ifdef _WIN32
47 static int win32_r; 47 static int win32_r;
62 struct gaim_connection *gc; 62 struct gaim_connection *gc;
63 char buf[80]; 63 char buf[80];
64 char buf2[2048]; 64 char buf2[2048];
65 65
66 g_snprintf(buf, sizeof(buf), "Looking up %s", aim_host); 66 g_snprintf(buf, sizeof(buf), "Looking up %s", aim_host);
67 set_login_progress(1, buf);
68 67
69 sin = (struct in_addr *)get_address(aim_host); 68 sin = (struct in_addr *)get_address(aim_host);
70 if (!sin) { 69 if (!sin) {
71
72 #ifdef USE_APPLET
73 set_user_state(offline);
74 #endif /* USE_APPLET */
75 g_snprintf(buf, sizeof(buf), "Unable to lookup %s", aim_host); 70 g_snprintf(buf, sizeof(buf), "Unable to lookup %s", aim_host);
76 hide_login_progress(buf); 71 hide_login_progress(username, buf);
77 return NULL; 72 return NULL;
78 } 73 }
79 74
80 g_snprintf(toc_addy, sizeof(toc_addy), "%s", inet_ntoa(*sin)); 75 g_snprintf(toc_addy, sizeof(toc_addy), "%s", inet_ntoa(*sin));
81 g_snprintf(buf, sizeof(buf), "Connecting to %s", inet_ntoa(*sin)); 76 g_snprintf(buf, sizeof(buf), "Connecting to %s", inet_ntoa(*sin));
82 77
83 set_login_progress(2, buf);
84 78
85 79
86 gc = new_gaim_conn(PROTO_TOC, username, password); 80 gc = new_gaim_conn(PROTO_TOC, username, password);
87 81
88 gc->toc_fd = connect_address(sin->s_addr, aim_port); 82 gc->toc_fd = connect_address(sin->s_addr, aim_port);
89 83
90 if (gc->toc_fd < 0) { 84 if (gc->toc_fd < 0) {
91 #ifdef USE_APPLET
92 set_user_state(offline);
93 #endif /* USE_APPLET */
94 g_snprintf(buf, sizeof(buf), "Connect to %s failed", 85 g_snprintf(buf, sizeof(buf), "Connect to %s failed",
95 inet_ntoa(*sin)); 86 inet_ntoa(*sin));
96 hide_login_progress(buf); 87 hide_login_progress(gc->username, buf);
97 destroy_gaim_conn(gc); 88 destroy_gaim_conn(gc);
98 return NULL; 89 return NULL;
99 } 90 }
100 91
101 g_free(sin); 92 g_free(sin);
102 93
103 g_snprintf(buf, sizeof(buf), "Signon: %s",username); 94 g_snprintf(buf, sizeof(buf), "Signon: %s",username);
104 95
105 set_login_progress(3, buf);
106
107 if (toc_signon(gc) < 0) { 96 if (toc_signon(gc) < 0) {
108 #ifdef USE_APPLET 97 hide_login_progress(gc->username, "Disconnected.");
109 set_user_state(offline);
110 #endif /* USE_APPLET */
111 hide_login_progress("Disconnected.");
112 destroy_gaim_conn(gc); 98 destroy_gaim_conn(gc);
113 return NULL; 99 return NULL;
114 } 100 }
115 101
116 g_snprintf(buf, sizeof(buf), "Waiting for reply..."); 102 g_snprintf(buf, sizeof(buf), "Waiting for reply...");
117 set_login_progress(4, buf);
118 if (toc_wait_signon(gc) < 0) { 103 if (toc_wait_signon(gc) < 0) {
119 #ifdef USE_APPLET 104 hide_login_progress(gc->username, "Authentication Failed");
120 set_user_state(offline);
121 #endif /* USE_APPLET */
122 hide_login_progress("Authentication Failed");
123 destroy_gaim_conn(gc); 105 destroy_gaim_conn(gc);
124 return NULL; 106 return NULL;
125 } 107 }
126 108
127 u = find_user(username); 109 u = find_user(username);
128 sprintf(gc->user_info, "%s", u->user_info); 110 sprintf(gc->user_info, "%s", u->user_info);
129 gc->options = u->options; 111 gc->options = u->options;
130 save_prefs(); 112 save_prefs();
131 113
132 g_snprintf(buf, sizeof(buf), "Retrieving config..."); 114 g_snprintf(buf, sizeof(buf), "Retrieving config...");
133 set_login_progress(5, buf);
134 config = toc_wait_config(gc); 115 config = toc_wait_config(gc);
135 gc->state = STATE_ONLINE; 116 gc->state = STATE_ONLINE;
136 117
137 if (mainwindow) 118 if (mainwindow)
138 gtk_widget_hide(mainwindow); 119 gtk_widget_hide(mainwindow);
361 char *l; 342 char *l;
362 struct gaim_connection *gc = (struct gaim_connection *)data; 343 struct gaim_connection *gc = (struct gaim_connection *)data;
363 344
364 buf = g_malloc(2 * BUF_LONG); 345 buf = g_malloc(2 * BUF_LONG);
365 if (wait_reply(gc, buf, 2 * BUF_LONG) < 0) { 346 if (wait_reply(gc, buf, 2 * BUF_LONG) < 0) {
347 hide_login_progress(gc->username, "Connection Closed");
366 signoff(gc); /* this will free gc for us */ 348 signoff(gc); /* this will free gc for us */
367 hide_login_progress("Connection Closed");
368 g_free(buf); 349 g_free(buf);
369 return; 350 return;
370 } 351 }
371 352
372 353