Mercurial > pidgin
comparison src/toc.c @ 1089:f0f5c10cce63
[gaim-migrate @ 1099]
added a cancel button to the progress meter
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Mon, 13 Nov 2000 02:58:00 +0000 |
| parents | 18a14e6dd0af |
| children | f168625b63fe |
comparison
equal
deleted
inserted
replaced
| 1088:18a14e6dd0af | 1089:f0f5c10cce63 |
|---|---|
| 45 #include "pixmaps/aol_icon.xpm" | 45 #include "pixmaps/aol_icon.xpm" |
| 46 #include "pixmaps/away_icon.xpm" | 46 #include "pixmaps/away_icon.xpm" |
| 47 #include "pixmaps/dt_icon.xpm" | 47 #include "pixmaps/dt_icon.xpm" |
| 48 #include "pixmaps/free_icon.xpm" | 48 #include "pixmaps/free_icon.xpm" |
| 49 | 49 |
| 50 #define REVISION "gaim:$Revision: 1098 $" | 50 #define REVISION "gaim:$Revision: 1099 $" |
| 51 | 51 |
| 52 struct toc_data { | 52 struct toc_data { |
| 53 int toc_fd; | 53 int toc_fd; |
| 54 int seqno; | 54 int seqno; |
| 55 int state; | 55 int state; |
| 79 struct gaim_connection *gc; | 79 struct gaim_connection *gc; |
| 80 struct toc_data *tdt; | 80 struct toc_data *tdt; |
| 81 char buf[80]; | 81 char buf[80]; |
| 82 char buf2[2048]; | 82 char buf2[2048]; |
| 83 | 83 |
| 84 gc = new_gaim_conn(PROTO_TOC, user->username, user->password); | 84 gc = new_gaim_conn(user); |
| 85 gc->proto_data = tdt = g_new0(struct toc_data, 1); | 85 gc->proto_data = tdt = g_new0(struct toc_data, 1); |
| 86 | 86 |
| 87 g_snprintf(buf, sizeof(buf), "Looking up %s", | 87 g_snprintf(buf, sizeof(buf), "Looking up %s", |
| 88 user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST); | 88 user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST); |
| 89 set_login_progress(gc, 1, buf); | 89 set_login_progress(gc, 1, buf); |
| 90 while (gtk_events_pending()) | 90 while (gtk_events_pending()) |
| 91 gtk_main_iteration(); | 91 gtk_main_iteration(); |
| 92 if (!g_slist_find(connections, gc)) | |
| 93 return; | |
| 92 | 94 |
| 93 tdt->toc_fd = proxy_connect( | 95 tdt->toc_fd = proxy_connect( |
| 94 user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST, | 96 user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST, |
| 95 user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->proto_opt[USEROPT_AUTHPORT]) : TOC_PORT, | 97 user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->proto_opt[USEROPT_AUTHPORT]) : TOC_PORT, |
| 96 user->proto_opt[USEROPT_SOCKSHOST], atoi(user->proto_opt[USEROPT_SOCKSPORT]), | 98 user->proto_opt[USEROPT_SOCKSHOST], atoi(user->proto_opt[USEROPT_SOCKSPORT]), |
| 98 | 100 |
| 99 if (tdt->toc_fd < 0) { | 101 if (tdt->toc_fd < 0) { |
| 100 g_snprintf(buf, sizeof(buf), "Connect to %s failed", | 102 g_snprintf(buf, sizeof(buf), "Connect to %s failed", |
| 101 user->proto_opt[USEROPT_AUTH]); | 103 user->proto_opt[USEROPT_AUTH]); |
| 102 hide_login_progress(gc, buf); | 104 hide_login_progress(gc, buf); |
| 103 destroy_gaim_conn(gc); | 105 serv_close(gc); |
| 104 return; | 106 return; |
| 105 } | 107 } |
| 106 | 108 |
| 107 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); | 109 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); |
| 108 set_login_progress(gc, 3, buf); | 110 set_login_progress(gc, 3, buf); |
| 109 while (gtk_events_pending()) | 111 while (gtk_events_pending()) |
| 110 gtk_main_iteration(); | 112 gtk_main_iteration(); |
| 113 if (!g_slist_find(connections, gc)) | |
| 114 return; | |
| 111 | 115 |
| 112 if (toc_signon(gc) < 0) { | 116 if (toc_signon(gc) < 0) { |
| 113 hide_login_progress(gc, "Disconnected."); | 117 hide_login_progress(gc, "Disconnected."); |
| 114 destroy_gaim_conn(gc); | 118 serv_close(gc); |
| 115 return; | 119 return; |
| 116 } | 120 } |
| 117 | 121 |
| 118 g_snprintf(buf, sizeof(buf), "Waiting for reply..."); | 122 g_snprintf(buf, sizeof(buf), "Waiting for reply..."); |
| 119 set_login_progress(gc, 4, buf); | 123 set_login_progress(gc, 4, buf); |
| 120 while (gtk_events_pending()) | 124 while (gtk_events_pending()) |
| 121 gtk_main_iteration(); | 125 gtk_main_iteration(); |
| 126 if (!g_slist_find(connections, gc)) | |
| 127 return; | |
| 122 if (toc_wait_signon(gc) < 0) { | 128 if (toc_wait_signon(gc) < 0) { |
| 123 hide_login_progress(gc, "Authentication Failed"); | 129 hide_login_progress(gc, "Authentication Failed"); |
| 124 destroy_gaim_conn(gc); | 130 serv_close(gc); |
| 125 return; | 131 return; |
| 126 } | 132 } |
| 127 | 133 |
| 128 gc->options = user->options; | 134 gc->options = user->options; |
| 129 save_prefs(); | 135 save_prefs(); |
| 130 | 136 |
| 131 g_snprintf(buf, sizeof(buf), "Retrieving config..."); | 137 g_snprintf(buf, sizeof(buf), "Retrieving config..."); |
| 132 set_login_progress(gc, 5, buf); | 138 set_login_progress(gc, 5, buf); |
| 133 while (gtk_events_pending()) | 139 while (gtk_events_pending()) |
| 134 gtk_main_iteration(); | 140 gtk_main_iteration(); |
| 135 | 141 if (!g_slist_find(connections, gc)) |
| 136 account_online(user, gc); | 142 return; |
| 143 | |
| 144 account_online(gc); | |
| 137 serv_finish_login(gc); | 145 serv_finish_login(gc); |
| 138 | 146 |
| 139 config = toc_wait_config(gc); | 147 config = toc_wait_config(gc); |
| 140 tdt->state = STATE_ONLINE; | 148 tdt->state = STATE_ONLINE; |
| 141 | 149 |
