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