Changes in protocols/oscar/oscar.c [936ded6:91bd910]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/oscar.c
r936ded6 r91bd910 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 if (isdigit(acc->user[0])) { 366 s = set_add( &acc->set, "web_aware", "false", set_eval_bool, acc ); 367 s->flags |= ACC_SET_OFFLINE_ONLY; 368 } 369 } 370 371 static void oscar_login(account_t *acc) { 352 372 aim_session_t *sess; 353 373 aim_conn_t *conn; 354 374 char buf[256]; 355 struct gaim_connection *gc = new_gaim_conn( user);375 struct gaim_connection *gc = new_gaim_conn(acc); 356 376 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); 357 377 358 if (isdigit( *user->username)) {378 if (isdigit(acc->user[0])) { 359 379 odata->icq = TRUE; 360 380 /* This is odd but it's necessary for a proper do_import and do_export. 361 381 We don't do those anymore, but let's stick with it, just in case 362 it accidentally fixes something else too... */382 it accidentally fixes something else too... </bitlbee> */ 363 383 gc->password[8] = 0; 364 384 } else { … … 383 403 } 384 404 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]); 405 if (acc->server == NULL) { 406 hide_login_progress(gc, "No servername specified"); 407 signoff(gc); 408 return; 409 } 410 411 if (g_strcasecmp(acc->server, "login.icq.com") != 0 && 412 g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { 413 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); 388 414 } 389 415 … … 395 421 396 422 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); 423 conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc); 402 424 if (conn->fd < 0) { 403 425 hide_login_progress(gc, _("Couldn't connect to host")); … … 414 436 struct chat_connection *n = odata->oscar_chats->data; 415 437 if (n->inpa > 0) 416 gaim_input_remove(n->inpa);438 b_event_remove(n->inpa); 417 439 g_free(n->name); 418 440 g_free(n->show); … … 433 455 g_free(odata->oldp); 434 456 if (gc->inpa > 0) 435 gaim_input_remove(gc->inpa);457 b_event_remove(gc->inpa); 436 458 if (odata->cnpa > 0) 437 gaim_input_remove(odata->cnpa);459 b_event_remove(odata->cnpa); 438 460 if (odata->paspa > 0) 439 gaim_input_remove(odata->paspa);461 b_event_remove(odata->paspa); 440 462 aim_session_kill(odata->sess); 441 463 g_free(odata->sess); … … 445 467 } 446 468 447 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {469 static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) { 448 470 struct gaim_connection *gc = data; 449 471 struct oscar_data *odata; … … 453 475 if (!g_slist_find(get_connections(), gc)) { 454 476 closesocket(source); 455 return ;477 return FALSE; 456 478 } 457 479 … … 463 485 hide_login_progress(gc, _("Could Not Connect")); 464 486 signoff(gc); 465 return ;487 return FALSE; 466 488 } 467 489 468 490 aim_conn_completeconnect(sess, bosconn); 469 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,491 gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, 470 492 oscar_callback, bosconn); 471 493 set_login_progress(gc, 4, _("Connection established, cookie sent")); 494 495 return FALSE; 472 496 } 473 497 … … 476 500 struct aim_authresp_info *info; 477 501 int i; char *host; int port; 478 struct aim_user *user;479 502 aim_conn_t *bosconn; 480 503 481 504 struct gaim_connection *gc = sess->aux_data; 482 505 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, 506 port = AIM_LOGIN_PORT; 486 507 487 508 va_start(ap, fr); … … 572 593 } 573 594 aim_sendcookie(sess, bosconn, info->cookie); 574 gaim_input_remove(gc->inpa);595 b_event_remove(gc->inpa); 575 596 576 597 return 1; … … 587 608 }; 588 609 589 static void damn_you(gpointer data, gint source, GaimInputCondition c)610 static gboolean damn_you(gpointer data, gint source, b_input_condition c) 590 611 { 591 612 struct pieceofcrap *pos = data; … … 607 628 do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM." 608 629 " You may be disconnected shortly.", "Login Error"); 609 gaim_input_remove(pos->inpa);630 b_event_remove(pos->inpa); 610 631 closesocket(pos->fd); 611 632 g_free(pos); 612 return ;633 return FALSE; 613 634 } 614 635 /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */ 615 636 read(pos->fd, m, 16); 616 637 m[16] = '\0'; 617 gaim_input_remove(pos->inpa);638 b_event_remove(pos->inpa); 618 639 closesocket(pos->fd); 619 640 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); 620 641 g_free(pos); 621 } 622 623 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { 642 643 return FALSE; 644 } 645 646 static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) { 624 647 struct pieceofcrap *pos = data; 625 648 char buf[BUF_LONG]; … … 631 654 g_free(pos->modname); 632 655 g_free(pos); 633 return ;656 return FALSE; 634 657 } 635 658 … … 640 663 if (pos->modname) 641 664 g_free(pos->modname); 642 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);643 return ;665 pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); 666 return FALSE; 644 667 } 645 668 … … 763 786 } 764 787 765 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {788 static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) { 766 789 struct gaim_connection *gc = data; 767 790 struct oscar_data *odata; … … 771 794 if (!g_slist_find(get_connections(), gc)) { 772 795 closesocket(source); 773 return ;796 return FALSE; 774 797 } 775 798 … … 780 803 if (source < 0) { 781 804 aim_conn_kill(sess, &tstconn); 782 return ;805 return FALSE; 783 806 } 784 807 785 808 aim_conn_completeconnect(sess, tstconn); 786 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,809 odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ, 787 810 oscar_callback, tstconn); 788 } 789 790 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) 811 812 return FALSE; 813 } 814 815 static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond) 791 816 { 792 817 struct gaim_connection *gc = data; … … 797 822 if (!g_slist_find(get_connections(), gc)) { 798 823 closesocket(source); 799 return ;824 return FALSE; 800 825 } 801 826 … … 806 831 if (source < 0) { 807 832 aim_conn_kill(sess, &tstconn); 808 return ;833 return FALSE; 809 834 } 810 835 811 836 aim_conn_completeconnect(sess, tstconn); 812 odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,837 odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ, 813 838 oscar_callback, tstconn); 814 } 815 816 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) 839 840 return FALSE; 841 } 842 843 static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond) 817 844 { 818 845 struct chat_connection *ccon = data; … … 827 854 g_free(ccon->name); 828 855 g_free(ccon); 829 return ;856 return FALSE; 830 857 } 831 858 … … 839 866 g_free(ccon->name); 840 867 g_free(ccon); 841 return ;868 return FALSE; 842 869 } 843 870 844 871 aim_conn_completeconnect(sess, ccon->conn); 845 ccon->inpa = gaim_input_add(tstconn->fd,872 ccon->inpa = b_input_add(tstconn->fd, 846 873 GAIM_INPUT_READ, 847 874 oscar_callback, tstconn); 848 875 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); 876 877 return FALSE; 849 878 } 850 879 … … 854 883 struct aim_redirect_data *redir; 855 884 struct gaim_connection *gc = sess->aux_data; 856 struct aim_user *user = gc->user;857 885 aim_conn_t *tstconn; 858 886 int i; … … 860 888 int port; 861 889 862 port = user->proto_opt[USEROPT_AUTHPORT][0] ?863 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,864 865 890 va_start(ap, fr); 866 891 redir = va_arg(ap, struct aim_redirect_data *); 867 892 va_end(ap); 868 893 894 port = AIM_LOGIN_PORT; 869 895 for (i = 0; i < (int)strlen(redir->ip); i++) { 870 896 if (redir->ip[i] == ':') { … … 1225 1251 channel = va_arg(ap, int); 1226 1252 userinfo = va_arg(ap, aim_userinfo_t *); 1227 1228 if (set_getint(sess->aux_data, "debug")) {1229 serv_got_crap(sess->aux_data, "channel %i called", channel);1230 }1231 1253 1232 1254 switch (channel) { … … 1706 1728 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; 1707 1729 1730 /* FIXME: It seems we're not really using this, and it broke now that 1731 struct aim_user is dead. 1708 1732 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); 1709 1733 */ 1734 1710 1735 return 1; 1711 1736 } … … 2272 2297 } 2273 2298 info_string_append(str, "\n", _("Mobile Phone"), info->mobile); 2274 info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : _("Male"));2299 info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : info->gender==2 ? _("Male") : _("Unknown")); 2275 2300 if (info->birthyear || info->birthmonth || info->birthday) { 2276 2301 char date[30]; … … 2565 2590 od->oscar_chats = g_slist_remove(od->oscar_chats, cc); 2566 2591 if (cc->inpa > 0) 2567 gaim_input_remove(cc->inpa);2592 b_event_remove(cc->inpa); 2568 2593 aim_conn_kill(od->sess, &cc->conn); 2569 2594 g_free(cc->name); … … 2639 2664 ret->away_states = oscar_away_states; 2640 2665 ret->login = oscar_login; 2666 ret->acc_init = oscar_acc_init; 2641 2667 ret->close = oscar_close; 2642 2668 ret->send_im = oscar_send_im; … … 2656 2682 ret->set_permit_deny = oscar_set_permit_deny; 2657 2683 ret->keepalive = oscar_keepalive; 2658 ret->cmp_buddynames = aim_sncmp;2659 2684 ret->get_status_string = oscar_get_status_string; 2660 2685 ret->send_typing = oscar_send_typing; 2686 2687 ret->handle_cmp = aim_sncmp; 2661 2688 2662 2689 register_protocol(ret);
Note: See TracChangeset
for help on using the changeset viewer.