Changes in protocols/oscar/oscar.c [0a3c243:936ded6]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/oscar.c
r0a3c243 r936ded6 255 255 static int msgerrreasonlen = 25; 256 256 257 static gbooleanoscar_callback(gpointer data, gint source,258 b_input_condition condition) {257 static void oscar_callback(gpointer data, gint source, 258 GaimInputCondition condition) { 259 259 aim_conn_t *conn = (aim_conn_t *)data; 260 260 aim_session_t *sess = aim_conn_getsess(conn); … … 264 264 if (!gc) { 265 265 /* gc is null. we return, else we seg SIGSEG on next line. */ 266 return FALSE;266 return; 267 267 } 268 268 … … 270 270 /* oh boy. this is probably bad. i guess the only thing we 271 271 * can really do is return? */ 272 return FALSE;272 return; 273 273 } 274 274 … … 290 290 c->conn = NULL; 291 291 if (c->inpa > 0) 292 b_event_remove(c->inpa);292 gaim_input_remove(c->inpa); 293 293 c->inpa = 0; 294 294 c->fd = -1; … … 298 298 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { 299 299 if (odata->cnpa > 0) 300 b_event_remove(odata->cnpa);300 gaim_input_remove(odata->cnpa); 301 301 odata->cnpa = 0; 302 302 while (odata->create_rooms) { … … 312 312 } else if (conn->type == AIM_CONN_TYPE_AUTH) { 313 313 if (odata->paspa > 0) 314 b_event_remove(odata->paspa);314 gaim_input_remove(odata->paspa); 315 315 odata->paspa = 0; 316 316 aim_conn_kill(odata->sess, &conn); … … 319 319 } 320 320 } 321 } else { 322 /* WTF??? */ 323 return FALSE; 324 } 325 326 return TRUE; 327 } 328 329 static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond) 321 } 322 } 323 324 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) 330 325 { 331 326 struct gaim_connection *gc = data; … … 336 331 if (!g_slist_find(get_connections(), gc)) { 337 332 closesocket(source); 338 return FALSE;333 return; 339 334 } 340 335 … … 346 341 hide_login_progress(gc, _("Couldn't connect to host")); 347 342 signoff(gc); 348 return FALSE;343 return; 349 344 } 350 345 351 346 aim_conn_completeconnect(sess, conn); 352 gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,347 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, 353 348 oscar_callback, conn); 354 355 return FALSE; 356 } 357 358 static void oscar_login(account_t *acc) { 349 } 350 351 static void oscar_login(struct aim_user *user) { 359 352 aim_session_t *sess; 360 353 aim_conn_t *conn; 361 354 char buf[256]; 362 struct gaim_connection *gc = new_gaim_conn( acc);355 struct gaim_connection *gc = new_gaim_conn(user); 363 356 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); 364 357 365 if (isdigit( acc->user[0])) {358 if (isdigit(*user->username)) { 366 359 odata->icq = TRUE; 367 360 /* This is odd but it's necessary for a proper do_import and do_export. 368 361 We don't do those anymore, but let's stick with it, just in case 369 it accidentally fixes something else too... </bitlbee>*/362 it accidentally fixes something else too... */ 370 363 gc->password[8] = 0; 371 364 } else { … … 390 383 } 391 384 392 if (g_strcasecmp( acc->server, "login.icq.com") != 0 &&393 g_strcasecmp( acc->server, "login.oscar.aol.com") != 0) {394 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.", acc->server);385 if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 && 386 g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) { 387 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]); 395 388 } 396 389 … … 402 395 403 396 conn->status |= AIM_CONN_STATUS_INPROGRESS; 404 conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc); 397 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? 398 user->proto_opt[USEROPT_AUTH] : AIM_DEFAULT_LOGIN_SERVER, 399 user->proto_opt[USEROPT_AUTHPORT][0] ? 400 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, 401 oscar_login_connect, gc); 405 402 if (conn->fd < 0) { 406 403 hide_login_progress(gc, _("Couldn't connect to host")); … … 417 414 struct chat_connection *n = odata->oscar_chats->data; 418 415 if (n->inpa > 0) 419 b_event_remove(n->inpa);416 gaim_input_remove(n->inpa); 420 417 g_free(n->name); 421 418 g_free(n->show); … … 436 433 g_free(odata->oldp); 437 434 if (gc->inpa > 0) 438 b_event_remove(gc->inpa);435 gaim_input_remove(gc->inpa); 439 436 if (odata->cnpa > 0) 440 b_event_remove(odata->cnpa);437 gaim_input_remove(odata->cnpa); 441 438 if (odata->paspa > 0) 442 b_event_remove(odata->paspa);439 gaim_input_remove(odata->paspa); 443 440 aim_session_kill(odata->sess); 444 441 g_free(odata->sess); … … 448 445 } 449 446 450 static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {447 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { 451 448 struct gaim_connection *gc = data; 452 449 struct oscar_data *odata; … … 456 453 if (!g_slist_find(get_connections(), gc)) { 457 454 closesocket(source); 458 return FALSE;455 return; 459 456 } 460 457 … … 466 463 hide_login_progress(gc, _("Could Not Connect")); 467 464 signoff(gc); 468 return FALSE;465 return; 469 466 } 470 467 471 468 aim_conn_completeconnect(sess, bosconn); 472 gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,469 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, 473 470 oscar_callback, bosconn); 474 471 set_login_progress(gc, 4, _("Connection established, cookie sent")); 475 476 return FALSE;477 472 } 478 473 … … 481 476 struct aim_authresp_info *info; 482 477 int i; char *host; int port; 478 struct aim_user *user; 483 479 aim_conn_t *bosconn; 484 480 485 481 struct gaim_connection *gc = sess->aux_data; 486 482 struct oscar_data *od = gc->proto_data; 487 port = AIM_LOGIN_PORT; 483 user = gc->user; 484 port = user->proto_opt[USEROPT_AUTHPORT][0] ? 485 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, 488 486 489 487 va_start(ap, fr); … … 574 572 } 575 573 aim_sendcookie(sess, bosconn, info->cookie); 576 b_event_remove(gc->inpa);574 gaim_input_remove(gc->inpa); 577 575 578 576 return 1; … … 589 587 }; 590 588 591 static gboolean damn_you(gpointer data, gint source, b_input_condition c)589 static void damn_you(gpointer data, gint source, GaimInputCondition c) 592 590 { 593 591 struct pieceofcrap *pos = data; … … 609 607 do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM." 610 608 " You may be disconnected shortly.", "Login Error"); 611 b_event_remove(pos->inpa);609 gaim_input_remove(pos->inpa); 612 610 closesocket(pos->fd); 613 611 g_free(pos); 614 return FALSE;612 return; 615 613 } 616 614 /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */ 617 615 read(pos->fd, m, 16); 618 616 m[16] = '\0'; 619 b_event_remove(pos->inpa);617 gaim_input_remove(pos->inpa); 620 618 closesocket(pos->fd); 621 619 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); 622 620 g_free(pos); 623 624 return FALSE; 625 } 626 627 static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) { 621 } 622 623 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { 628 624 struct pieceofcrap *pos = data; 629 625 char buf[BUF_LONG]; … … 635 631 g_free(pos->modname); 636 632 g_free(pos); 637 return FALSE;633 return; 638 634 } 639 635 … … 644 640 if (pos->modname) 645 641 g_free(pos->modname); 646 pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);647 return FALSE;642 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); 643 return; 648 644 } 649 645 … … 767 763 } 768 764 769 static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {765 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { 770 766 struct gaim_connection *gc = data; 771 767 struct oscar_data *odata; … … 775 771 if (!g_slist_find(get_connections(), gc)) { 776 772 closesocket(source); 777 return FALSE;773 return; 778 774 } 779 775 … … 784 780 if (source < 0) { 785 781 aim_conn_kill(sess, &tstconn); 786 return FALSE;782 return; 787 783 } 788 784 789 785 aim_conn_completeconnect(sess, tstconn); 790 odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,786 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, 791 787 oscar_callback, tstconn); 792 793 return FALSE; 794 } 795 796 static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond) 788 } 789 790 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) 797 791 { 798 792 struct gaim_connection *gc = data; … … 803 797 if (!g_slist_find(get_connections(), gc)) { 804 798 closesocket(source); 805 return FALSE;799 return; 806 800 } 807 801 … … 812 806 if (source < 0) { 813 807 aim_conn_kill(sess, &tstconn); 814 return FALSE;808 return; 815 809 } 816 810 817 811 aim_conn_completeconnect(sess, tstconn); 818 odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,812 odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, 819 813 oscar_callback, tstconn); 820 821 return FALSE; 822 } 823 824 static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond) 814 } 815 816 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) 825 817 { 826 818 struct chat_connection *ccon = data; … … 835 827 g_free(ccon->name); 836 828 g_free(ccon); 837 return FALSE;829 return; 838 830 } 839 831 … … 847 839 g_free(ccon->name); 848 840 g_free(ccon); 849 return FALSE;841 return; 850 842 } 851 843 852 844 aim_conn_completeconnect(sess, ccon->conn); 853 ccon->inpa = b_input_add(tstconn->fd,845 ccon->inpa = gaim_input_add(tstconn->fd, 854 846 GAIM_INPUT_READ, 855 847 oscar_callback, tstconn); 856 848 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); 857 858 return FALSE;859 849 } 860 850 … … 864 854 struct aim_redirect_data *redir; 865 855 struct gaim_connection *gc = sess->aux_data; 856 struct aim_user *user = gc->user; 866 857 aim_conn_t *tstconn; 867 858 int i; … … 869 860 int port; 870 861 862 port = user->proto_opt[USEROPT_AUTHPORT][0] ? 863 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, 864 871 865 va_start(ap, fr); 872 866 redir = va_arg(ap, struct aim_redirect_data *); 873 867 va_end(ap); 874 868 875 port = AIM_LOGIN_PORT;876 869 for (i = 0; i < (int)strlen(redir->ip); i++) { 877 870 if (redir->ip[i] == ':') { … … 1713 1706 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; 1714 1707 1715 /* FIXME: It seems we're not really using this, and it broke now that1716 struct aim_user is dead.1717 1708 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); 1718 */ 1719 1709 1720 1710 return 1; 1721 1711 } … … 2575 2565 od->oscar_chats = g_slist_remove(od->oscar_chats, cc); 2576 2566 if (cc->inpa > 0) 2577 b_event_remove(cc->inpa);2567 gaim_input_remove(cc->inpa); 2578 2568 aim_conn_kill(od->sess, &cc->conn); 2579 2569 g_free(cc->name);
Note: See TracChangeset
for help on using the changeset viewer.