Mercurial > pidgin
comparison src/oscar.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 | ce201056e7a6 |
children | a930439f29b1 |
comparison
equal
deleted
inserted
replaced
1088:18a14e6dd0af | 1089:f0f5c10cce63 |
---|---|
306 void oscar_login(struct aim_user *user) { | 306 void oscar_login(struct aim_user *user) { |
307 struct aim_session_t *sess; | 307 struct aim_session_t *sess; |
308 struct aim_conn_t *conn; | 308 struct aim_conn_t *conn; |
309 char buf[256]; | 309 char buf[256]; |
310 char *finalauth = NULL; | 310 char *finalauth = NULL; |
311 struct gaim_connection *gc = new_gaim_conn(PROTO_OSCAR, user->username, user->password); | 311 struct gaim_connection *gc = new_gaim_conn(user); |
312 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); | 312 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); |
313 gc->user = user; | 313 gc->user = user; |
314 | 314 |
315 sprintf(debug_buff, _("Logging in %s\n"), user->username); | 315 sprintf(debug_buff, _("Logging in %s\n"), user->username); |
316 debug_print(debug_buff); | 316 debug_print(debug_buff); |
341 /* we need an immediate queue because we don't use a while-loop to | 341 /* we need an immediate queue because we don't use a while-loop to |
342 * see if things need to be sent. */ | 342 * see if things need to be sent. */ |
343 sess->tx_enqueue = &aim_tx_enqueue__immediate; | 343 sess->tx_enqueue = &aim_tx_enqueue__immediate; |
344 odata->sess = sess; | 344 odata->sess = sess; |
345 | 345 |
346 sprintf(buf, _("Looking up %s"), finalauth ? finalauth : FAIM_LOGIN_SERVER); | |
347 set_login_progress(gc, 1, buf); | |
348 /* this creates a possible race condition, but hey, what can you do */ | |
349 while (gtk_events_pending()) | |
350 gtk_main_iteration(); | |
351 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, finalauth ? finalauth : FAIM_LOGIN_SERVER); | 346 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, finalauth ? finalauth : FAIM_LOGIN_SERVER); |
352 | 347 |
353 if (finalauth) | 348 if (finalauth) |
354 g_free(finalauth); | 349 g_free(finalauth); |
355 | 350 |
356 if (conn == NULL) { | 351 if (conn == NULL) { |
357 debug_print(_("internal connection error\n")); | 352 debug_print(_("internal connection error\n")); |
358 hide_login_progress(gc, _("Unable to login to AIM")); | 353 hide_login_progress(gc, _("Unable to login to AIM")); |
359 destroy_gaim_conn(gc); | 354 serv_close(gc); |
360 return; | 355 return; |
361 } else if (conn->fd == -1) { | 356 } else if (conn->fd == -1) { |
362 if (conn->status & AIM_CONN_STATUS_RESOLVERR) { | 357 if (conn->status & AIM_CONN_STATUS_RESOLVERR) { |
363 sprintf(debug_buff, _("couldn't resolve host")); | 358 sprintf(debug_buff, _("couldn't resolve host")); |
364 debug_print(debug_buff); debug_print("\n"); | 359 debug_print(debug_buff); debug_print("\n"); |
366 } else if (conn->status & AIM_CONN_STATUS_CONNERR) { | 361 } else if (conn->status & AIM_CONN_STATUS_CONNERR) { |
367 sprintf(debug_buff, _("couldn't connect to host")); | 362 sprintf(debug_buff, _("couldn't connect to host")); |
368 debug_print(debug_buff); debug_print("\n"); | 363 debug_print(debug_buff); debug_print("\n"); |
369 hide_login_progress(gc, debug_buff); | 364 hide_login_progress(gc, debug_buff); |
370 } | 365 } |
371 destroy_gaim_conn(gc); | 366 serv_close(gc); |
372 return; | 367 return; |
373 } | 368 } |
374 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); | 369 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); |
375 set_login_progress(gc, 2, buf); | 370 set_login_progress(gc, 2, buf); |
376 | 371 |
470 if (bosconn == NULL) { | 465 if (bosconn == NULL) { |
471 #ifdef USE_APPLET | 466 #ifdef USE_APPLET |
472 set_user_state(offline); | 467 set_user_state(offline); |
473 #endif | 468 #endif |
474 hide_login_progress(gc, _("Internal Error")); | 469 hide_login_progress(gc, _("Internal Error")); |
475 destroy_gaim_conn(gc); | 470 serv_close(gc); |
476 return -1; | 471 return -1; |
477 } else if (bosconn->status & AIM_CONN_STATUS_CONNERR) { | 472 } else if (bosconn->status & AIM_CONN_STATUS_CONNERR) { |
478 #ifdef USE_APPLET | 473 #ifdef USE_APPLET |
479 set_user_state(offline); | 474 set_user_state(offline); |
480 #endif | 475 #endif |
481 hide_login_progress(gc, _("Could Not Connect")); | 476 hide_login_progress(gc, _("Could Not Connect")); |
482 destroy_gaim_conn(gc); | 477 serv_close(gc); |
483 return -1; | 478 return -1; |
484 } | 479 } |
485 | 480 |
486 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); | 481 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
487 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0007, gaim_rateresp, 0); /* rate info */ | 482 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0007, gaim_rateresp, 0); /* rate info */ |
1258 aim_bos_reqpersonalinfo(sess, command->conn); | 1253 aim_bos_reqpersonalinfo(sess, command->conn); |
1259 aim_bos_reqlocaterights(sess, command->conn); | 1254 aim_bos_reqlocaterights(sess, command->conn); |
1260 aim_bos_setprofile(sess, command->conn, gc->user->user_info, NULL, gaim_caps); | 1255 aim_bos_setprofile(sess, command->conn, gc->user->user_info, NULL, gaim_caps); |
1261 aim_bos_reqbuddyrights(sess, command->conn); | 1256 aim_bos_reqbuddyrights(sess, command->conn); |
1262 | 1257 |
1263 account_online(gc->user, gc); /* this is an awkward hack */ | 1258 account_online(gc); |
1264 serv_finish_login(gc); | 1259 serv_finish_login(gc); |
1265 | 1260 |
1266 if (bud_list_cache_exists(gc)) | 1261 if (bud_list_cache_exists(gc)) |
1267 do_import(NULL, gc); | 1262 do_import(NULL, gc); |
1268 | 1263 |