Changes in protocols/oscar/oscar.c [936ded6:5b52a48]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/oscar.c
r936ded6 r5b52a48 255 255 static int msgerrreasonlen = 25; 256 256 257 static voidoscar_callback(gpointer data, gint source,258 GaimInputCondition condition) {257 static gboolean oscar_callback(gpointer data, gint source, 258 b_input_condition 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 ;266 return FALSE; 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 ;272 return FALSE; 273 273 } 274 274 … … 290 290 c->conn = NULL; 291 291 if (c->inpa > 0) 292 gaim_input_remove(c->inpa);292 b_event_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 gaim_input_remove(odata->cnpa);300 b_event_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 gaim_input_remove(odata->paspa);314 b_event_remove(odata->paspa); 315 315 odata->paspa = 0; 316 316 aim_conn_kill(odata->sess, &conn); … … 319 319 } 320 320 } 321 } 322 } 323 324 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) 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) 325 330 { 326 331 struct gaim_connection *gc = data; … … 331 336 if (!g_slist_find(get_connections(), gc)) { 332 337 closesocket(source); 333 return ;338 return FALSE; 334 339 } 335 340 … … 341 346 hide_login_progress(gc, _("Couldn't connect to host")); 342 347 signoff(gc); 343 return ;348 return FALSE; 344 349 } 345 350 346 351 aim_conn_completeconnect(sess, conn); 347 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,352 gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ, 348 353 oscar_callback, conn); 349 } 350 351 static void oscar_login(struct aim_user *user) { 354 355 return FALSE; 356 } 357 358 static void oscar_acc_init(account_t *acc) 359 { 360 set_t *s; 361 362 s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); 363 s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY; 364 } 365 366 static void oscar_login(account_t *acc) { 352 367 aim_session_t *sess; 353 368 aim_conn_t *conn; 354 369 char buf[256]; 355 struct gaim_connection *gc = new_gaim_conn( user);370 struct gaim_connection *gc = new_gaim_conn(acc); 356 371 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); 357 372 358 if (isdigit( *user->username)) {373 if (isdigit(acc->user[0])) { 359 374 odata->icq = TRUE; 360 375 /* This is odd but it's necessary for a proper do_import and do_export. 361 376 We don't do those anymore, but let's stick with it, just in case 362 it accidentally fixes something else too... */377 it accidentally fixes something else too... </bitlbee> */ 363 378 gc->password[8] = 0; 364 379 } else { … … 383 398 } 384 399 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]); 400 if (acc->server == NULL) { 401 hide_login_progress(gc, "No servername specified"); 402 signoff(gc); 403 return; 404 } 405 406 if (g_strcasecmp(acc->server, "login.icq.com") != 0 && 407 g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { 408 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); 388 409 } 389 410 … … 395 416 396 417 conn->status |= AIM_CONN_STATUS_INPROGRESS; 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); 418 conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc); 402 419 if (conn->fd < 0) { 403 420 hide_login_progress(gc, _("Couldn't connect to host")); … … 414 431 struct chat_connection *n = odata->oscar_chats->data; 415 432 if (n->inpa > 0) 416 gaim_input_remove(n->inpa);433 b_event_remove(n->inpa); 417 434 g_free(n->name); 418 435 g_free(n->show); … … 433 450 g_free(odata->oldp); 434 451 if (gc->inpa > 0) 435 gaim_input_remove(gc->inpa);452 b_event_remove(gc->inpa); 436 453 if (odata->cnpa > 0) 437 gaim_input_remove(odata->cnpa);454 b_event_remove(odata->cnpa); 438 455 if (odata->paspa > 0) 439 gaim_input_remove(odata->paspa);456 b_event_remove(odata->paspa); 440 457 aim_session_kill(odata->sess); 441 458 g_free(odata->sess); … … 445 462 } 446 463 447 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {464 static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) { 448 465 struct gaim_connection *gc = data; 449 466 struct oscar_data *odata; … … 453 470 if (!g_slist_find(get_connections(), gc)) { 454 471 closesocket(source); 455 return ;472 return FALSE; 456 473 } 457 474 … … 463 480 hide_login_progress(gc, _("Could Not Connect")); 464 481 signoff(gc); 465 return ;482 return FALSE; 466 483 } 467 484 468 485 aim_conn_completeconnect(sess, bosconn); 469 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,486 gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, 470 487 oscar_callback, bosconn); 471 488 set_login_progress(gc, 4, _("Connection established, cookie sent")); 489 490 return FALSE; 472 491 } 473 492 … … 476 495 struct aim_authresp_info *info; 477 496 int i; char *host; int port; 478 struct aim_user *user;479 497 aim_conn_t *bosconn; 480 498 481 499 struct gaim_connection *gc = sess->aux_data; 482 500 struct oscar_data *od = gc->proto_data; 483 user = gc->user; 484 port = user->proto_opt[USEROPT_AUTHPORT][0] ? 485 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, 501 port = AIM_LOGIN_PORT; 486 502 487 503 va_start(ap, fr); … … 572 588 } 573 589 aim_sendcookie(sess, bosconn, info->cookie); 574 gaim_input_remove(gc->inpa);590 b_event_remove(gc->inpa); 575 591 576 592 return 1; … … 587 603 }; 588 604 589 static void damn_you(gpointer data, gint source, GaimInputCondition c)605 static gboolean damn_you(gpointer data, gint source, b_input_condition c) 590 606 { 591 607 struct pieceofcrap *pos = data; … … 607 623 do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM." 608 624 " You may be disconnected shortly.", "Login Error"); 609 gaim_input_remove(pos->inpa);625 b_event_remove(pos->inpa); 610 626 closesocket(pos->fd); 611 627 g_free(pos); 612 return ;628 return FALSE; 613 629 } 614 630 /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */ 615 631 read(pos->fd, m, 16); 616 632 m[16] = '\0'; 617 gaim_input_remove(pos->inpa);633 b_event_remove(pos->inpa); 618 634 closesocket(pos->fd); 619 635 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); 620 636 g_free(pos); 621 } 622 623 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { 637 638 return FALSE; 639 } 640 641 static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) { 624 642 struct pieceofcrap *pos = data; 625 643 char buf[BUF_LONG]; … … 631 649 g_free(pos->modname); 632 650 g_free(pos); 633 return ;651 return FALSE; 634 652 } 635 653 … … 640 658 if (pos->modname) 641 659 g_free(pos->modname); 642 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);643 return ;660 pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); 661 return FALSE; 644 662 } 645 663 … … 763 781 } 764 782 765 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {783 static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) { 766 784 struct gaim_connection *gc = data; 767 785 struct oscar_data *odata; … … 771 789 if (!g_slist_find(get_connections(), gc)) { 772 790 closesocket(source); 773 return ;791 return FALSE; 774 792 } 775 793 … … 780 798 if (source < 0) { 781 799 aim_conn_kill(sess, &tstconn); 782 return ;800 return FALSE; 783 801 } 784 802 785 803 aim_conn_completeconnect(sess, tstconn); 786 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,804 odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ, 787 805 oscar_callback, tstconn); 788 } 789 790 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) 806 807 return FALSE; 808 } 809 810 static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond) 791 811 { 792 812 struct gaim_connection *gc = data; … … 797 817 if (!g_slist_find(get_connections(), gc)) { 798 818 closesocket(source); 799 return ;819 return FALSE; 800 820 } 801 821 … … 806 826 if (source < 0) { 807 827 aim_conn_kill(sess, &tstconn); 808 return ;828 return FALSE; 809 829 } 810 830 811 831 aim_conn_completeconnect(sess, tstconn); 812 odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,832 odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ, 813 833 oscar_callback, tstconn); 814 } 815 816 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) 834 835 return FALSE; 836 } 837 838 static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond) 817 839 { 818 840 struct chat_connection *ccon = data; … … 827 849 g_free(ccon->name); 828 850 g_free(ccon); 829 return ;851 return FALSE; 830 852 } 831 853 … … 839 861 g_free(ccon->name); 840 862 g_free(ccon); 841 return ;863 return FALSE; 842 864 } 843 865 844 866 aim_conn_completeconnect(sess, ccon->conn); 845 ccon->inpa = gaim_input_add(tstconn->fd,867 ccon->inpa = b_input_add(tstconn->fd, 846 868 GAIM_INPUT_READ, 847 869 oscar_callback, tstconn); 848 870 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); 871 872 return FALSE; 849 873 } 850 874 … … 854 878 struct aim_redirect_data *redir; 855 879 struct gaim_connection *gc = sess->aux_data; 856 struct aim_user *user = gc->user;857 880 aim_conn_t *tstconn; 858 881 int i; … … 860 883 int port; 861 884 862 port = user->proto_opt[USEROPT_AUTHPORT][0] ?863 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,864 865 885 va_start(ap, fr); 866 886 redir = va_arg(ap, struct aim_redirect_data *); 867 887 va_end(ap); 868 888 889 port = AIM_LOGIN_PORT; 869 890 for (i = 0; i < (int)strlen(redir->ip); i++) { 870 891 if (redir->ip[i] == ':') { … … 1706 1727 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; 1707 1728 1729 /* FIXME: It seems we're not really using this, and it broke now that 1730 struct aim_user is dead. 1708 1731 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); 1709 1732 */ 1733 1710 1734 return 1; 1711 1735 } … … 2565 2589 od->oscar_chats = g_slist_remove(od->oscar_chats, cc); 2566 2590 if (cc->inpa > 0) 2567 gaim_input_remove(cc->inpa);2591 b_event_remove(cc->inpa); 2568 2592 aim_conn_kill(od->sess, &cc->conn); 2569 2593 g_free(cc->name); … … 2639 2663 ret->away_states = oscar_away_states; 2640 2664 ret->login = oscar_login; 2665 ret->acc_init = oscar_acc_init; 2641 2666 ret->close = oscar_close; 2642 2667 ret->send_im = oscar_send_im; … … 2656 2681 ret->set_permit_deny = oscar_set_permit_deny; 2657 2682 ret->keepalive = oscar_keepalive; 2658 ret->cmp_buddynames = aim_sncmp;2659 2683 ret->get_status_string = oscar_get_status_string; 2660 2684 ret->send_typing = oscar_send_typing; 2685 2686 ret->handle_cmp = aim_sncmp; 2661 2687 2662 2688 register_protocol(ret);
Note: See TracChangeset
for help on using the changeset viewer.