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