comparison src/protocols/oscar/oscar.c @ 5576:8c398efc88f2

[gaim-migrate @ 5980] Some stuff fixed. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 31 May 2003 02:10:58 +0000
parents ca4762df72d1
children 7ed9999926af
comparison
equal deleted inserted replaced
5575:ca4762df72d1 5576:8c398efc88f2
531 aim_conn_kill(od->sess, &conn); 531 aim_conn_kill(od->sess, &conn);
532 } 532 }
533 } else { 533 } else {
534 if (aim_get_command(od->sess, conn) >= 0) { 534 if (aim_get_command(od->sess, conn) >= 0) {
535 aim_rxdispatch(od->sess); 535 aim_rxdispatch(od->sess);
536 if (od->killme) 536 if (od->killme)
537 signoff(gc); 537 gaim_connection_destroy(gc);
538 } else { 538 } else {
539 if ((conn->type == AIM_CONN_TYPE_BOS) || 539 if ((conn->type == AIM_CONN_TYPE_BOS) ||
540 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { 540 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) {
541 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 541 gaim_debug(GAIM_DEBUG_ERROR, "oscar",
542 "major connection error\n"); 542 "major connection error\n");
543 hide_login_progress_error(gc, _("Disconnected.")); 543 gaim_connection_error(gc, _("Disconnected."));
544 signoff(gc);
545 } else if (conn->type == AIM_CONN_TYPE_CHAT) { 544 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
546 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); 545 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
547 char *buf; 546 char *buf;
548 gaim_debug(GAIM_DEBUG_INFO, "oscar", 547 gaim_debug(GAIM_DEBUG_INFO, "oscar",
549 "disconnected from chat room %s\n", c->name); 548 "disconnected from chat room %s\n", c->name);
641 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); 640 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
642 641
643 conn->fd = source; 642 conn->fd = source;
644 643
645 if (source < 0) { 644 if (source < 0) {
646 hide_login_progress(gc, _("Couldn't connect to host")); 645 gaim_connection_error(gc, _("Couldn't connect to host"));
647 signoff(gc);
648 return; 646 return;
649 } 647 }
650 648
651 aim_conn_completeconnect(sess, conn); 649 aim_conn_completeconnect(sess, conn);
652 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); 650 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn);
684 682
685 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); 683 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
686 if (conn == NULL) { 684 if (conn == NULL) {
687 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 685 gaim_debug(GAIM_DEBUG_ERROR, "oscar",
688 "internal connection error\n"); 686 "internal connection error\n");
689 hide_login_progress(gc, _("Unable to login to AIM")); 687 gaim_connection_error(gc, _("Unable to login to AIM"));
690 signoff(gc);
691 return; 688 return;
692 } 689 }
693 690
694 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account)); 691 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account));
695 set_login_progress(gc, 2, buf); 692 gaim_connection_update_progress(gc, buf, 2, 5);
696 693
697 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 694 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
698 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); 695 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
699 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); 696 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
700 697
701 conn->status |= AIM_CONN_STATUS_INPROGRESS; 698 conn->status |= AIM_CONN_STATUS_INPROGRESS;
702 if (proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), 699 if (proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER),
703 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), 700 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT),
704 oscar_login_connect, gc) < 0) { 701 oscar_login_connect, gc) < 0) {
705 hide_login_progress(gc, _("Couldn't connect to host")); 702 gaim_connection_error(gc, _("Couldn't connect to host"));
706 signoff(gc);
707 return; 703 return;
708 } 704 }
709 aim_request_login(sess, conn, gaim_account_get_username(account)); 705 aim_request_login(sess, conn, gaim_account_get_username(account));
710 } 706 }
711 707
793 sess = od->sess; 789 sess = od->sess;
794 bosconn = od->conn; 790 bosconn = od->conn;
795 bosconn->fd = source; 791 bosconn->fd = source;
796 792
797 if (source < 0) { 793 if (source < 0) {
798 hide_login_progress(gc, _("Could Not Connect")); 794 gaim_connection_error(gc, _("Could Not Connect"));
799 signoff(gc);
800 return; 795 return;
801 } 796 }
802 797
803 aim_conn_completeconnect(sess, bosconn); 798 aim_conn_completeconnect(sess, bosconn);
804 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); 799 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn);
805 set_login_progress(gc, 4, _("Connection established, cookie sent")); 800 gaim_connection_update_progress(gc,
801 _("Connection established, cookie sent"), 1, 2);
806 } 802 }
807 803
808 /* BBB */ 804 /* BBB */
809 /* 805 /*
810 * This little area in oscar.c is the nexus of file transfer code, 806 * This little area in oscar.c is the nexus of file transfer code,
1069 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { 1065 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) {
1070 char buf[256]; 1066 char buf[256];
1071 switch (info->errorcode) { 1067 switch (info->errorcode) {
1072 case 0x05: 1068 case 0x05:
1073 /* Incorrect nick/password */ 1069 /* Incorrect nick/password */
1074 hide_login_progress(gc, _("Incorrect nickname or password.")); 1070 gaim_connection_error(gc, _("Incorrect nickname or password."));
1075 break; 1071 break;
1076 case 0x11: 1072 case 0x11:
1077 /* Suspended account */ 1073 /* Suspended account */
1078 hide_login_progress(gc, _("Your account is currently suspended.")); 1074 gaim_connection_error(gc, _("Your account is currently suspended."));
1079 break; 1075 break;
1080 case 0x14: 1076 case 0x14:
1081 /* service temporarily unavailable */ 1077 /* service temporarily unavailable */
1082 hide_login_progress(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); 1078 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable."));
1083 break; 1079 break;
1084 case 0x18: 1080 case 0x18:
1085 /* connecting too frequently */ 1081 /* connecting too frequently */
1086 hide_login_progress(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); 1082 gaim_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
1087 break; 1083 break;
1088 case 0x1c: 1084 case 0x1c:
1089 /* client too old */ 1085 /* client too old */
1090 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), WEBSITE); 1086 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), WEBSITE);
1091 hide_login_progress(gc, buf); 1087 gaim_connection_error(gc, buf);
1092 break; 1088 break;
1093 default: 1089 default:
1094 hide_login_progress(gc, _("Authentication Failed")); 1090 gaim_connection_error(gc, _("Authentication Failed"));
1095 break; 1091 break;
1096 } 1092 }
1097 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1093 gaim_debug(GAIM_DEBUG_ERROR, "oscar",
1098 "Login Error Code 0x%04hx\n", info->errorcode); 1094 "Login Error Code 0x%04hx\n", info->errorcode);
1099 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1095 gaim_debug(GAIM_DEBUG_ERROR, "oscar",
1117 "Closing auth connection...\n"); 1113 "Closing auth connection...\n");
1118 aim_conn_kill(sess, &fr->conn); 1114 aim_conn_kill(sess, &fr->conn);
1119 1115
1120 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); 1116 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
1121 if (bosconn == NULL) { 1117 if (bosconn == NULL) {
1122 hide_login_progress(gc, _("Internal Error")); 1118 gaim_connection_error(gc, _("Internal Error"));
1123 od->killme = TRUE; 1119 od->killme = TRUE;
1124 return 0; 1120 return 0;
1125 } 1121 }
1126 1122
1127 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 1123 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
1179 host = g_strndup(info->bosip, i); 1175 host = g_strndup(info->bosip, i);
1180 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; 1176 bosconn->status |= AIM_CONN_STATUS_INPROGRESS;
1181 rc = proxy_connect(gc->account, host, port, oscar_bos_connect, gc); 1177 rc = proxy_connect(gc->account, host, port, oscar_bos_connect, gc);
1182 g_free(host); 1178 g_free(host);
1183 if (rc < 0) { 1179 if (rc < 0) {
1184 hide_login_progress(gc, _("Could Not Connect")); 1180 gaim_connection_error(gc, _("Could Not Connect"));
1185 od->killme = TRUE; 1181 od->killme = TRUE;
1186 return 0; 1182 return 0;
1187 } 1183 }
1188 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); 1184 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie);
1189 gaim_input_remove(gc->inpa); 1185 gaim_input_remove(gc->inpa);
3674 3670
3675 gaim_debug(GAIM_DEBUG_INFO, "oscar", 3671 gaim_debug(GAIM_DEBUG_INFO, "oscar",
3676 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); 3672 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg);
3677 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { 3673 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) {
3678 if (code == 0x0001) { 3674 if (code == 0x0001) {
3679 hide_login_progress_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); 3675 gaim_connection_error_error(gc, _("You have been disconnected because you have signed on with this screen name at another location."));
3680 } else { 3676 } else {
3681 hide_login_progress_error(gc, _("You have been signed off for an unknown reason.")); 3677 gaim_connection_error_error(gc, _("You have been signed off for an unknown reason."));
3682 } 3678 }
3683 od->killme = TRUE; 3679 od->killme = TRUE;
3684 } 3680 }
3685 3681
3686 return 1; 3682 return 1;
3838 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); 3834 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies);
3839 3835
3840 od->rights.maxpermits = (guint)maxpermits; 3836 od->rights.maxpermits = (guint)maxpermits;
3841 od->rights.maxdenies = (guint)maxdenies; 3837 od->rights.maxdenies = (guint)maxdenies;
3842 3838
3843 account_online(gc); 3839 gaim_connection_set_state(gc, GAIM_CONNECTED);
3844 serv_finish_login(gc); 3840 serv_finish_login(gc);
3845 3841
3846 gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n"); 3842 gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n");
3847 3843
3848 aim_clientready(sess, fr->conn); 3844 aim_clientready(sess, fr->conn);