Changeset aef4828 for protocols/oscar/oscar.c
- Timestamp:
- 2007-04-06T05:20:31Z (17 years ago)
- Branches:
- master
- Children:
- 552e641
- Parents:
- 0da65d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/oscar.c
r0da65d5 raef4828 263 263 aim_rxdispatch(odata->sess); 264 264 if (odata->killme) 265 signoff(ic);265 imc_logout(ic); 266 266 } else { 267 267 if ((conn->type == AIM_CONN_TYPE_BOS) || 268 268 !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { 269 hide_login_progress_error(ic, _("Disconnected."));270 signoff(ic);269 imc_error(ic, _("Disconnected.")); 270 imc_logout(ic); 271 271 } else if (conn->type == AIM_CONN_TYPE_CHAT) { 272 272 struct chat_connection *c = find_oscar_chat_by_conn(ic, conn); 273 char buf[BUF_LONG];274 273 c->conn = NULL; 275 274 if (c->inpa > 0) … … 278 277 c->fd = -1; 279 278 aim_conn_kill(odata->sess, &conn); 280 sprintf(buf, _("You have been disconnected from chat room %s."), c->name); 281 do_error_dialog(sess->aux_data, buf, _("Chat Error!")); 279 imc_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name); 282 280 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { 283 281 if (odata->cnpa > 0) … … 290 288 g_slist_remove(odata->create_rooms, cr); 291 289 g_free(cr); 292 do_error_dialog(sess->aux_data, _("Chat is currently unavailable"), 293 _("Gaim - Chat")); 290 imc_error(sess->aux_data, _("Chat is currently unavailable")); 294 291 } 295 292 aim_conn_kill(odata->sess, &conn); … … 328 325 329 326 if (source < 0) { 330 hide_login_progress(ic, _("Couldn't connect to host"));331 signoff(ic);327 imc_error(ic, _("Couldn't connect to host")); 328 imc_logout(ic); 332 329 return FALSE; 333 330 } … … 356 353 aim_session_t *sess; 357 354 aim_conn_t *conn; 358 char buf[256]; 359 struct im_connection *ic = new_gaim_conn(acc); 355 struct im_connection *ic = imc_new(acc); 360 356 struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); 361 357 … … 382 378 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); 383 379 if (conn == NULL) { 384 hide_login_progress(ic, _("Unable to login to AIM"));385 signoff(ic);380 imc_error(ic, _("Unable to login to AIM")); 381 imc_logout(ic); 386 382 return; 387 383 } 388 384 389 385 if (acc->server == NULL) { 390 hide_login_progress(ic, "No servername specified");391 signoff(ic);386 imc_error(ic, "No servername specified"); 387 imc_logout(ic); 392 388 return; 393 389 } … … 395 391 if (g_strcasecmp(acc->server, "login.icq.com") != 0 && 396 392 g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { 397 serv_got_crap(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); 398 } 399 400 g_snprintf(buf, sizeof(buf), _("Signon: %s"), ic->username); 401 set_login_progress(ic, 2, buf); 393 imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); 394 } 395 396 imc_log(ic, _("Signon: %s"), ic->username); 402 397 403 398 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); … … 407 402 conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); 408 403 if (conn->fd < 0) { 409 hide_login_progress(ic, _("Couldn't connect to host"));410 signoff(ic);404 imc_error(ic, _("Couldn't connect to host")); 405 imc_logout(ic); 411 406 return; 412 407 } … … 467 462 468 463 if (source < 0) { 469 hide_login_progress(ic, _("Could Not Connect"));470 signoff(ic);464 imc_error(ic, _("Could Not Connect")); 465 imc_logout(ic); 471 466 return FALSE; 472 467 } … … 475 470 ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, 476 471 oscar_callback, bosconn); 477 set_login_progress(ic, 4, _("Connection established, cookie sent"));472 imc_log(ic, _("Connection established, cookie sent")); 478 473 479 474 return FALSE; … … 498 493 case 0x05: 499 494 /* Incorrect nick/password */ 500 hide_login_progress(ic, _("Incorrect nickname or password."));495 imc_error(ic, _("Incorrect nickname or password.")); 501 496 // plugin_event(event_error, (void *)980, 0, 0, 0); 502 497 break; 503 498 case 0x11: 504 499 /* Suspended account */ 505 hide_login_progress(ic, _("Your account is currently suspended."));500 imc_error(ic, _("Your account is currently suspended.")); 506 501 break; 507 502 case 0x18: 508 503 /* connecting too frequently */ 509 hide_login_progress(ic, _("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."));504 imc_error(ic, _("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.")); 510 505 break; 511 506 case 0x1c: 512 507 /* client too old */ 513 hide_login_progress(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));508 imc_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); 514 509 break; 515 510 default: 516 hide_login_progress(ic, _("Authentication Failed"));511 imc_error(ic, _("Authentication Failed")); 517 512 break; 518 513 } … … 526 521 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); 527 522 if (bosconn == NULL) { 528 hide_login_progress(ic, _("Internal Error"));523 imc_error(ic, _("Internal Error")); 529 524 od->killme = TRUE; 530 525 return 0; … … 572 567 g_free(host); 573 568 if (bosconn->fd < 0) { 574 hide_login_progress(ic, _("Could Not Connect"));569 imc_error(ic, _("Could Not Connect")); 575 570 od->killme = TRUE; 576 571 return 0; … … 610 605 } 611 606 if (in != '\n') { 612 do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."613 " You may be disconnected shortly." , "Login Error");607 imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." 608 " You may be disconnected shortly."); 614 609 b_event_remove(pos->inpa); 615 610 closesocket(pos->fd); … … 633 628 634 629 if (source < 0) { 635 do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."636 " You may be disconnected shortly." , "Login Error");630 imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." 631 " You may be disconnected shortly."); 637 632 if (pos->modname) 638 633 g_free(pos->modname); … … 711 706 g_free(pos->modname); 712 707 g_free(pos); 713 do_error_dialog(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."714 " You may be disconnected shortly." , "Login Error");708 imc_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." 709 " You may be disconnected shortly."); 715 710 } 716 711 pos->fd = fd; … … 1210 1205 1211 1206 case 0x0007: { /* Someone has denied you authorization */ 1212 serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );1207 imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); 1213 1208 } break; 1214 1209 1215 1210 case 0x0008: { /* Someone has granted you authorization */ 1216 serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );1211 imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); 1217 1212 } break; 1218 1213 … … 1339 1334 break; 1340 1335 } 1341 do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));1336 imc_error(sess->aux_data, buf); 1342 1337 1343 1338 return 1; … … 1347 1342 va_list ap; 1348 1343 guint16 reason; 1349 char *m;1350 1344 1351 1345 va_start(ap, fr); … … 1353 1347 va_end(ap); 1354 1348 1355 m = g_strdup_printf(_("SNAC threw error: %s\n"), 1356 reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error"); 1357 do_error_dialog(sess->aux_data, m, _("Gaim - Oscar SNAC Error")); 1358 g_free(m); 1349 imc_error(sess->aux_data, _("SNAC threw error: %s"), 1350 reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error"); 1359 1351 1360 1352 return 1; … … 1365 1357 char *destn; 1366 1358 guint16 reason; 1367 char buf[1024];1368 1359 1369 1360 va_start(ap, fr); … … 1372 1363 va_end(ap); 1373 1364 1374 sprintf(buf, _("Your message to %s did not get sent: %s"), destn,1365 imc_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn, 1375 1366 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); 1376 do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));1377 1367 1378 1368 return 1; … … 1383 1373 char *destn; 1384 1374 guint16 reason; 1385 char buf[1024];1386 1375 1387 1376 va_start(ap, fr); … … 1390 1379 va_end(ap); 1391 1380 1392 sprintf(buf, _("User information for %s unavailable: %s"), destn,1381 imc_error(sess->aux_data, _("User information for %s unavailable: %s"), destn, 1393 1382 (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); 1394 do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));1395 1396 1383 1397 1384 return 1; … … 1409 1396 1410 1397 if (id < 4) 1411 do_error_dialog(sess->aux_data, _("Your connection may be lost."), 1412 _("AOL error")); 1398 imc_error(sess->aux_data, _("Your connection may be lost.")); 1413 1399 1414 1400 return 1; … … 1604 1590 aim_conn_setlatency(fr->conn, windowsize/4); 1605 1591 } else if (code == AIM_RATE_CODE_LIMIT) { 1606 do_error_dialog(sess->aux_data, _("The last message was not sent because you are over the rate limit. "1607 "Please wait 10 seconds and try again."), _("Gaim - Error"));1592 imc_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. " 1593 "Please wait 10 seconds and try again.")); 1608 1594 aim_conn_setlatency(fr->conn, windowsize/2); 1609 1595 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { … … 1809 1795 1810 1796 case 0x0007: { /* Someone has denied you authorization */ 1811 serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );1797 imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); 1812 1798 } break; 1813 1799 1814 1800 case 0x0008: { /* Someone has granted you authorization */ 1815 serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );1801 imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); 1816 1802 } break; 1817 1803 … … 1926 1912 1927 1913 if (od->rights.maxawaymsglen == 0) 1928 do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error");1914 imc_error(ic, "oscar_set_away_aim called before locate rights received"); 1929 1915 1930 1916 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); … … 1944 1930 errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); 1945 1931 1946 do_error_dialog(ic, errstr, "Away Message Too Long");1932 imc_error(ic, errstr); 1947 1933 1948 1934 g_free(errstr); … … 2110 2096 2111 2097 /* Now that we have a buddy list, we can tell BitlBee that we're online. */ 2112 account_online(ic);2098 imc_connected(ic); 2113 2099 2114 2100 return 1; … … 2132 2118 { 2133 2119 /* Hmm, the length should be even... */ 2134 do_error_dialog( sess->aux_data, "Received SSI ACK package with non-even length", "Gaim - Error");2120 imc_error( sess->aux_data, "Received SSI ACK package with non-even length"); 2135 2121 return( 0 ); 2136 2122 } … … 2143 2129 if( st == 0x0E ) 2144 2130 { 2145 serv_got_crap( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );2131 imc_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); 2146 2132 2147 2133 aim_ssi_auth_request( sess, fr->conn, list, "" ); … … 2330 2316 } 2331 2317 2332 serv_got_crap(ic, "%s\n%s", _("User Info"), str->str);2318 imc_log(ic, "%s\n%s", _("User Info"), str->str); 2333 2319 g_string_free(str, TRUE); 2334 2320 … … 2424 2410 idletime.tm_sec = 0; 2425 2411 strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime); 2426 serv_got_crap(ic, "%s: %s", _("Idle Time"), buff);2412 imc_log(ic, "%s: %s", _("Idle Time"), buff); 2427 2413 } 2428 2414 2429 2415 if(text) { 2430 2416 utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); 2431 serv_got_crap(ic, "%s\n%s", _("User Info"), utf8);2417 imc_log(ic, "%s\n%s", _("User Info"), utf8); 2432 2418 } else { 2433 serv_got_crap(ic, _("No user info available."));2419 imc_log(ic, _("No user info available.")); 2434 2420 } 2435 2421 } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) { 2436 2422 utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); 2437 serv_got_crap(ic, "%s\n%s", _("Away Message"), utf8);2423 imc_log(ic, "%s\n%s", _("Away Message"), utf8); 2438 2424 } 2439 2425
Note: See TracChangeset
for help on using the changeset viewer.