comparison src/protocols/oscar/oscar.c @ 8660:7dfd4b16c937

[gaim-migrate @ 9412] This is going to break patches left and everywhere, but I felt compelled. I replaced gaim_debug(GAIM_DEBUB_WHATEVER, with the corresponding gaim_debug_whatever( For what it's worth, it makes oscar.c 2KB smaller. But really, I just think it's prettier. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 14 Apr 2004 04:10:26 +0000
parents f0275c2b6281
children 7a99cfed1996
comparison
equal deleted inserted replaced
8659:32d2620ad25e 8660:7dfd4b16c937
364 * Return the flag specifying the given encoding. 364 * Return the flag specifying the given encoding.
365 */ 365 */
366 static fu32_t oscar_encoding_parse(const char *encoding) 366 static fu32_t oscar_encoding_parse(const char *encoding)
367 { 367 {
368 if ((encoding == NULL) || encoding[0] == '\0') { 368 if ((encoding == NULL) || encoding[0] == '\0') {
369 gaim_debug(GAIM_DEBUG_WARNING, "oscar", "Empty encoding, assuming ASCII\n"); 369 gaim_debug_warning("oscar", "Empty encoding, assuming ASCII\n");
370 return 0; 370 return 0;
371 } 371 }
372 372
373 if (!strcmp(encoding, "us-ascii") || !strcmp(encoding, "utf-8")) { 373 if (!strcmp(encoding, "us-ascii") || !strcmp(encoding, "utf-8")) {
374 /* UTF-8 is our native encoding, ASCII is a proper subset */ 374 /* UTF-8 is our native encoding, ASCII is a proper subset */
376 } else if (!strcmp(encoding, "iso-8859-1")) { 376 } else if (!strcmp(encoding, "iso-8859-1")) {
377 return AIM_IMFLAGS_ISO_8859_1; 377 return AIM_IMFLAGS_ISO_8859_1;
378 } else if (!strcmp(encoding, "unicode-2-0")) { 378 } else if (!strcmp(encoding, "unicode-2-0")) {
379 return AIM_IMFLAGS_UNICODE; 379 return AIM_IMFLAGS_UNICODE;
380 } else { 380 } else {
381 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 381 gaim_debug_warning("oscar",
382 "Unrecognized character encoding '%s', attempting to convert to utf8 anyway\n", encoding); 382 "Unrecognized character encoding '%s', attempting to convert to utf8 anyway\n", encoding);
383 return 99; 383 return 99;
384 } 384 }
385 } 385 }
386 386
508 char *sn; 508 char *sn;
509 char buf[256]; 509 char buf[256];
510 510
511 sn = g_strdup(aim_odc_getsn(conn)); 511 sn = g_strdup(aim_odc_getsn(conn));
512 512
513 gaim_debug(GAIM_DEBUG_INFO, "oscar", 513 gaim_debug_info("oscar",
514 "%s disconnected Direct IM.\n", sn); 514 "%s disconnected Direct IM.\n", sn);
515 515
516 dim = find_direct_im(od, sn); 516 dim = find_direct_im(od, sn);
517 od->direct_ims = g_slist_remove(od->direct_ims, dim); 517 od->direct_ims = g_slist_remove(od->direct_ims, dim);
518 gaim_input_remove(dim->watcher); 518 gaim_input_remove(dim->watcher);
539 aim_session_t *sess = aim_conn_getsess(conn); 539 aim_session_t *sess = aim_conn_getsess(conn);
540 GaimConnection *gc = sess ? sess->aux_data : NULL; 540 GaimConnection *gc = sess ? sess->aux_data : NULL;
541 OscarData *od; 541 OscarData *od;
542 542
543 if (!gc) { 543 if (!gc) {
544 gaim_debug(GAIM_DEBUG_INFO, "oscar", 544 gaim_debug_info("oscar",
545 "oscar callback for closed connection (1).\n"); 545 "oscar callback for closed connection (1).\n");
546 return; 546 return;
547 } 547 }
548 548
549 od = (OscarData *)gc->proto_data; 549 od = (OscarData *)gc->proto_data;
550 550
551 if (!g_list_find(gaim_connections_get_all(), gc)) { 551 if (!g_list_find(gaim_connections_get_all(), gc)) {
552 /* oh boy. this is probably bad. i guess the only thing we 552 /* oh boy. this is probably bad. i guess the only thing we
553 * can really do is return? */ 553 * can really do is return? */
554 gaim_debug(GAIM_DEBUG_INFO, "oscar", 554 gaim_debug_info("oscar",
555 "oscar callback for closed connection (2).\n"); 555 "oscar callback for closed connection (2).\n");
556 gaim_debug(GAIM_DEBUG_MISC, "oscar", "gc = %p\n", gc); 556 gaim_debug_misc("oscar", "gc = %p\n", gc);
557 return; 557 return;
558 } 558 }
559 559
560 if (condition & GAIM_INPUT_READ) { 560 if (condition & GAIM_INPUT_READ) {
561 if (conn->type == AIM_CONN_TYPE_LISTENER) { 561 if (conn->type == AIM_CONN_TYPE_LISTENER) {
562 gaim_debug(GAIM_DEBUG_INFO, "oscar", 562 gaim_debug_info("oscar",
563 "got information on rendezvous listener\n"); 563 "got information on rendezvous listener\n");
564 if (aim_handlerendconnect(od->sess, conn) < 0) { 564 if (aim_handlerendconnect(od->sess, conn) < 0) {
565 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 565 gaim_debug_error("oscar",
566 "connection error (rendezvous listener)\n"); 566 "connection error (rendezvous listener)\n");
567 aim_conn_kill(od->sess, &conn); 567 aim_conn_kill(od->sess, &conn);
568 /* AAA - Don't we need to gaim_xfer_cancel here? --marv */ 568 /* AAA - Don't we need to gaim_xfer_cancel here? --marv */
569 } 569 }
570 } else { 570 } else {
571 if (aim_get_command(od->sess, conn) >= 0) { 571 if (aim_get_command(od->sess, conn) >= 0) {
572 aim_rxdispatch(od->sess); 572 aim_rxdispatch(od->sess);
573 if (od->killme) { 573 if (od->killme) {
574 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Waiting to be destroyed\n"); 574 gaim_debug_error("oscar", "Waiting to be destroyed\n");
575 return; 575 return;
576 } 576 }
577 } else { 577 } else {
578 if ((conn->type == AIM_CONN_TYPE_BOS) || 578 if ((conn->type == AIM_CONN_TYPE_BOS) ||
579 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { 579 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) {
580 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 580 gaim_debug_error("oscar",
581 "major connection error\n"); 581 "major connection error\n");
582 gaim_connection_error(gc, _("Disconnected.")); 582 gaim_connection_error(gc, _("Disconnected."));
583 } else if (conn->type == AIM_CONN_TYPE_CHAT) { 583 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
584 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); 584 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
585 char *buf; 585 char *buf;
586 gaim_debug(GAIM_DEBUG_INFO, "oscar", 586 gaim_debug_info("oscar",
587 "disconnected from chat room %s\n", c->name); 587 "disconnected from chat room %s\n", c->name);
588 c->conn = NULL; 588 c->conn = NULL;
589 if (c->inpa > 0) 589 if (c->inpa > 0)
590 gaim_input_remove(c->inpa); 590 gaim_input_remove(c->inpa);
591 c->inpa = 0; 591 c->inpa = 0;
596 g_free(buf); 596 g_free(buf);
597 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { 597 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
598 if (od->cnpa > 0) 598 if (od->cnpa > 0)
599 gaim_input_remove(od->cnpa); 599 gaim_input_remove(od->cnpa);
600 od->cnpa = 0; 600 od->cnpa = 0;
601 gaim_debug(GAIM_DEBUG_INFO, "oscar", 601 gaim_debug_info("oscar",
602 "removing chatnav input watcher\n"); 602 "removing chatnav input watcher\n");
603 while (od->create_rooms) { 603 while (od->create_rooms) {
604 struct create_room *cr = od->create_rooms->data; 604 struct create_room *cr = od->create_rooms->data;
605 g_free(cr->name); 605 g_free(cr->name);
606 od->create_rooms = 606 od->create_rooms =
613 aim_conn_kill(od->sess, &conn); 613 aim_conn_kill(od->sess, &conn);
614 } else if (conn->type == AIM_CONN_TYPE_AUTH) { 614 } else if (conn->type == AIM_CONN_TYPE_AUTH) {
615 if (od->paspa > 0) 615 if (od->paspa > 0)
616 gaim_input_remove(od->paspa); 616 gaim_input_remove(od->paspa);
617 od->paspa = 0; 617 od->paspa = 0;
618 gaim_debug(GAIM_DEBUG_INFO, "oscar", 618 gaim_debug_info("oscar",
619 "removing authconn input watcher\n"); 619 "removing authconn input watcher\n");
620 aim_conn_kill(od->sess, &conn); 620 aim_conn_kill(od->sess, &conn);
621 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { 621 } else if (conn->type == AIM_CONN_TYPE_EMAIL) {
622 if (od->emlpa > 0) 622 if (od->emlpa > 0)
623 gaim_input_remove(od->emlpa); 623 gaim_input_remove(od->emlpa);
624 od->emlpa = 0; 624 od->emlpa = 0;
625 gaim_debug(GAIM_DEBUG_INFO, "oscar", 625 gaim_debug_info("oscar",
626 "removing email input watcher\n"); 626 "removing email input watcher\n");
627 aim_conn_kill(od->sess, &conn); 627 aim_conn_kill(od->sess, &conn);
628 } else if (conn->type == AIM_CONN_TYPE_ICON) { 628 } else if (conn->type == AIM_CONN_TYPE_ICON) {
629 if (od->icopa > 0) 629 if (od->icopa > 0)
630 gaim_input_remove(od->icopa); 630 gaim_input_remove(od->icopa);
631 od->icopa = 0; 631 od->icopa = 0;
632 gaim_debug(GAIM_DEBUG_INFO, "oscar", 632 gaim_debug_info("oscar",
633 "removing icon input watcher\n"); 633 "removing icon input watcher\n");
634 aim_conn_kill(od->sess, &conn); 634 aim_conn_kill(od->sess, &conn);
635 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { 635 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) {
636 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) 636 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)
637 gaim_odc_disconnect(od->sess, conn); 637 gaim_odc_disconnect(od->sess, conn);
638 aim_conn_kill(od->sess, &conn); 638 aim_conn_kill(od->sess, &conn);
639 } else { 639 } else {
640 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 640 gaim_debug_error("oscar",
641 "holy crap! generic connection error! %hu\n", 641 "holy crap! generic connection error! %hu\n",
642 conn->type); 642 conn->type);
643 aim_conn_kill(od->sess, &conn); 643 aim_conn_kill(od->sess, &conn);
644 } 644 }
645 } 645 }
651 GaimConnection *gc = sess->aux_data; 651 GaimConnection *gc = sess->aux_data;
652 gchar *s = g_strdup_vprintf(format, va); 652 gchar *s = g_strdup_vprintf(format, va);
653 gchar *buf; 653 gchar *buf;
654 654
655 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s); 655 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s);
656 gaim_debug(GAIM_DEBUG_INFO, "oscar", buf); 656 gaim_debug_info("oscar", buf);
657 if (buf[strlen(buf)-1] != '\n') 657 if (buf[strlen(buf)-1] != '\n')
658 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); 658 gaim_debug_info(NULL, "\n");
659 g_free(buf); 659 g_free(buf);
660 g_free(s); 660 g_free(s);
661 } 661 }
662 662
663 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) 663 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
684 684
685 aim_conn_completeconnect(sess, conn); 685 aim_conn_completeconnect(sess, conn);
686 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); 686 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn);
687 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); 687 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc)));
688 688
689 gaim_debug(GAIM_DEBUG_INFO, "oscar", 689 gaim_debug_info("oscar",
690 "Screen name sent, waiting for response\n"); 690 "Screen name sent, waiting for response\n");
691 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); 691 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS);
692 ck[1] = 0x65; 692 ck[1] = 0x65;
693 } 693 }
694 694
696 aim_session_t *sess; 696 aim_session_t *sess;
697 aim_conn_t *conn; 697 aim_conn_t *conn;
698 GaimConnection *gc = gaim_account_get_connection(account); 698 GaimConnection *gc = gaim_account_get_connection(account);
699 OscarData *od = gc->proto_data = g_new0(OscarData, 1); 699 OscarData *od = gc->proto_data = g_new0(OscarData, 1);
700 700
701 gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); 701 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc);
702 702
703 if (!aim_snvalid(gaim_account_get_username(account))) { 703 if (!aim_snvalid(gaim_account_get_username(account))) {
704 gchar *buf; 704 gchar *buf;
705 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), gaim_account_get_username(account)); 705 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), gaim_account_get_username(account));
706 gaim_connection_error(gc, buf); 706 gaim_connection_error(gc, buf);
726 od->sess = sess; 726 od->sess = sess;
727 sess->aux_data = gc; 727 sess->aux_data = gc;
728 728
729 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); 729 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
730 if (conn == NULL) { 730 if (conn == NULL) {
731 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 731 gaim_debug_error("oscar",
732 "internal connection error\n"); 732 "internal connection error\n");
733 gaim_connection_error(gc, _("Unable to login to AIM")); 733 gaim_connection_error(gc, _("Unable to login to AIM"));
734 return; 734 return;
735 } 735 }
736 736
812 aim_session_kill(od->sess); 812 aim_session_kill(od->sess);
813 g_free(od->sess); 813 g_free(od->sess);
814 od->sess = NULL; 814 od->sess = NULL;
815 g_free(gc->proto_data); 815 g_free(gc->proto_data);
816 gc->proto_data = NULL; 816 gc->proto_data = NULL;
817 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); 817 gaim_debug_info("oscar", "Signed off.\n");
818 } 818 }
819 819
820 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { 820 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
821 GaimConnection *gc = data; 821 GaimConnection *gc = data;
822 OscarData *od; 822 OscarData *od;
920 { 920 {
921 struct aim_oft_info *oft_info = xfer->data; 921 struct aim_oft_info *oft_info = xfer->data;
922 GaimConnection *gc = oft_info->sess->aux_data; 922 GaimConnection *gc = oft_info->sess->aux_data;
923 OscarData *od = gc->proto_data; 923 OscarData *od = gc->proto_data;
924 924
925 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); 925 gaim_debug_info("oscar", "AAA - in oscar_xfer_end\n");
926 926
927 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { 927 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) {
928 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); 928 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer);
929 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); 929 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info);
930 } 930 }
943 { 943 {
944 struct aim_oft_info *oft_info = xfer->data; 944 struct aim_oft_info *oft_info = xfer->data;
945 GaimConnection *gc = oft_info->sess->aux_data; 945 GaimConnection *gc = oft_info->sess->aux_data;
946 OscarData *od = gc->proto_data; 946 OscarData *od = gc->proto_data;
947 947
948 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_recv_init\n"); 948 gaim_debug_info("oscar", "AAA - in oscar_xfer_recv_init\n");
949 949
950 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); 950 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL);
951 if (oft_info->conn) { 951 if (oft_info->conn) {
952 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; 952 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE;
953 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); 953 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0);
971 { 971 {
972 struct aim_oft_info *oft_info = xfer->data; 972 struct aim_oft_info *oft_info = xfer->data;
973 GaimConnection *gc = oft_info->sess->aux_data; 973 GaimConnection *gc = oft_info->sess->aux_data;
974 OscarData *od = gc->proto_data; 974 OscarData *od = gc->proto_data;
975 975
976 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_cancel_recv\n"); 976 gaim_debug_info("oscar", "AAA - in oscar_xfer_cancel_recv\n");
977 977
978 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); 978 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info);
979 979
980 aim_conn_kill(oft_info->sess, &oft_info->conn); 980 aim_conn_kill(oft_info->sess, &oft_info->conn);
981 aim_oft_destroyinfo(oft_info); 981 aim_oft_destroyinfo(oft_info);
1000 struct aim_oft_info *oft_info = xfer->data; 1000 struct aim_oft_info *oft_info = xfer->data;
1001 GaimConnection *gc = oft_info->sess->aux_data; 1001 GaimConnection *gc = oft_info->sess->aux_data;
1002 OscarData *od = gc->proto_data; 1002 OscarData *od = gc->proto_data;
1003 int listenfd; 1003 int listenfd;
1004 1004
1005 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_send_init\n"); 1005 gaim_debug_info("oscar", "AAA - in oscar_xfer_send_init\n");
1006 1006
1007 xfer->filename = g_path_get_basename(xfer->local_filename); 1007 xfer->filename = g_path_get_basename(xfer->local_filename);
1008 strncpy(oft_info->fh.name, xfer->filename, 64); 1008 strncpy(oft_info->fh.name, xfer->filename, 64);
1009 oft_info->fh.name[63] = '\0'; 1009 oft_info->fh.name[63] = '\0';
1010 oft_info->fh.totsize = gaim_xfer_get_size(xfer); 1010 oft_info->fh.totsize = gaim_xfer_get_size(xfer);
1020 oft_info->port = xfer->local_port; 1020 oft_info->port = xfer->local_port;
1021 if (aim_sendfile_listen(od->sess, oft_info, listenfd) != 0) { 1021 if (aim_sendfile_listen(od->sess, oft_info, listenfd) != 0) {
1022 gaim_xfer_cancel_local(xfer); 1022 gaim_xfer_cancel_local(xfer);
1023 return; 1023 return;
1024 } 1024 }
1025 gaim_debug(GAIM_DEBUG_MISC, "oscar", 1025 gaim_debug_misc("oscar",
1026 "port is %hu, ip is %s\n", 1026 "port is %hu, ip is %s\n",
1027 xfer->local_port, oft_info->clientip); 1027 xfer->local_port, oft_info->clientip);
1028 if (oft_info->conn) { 1028 if (oft_info->conn) {
1029 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); 1029 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn);
1030 aim_im_sendch2_sendfile_ask(od->sess, oft_info); 1030 aim_im_sendch2_sendfile_ask(od->sess, oft_info);
1040 { 1040 {
1041 struct aim_oft_info *oft_info = xfer->data; 1041 struct aim_oft_info *oft_info = xfer->data;
1042 GaimConnection *gc = oft_info->sess->aux_data; 1042 GaimConnection *gc = oft_info->sess->aux_data;
1043 OscarData *od = gc->proto_data; 1043 OscarData *od = gc->proto_data;
1044 1044
1045 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_cancel_send\n"); 1045 gaim_debug_info("oscar", "AAA - in oscar_xfer_cancel_send\n");
1046 1046
1047 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); 1047 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info);
1048 1048
1049 aim_conn_kill(oft_info->sess, &oft_info->conn); 1049 aim_conn_kill(oft_info->sess, &oft_info->conn);
1050 aim_oft_destroyinfo(oft_info); 1050 aim_oft_destroyinfo(oft_info);
1125 1125
1126 va_start(ap, fr); 1126 va_start(ap, fr);
1127 info = va_arg(ap, struct aim_authresp_info *); 1127 info = va_arg(ap, struct aim_authresp_info *);
1128 va_end(ap); 1128 va_end(ap);
1129 1129
1130 gaim_debug(GAIM_DEBUG_INFO, "oscar", 1130 gaim_debug_info("oscar",
1131 "inside auth_resp (Screen name: %s)\n", info->sn); 1131 "inside auth_resp (Screen name: %s)\n", info->sn);
1132 1132
1133 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { 1133 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) {
1134 char buf[256]; 1134 char buf[256];
1135 switch (info->errorcode) { 1135 switch (info->errorcode) {
1160 break; 1160 break;
1161 default: 1161 default:
1162 gaim_connection_error(gc, _("Authentication failed")); 1162 gaim_connection_error(gc, _("Authentication failed"));
1163 break; 1163 break;
1164 } 1164 }
1165 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1165 gaim_debug_error("oscar",
1166 "Login Error Code 0x%04hx\n", info->errorcode); 1166 "Login Error Code 0x%04hx\n", info->errorcode);
1167 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1167 gaim_debug_error("oscar",
1168 "Error URL: %s\n", info->errorurl); 1168 "Error URL: %s\n", info->errorurl);
1169 od->killme = TRUE; 1169 od->killme = TRUE;
1170 return 1; 1170 return 1;
1171 } 1171 }
1172 1172
1173 1173
1174 gaim_debug(GAIM_DEBUG_MISC, "oscar", 1174 gaim_debug_misc("oscar",
1175 "Reg status: %hu\n", info->regstatus); 1175 "Reg status: %hu\n", info->regstatus);
1176 1176
1177 if (info->email) { 1177 if (info->email) {
1178 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email: %s\n", info->email); 1178 gaim_debug_misc("oscar", "Email: %s\n", info->email);
1179 } else { 1179 } else {
1180 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email is NULL\n"); 1180 gaim_debug_misc("oscar", "Email is NULL\n");
1181 } 1181 }
1182 1182
1183 gaim_debug(GAIM_DEBUG_MISC, "oscar", "BOSIP: %s\n", info->bosip); 1183 gaim_debug_misc("oscar", "BOSIP: %s\n", info->bosip);
1184 gaim_debug(GAIM_DEBUG_INFO, "oscar", 1184 gaim_debug_info("oscar",
1185 "Closing auth connection...\n"); 1185 "Closing auth connection...\n");
1186 aim_conn_kill(sess, &fr->conn); 1186 aim_conn_kill(sess, &fr->conn);
1187 1187
1188 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); 1188 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
1189 if (bosconn == NULL) { 1189 if (bosconn == NULL) {
1305 g_free(pos); 1305 g_free(pos);
1306 return; 1306 return;
1307 } 1307 }
1308 read(pos->fd, m, 16); 1308 read(pos->fd, m, 16);
1309 m[16] = '\0'; 1309 m[16] = '\0';
1310 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Sending hash: "); 1310 gaim_debug_misc("oscar", "Sending hash: ");
1311 for (x = 0; x < 16; x++) 1311 for (x = 0; x < 16; x++)
1312 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx ", (unsigned char)m[x]); 1312 gaim_debug_misc(NULL, "%02hhx ", (unsigned char)m[x]);
1313 1313
1314 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); 1314 gaim_debug_misc(NULL, "\n");
1315 gaim_input_remove(pos->inpa); 1315 gaim_input_remove(pos->inpa);
1316 close(pos->fd); 1316 close(pos->fd);
1317 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); 1317 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
1318 g_free(pos); 1318 g_free(pos);
1319 } 1319 }
1360 offset = va_arg(ap, fu32_t); 1360 offset = va_arg(ap, fu32_t);
1361 len = va_arg(ap, fu32_t); 1361 len = va_arg(ap, fu32_t);
1362 modname = va_arg(ap, char *); 1362 modname = va_arg(ap, char *);
1363 va_end(ap); 1363 va_end(ap);
1364 1364
1365 gaim_debug(GAIM_DEBUG_MISC, "oscar", 1365 gaim_debug_misc("oscar",
1366 "offset: %u, len: %u, file: %s\n", 1366 "offset: %u, len: %u, file: %s\n",
1367 offset, len, (modname ? modname : "aim.exe")); 1367 offset, len, (modname ? modname : "aim.exe"));
1368 1368
1369 if (len == 0) { 1369 if (len == 0) {
1370 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len is 0, hashing NULL\n"); 1370 gaim_debug_misc("oscar", "len is 0, hashing NULL\n");
1371 aim_sendmemblock(sess, fr->conn, offset, len, NULL, 1371 aim_sendmemblock(sess, fr->conn, offset, len, NULL,
1372 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); 1372 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
1373 return 1; 1373 return 1;
1374 } 1374 }
1375 /* uncomment this when you're convinced it's right. remember, it's been wrong before. 1375 /* uncomment this when you're convinced it's right. remember, it's been wrong before.
1390 buf[i++] = (offset >> 24) & 0xff; 1390 buf[i++] = (offset >> 24) & 0xff;
1391 buf[i++] = len & 0xff; 1391 buf[i++] = len & 0xff;
1392 buf[i++] = (len >> 8) & 0xff; 1392 buf[i++] = (len >> 8) & 0xff;
1393 buf[i++] = (len >> 16) & 0xff; 1393 buf[i++] = (len >> 16) & 0xff;
1394 buf[i++] = (len >> 24) & 0xff; 1394 buf[i++] = (len >> 24) & 0xff;
1395 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len + offset is invalid, " 1395 gaim_debug_misc("oscar", "len + offset is invalid, "
1396 "hashing request\n"); 1396 "hashing request\n");
1397 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); 1397 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
1398 g_free(buf); 1398 g_free(buf);
1399 return 1; 1399 return 1;
1400 } 1400 }
1533 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); 1533 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV);
1534 tstconn->fd = source; 1534 tstconn->fd = source;
1535 1535
1536 if (source < 0) { 1536 if (source < 0) {
1537 aim_conn_kill(sess, &tstconn); 1537 aim_conn_kill(sess, &tstconn);
1538 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1538 gaim_debug_error("oscar",
1539 "unable to connect to chatnav server\n"); 1539 "unable to connect to chatnav server\n");
1540 return; 1540 return;
1541 } 1541 }
1542 1542
1543 aim_conn_completeconnect(sess, tstconn); 1543 aim_conn_completeconnect(sess, tstconn);
1544 od->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); 1544 od->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn);
1545 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); 1545 gaim_debug_info("oscar", "chatnav: connected\n");
1546 } 1546 }
1547 1547
1548 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) 1548 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
1549 { 1549 {
1550 GaimConnection *gc = data; 1550 GaimConnection *gc = data;
1562 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); 1562 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
1563 tstconn->fd = source; 1563 tstconn->fd = source;
1564 1564
1565 if (source < 0) { 1565 if (source < 0) {
1566 aim_conn_kill(sess, &tstconn); 1566 aim_conn_kill(sess, &tstconn);
1567 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1567 gaim_debug_error("oscar",
1568 "unable to connect to authorizer\n"); 1568 "unable to connect to authorizer\n");
1569 return; 1569 return;
1570 } 1570 }
1571 1571
1572 aim_conn_completeconnect(sess, tstconn); 1572 aim_conn_completeconnect(sess, tstconn);
1573 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); 1573 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn);
1574 gaim_debug(GAIM_DEBUG_INFO, "oscar", "admin: connected\n"); 1574 gaim_debug_info("oscar", "admin: connected\n");
1575 } 1575 }
1576 1576
1577 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) 1577 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
1578 { 1578 {
1579 struct chat_connection *ccon = data; 1579 struct chat_connection *ccon = data;
1624 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); 1624 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL);
1625 tstconn->fd = source; 1625 tstconn->fd = source;
1626 1626
1627 if (source < 0) { 1627 if (source < 0) {
1628 aim_conn_kill(sess, &tstconn); 1628 aim_conn_kill(sess, &tstconn);
1629 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1629 gaim_debug_error("oscar",
1630 "unable to connect to email server\n"); 1630 "unable to connect to email server\n");
1631 return; 1631 return;
1632 } 1632 }
1633 1633
1634 aim_conn_completeconnect(sess, tstconn); 1634 aim_conn_completeconnect(sess, tstconn);
1635 od->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); 1635 od->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn);
1636 gaim_debug(GAIM_DEBUG_INFO, "oscar", 1636 gaim_debug_info("oscar",
1637 "email: connected\n"); 1637 "email: connected\n");
1638 } 1638 }
1639 1639
1640 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { 1640 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) {
1641 GaimConnection *gc = data; 1641 GaimConnection *gc = data;
1653 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); 1653 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON);
1654 tstconn->fd = source; 1654 tstconn->fd = source;
1655 1655
1656 if (source < 0) { 1656 if (source < 0) {
1657 aim_conn_kill(sess, &tstconn); 1657 aim_conn_kill(sess, &tstconn);
1658 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1658 gaim_debug_error("oscar",
1659 "unable to connect to icon server\n"); 1659 "unable to connect to icon server\n");
1660 return; 1660 return;
1661 } 1661 }
1662 1662
1663 aim_conn_completeconnect(sess, tstconn); 1663 aim_conn_completeconnect(sess, tstconn);
1664 od->icopa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); 1664 od->icopa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn);
1665 gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); 1665 gaim_debug_info("oscar", "icon: connected\n");
1666 } 1666 }
1667 1667
1668 /* Hrmph. I don't know how to make this look better. --mid */ 1668 /* Hrmph. I don't know how to make this look better. --mid */
1669 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { 1669 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
1670 GaimConnection *gc = sess->aux_data; 1670 GaimConnection *gc = sess->aux_data;
1690 } 1690 }
1691 host = g_strndup(redir->ip, i); 1691 host = g_strndup(redir->ip, i);
1692 1692
1693 switch(redir->group) { 1693 switch(redir->group) {
1694 case 0x7: /* Authorizer */ 1694 case 0x7: /* Authorizer */
1695 gaim_debug(GAIM_DEBUG_INFO, "oscar", 1695 gaim_debug_info("oscar",
1696 "Reconnecting with authorizor...\n"); 1696 "Reconnecting with authorizor...\n");
1697 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); 1697 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
1698 if (tstconn == NULL) { 1698 if (tstconn == NULL) {
1699 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1699 gaim_debug_error("oscar",
1700 "unable to reconnect with authorizer\n"); 1700 "unable to reconnect with authorizer\n");
1701 g_free(host); 1701 g_free(host);
1702 return 1; 1702 return 1;
1703 } 1703 }
1704 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 1704 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
1705 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); 1705 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0);
1706 1706
1707 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; 1707 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
1708 if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { 1708 if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) {
1709 aim_conn_kill(sess, &tstconn); 1709 aim_conn_kill(sess, &tstconn);
1710 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1710 gaim_debug_error("oscar",
1711 "unable to reconnect with authorizer\n"); 1711 "unable to reconnect with authorizer\n");
1712 g_free(host); 1712 g_free(host);
1713 return 1; 1713 return 1;
1714 } 1714 }
1715 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); 1715 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie);
1716 break; 1716 break;
1717 1717
1718 case 0xd: /* ChatNav */ 1718 case 0xd: /* ChatNav */
1719 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); 1719 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL);
1720 if (tstconn == NULL) { 1720 if (tstconn == NULL) {
1721 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1721 gaim_debug_error("oscar",
1722 "unable to connect to chatnav server\n"); 1722 "unable to connect to chatnav server\n");
1723 g_free(host); 1723 g_free(host);
1724 return 1; 1724 return 1;
1725 } 1725 }
1726 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 1726 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
1727 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); 1727 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0);
1728 1728
1729 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; 1729 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
1730 if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { 1730 if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) {
1731 aim_conn_kill(sess, &tstconn); 1731 aim_conn_kill(sess, &tstconn);
1732 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1732 gaim_debug_error("oscar",
1733 "unable to connect to chatnav server\n"); 1733 "unable to connect to chatnav server\n");
1734 g_free(host); 1734 g_free(host);
1735 return 1; 1735 return 1;
1736 } 1736 }
1737 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); 1737 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie);
1740 case 0xe: { /* Chat */ 1740 case 0xe: { /* Chat */
1741 struct chat_connection *ccon; 1741 struct chat_connection *ccon;
1742 1742
1743 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); 1743 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL);
1744 if (tstconn == NULL) { 1744 if (tstconn == NULL) {
1745 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1745 gaim_debug_error("oscar",
1746 "unable to connect to chat server\n"); 1746 "unable to connect to chat server\n");
1747 g_free(host); 1747 g_free(host);
1748 return 1; 1748 return 1;
1749 } 1749 }
1750 1750
1761 ccon->show = extract_name(redir->chat.room); 1761 ccon->show = extract_name(redir->chat.room);
1762 1762
1763 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; 1763 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS;
1764 if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { 1764 if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) {
1765 aim_conn_kill(sess, &tstconn); 1765 aim_conn_kill(sess, &tstconn);
1766 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1766 gaim_debug_error("oscar",
1767 "unable to connect to chat server\n"); 1767 "unable to connect to chat server\n");
1768 g_free(host); 1768 g_free(host);
1769 g_free(ccon->show); 1769 g_free(ccon->show);
1770 g_free(ccon->name); 1770 g_free(ccon->name);
1771 g_free(ccon); 1771 g_free(ccon);
1772 return 1; 1772 return 1;
1773 } 1773 }
1774 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); 1774 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie);
1775 gaim_debug(GAIM_DEBUG_INFO, "oscar", 1775 gaim_debug_info("oscar",
1776 "Connected to chat room %s exchange %hu\n", 1776 "Connected to chat room %s exchange %hu\n",
1777 ccon->name, ccon->exchange); 1777 ccon->name, ccon->exchange);
1778 } break; 1778 } break;
1779 1779
1780 case 0x0010: { /* icon */ 1780 case 0x0010: { /* icon */
1781 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { 1781 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) {
1782 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1782 gaim_debug_error("oscar",
1783 "unable to connect to icon server\n"); 1783 "unable to connect to icon server\n");
1784 g_free(host); 1784 g_free(host);
1785 return 1; 1785 return 1;
1786 } 1786 }
1787 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 1787 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
1788 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); 1788 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0);
1789 1789
1790 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; 1790 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
1791 if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { 1791 if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) {
1792 aim_conn_kill(sess, &tstconn); 1792 aim_conn_kill(sess, &tstconn);
1793 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1793 gaim_debug_error("oscar",
1794 "unable to connect to icon server\n"); 1794 "unable to connect to icon server\n");
1795 g_free(host); 1795 g_free(host);
1796 return 1; 1796 return 1;
1797 } 1797 }
1798 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); 1798 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie);
1799 } break; 1799 } break;
1800 1800
1801 case 0x0018: { /* email */ 1801 case 0x0018: { /* email */
1802 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { 1802 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) {
1803 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1803 gaim_debug_error("oscar",
1804 "unable to connect to email server\n"); 1804 "unable to connect to email server\n");
1805 g_free(host); 1805 g_free(host);
1806 return 1; 1806 return 1;
1807 } 1807 }
1808 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 1808 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
1809 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); 1809 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0);
1810 1810
1811 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; 1811 tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
1812 if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { 1812 if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) {
1813 aim_conn_kill(sess, &tstconn); 1813 aim_conn_kill(sess, &tstconn);
1814 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 1814 gaim_debug_error("oscar",
1815 "unable to connect to email server\n"); 1815 "unable to connect to email server\n");
1816 g_free(host); 1816 g_free(host);
1817 return 1; 1817 return 1;
1818 } 1818 }
1819 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); 1819 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie);
1820 } break; 1820 } break;
1821 1821
1822 default: /* huh? */ 1822 default: /* huh? */
1823 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 1823 gaim_debug_warning("oscar",
1824 "got redirect for unknown service 0x%04hx\n", 1824 "got redirect for unknown service 0x%04hx\n",
1825 redir->group); 1825 redir->group);
1826 break; 1826 break;
1827 } 1827 }
1828 1828
1965 1965
1966 return 1; 1966 return 1;
1967 } 1967 }
1968 1968
1969 static void cancel_direct_im(struct ask_direct *d) { 1969 static void cancel_direct_im(struct ask_direct *d) {
1970 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Freeing DirectIM prompts.\n"); 1970 gaim_debug_info("oscar", "Freeing DirectIM prompts.\n");
1971 1971
1972 g_free(d->sn); 1972 g_free(d->sn);
1973 g_free(d); 1973 g_free(d);
1974 } 1974 }
1975 1975
2019 GaimXfer *xfer; 2019 GaimXfer *xfer;
2020 struct aim_oft_info *oft_info; 2020 struct aim_oft_info *oft_info;
2021 va_list ap; 2021 va_list ap;
2022 aim_conn_t *conn, *listenerconn; 2022 aim_conn_t *conn, *listenerconn;
2023 2023
2024 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2024 gaim_debug_info("oscar",
2025 "AAA - in oscar_sendfile_estblsh\n"); 2025 "AAA - in oscar_sendfile_estblsh\n");
2026 va_start(ap, fr); 2026 va_start(ap, fr);
2027 conn = va_arg(ap, aim_conn_t *); 2027 conn = va_arg(ap, aim_conn_t *);
2028 listenerconn = va_arg(ap, aim_conn_t *); 2028 listenerconn = va_arg(ap, aim_conn_t *);
2029 va_end(ap); 2029 va_end(ap);
2057 */ 2057 */
2058 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition) { 2058 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition) {
2059 GaimXfer *xfer; 2059 GaimXfer *xfer;
2060 struct aim_oft_info *oft_info; 2060 struct aim_oft_info *oft_info;
2061 2061
2062 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2062 gaim_debug_info("oscar",
2063 "AAA - in oscar_sendfile_connected\n"); 2063 "AAA - in oscar_sendfile_connected\n");
2064 if (!(xfer = data)) 2064 if (!(xfer = data))
2065 return; 2065 return;
2066 if (!(oft_info = xfer->data)) 2066 if (!(oft_info = xfer->data))
2067 return; 2067 return;
2096 va_list ap; 2096 va_list ap;
2097 aim_conn_t *conn; 2097 aim_conn_t *conn;
2098 fu8_t *cookie; 2098 fu8_t *cookie;
2099 struct aim_fileheader_t *fh; 2099 struct aim_fileheader_t *fh;
2100 2100
2101 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2101 gaim_debug_info("oscar",
2102 "AAA - in oscar_sendfile_prompt\n"); 2102 "AAA - in oscar_sendfile_prompt\n");
2103 va_start(ap, fr); 2103 va_start(ap, fr);
2104 conn = va_arg(ap, aim_conn_t *); 2104 conn = va_arg(ap, aim_conn_t *);
2105 cookie = va_arg(ap, fu8_t *); 2105 cookie = va_arg(ap, fu8_t *);
2106 fh = va_arg(ap, struct aim_fileheader_t *); 2106 fh = va_arg(ap, struct aim_fileheader_t *);
2140 va_list ap; 2140 va_list ap;
2141 aim_conn_t *conn; 2141 aim_conn_t *conn;
2142 fu8_t *cookie; 2142 fu8_t *cookie;
2143 struct aim_fileheader_t *fh; 2143 struct aim_fileheader_t *fh;
2144 2144
2145 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_ack\n"); 2145 gaim_debug_info("oscar", "AAA - in oscar_sendfile_ack\n");
2146 va_start(ap, fr); 2146 va_start(ap, fr);
2147 conn = va_arg(ap, aim_conn_t *); 2147 conn = va_arg(ap, aim_conn_t *);
2148 cookie = va_arg(ap, fu8_t *); 2148 cookie = va_arg(ap, fu8_t *);
2149 fh = va_arg(ap, struct aim_fileheader_t *); 2149 fh = va_arg(ap, struct aim_fileheader_t *);
2150 va_end(ap); 2150 va_end(ap);
2172 va_list ap; 2172 va_list ap;
2173 aim_conn_t *conn; 2173 aim_conn_t *conn;
2174 fu8_t *cookie; 2174 fu8_t *cookie;
2175 struct aim_fileheader_t *fh; 2175 struct aim_fileheader_t *fh;
2176 2176
2177 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_done\n"); 2177 gaim_debug_info("oscar", "AAA - in oscar_sendfile_done\n");
2178 va_start(ap, fr); 2178 va_start(ap, fr);
2179 conn = va_arg(ap, aim_conn_t *); 2179 conn = va_arg(ap, aim_conn_t *);
2180 cookie = va_arg(ap, fu8_t *); 2180 cookie = va_arg(ap, fu8_t *);
2181 fh = va_arg(ap, struct aim_fileheader_t *); 2181 fh = va_arg(ap, struct aim_fileheader_t *);
2182 va_end(ap); 2182 va_end(ap);
2201 cancel_direct_im(d); 2201 cancel_direct_im(d);
2202 return; 2202 return;
2203 } 2203 }
2204 2204
2205 od = (OscarData *)gc->proto_data; 2205 od = (OscarData *)gc->proto_data;
2206 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); 2206 gaim_debug_info("oscar", "Accepted DirectIM.\n");
2207 2207
2208 dim = find_direct_im(od, d->sn); 2208 dim = find_direct_im(od, d->sn);
2209 if (dim) { 2209 if (dim) {
2210 cancel_direct_im(d); /* 40 */ 2210 cancel_direct_im(d); /* 40 */
2211 return; 2211 return;
2272 bi->typingnot = TRUE; 2272 bi->typingnot = TRUE;
2273 else 2273 else
2274 bi->typingnot = FALSE; 2274 bi->typingnot = FALSE;
2275 2275
2276 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { 2276 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) {
2277 gaim_debug(GAIM_DEBUG_MISC, "oscar", 2277 gaim_debug_misc("oscar",
2278 "%s has an icon\n", userinfo->sn); 2278 "%s has an icon\n", userinfo->sn);
2279 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { 2279 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) {
2280 bi->ico_need = TRUE; 2280 bi->ico_need = TRUE;
2281 bi->ico_len = args->iconlen; 2281 bi->ico_len = args->iconlen;
2282 bi->ico_csum = args->iconsum; 2282 bi->ico_csum = args->iconsum;
2292 if (!stat(iconfile, &st)) { 2292 if (!stat(iconfile, &st)) {
2293 char *buf = g_malloc(st.st_size); 2293 char *buf = g_malloc(st.st_size);
2294 file = fopen(iconfile, "rb"); 2294 file = fopen(iconfile, "rb");
2295 if (file) { 2295 if (file) {
2296 int len = fread(buf, 1, st.st_size, file); 2296 int len = fread(buf, 1, st.st_size, file);
2297 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2297 gaim_debug_info("oscar",
2298 "Sending buddy icon to %s (%d bytes, " 2298 "Sending buddy icon to %s (%d bytes, "
2299 "%lu reported)\n", 2299 "%lu reported)\n",
2300 userinfo->sn, len, st.st_size); 2300 userinfo->sn, len, st.st_size);
2301 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, 2301 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size,
2302 st.st_mtime, aimutil_iconsum(buf, st.st_size)); 2302 st.st_mtime, aimutil_iconsum(buf, st.st_size));
2303 fclose(file); 2303 fclose(file);
2304 } else 2304 } else
2305 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 2305 gaim_debug_error("oscar",
2306 "Can't open buddy icon file!\n"); 2306 "Can't open buddy icon file!\n");
2307 g_free(buf); 2307 g_free(buf);
2308 } else 2308 } else
2309 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 2309 gaim_debug_error("oscar",
2310 "Can't stat buddy icon file!\n"); 2310 "Can't stat buddy icon file!\n");
2311 } 2311 }
2312 2312
2313 gaim_debug(GAIM_DEBUG_MISC, "oscar", 2313 gaim_debug_misc("oscar",
2314 "Received message from %s with charset %hu %hu\n", 2314 "Received message from %s with charset %hu %hu\n",
2315 userinfo->sn, args->charset, args->charsubset); 2315 userinfo->sn, args->charset, args->charsubset);
2316 2316
2317 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { 2317 if (args->icbmflags & AIM_IMFLAGS_UNICODE) {
2318 /* This message is marked as UNICODE, so we have to 2318 /* This message is marked as UNICODE, so we have to
2320 * This conversion should *never* fail, if it does it 2320 * This conversion should *never* fail, if it does it
2321 * means that either the incoming ICBM is corrupted or 2321 * means that either the incoming ICBM is corrupted or
2322 * there is something we don't understand about it. 2322 * there is something we don't understand about it.
2323 * For the record, AIM Unicode is big-endian UCS-2 */ 2323 * For the record, AIM Unicode is big-endian UCS-2 */
2324 2324
2325 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Received UNICODE IM\n"); 2325 gaim_debug_info("oscar", "Received UNICODE IM\n");
2326 2326
2327 if (!args->msg || !args->msglen) 2327 if (!args->msg || !args->msglen)
2328 return 1; 2328 return 1;
2329 2329
2330 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); 2330 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err);
2331 if (err) { 2331 if (err) {
2332 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2332 gaim_debug_info("oscar",
2333 "Unicode IM conversion: %s\n", err->message); 2333 "Unicode IM conversion: %s\n", err->message);
2334 tmp = g_strdup(_("(There was an error receiving this message)")); 2334 tmp = g_strdup(_("(There was an error receiving this message)"));
2335 g_error_free(err); 2335 g_error_free(err);
2336 } 2336 }
2337 } else { 2337 } else {
2341 * help with compatibility with old, broken versions of 2341 * help with compatibility with old, broken versions of
2342 * gaim (everything before 0.60) and other broken clients 2342 * gaim (everything before 0.60) and other broken clients
2343 * that will happily send ISO-8859-1 without marking it as 2343 * that will happily send ISO-8859-1 without marking it as
2344 * such */ 2344 * such */
2345 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) 2345 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1)
2346 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2346 gaim_debug_info("oscar",
2347 "Received ISO-8859-1 IM\n"); 2347 "Received ISO-8859-1 IM\n");
2348 2348
2349 if (!args->msg || !args->msglen) 2349 if (!args->msg || !args->msglen)
2350 return 1; 2350 return 1;
2351 2351
2352 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); 2352 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err);
2353 if (err) { 2353 if (err) {
2354 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2354 gaim_debug_info("oscar",
2355 "ISO-8859-1 IM conversion: %s\n", err->message); 2355 "ISO-8859-1 IM conversion: %s\n", err->message);
2356 tmp = g_strdup(_("(There was an error receiving this message)")); 2356 tmp = g_strdup(_("(There was an error receiving this message)"));
2357 g_error_free(err); 2357 g_error_free(err);
2358 } 2358 }
2359 } 2359 }
2378 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); 2378 const char *username = gaim_account_get_username(gaim_connection_get_account(gc));
2379 2379
2380 if (!args) 2380 if (!args)
2381 return 0; 2381 return 0;
2382 2382
2383 gaim_debug(GAIM_DEBUG_MISC, "oscar", 2383 gaim_debug_misc("oscar",
2384 "rendezvous with %s, status is %hu\n", 2384 "rendezvous with %s, status is %hu\n",
2385 userinfo->sn, args->status); 2385 userinfo->sn, args->status);
2386 2386
2387 if (args->reqclass & AIM_CAPS_CHAT) { 2387 if (args->reqclass & AIM_CAPS_CHAT) {
2388 char *name; 2388 char *name;
2410 struct aim_oft_info *oft_info; 2410 struct aim_oft_info *oft_info;
2411 2411
2412 if (!args->cookie || !args->port || !args->verifiedip || 2412 if (!args->cookie || !args->port || !args->verifiedip ||
2413 !args->info.sendfile.filename || !args->info.sendfile.totsize || 2413 !args->info.sendfile.filename || !args->info.sendfile.totsize ||
2414 !args->info.sendfile.totfiles || !args->reqclass) { 2414 !args->info.sendfile.totfiles || !args->reqclass) {
2415 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 2415 gaim_debug_warning("oscar",
2416 "%s tried to send you a file with incomplete " 2416 "%s tried to send you a file with incomplete "
2417 "information.\n", userinfo->sn); 2417 "information.\n", userinfo->sn);
2418 if (args->proxyip) 2418 if (args->proxyip)
2419 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 2419 gaim_debug_warning("oscar",
2420 "IP for a proxy server was given. Gaim " 2420 "IP for a proxy server was given. Gaim "
2421 "does not support this yet.\n"); 2421 "does not support this yet.\n");
2422 return 1; 2422 return 1;
2423 } 2423 }
2424 2424
2428 * directories that look like 'dirname\*' -- arl */ 2428 * directories that look like 'dirname\*' -- arl */
2429 char *tmp = strrchr(args->info.sendfile.filename, '\\'); 2429 char *tmp = strrchr(args->info.sendfile.filename, '\\');
2430 if (tmp && (tmp[1] == '*')) { 2430 if (tmp && (tmp[1] == '*')) {
2431 tmp[0] = '\0'; 2431 tmp[0] = '\0';
2432 } 2432 }
2433 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 2433 gaim_debug_warning("oscar",
2434 "We're receiving a whole directory! What fun! " 2434 "We're receiving a whole directory! What fun! "
2435 "Especially since we don't support that!\n"); 2435 "Especially since we don't support that!\n");
2436 } 2436 }
2437 2437
2438 /* Build the file transfer handle */ 2438 /* Build the file transfer handle */
2468 /* Now perform the request */ 2468 /* Now perform the request */
2469 gaim_xfer_request(xfer); 2469 gaim_xfer_request(xfer);
2470 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { 2470 } else if (args->status == AIM_RENDEZVOUS_CANCEL) {
2471 /* The other user wants to cancel a file transfer */ 2471 /* The other user wants to cancel a file transfer */
2472 GaimXfer *xfer; 2472 GaimXfer *xfer;
2473 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2473 gaim_debug_info("oscar",
2474 "AAA - File transfer canceled by remote user\n"); 2474 "AAA - File transfer canceled by remote user\n");
2475 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, args->cookie))) 2475 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, args->cookie)))
2476 gaim_xfer_cancel_remote(xfer); 2476 gaim_xfer_cancel_remote(xfer);
2477 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { 2477 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) {
2478 /* 2478 /*
2480 * as they connect directly to us. If we don't 2480 * as they connect directly to us. If we don't
2481 * get this, then maybe a third party connected 2481 * get this, then maybe a third party connected
2482 * to us, and we shouldn't send them anything. 2482 * to us, and we shouldn't send them anything.
2483 */ 2483 */
2484 } else { 2484 } else {
2485 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 2485 gaim_debug_error("oscar",
2486 "unknown rendezvous status!\n"); 2486 "unknown rendezvous status!\n");
2487 } 2487 }
2488 } else if (args->reqclass & AIM_CAPS_GETFILE) { 2488 } else if (args->reqclass & AIM_CAPS_GETFILE) {
2489 } else if (args->reqclass & AIM_CAPS_TALK) { 2489 } else if (args->reqclass & AIM_CAPS_TALK) {
2490 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { 2490 } else if (args->reqclass & AIM_CAPS_BUDDYICON) {
2494 } else if (args->reqclass & AIM_CAPS_DIRECTIM) { 2494 } else if (args->reqclass & AIM_CAPS_DIRECTIM) {
2495 struct ask_direct *d = g_new0(struct ask_direct, 1); 2495 struct ask_direct *d = g_new0(struct ask_direct, 1);
2496 char buf[256]; 2496 char buf[256];
2497 2497
2498 if (!args->verifiedip) { 2498 if (!args->verifiedip) {
2499 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2499 gaim_debug_info("oscar",
2500 "directim kill blocked (%s)\n", userinfo->sn); 2500 "directim kill blocked (%s)\n", userinfo->sn);
2501 return 1; 2501 return 1;
2502 } 2502 }
2503 2503
2504 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2504 gaim_debug_info("oscar",
2505 "%s received direct im request from %s (%s)\n", 2505 "%s received direct im request from %s (%s)\n",
2506 username, userinfo->sn, args->verifiedip); 2506 username, userinfo->sn, args->verifiedip);
2507 2507
2508 d->gc = gc; 2508 d->gc = gc;
2509 d->sn = g_strdup(userinfo->sn); 2509 d->sn = g_strdup(userinfo->sn);
2518 "revealed, this may be considered a privacy " 2518 "revealed, this may be considered a privacy "
2519 "risk."), 0, d, 2, 2519 "risk."), 0, d, 2,
2520 _("Connect"), G_CALLBACK(accept_direct_im), 2520 _("Connect"), G_CALLBACK(accept_direct_im),
2521 _("Cancel"), G_CALLBACK(cancel_direct_im)); 2521 _("Cancel"), G_CALLBACK(cancel_direct_im));
2522 } else { 2522 } else {
2523 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 2523 gaim_debug_error("oscar",
2524 "Unknown reqclass %hu\n", args->reqclass); 2524 "Unknown reqclass %hu\n", args->reqclass);
2525 } 2525 }
2526 2526
2527 return 1; 2527 return 1;
2528 } 2528 }
2539 if (g_list_find(gaim_connections_get_all(), gc)) { 2539 if (g_list_find(gaim_connections_get_all(), gc)) {
2540 OscarData *od = gc->proto_data; 2540 OscarData *od = gc->proto_data;
2541 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); 2541 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name);
2542 GaimGroup *group = gaim_find_buddys_group(buddy); 2542 GaimGroup *group = gaim_find_buddys_group(buddy);
2543 if (buddy && group) { 2543 if (buddy && group) {
2544 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2544 gaim_debug_info("oscar",
2545 "ssi: adding buddy %s to group %s\n", 2545 "ssi: adding buddy %s to group %s\n",
2546 buddy->name, group->name); 2546 buddy->name, group->name);
2547 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); 2547 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
2548 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) 2548 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))
2549 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); 2549 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1);
2658 int i, numtoks; 2658 int i, numtoks;
2659 2659
2660 if (!args->type || !args->msg || !args->uin) 2660 if (!args->type || !args->msg || !args->uin)
2661 return 1; 2661 return 1;
2662 2662
2663 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2663 gaim_debug_info("oscar",
2664 "Received a channel 4 message of type 0x%02hhx.\n", args->type); 2664 "Received a channel 4 message of type 0x%02hhx.\n", args->type);
2665 2665
2666 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ 2666 /* Split up the message at the delimeter character, then convert each string to UTF-8 */
2667 msg1 = g_strsplit(args->msg, "\376", 0); 2667 msg1 = g_strsplit(args->msg, "\376", 0);
2668 for (numtoks=0; msg1[numtoks]; numtoks++); 2668 for (numtoks=0; msg1[numtoks]; numtoks++);
2669 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); 2669 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *));
2670 for (i=0; msg1[i]; i++) { 2670 for (i=0; msg1[i]; i++) {
2671 gaim_str_strip_cr(msg1[i]); 2671 gaim_str_strip_cr(msg1[i]);
2672 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); 2672 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err);
2673 if (err) { 2673 if (err) {
2674 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 2674 gaim_debug_error("oscar",
2675 "Error converting a string from ISO-8859-1 to " 2675 "Error converting a string from ISO-8859-1 to "
2676 "UTF-8 in oscar ICBM channel 4 parsing\n"); 2676 "UTF-8 in oscar ICBM channel 4 parsing\n");
2677 g_error_free(err); 2677 g_error_free(err);
2678 } 2678 }
2679 } 2679 }
2715 2715
2716 case 0x06: { /* Someone requested authorization */ 2716 case 0x06: { /* Someone requested authorization */
2717 if (i >= 6) { 2717 if (i >= 6) {
2718 struct name_data *data = g_new(struct name_data, 1); 2718 struct name_data *data = g_new(struct name_data, 1);
2719 gchar *dialog_msg = g_strdup_printf(_("The user %u wants to add you to their buddy list for the following reason:\n%s"), args->uin, msg2[5] ? msg2[5] : _("No reason given.")); 2719 gchar *dialog_msg = g_strdup_printf(_("The user %u wants to add you to their buddy list for the following reason:\n%s"), args->uin, msg2[5] ? msg2[5] : _("No reason given."));
2720 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2720 gaim_debug_info("oscar",
2721 "Received an authorization request from UIN %u\n", 2721 "Received an authorization request from UIN %u\n",
2722 args->uin); 2722 args->uin);
2723 data->gc = gc; 2723 data->gc = gc;
2724 data->name = g_strdup_printf("%u", args->uin); 2724 data->name = g_strdup_printf("%u", args->uin);
2725 data->nick = NULL; 2725 data->nick = NULL;
2809 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */ 2809 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */
2810 /* This is boring and silly. */ 2810 /* This is boring and silly. */
2811 } break; 2811 } break;
2812 2812
2813 default: { 2813 default: {
2814 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2814 gaim_debug_info("oscar",
2815 "Received a channel 4 message of unknown type " 2815 "Received a channel 4 message of unknown type "
2816 "(type 0x%02hhx).\n", args->type); 2816 "(type 0x%02hhx).\n", args->type);
2817 } break; 2817 } break;
2818 } 2818 }
2819 2819
2851 args = va_arg(ap, struct aim_incomingim_ch4_args *); 2851 args = va_arg(ap, struct aim_incomingim_ch4_args *);
2852 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); 2852 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0);
2853 } break; 2853 } break;
2854 2854
2855 default: { 2855 default: {
2856 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 2856 gaim_debug_warning("oscar",
2857 "ICBM received on unsupported channel (channel " 2857 "ICBM received on unsupported channel (channel "
2858 "0x%04hx).", channel); 2858 "0x%04hx).", channel);
2859 } break; 2859 } break;
2860 } 2860 }
2861 2861
2965 2965
2966 /* BBB */ 2966 /* BBB */
2967 switch (reason) { 2967 switch (reason) {
2968 case 3: { /* Decline sendfile. */ 2968 case 3: { /* Decline sendfile. */
2969 GaimXfer *xfer; 2969 GaimXfer *xfer;
2970 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2970 gaim_debug_info("oscar",
2971 "AAA - Other user declined file transfer\n"); 2971 "AAA - Other user declined file transfer\n");
2972 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) 2972 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie)))
2973 gaim_xfer_cancel_remote(xfer); 2973 gaim_xfer_cancel_remote(xfer);
2974 } break; 2974 } break;
2975 2975
2976 default: { 2976 default: {
2977 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 2977 gaim_debug_warning("oscar",
2978 "Received an unknown rendezvous client auto-response " 2978 "Received an unknown rendezvous client auto-response "
2979 "from %s. Type 0x%04hx\n", who, reason); 2979 "from %s. Type 0x%04hx\n", who, reason);
2980 } 2980 }
2981 2981
2982 } 2982 }
3002 g_free(dialog_msg); 3002 g_free(dialog_msg);
3003 g_strfreev(splitmsg); 3003 g_strfreev(splitmsg);
3004 } break; 3004 } break;
3005 3005
3006 default: { 3006 default: {
3007 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 3007 gaim_debug_warning("oscar",
3008 "Received an unknown client auto-response from %s. " 3008 "Received an unknown client auto-response from %s. "
3009 "Type 0x%04hx\n", who, reason); 3009 "Type 0x%04hx\n", who, reason);
3010 } break; 3010 } break;
3011 } /* end of switch */ 3011 } /* end of switch */
3012 3012
3048 3048
3049 va_start(ap, fr); 3049 va_start(ap, fr);
3050 reason = (fu16_t) va_arg(ap, unsigned int); 3050 reason = (fu16_t) va_arg(ap, unsigned int);
3051 va_end(ap); 3051 va_end(ap);
3052 3052
3053 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 3053 gaim_debug_error("oscar",
3054 "snac threw error (reason 0x%04hx: %s)\n", reason, 3054 "snac threw error (reason 0x%04hx: %s)\n", reason,
3055 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); 3055 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown");
3056 3056
3057 m = g_strdup_printf(_("SNAC threw error: %s\n"), 3057 m = g_strdup_printf(_("SNAC threw error: %s\n"),
3058 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); 3058 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error"));
3075 va_start(ap, fr); 3075 va_start(ap, fr);
3076 reason = (fu16_t)va_arg(ap, unsigned int); 3076 reason = (fu16_t)va_arg(ap, unsigned int);
3077 data = va_arg(ap, char *); 3077 data = va_arg(ap, char *);
3078 va_end(ap); 3078 va_end(ap);
3079 3079
3080 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 3080 gaim_debug_error("oscar",
3081 "Message error with data %s and reason %hu\n", data, reason); 3081 "Message error with data %s and reason %hu\n", data, reason);
3082 3082
3083 /* BBB */ 3083 /* BBB */
3084 #if 0 3084 #if 0
3085 /* If this was a file transfer request, data is a cookie */ 3085 /* If this was a file transfer request, data is a cookie */
3122 case 0x0002: { /* Typing */ 3122 case 0x0002: { /* Typing */
3123 serv_got_typing(gc, sn, 0, GAIM_TYPING); 3123 serv_got_typing(gc, sn, 0, GAIM_TYPING);
3124 } break; 3124 } break;
3125 3125
3126 default: { 3126 default: {
3127 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2); 3127 gaim_debug_error("oscar", "Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2);
3128 } break; 3128 } break;
3129 } 3129 }
3130 3130
3131 return 1; 3131 return 1;
3132 } 3132 }
3349 va_start(ap, fr); 3349 va_start(ap, fr);
3350 id = (fu16_t) va_arg(ap, unsigned int); 3350 id = (fu16_t) va_arg(ap, unsigned int);
3351 msg = va_arg(ap, char *); 3351 msg = va_arg(ap, char *);
3352 va_end(ap); 3352 va_end(ap);
3353 3353
3354 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3354 gaim_debug_misc("oscar",
3355 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); 3355 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id);
3356 if (id < 4) 3356 if (id < 4)
3357 gaim_notify_warning(sess->aux_data, NULL, 3357 gaim_notify_warning(sess->aux_data, NULL,
3358 _("Your AIM connection may be lost."), NULL); 3358 _("Your AIM connection may be lost."), NULL);
3359 3359
3377 3377
3378 maxrooms = (fu8_t) va_arg(ap, unsigned int); 3378 maxrooms = (fu8_t) va_arg(ap, unsigned int);
3379 exchangecount = va_arg(ap, int); 3379 exchangecount = va_arg(ap, int);
3380 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); 3380 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
3381 3381
3382 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3382 gaim_debug_misc("oscar",
3383 "chat info: Chat Rights:\n"); 3383 "chat info: Chat Rights:\n");
3384 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3384 gaim_debug_misc("oscar",
3385 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); 3385 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms);
3386 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3386 gaim_debug_misc("oscar",
3387 "chat info: \tExchange List: (%d total)\n", exchangecount); 3387 "chat info: \tExchange List: (%d total)\n", exchangecount);
3388 for (i = 0; i < exchangecount; i++) 3388 for (i = 0; i < exchangecount; i++)
3389 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3389 gaim_debug_misc("oscar",
3390 "chat info: \t\t%hu %s\n", 3390 "chat info: \t\t%hu %s\n",
3391 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); 3391 exchanges[i].number, exchanges[i].name ? exchanges[i].name : "");
3392 while (od->create_rooms) { 3392 while (od->create_rooms) {
3393 struct create_room *cr = od->create_rooms->data; 3393 struct create_room *cr = od->create_rooms->data;
3394 gaim_debug(GAIM_DEBUG_INFO, "oscar", 3394 gaim_debug_info("oscar",
3395 "creating room %s\n", cr->name); 3395 "creating room %s\n", cr->name);
3396 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); 3396 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange);
3397 g_free(cr->name); 3397 g_free(cr->name);
3398 od->create_rooms = g_slist_remove(od->create_rooms, cr); 3398 od->create_rooms = g_slist_remove(od->create_rooms, cr);
3399 g_free(cr); 3399 g_free(cr);
3416 createperms = (fu8_t)va_arg(ap, unsigned int); 3416 createperms = (fu8_t)va_arg(ap, unsigned int);
3417 unknown = (fu16_t)va_arg(ap, unsigned int); 3417 unknown = (fu16_t)va_arg(ap, unsigned int);
3418 name = va_arg(ap, char *); 3418 name = va_arg(ap, char *);
3419 ck = va_arg(ap, char *); 3419 ck = va_arg(ap, char *);
3420 3420
3421 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3421 gaim_debug_misc("oscar",
3422 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", 3422 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n",
3423 fqcn, 3423 fqcn,
3424 exchange, instance, flags, 3424 exchange, instance, flags,
3425 createtime, 3425 createtime,
3426 maxmsglen, maxoccupancy, createperms, unknown, 3426 maxmsglen, maxoccupancy, createperms, unknown,
3427 name, ck); 3427 name, ck);
3428 aim_chat_join(od->sess, od->conn, exchange, ck, instance); 3428 aim_chat_join(od->sess, od->conn, exchange, ck, instance);
3429 } 3429 }
3430 break; 3430 break;
3431 default: 3431 default:
3432 gaim_debug(GAIM_DEBUG_WARNING, "oscar", 3432 gaim_debug_warning("oscar",
3433 "chatnav info: unknown type (%04hx)\n", type); 3433 "chatnav info: unknown type (%04hx)\n", type);
3434 break; 3434 break;
3435 } 3435 }
3436 3436
3437 va_end(ap); 3437 va_end(ap);
3509 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); 3509 unknown_d2 = (fu16_t)va_arg(ap, unsigned int);
3510 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); 3510 unknown_d5 = (fu16_t)va_arg(ap, unsigned int);
3511 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); 3511 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int);
3512 va_end(ap); 3512 va_end(ap);
3513 3513
3514 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3514 gaim_debug_misc("oscar",
3515 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", 3515 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n",
3516 maxmsglen, maxvisiblemsglen); 3516 maxmsglen, maxvisiblemsglen);
3517 3517
3518 ccon->maxlen = maxmsglen; 3518 ccon->maxlen = maxmsglen;
3519 ccon->maxvis = maxvisiblemsglen; 3519 ccon->maxvis = maxvisiblemsglen;
3565 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); 3565 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL);
3566 g_free(to); 3566 g_free(to);
3567 } 3567 }
3568 3568
3569 if (alertitle) 3569 if (alertitle)
3570 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); 3570 gaim_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : "");
3571 3571
3572 return 1; 3572 return 1;
3573 } 3573 }
3574 3574
3575 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { 3575 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) {
3576 GaimConnection *gc = sess->aux_data; 3576 GaimConnection *gc = sess->aux_data;
3577 OscarData *od = gc->proto_data; 3577 OscarData *od = gc->proto_data;
3578 char *sn; 3578 char *sn;
3579 3579
3580 sn = od->requesticon->data; 3580 sn = od->requesticon->data;
3581 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3581 gaim_debug_misc("oscar",
3582 "removing %s from hash table\n", sn); 3582 "removing %s from hash table\n", sn);
3583 od->requesticon = g_slist_remove(od->requesticon, sn); 3583 od->requesticon = g_slist_remove(od->requesticon, sn);
3584 free(sn); 3584 free(sn);
3585 3585
3586 if (od->icontimer) 3586 if (od->icontimer)
3662 char *buf = g_malloc(st.st_size); 3662 char *buf = g_malloc(st.st_size);
3663 FILE *file = fopen(iconfile, "rb"); 3663 FILE *file = fopen(iconfile, "rb");
3664 if (file) { 3664 if (file) {
3665 fread(buf, 1, st.st_size, file); 3665 fread(buf, 1, st.st_size, file);
3666 fclose(file); 3666 fclose(file);
3667 gaim_debug(GAIM_DEBUG_INFO, "oscar", 3667 gaim_debug_info("oscar",
3668 "Uploading icon to icon server\n"); 3668 "Uploading icon to icon server\n");
3669 aim_bart_upload(od->sess, buf, st.st_size); 3669 aim_bart_upload(od->sess, buf, st.st_size);
3670 } else 3670 } else
3671 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 3671 gaim_debug_error("oscar",
3672 "Can't open buddy icon file!\n"); 3672 "Can't open buddy icon file!\n");
3673 g_free(buf); 3673 g_free(buf);
3674 } else { 3674 } else {
3675 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 3675 gaim_debug_error("oscar",
3676 "Can't stat buddy icon file!\n"); 3676 "Can't stat buddy icon file!\n");
3677 } 3677 }
3678 od->set_icon = FALSE; 3678 od->set_icon = FALSE;
3679 } 3679 }
3680 3680
3681 if (!od->requesticon) { 3681 if (!od->requesticon) {
3682 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3682 gaim_debug_misc("oscar",
3683 "no more icons to request\n"); 3683 "no more icons to request\n");
3684 return FALSE; 3684 return FALSE;
3685 } 3685 }
3686 3686
3687 userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data); 3687 userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data);
3708 va_start(ap, fr); 3708 va_start(ap, fr);
3709 type = (fu16_t) va_arg(ap, unsigned int); 3709 type = (fu16_t) va_arg(ap, unsigned int);
3710 sn = va_arg(ap, char *); 3710 sn = va_arg(ap, char *);
3711 va_end(ap); 3711 va_end(ap);
3712 3712
3713 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sent message to %s.\n", sn); 3713 gaim_debug_info("oscar", "Sent message to %s.\n", sn);
3714 3714
3715 return 1; 3715 return 1;
3716 } 3716 }
3717 3717
3718 static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { 3718 static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) {
3737 disconnect = va_arg(ap, fu32_t); 3737 disconnect = va_arg(ap, fu32_t);
3738 currentavg = va_arg(ap, fu32_t); 3738 currentavg = va_arg(ap, fu32_t);
3739 maxavg = va_arg(ap, fu32_t); 3739 maxavg = va_arg(ap, fu32_t);
3740 va_end(ap); 3740 va_end(ap);
3741 3741
3742 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3742 gaim_debug_misc("oscar",
3743 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " 3743 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, "
3744 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", 3744 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n",
3745 (code < 5) ? codes[code] : codes[0], 3745 (code < 5) ? codes[code] : codes[0],
3746 rateclass, 3746 rateclass,
3747 currentavg, maxavg, 3747 currentavg, maxavg,
3813 va_start(ap, fr); 3813 va_start(ap, fr);
3814 code = (fu16_t)va_arg(ap, int); 3814 code = (fu16_t)va_arg(ap, int);
3815 msg = va_arg(ap, char *); 3815 msg = va_arg(ap, char *);
3816 va_end(ap); 3816 va_end(ap);
3817 3817
3818 gaim_debug(GAIM_DEBUG_INFO, "oscar", 3818 gaim_debug_info("oscar",
3819 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); 3819 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg);
3820 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { 3820 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) {
3821 if (code == 0x0001) { 3821 if (code == 0x0001) {
3822 gc->wants_to_die = TRUE; 3822 gc->wants_to_die = TRUE;
3823 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); 3823 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location."));
3834 GaimConnection *gc = sess->aux_data; 3834 GaimConnection *gc = sess->aux_data;
3835 3835
3836 aim_reqpersonalinfo(sess, fr->conn); 3836 aim_reqpersonalinfo(sess, fr->conn);
3837 3837
3838 #ifndef NOSSI 3838 #ifndef NOSSI
3839 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting rights and list\n"); 3839 gaim_debug_info("oscar", "ssi: requesting rights and list\n");
3840 aim_ssi_reqrights(sess); 3840 aim_ssi_reqrights(sess);
3841 aim_ssi_reqdata(sess); 3841 aim_ssi_reqdata(sess);
3842 #endif 3842 #endif
3843 3843
3844 aim_locate_reqrights(sess); 3844 aim_locate_reqrights(sess);
3845 aim_buddylist_reqrights(sess, fr->conn); 3845 aim_buddylist_reqrights(sess, fr->conn);
3846 aim_im_reqparams(sess); 3846 aim_im_reqparams(sess);
3847 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */ 3847 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */
3848 3848
3849 #ifdef NOSSI 3849 #ifdef NOSSI
3850 gaim_debug(GAIM_DEBUG_INFO, "oscar", "bos: requesting rights\n"); 3850 gaim_debug_info("oscar", "bos: requesting rights\n");
3851 aim_bos_reqrights(sess, fr->conn); 3851 aim_bos_reqrights(sess, fr->conn);
3852 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); 3852 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
3853 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); 3853 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
3854 #endif 3854 #endif
3855 3855
3865 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); 3865 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0);
3866 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); 3866 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0);
3867 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); 3867 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0);
3868 3868
3869 aim_clientready(sess, fr->conn); 3869 aim_clientready(sess, fr->conn);
3870 gaim_debug(GAIM_DEBUG_INFO, "oscar", "connected to admin\n"); 3870 gaim_debug_info("oscar", "connected to admin\n");
3871 3871
3872 if (od->chpass) { 3872 if (od->chpass) {
3873 gaim_debug(GAIM_DEBUG_INFO, "oscar", "changing password\n"); 3873 gaim_debug_info("oscar", "changing password\n");
3874 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); 3874 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp);
3875 g_free(od->oldp); 3875 g_free(od->oldp);
3876 od->oldp = NULL; 3876 od->oldp = NULL;
3877 g_free(od->newp); 3877 g_free(od->newp);
3878 od->newp = NULL; 3878 od->newp = NULL;
3879 od->chpass = FALSE; 3879 od->chpass = FALSE;
3880 } 3880 }
3881 if (od->setnick) { 3881 if (od->setnick) {
3882 gaim_debug(GAIM_DEBUG_INFO, "oscar", "formatting screen name\n"); 3882 gaim_debug_info("oscar", "formatting screen name\n");
3883 aim_admin_setnick(sess, fr->conn, od->newsn); 3883 aim_admin_setnick(sess, fr->conn, od->newsn);
3884 g_free(od->newsn); 3884 g_free(od->newsn);
3885 od->newsn = NULL; 3885 od->newsn = NULL;
3886 od->setnick = FALSE; 3886 od->setnick = FALSE;
3887 } 3887 }
3888 if (od->conf) { 3888 if (od->conf) {
3889 gaim_debug(GAIM_DEBUG_INFO, "oscar", "confirming account\n"); 3889 gaim_debug_info("oscar", "confirming account\n");
3890 aim_admin_reqconfirm(sess, fr->conn); 3890 aim_admin_reqconfirm(sess, fr->conn);
3891 od->conf = FALSE; 3891 od->conf = FALSE;
3892 } 3892 }
3893 if (od->reqemail) { 3893 if (od->reqemail) {
3894 gaim_debug(GAIM_DEBUG_INFO, "oscar", "requesting email\n"); 3894 gaim_debug_info("oscar", "requesting email\n");
3895 aim_admin_getinfo(sess, fr->conn, 0x0011); 3895 aim_admin_getinfo(sess, fr->conn, 0x0011);
3896 od->reqemail = FALSE; 3896 od->reqemail = FALSE;
3897 } 3897 }
3898 if (od->setemail) { 3898 if (od->setemail) {
3899 gaim_debug(GAIM_DEBUG_INFO, "oscar", "setting email\n"); 3899 gaim_debug_info("oscar", "setting email\n");
3900 aim_admin_setemail(sess, fr->conn, od->email); 3900 aim_admin_setemail(sess, fr->conn, od->email);
3901 g_free(od->email); 3901 g_free(od->email);
3902 od->email = NULL; 3902 od->email = NULL;
3903 od->setemail = FALSE; 3903 od->setemail = FALSE;
3904 } 3904 }
3913 va_start(ap, fr); 3913 va_start(ap, fr);
3914 params = va_arg(ap, struct aim_icbmparameters *); 3914 params = va_arg(ap, struct aim_icbmparameters *);
3915 va_end(ap); 3915 va_end(ap);
3916 3916
3917 /* XXX - evidently this crashes on solaris. i have no clue why 3917 /* XXX - evidently this crashes on solaris. i have no clue why
3918 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " 3918 gaim_debug_misc("oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, "
3919 "max sender evil = %f, max receiver evil = %f, min msg interval = %u\n", 3919 "max sender evil = %f, max receiver evil = %f, min msg interval = %u\n",
3920 params->maxchan, params->flags, params->maxmsglen, 3920 params->maxchan, params->flags, params->maxmsglen,
3921 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, 3921 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0,
3922 params->minmsginterval); 3922 params->minmsginterval);
3923 */ 3923 */
3941 3941
3942 va_start(ap, fr); 3942 va_start(ap, fr);
3943 maxsiglen = (fu16_t) va_arg(ap, int); 3943 maxsiglen = (fu16_t) va_arg(ap, int);
3944 va_end(ap); 3944 va_end(ap);
3945 3945
3946 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3946 gaim_debug_misc("oscar",
3947 "locate rights: max sig len = %d\n", maxsiglen); 3947 "locate rights: max sig len = %d\n", maxsiglen);
3948 3948
3949 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; 3949 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen;
3950 3950
3951 if (od->icq) 3951 if (od->icq)
3966 va_start(ap, fr); 3966 va_start(ap, fr);
3967 maxbuddies = (fu16_t) va_arg(ap, unsigned int); 3967 maxbuddies = (fu16_t) va_arg(ap, unsigned int);
3968 maxwatchers = (fu16_t) va_arg(ap, unsigned int); 3968 maxwatchers = (fu16_t) va_arg(ap, unsigned int);
3969 va_end(ap); 3969 va_end(ap);
3970 3970
3971 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3971 gaim_debug_misc("oscar",
3972 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); 3972 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers);
3973 3973
3974 od->rights.maxbuddies = (guint)maxbuddies; 3974 od->rights.maxbuddies = (guint)maxbuddies;
3975 od->rights.maxwatchers = (guint)maxwatchers; 3975 od->rights.maxwatchers = (guint)maxwatchers;
3976 3976
3986 va_start(ap, fr); 3986 va_start(ap, fr);
3987 maxpermits = (fu16_t) va_arg(ap, unsigned int); 3987 maxpermits = (fu16_t) va_arg(ap, unsigned int);
3988 maxdenies = (fu16_t) va_arg(ap, unsigned int); 3988 maxdenies = (fu16_t) va_arg(ap, unsigned int);
3989 va_end(ap); 3989 va_end(ap);
3990 3990
3991 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3991 gaim_debug_misc("oscar",
3992 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); 3992 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies);
3993 3993
3994 od->rights.maxpermits = (guint)maxpermits; 3994 od->rights.maxpermits = (guint)maxpermits;
3995 od->rights.maxdenies = (guint)maxdenies; 3995 od->rights.maxdenies = (guint)maxdenies;
3996 3996
3997 gaim_connection_set_state(gc, GAIM_CONNECTED); 3997 gaim_connection_set_state(gc, GAIM_CONNECTED);
3998 serv_finish_login(gc); 3998 serv_finish_login(gc);
3999 3999
4000 gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n"); 4000 gaim_debug_info("oscar", "buddy list loaded\n");
4001 4001
4002 aim_clientready(sess, fr->conn); 4002 aim_clientready(sess, fr->conn);
4003 aim_srv_setavailmsg(sess, NULL); 4003 aim_srv_setavailmsg(sess, NULL);
4004 aim_srv_setidle(sess, 0); 4004 aim_srv_setidle(sess, 0);
4005 4005
4023 4023
4024 va_start(ap, fr); 4024 va_start(ap, fr);
4025 msg = va_arg(ap, struct aim_icq_offlinemsg *); 4025 msg = va_arg(ap, struct aim_icq_offlinemsg *);
4026 va_end(ap); 4026 va_end(ap);
4027 4027
4028 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4028 gaim_debug_info("oscar",
4029 "Received offline message. Converting to channel 4 ICBM...\n"); 4029 "Received offline message. Converting to channel 4 ICBM...\n");
4030 args.uin = msg->sender; 4030 args.uin = msg->sender;
4031 args.type = msg->type; 4031 args.type = msg->type;
4032 args.flags = msg->flags; 4032 args.flags = msg->flags;
4033 args.msglen = msg->msglen; 4033 args.msglen = msg->msglen;
4307 4307
4308 va_start(ap, fr); 4308 va_start(ap, fr);
4309 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ 4309 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */
4310 va_end(ap); 4310 va_end(ap);
4311 4311
4312 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4312 gaim_debug_info("oscar",
4313 "account confirmation returned status 0x%04x (%s)\n", status, 4313 "account confirmation returned status 0x%04x (%s)\n", status,
4314 status ? "unknown" : "email sent"); 4314 status ? "unknown" : "email sent");
4315 if (!status) { 4315 if (!status) {
4316 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), 4316 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."),
4317 gaim_account_get_username(gaim_connection_get_account(gc))); 4317 gaim_account_get_username(gaim_connection_get_account(gc)));
4335 url = va_arg(ap, char *); 4335 url = va_arg(ap, char *);
4336 sn = va_arg(ap, char *); 4336 sn = va_arg(ap, char *);
4337 email = va_arg(ap, char *); 4337 email = va_arg(ap, char *);
4338 va_end(ap); 4338 va_end(ap);
4339 4339
4340 gaim_debug(GAIM_DEBUG_MISC, "oscar", 4340 gaim_debug_misc("oscar",
4341 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", 4341 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n",
4342 change ? "change" : "request", perms, err, url, sn, email); 4342 change ? "change" : "request", perms, err, url, sn, email);
4343 4343
4344 if (err && url) { 4344 if (err && url) {
4345 char *dialog_msg; 4345 char *dialog_msg;
4464 if (imflags & GAIM_CONV_IM_AUTO_RESP) 4464 if (imflags & GAIM_CONV_IM_AUTO_RESP)
4465 args.flags |= AIM_IMFLAGS_AWAY; 4465 args.flags |= AIM_IMFLAGS_AWAY;
4466 } 4466 }
4467 4467
4468 if (bi->ico_need) { 4468 if (bi->ico_need) {
4469 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4469 gaim_debug_info("oscar",
4470 "Sending buddy icon request with message\n"); 4470 "Sending buddy icon request with message\n");
4471 args.flags |= AIM_IMFLAGS_BUDDYREQ; 4471 args.flags |= AIM_IMFLAGS_BUDDYREQ;
4472 bi->ico_need = FALSE; 4472 bi->ico_need = FALSE;
4473 } 4473 }
4474 4474
4487 bi->ico_informed = FALSE; 4487 bi->ico_informed = FALSE;
4488 bi->ico_sent = FALSE; 4488 bi->ico_sent = FALSE;
4489 } 4489 }
4490 4490
4491 if (!bi->ico_informed) { 4491 if (!bi->ico_informed) {
4492 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4492 gaim_debug_info("oscar",
4493 "Claiming to have a buddy icon\n"); 4493 "Claiming to have a buddy icon\n");
4494 args.flags |= AIM_IMFLAGS_HASICON; 4494 args.flags |= AIM_IMFLAGS_HASICON;
4495 bi->ico_me_len = args.iconlen; 4495 bi->ico_me_len = args.iconlen;
4496 bi->ico_me_csum = args.iconsum; 4496 bi->ico_me_csum = args.iconsum;
4497 bi->ico_me_time = args.iconstamp; 4497 bi->ico_me_time = args.iconstamp;
4511 tmpmsg = gaim_strdup_withhtml(message); 4511 tmpmsg = gaim_strdup_withhtml(message);
4512 len = strlen(tmpmsg); 4512 len = strlen(tmpmsg);
4513 4513
4514 args.flags |= oscar_encoding_check(tmpmsg); 4514 args.flags |= oscar_encoding_check(tmpmsg);
4515 if (args.flags & AIM_IMFLAGS_UNICODE) { 4515 if (args.flags & AIM_IMFLAGS_UNICODE) {
4516 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode IM\n"); 4516 gaim_debug_info("oscar", "Sending Unicode IM\n");
4517 args.charset = 0x0002; 4517 args.charset = 0x0002;
4518 args.charsubset = 0x0000; 4518 args.charsubset = 0x0000;
4519 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err); 4519 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err);
4520 if (err) { 4520 if (err) {
4521 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 4521 gaim_debug_error("oscar",
4522 "Error converting a unicode message: %s\n", err->message); 4522 "Error converting a unicode message: %s\n", err->message);
4523 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 4523 gaim_debug_error("oscar",
4524 "This really shouldn't happen!\n"); 4524 "This really shouldn't happen!\n");
4525 /* We really shouldn't try to send the 4525 /* We really shouldn't try to send the
4526 * IM now, but I'm not sure what to do */ 4526 * IM now, but I'm not sure what to do */
4527 g_error_free(err); 4527 g_error_free(err);
4528 } 4528 }
4529 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { 4529 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) {
4530 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4530 gaim_debug_info("oscar",
4531 "Sending ISO-8859-1 IM\n"); 4531 "Sending ISO-8859-1 IM\n");
4532 args.charset = 0x0003; 4532 args.charset = 0x0003;
4533 args.charsubset = 0x0000; 4533 args.charsubset = 0x0000;
4534 args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); 4534 args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err);
4535 if (err) { 4535 if (err) {
4536 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 4536 gaim_debug_error("oscar",
4537 "conversion error: %s\n", err->message); 4537 "conversion error: %s\n", err->message);
4538 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 4538 gaim_debug_error("oscar",
4539 "Someone tell Ethan his 8859-1 detection is wrong\n"); 4539 "Someone tell Ethan his 8859-1 detection is wrong\n");
4540 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; 4540 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE;
4541 len = strlen(tmpmsg); 4541 len = strlen(tmpmsg);
4542 g_error_free(err); 4542 g_error_free(err);
4543 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err); 4543 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err);
4544 if (err) { 4544 if (err) {
4545 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 4545 gaim_debug_error("oscar",
4546 "Error in unicode fallback: %s\n", err->message); 4546 "Error in unicode fallback: %s\n", err->message);
4547 g_error_free(err); 4547 g_error_free(err);
4548 } 4548 }
4549 } 4549 }
4550 } else { 4550 } else {
4814 #ifdef NOSSI 4814 #ifdef NOSSI
4815 aim_buddylist_addbuddy(od->sess, od->conn, name); 4815 aim_buddylist_addbuddy(od->sess, od->conn, name);
4816 #else 4816 #else
4817 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { 4817 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) {
4818 if (b && g) { 4818 if (b && g) {
4819 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4819 gaim_debug_info("oscar",
4820 "ssi: adding buddy %s to group %s\n", name, g->name); 4820 "ssi: adding buddy %s to group %s\n", name, g->name);
4821 aim_ssi_addbuddy(od->sess, b->name, g->name, gaim_get_buddy_alias_only(b), NULL, NULL, 0); 4821 aim_ssi_addbuddy(od->sess, b->name, g->name, gaim_get_buddy_alias_only(b), NULL, NULL, 0);
4822 } 4822 }
4823 } 4823 }
4824 #endif 4824 #endif
4855 OscarData *od = (OscarData *)gc->proto_data; 4855 OscarData *od = (OscarData *)gc->proto_data;
4856 #ifdef NOSSI 4856 #ifdef NOSSI
4857 aim_buddylist_removebuddy(od->sess, od->conn, name); 4857 aim_buddylist_removebuddy(od->sess, od->conn, name);
4858 #else 4858 #else
4859 if (od->sess->ssi.received_data) { 4859 if (od->sess->ssi.received_data) {
4860 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4860 gaim_debug_info("oscar",
4861 "ssi: deleting buddy %s from group %s\n", name, group); 4861 "ssi: deleting buddy %s from group %s\n", name, group);
4862 aim_ssi_delbuddy(od->sess, name, group); 4862 aim_ssi_delbuddy(od->sess, name, group);
4863 } 4863 }
4864 #endif 4864 #endif
4865 } 4865 }
4882 4882
4883 #ifndef NOSSI 4883 #ifndef NOSSI
4884 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { 4884 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) {
4885 OscarData *od = (OscarData *)gc->proto_data; 4885 OscarData *od = (OscarData *)gc->proto_data;
4886 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { 4886 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) {
4887 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4887 gaim_debug_info("oscar",
4888 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); 4888 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group);
4889 aim_ssi_movebuddy(od->sess, old_group, new_group, name); 4889 aim_ssi_movebuddy(od->sess, old_group, new_group, name);
4890 } 4890 }
4891 } 4891 }
4892 4892
4893 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { 4893 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) {
4894 OscarData *od = (OscarData *)gc->proto_data; 4894 OscarData *od = (OscarData *)gc->proto_data;
4895 if (od->sess->ssi.received_data) { 4895 if (od->sess->ssi.received_data) {
4896 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); 4896 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name);
4897 if (gname) { 4897 if (gname) {
4898 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4898 gaim_debug_info("oscar",
4899 "ssi: changing the alias for buddy %s to %s\n", name, alias); 4899 "ssi: changing the alias for buddy %s to %s\n", name, alias);
4900 aim_ssi_aliasbuddy(od->sess, gname, name, alias); 4900 aim_ssi_aliasbuddy(od->sess, gname, name, alias);
4901 } 4901 }
4902 } 4902 }
4903 } 4903 }
4907 4907
4908 if (od->sess->ssi.received_data) { 4908 if (od->sess->ssi.received_data) {
4909 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { 4909 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) {
4910 oscar_remove_buddies(gc, members, old_group); 4910 oscar_remove_buddies(gc, members, old_group);
4911 oscar_add_buddies(gc, members); 4911 oscar_add_buddies(gc, members);
4912 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4912 gaim_debug_info("oscar",
4913 "ssi: moved all buddies from group %s to %s\n", old_group, new_group); 4913 "ssi: moved all buddies from group %s to %s\n", old_group, new_group);
4914 } else { 4914 } else {
4915 aim_ssi_rename_group(od->sess, old_group, new_group); 4915 aim_ssi_rename_group(od->sess, old_group, new_group);
4916 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4916 gaim_debug_info("oscar",
4917 "ssi: renamed group %s to %s\n", old_group, new_group); 4917 "ssi: renamed group %s to %s\n", old_group, new_group);
4918 } 4918 }
4919 } 4919 }
4920 } 4920 }
4921 4921
4933 4933
4934 va_start(ap, fr); 4934 va_start(ap, fr);
4935 reason = (fu16_t)va_arg(ap, unsigned int); 4935 reason = (fu16_t)va_arg(ap, unsigned int);
4936 va_end(ap); 4936 va_end(ap);
4937 4937
4938 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); 4938 gaim_debug_error("oscar", "ssi: SNAC error %hu\n", reason);
4939 4939
4940 if (reason == 0x0005) { 4940 if (reason == 0x0005) {
4941 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), 4941 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"),
4942 _("Gaim was temporarily unable to retrieve your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours.")); 4942 _("Gaim was temporarily unable to retrieve your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours."));
4943 od->getblisttimer = gaim_timeout_add(300000, gaim_ssi_rerequestdata, od->sess); 4943 od->getblisttimer = gaim_timeout_add(300000, gaim_ssi_rerequestdata, od->sess);
4944 } 4944 }
4945 4945
4946 /* Activate SSI */ 4946 /* Activate SSI */
4947 /* Sending the enable causes other people to be able to see you, and you to see them */ 4947 /* Sending the enable causes other people to be able to see you, and you to see them */
4948 /* Make sure your privacy setting/invisibility is set how you want it before this! */ 4948 /* Make sure your privacy setting/invisibility is set how you want it before this! */
4949 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: activating server-stored buddy list\n"); 4949 gaim_debug_info("oscar", "ssi: activating server-stored buddy list\n");
4950 aim_ssi_enable(od->sess); 4950 aim_ssi_enable(od->sess);
4951 4951
4952 return 1; 4952 return 1;
4953 } 4953 }
4954 4954
4962 va_start(ap, fr); 4962 va_start(ap, fr);
4963 numtypes = va_arg(ap, int); 4963 numtypes = va_arg(ap, int);
4964 maxitems = va_arg(ap, fu16_t *); 4964 maxitems = va_arg(ap, fu16_t *);
4965 va_end(ap); 4965 va_end(ap);
4966 4966
4967 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ssi rights:"); 4967 gaim_debug_misc("oscar", "ssi rights:");
4968 4968
4969 for (i=0; i<numtypes; i++) 4969 for (i=0; i<numtypes; i++)
4970 gaim_debug(GAIM_DEBUG_MISC, NULL, " max type 0x%04x=%hd,", 4970 gaim_debug_misc(NULL, " max type 0x%04x=%hd,",
4971 i, maxitems[i]); 4971 i, maxitems[i]);
4972 4972
4973 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); 4973 gaim_debug_misc(NULL, "\n");
4974 4974
4975 if (numtypes >= 0) 4975 if (numtypes >= 0)
4976 od->rights.maxbuddies = maxitems[0]; 4976 od->rights.maxbuddies = maxitems[0];
4977 if (numtypes >= 1) 4977 if (numtypes >= 1)
4978 od->rights.maxgroups = maxitems[1]; 4978 od->rights.maxgroups = maxitems[1];
5002 numitems = (fu16_t)va_arg(ap, int); 5002 numitems = (fu16_t)va_arg(ap, int);
5003 items = va_arg(ap, struct aim_ssi_item *); 5003 items = va_arg(ap, struct aim_ssi_item *);
5004 timestamp = va_arg(ap, fu32_t); 5004 timestamp = va_arg(ap, fu32_t);
5005 va_end(ap); 5005 va_end(ap);
5006 5006
5007 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5007 gaim_debug_info("oscar",
5008 "ssi: syncing local list and server list\n"); 5008 "ssi: syncing local list and server list\n");
5009 5009
5010 if ((timestamp == 0) || (numitems == 0)) { 5010 if ((timestamp == 0) || (numitems == 0)) {
5011 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Got AIM SSI with a 0 timestamp or 0 numitems--not syncing. This probably means your buddy list is empty.", NULL); 5011 gaim_debug_info("oscar", "Got AIM SSI with a 0 timestamp or 0 numitems--not syncing. This probably means your buddy list is empty.", NULL);
5012 return 1; 5012 return 1;
5013 } 5013 }
5014 5014
5015 /* Clean the buddy list */ 5015 /* Clean the buddy list */
5016 aim_ssi_cleanlist(sess); 5016 aim_ssi_cleanlist(sess);
5046 alias = aim_ssi_getalias(sess->ssi.local, g->name, b->name); 5046 alias = aim_ssi_getalias(sess->ssi.local, g->name, b->name);
5047 if (!alias && b->alias && strlen(b->alias)) 5047 if (!alias && b->alias && strlen(b->alias))
5048 aim_ssi_aliasbuddy(sess, g->name, b->name, b->alias); 5048 aim_ssi_aliasbuddy(sess, g->name, b->name, b->alias);
5049 free(alias); 5049 free(alias);
5050 } else { 5050 } else {
5051 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5051 gaim_debug_info("oscar",
5052 "ssi: removing buddy %s from local list\n", b->name); 5052 "ssi: removing buddy %s from local list\n", b->name);
5053 /* We can't actually remove now because it will screw up our looping */ 5053 /* We can't actually remove now because it will screw up our looping */
5054 cur = g_slist_prepend(cur, b); 5054 cur = g_slist_prepend(cur, b);
5055 } 5055 }
5056 } 5056 }
5067 5067
5068 /* Permit list */ 5068 /* Permit list */
5069 if (gc->account->permit) { 5069 if (gc->account->permit) {
5070 for (cur=gc->account->permit; cur; cur=cur->next) 5070 for (cur=gc->account->permit; cur; cur=cur->next)
5071 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { 5071 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) {
5072 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5072 gaim_debug_info("oscar",
5073 "ssi: removing permit %s from local list\n", (const char *)cur->data); 5073 "ssi: removing permit %s from local list\n", (const char *)cur->data);
5074 gaim_privacy_permit_remove(account, cur->data, TRUE); 5074 gaim_privacy_permit_remove(account, cur->data, TRUE);
5075 cur = gc->account->permit; 5075 cur = gc->account->permit;
5076 } 5076 }
5077 } 5077 }
5078 5078
5079 /* Deny list */ 5079 /* Deny list */
5080 if (gc->account->deny) { 5080 if (gc->account->deny) {
5081 for (cur=gc->account->deny; cur; cur=cur->next) 5081 for (cur=gc->account->deny; cur; cur=cur->next)
5082 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { 5082 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) {
5083 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5083 gaim_debug_info("oscar",
5084 "ssi: removing deny %s from local list\n", (const char *)cur->data); 5084 "ssi: removing deny %s from local list\n", (const char *)cur->data);
5085 gaim_privacy_deny_remove(account, cur->data, TRUE); 5085 gaim_privacy_deny_remove(account, cur->data, TRUE);
5086 cur = gc->account->deny; 5086 cur = gc->account->deny;
5087 } 5087 }
5088 } 5088 }
5118 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { 5118 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
5119 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); 5119 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
5120 gaim_blist_add_group(g, NULL); 5120 gaim_blist_add_group(g, NULL);
5121 } 5121 }
5122 5122
5123 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5123 gaim_debug_info("oscar",
5124 "ssi: adding b %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); 5124 "ssi: adding b %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans"));
5125 gaim_blist_add_buddy(b, NULL, g, NULL); 5125 gaim_blist_add_buddy(b, NULL, g, NULL);
5126 } 5126 }
5127 if (!aim_sncmp(curitem->name, account->username)) { 5127 if (!aim_sncmp(curitem->name, account->username)) {
5128 char *comment = aim_ssi_getcomment(sess->ssi.local, gname, curitem->name); 5128 char *comment = aim_ssi_getcomment(sess->ssi.local, gname, curitem->name);
5142 if (curitem->name) { 5142 if (curitem->name) {
5143 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ 5143 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */
5144 GSList *list; 5144 GSList *list;
5145 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); 5145 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
5146 if (!list) { 5146 if (!list) {
5147 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5147 gaim_debug_info("oscar",
5148 "ssi: adding permit buddy %s to local list\n", curitem->name); 5148 "ssi: adding permit buddy %s to local list\n", curitem->name);
5149 gaim_privacy_permit_add(account, curitem->name, TRUE); 5149 gaim_privacy_permit_add(account, curitem->name, TRUE);
5150 } 5150 }
5151 } 5151 }
5152 } break; 5152 } break;
5154 case 0x0003: { /* Deny buddy */ 5154 case 0x0003: { /* Deny buddy */
5155 if (curitem->name) { 5155 if (curitem->name) {
5156 GSList *list; 5156 GSList *list;
5157 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); 5157 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
5158 if (!list) { 5158 if (!list) {
5159 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5159 gaim_debug_info("oscar",
5160 "ssi: adding deny buddy %s to local list\n", curitem->name); 5160 "ssi: adding deny buddy %s to local list\n", curitem->name);
5161 gaim_privacy_deny_add(account, curitem->name, TRUE); 5161 gaim_privacy_deny_add(account, curitem->name, TRUE);
5162 } 5162 }
5163 } 5163 }
5164 } break; 5164 } break;
5165 5165
5166 case 0x0004: { /* Permit/deny setting */ 5166 case 0x0004: { /* Permit/deny setting */
5167 if (curitem->data) { 5167 if (curitem->data) {
5168 fu8_t permdeny; 5168 fu8_t permdeny;
5169 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != account->perm_deny)) { 5169 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != account->perm_deny)) {
5170 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5170 gaim_debug_info("oscar",
5171 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); 5171 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny);
5172 account->perm_deny = permdeny; 5172 account->perm_deny = permdeny;
5173 if (od->icq && account->perm_deny == 0x03) { 5173 if (od->icq && account->perm_deny == 0x03) {
5174 serv_set_away(gc, "Invisible", ""); 5174 serv_set_away(gc, "Invisible", "");
5175 } 5175 }
5189 } 5189 }
5190 5190
5191 /* Activate SSI */ 5191 /* Activate SSI */
5192 /* Sending the enable causes other people to be able to see you, and you to see them */ 5192 /* Sending the enable causes other people to be able to see you, and you to see them */
5193 /* Make sure your privacy setting/invisibility is set how you want it before this! */ 5193 /* Make sure your privacy setting/invisibility is set how you want it before this! */
5194 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5194 gaim_debug_info("oscar",
5195 "ssi: activating server-stored buddy list\n"); 5195 "ssi: activating server-stored buddy list\n");
5196 aim_ssi_enable(sess); 5196 aim_ssi_enable(sess);
5197 5197
5198 return 1; 5198 return 1;
5199 } 5199 }
5206 va_start(ap, fr); 5206 va_start(ap, fr);
5207 retval = va_arg(ap, struct aim_ssi_tmp *); 5207 retval = va_arg(ap, struct aim_ssi_tmp *);
5208 va_end(ap); 5208 va_end(ap);
5209 5209
5210 while (retval) { 5210 while (retval) {
5211 gaim_debug(GAIM_DEBUG_MISC, "oscar", 5211 gaim_debug_misc("oscar",
5212 "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack, retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item"); 5212 "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack, retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item");
5213 5213
5214 if (retval->ack != 0xffff) 5214 if (retval->ack != 0xffff)
5215 switch (retval->ack) { 5215 switch (retval->ack) {
5216 case 0x0000: { /* added successfully */ 5216 case 0x0000: { /* added successfully */
5228 gaim_auth_sendrequest(gc, retval->name); 5228 gaim_auth_sendrequest(gc, retval->name);
5229 } break; 5229 } break;
5230 5230
5231 default: { /* La la la */ 5231 default: { /* La la la */
5232 gchar *buf; 5232 gchar *buf;
5233 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); 5233 gaim_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack);
5234 buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason. The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)"))); 5234 buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason. The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)")));
5235 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); 5235 gaim_notify_error(gc, NULL, _("Unable To Add"), buf);
5236 g_free(buf); 5236 g_free(buf);
5237 } break; 5237 } break;
5238 } 5238 }
5279 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { 5279 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
5280 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); 5280 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
5281 gaim_blist_add_group(g, NULL); 5281 gaim_blist_add_group(g, NULL);
5282 } 5282 }
5283 5283
5284 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5284 gaim_debug_info("oscar",
5285 "ssi: adding b %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); 5285 "ssi: adding b %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans"));
5286 gaim_blist_add_buddy(b, NULL, g, NULL); 5286 gaim_blist_add_buddy(b, NULL, g, NULL);
5287 } 5287 }
5288 g_free(gname_utf8); 5288 g_free(gname_utf8);
5289 g_free(alias_utf8); 5289 g_free(alias_utf8);
5302 va_start(ap, fr); 5302 va_start(ap, fr);
5303 sn = va_arg(ap, char *); 5303 sn = va_arg(ap, char *);
5304 msg = va_arg(ap, char *); 5304 msg = va_arg(ap, char *);
5305 va_end(ap); 5305 va_end(ap);
5306 5306
5307 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5307 gaim_debug_info("oscar",
5308 "ssi: %s has given you permission to add him to your buddy list\n", sn); 5308 "ssi: %s has given you permission to add him to your buddy list\n", sn);
5309 5309
5310 buddy = gaim_find_buddy(gc->account, sn); 5310 buddy = gaim_find_buddy(gc->account, sn);
5311 if (buddy && (gaim_get_buddy_alias_only(buddy))) 5311 if (buddy && (gaim_get_buddy_alias_only(buddy)))
5312 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); 5312 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy));
5341 va_start(ap, fr); 5341 va_start(ap, fr);
5342 sn = va_arg(ap, char *); 5342 sn = va_arg(ap, char *);
5343 msg = va_arg(ap, char *); 5343 msg = va_arg(ap, char *);
5344 va_end(ap); 5344 va_end(ap);
5345 5345
5346 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5346 gaim_debug_info("oscar",
5347 "ssi: received authorization request from %s\n", sn); 5347 "ssi: received authorization request from %s\n", sn);
5348 5348
5349 buddy = gaim_find_buddy(gc->account, sn); 5349 buddy = gaim_find_buddy(gc->account, sn);
5350 if (buddy && (gaim_get_buddy_alias_only(buddy))) 5350 if (buddy && (gaim_get_buddy_alias_only(buddy)))
5351 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); 5351 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy));
5381 sn = va_arg(ap, char *); 5381 sn = va_arg(ap, char *);
5382 reply = (fu8_t)va_arg(ap, int); 5382 reply = (fu8_t)va_arg(ap, int);
5383 msg = va_arg(ap, char *); 5383 msg = va_arg(ap, char *);
5384 va_end(ap); 5384 va_end(ap);
5385 5385
5386 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5386 gaim_debug_info("oscar",
5387 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); 5387 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply);
5388 5388
5389 buddy = gaim_find_buddy(gc->account, sn); 5389 buddy = gaim_find_buddy(gc->account, sn);
5390 if (buddy && (gaim_get_buddy_alias_only(buddy))) 5390 if (buddy && (gaim_get_buddy_alias_only(buddy)))
5391 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); 5391 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy));
5416 va_start(ap, fr); 5416 va_start(ap, fr);
5417 sn = va_arg(ap, char *); 5417 sn = va_arg(ap, char *);
5418 va_end(ap); 5418 va_end(ap);
5419 5419
5420 buddy = gaim_find_buddy(gc->account, sn); 5420 buddy = gaim_find_buddy(gc->account, sn);
5421 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5421 gaim_debug_info("oscar",
5422 "ssi: %s added you to their buddy list\n", sn); 5422 "ssi: %s added you to their buddy list\n", sn);
5423 gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); 5423 gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL);
5424 5424
5425 return 1; 5425 return 1;
5426 } 5426 }
5452 char *name, *exchange; 5452 char *name, *exchange;
5453 5453
5454 name = g_hash_table_lookup(data, "room"); 5454 name = g_hash_table_lookup(data, "room");
5455 exchange = g_hash_table_lookup(data, "exchange"); 5455 exchange = g_hash_table_lookup(data, "exchange");
5456 5456
5457 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5457 gaim_debug_info("oscar",
5458 "Attempting to join chat room %s.\n", name); 5458 "Attempting to join chat room %s.\n", name);
5459 5459
5460 if ((name == NULL) || (*name == '\0')) { 5460 if ((name == NULL) || (*name == '\0')) {
5461 gaim_notify_error(gc, NULL, _("Invalid chat name specified."), NULL); 5461 gaim_notify_error(gc, NULL, _("Invalid chat name specified."), NULL);
5462 return; 5462 return;
5463 } 5463 }
5464 5464
5465 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { 5465 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) {
5466 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5466 gaim_debug_info("oscar",
5467 "chatnav exists, creating room\n"); 5467 "chatnav exists, creating room\n");
5468 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); 5468 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange));
5469 } else { 5469 } else {
5470 /* this gets tricky */ 5470 /* this gets tricky */
5471 struct create_room *cr = g_new0(struct create_room, 1); 5471 struct create_room *cr = g_new0(struct create_room, 1);
5472 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5472 gaim_debug_info("oscar",
5473 "chatnav does not exist, opening chatnav\n"); 5473 "chatnav does not exist, opening chatnav\n");
5474 cr->exchange = atoi(exchange); 5474 cr->exchange = atoi(exchange);
5475 cr->name = g_strdup(name); 5475 cr->name = g_strdup(name);
5476 od->create_rooms = g_slist_append(od->create_rooms, cr); 5476 od->create_rooms = g_slist_append(od->create_rooms, cr);
5477 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); 5477 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV);
5506 } 5506 }
5507 5507
5508 if (!b) 5508 if (!b)
5509 return; 5509 return;
5510 5510
5511 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5511 gaim_debug_info("oscar",
5512 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); 5512 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count);
5513 5513
5514 c = find_oscar_chat(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); 5514 c = find_oscar_chat(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)));
5515 if (c != NULL) { 5515 if (c != NULL) {
5516 if (od) 5516 if (od)
5546 buf = gaim_strdup_withhtml(message); 5546 buf = gaim_strdup_withhtml(message);
5547 len = strlen(buf); 5547 len = strlen(buf);
5548 5548
5549 encoding = oscar_encoding_check(buf); 5549 encoding = oscar_encoding_check(buf);
5550 if (encoding & AIM_IMFLAGS_UNICODE) { 5550 if (encoding & AIM_IMFLAGS_UNICODE) {
5551 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode chat\n"); 5551 gaim_debug_info("oscar", "Sending Unicode chat\n");
5552 charset = "unicode-2-0"; 5552 charset = "unicode-2-0";
5553 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err); 5553 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err);
5554 if (err) { 5554 if (err) {
5555 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 5555 gaim_debug_error("oscar",
5556 "Error converting to unicode-2-0: %s\n", err->message); 5556 "Error converting to unicode-2-0: %s\n", err->message);
5557 g_error_free(err); 5557 g_error_free(err);
5558 } 5558 }
5559 } else if (encoding & AIM_IMFLAGS_ISO_8859_1) { 5559 } else if (encoding & AIM_IMFLAGS_ISO_8859_1) {
5560 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending ISO-8859-1 chat\n"); 5560 gaim_debug_info("oscar", "Sending ISO-8859-1 chat\n");
5561 charset = "iso-8859-1"; 5561 charset = "iso-8859-1";
5562 buf2 = g_convert(buf, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); 5562 buf2 = g_convert(buf, len, "ISO-8859-1", "UTF-8", NULL, &len, &err);
5563 if (err) { 5563 if (err) {
5564 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 5564 gaim_debug_error("oscar",
5565 "Error converting to iso-8859-1: %s\n", err->message); 5565 "Error converting to iso-8859-1: %s\n", err->message);
5566 g_error_free(err); 5566 g_error_free(err);
5567 err = NULL; 5567 err = NULL;
5568 5568
5569 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Falling back to Unicode\n"); 5569 gaim_debug_info("oscar", "Falling back to Unicode\n");
5570 charset = "unicode-2-0"; 5570 charset = "unicode-2-0";
5571 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err); 5571 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err);
5572 if (err) { 5572 if (err) {
5573 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 5573 gaim_debug_error("oscar",
5574 "Error converting to unicode-2-0: %s\n", 5574 "Error converting to unicode-2-0: %s\n",
5575 err->message); 5575 err->message);
5576 g_error_free(err); 5576 g_error_free(err);
5577 } 5577 }
5578 } 5578 }
5809 char *buf = g_malloc(st.st_size); 5809 char *buf = g_malloc(st.st_size);
5810 FILE *file = fopen(iconfile, "rb"); 5810 FILE *file = fopen(iconfile, "rb");
5811 if (file) { 5811 if (file) {
5812 fread(buf, 1, st.st_size, file); 5812 fread(buf, 1, st.st_size, file);
5813 fclose(file); 5813 fclose(file);
5814 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5814 gaim_debug_info("oscar",
5815 "Uploading icon to icon server\n"); 5815 "Uploading icon to icon server\n");
5816 aim_bart_upload(od->sess, buf, st.st_size); 5816 aim_bart_upload(od->sess, buf, st.st_size);
5817 } else 5817 } else
5818 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 5818 gaim_debug_error("oscar",
5819 "Can't open buddy icon file!\n"); 5819 "Can't open buddy icon file!\n");
5820 g_free(buf); 5820 g_free(buf);
5821 } else { 5821 } else {
5822 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 5822 gaim_debug_error("oscar",
5823 "Can't stat buddy icon file!\n"); 5823 "Can't stat buddy icon file!\n");
5824 } 5824 }
5825 } 5825 }
5826 } else if (flags == 0x81) { 5826 } else if (flags == 0x81) {
5827 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); 5827 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc));
5862 aim_conn_close(listenerconn); 5862 aim_conn_close(listenerconn);
5863 aim_conn_kill(sess, &listenerconn); 5863 aim_conn_kill(sess, &listenerconn);
5864 5864
5865 sn = g_strdup(aim_odc_getsn(newconn)); 5865 sn = g_strdup(aim_odc_getsn(newconn));
5866 5866
5867 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5867 gaim_debug_info("oscar",
5868 "DirectIM: initiate success to %s\n", sn); 5868 "DirectIM: initiate success to %s\n", sn);
5869 dim = find_direct_im(od, sn); 5869 dim = find_direct_im(od, sn);
5870 5870
5871 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn); 5871 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn);
5872 gaim_input_remove(dim->watcher); 5872 gaim_input_remove(dim->watcher);
5966 encoding = va_arg(ap, int); 5966 encoding = va_arg(ap, int);
5967 isawaymsg = va_arg(ap, int); 5967 isawaymsg = va_arg(ap, int);
5968 va_end(ap); 5968 va_end(ap);
5969 msgend = msg + len; 5969 msgend = msg + len;
5970 5970
5971 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5971 gaim_debug_info("oscar",
5972 "Got DirectIM message from %s\n", sn); 5972 "Got DirectIM message from %s\n", sn);
5973 5973
5974 if (isawaymsg) 5974 if (isawaymsg)
5975 imflags |= GAIM_CONV_IM_AUTO_RESP; 5975 imflags |= GAIM_CONV_IM_AUTO_RESP;
5976 5976
6086 typing = va_arg(ap, int); 6086 typing = va_arg(ap, int);
6087 va_end(ap); 6087 va_end(ap);
6088 6088
6089 if (typing == 0x0002) { 6089 if (typing == 0x0002) {
6090 /* I had to leave this. It's just too funny. It reminds me of my sister. */ 6090 /* I had to leave this. It's just too funny. It reminds me of my sister. */
6091 gaim_debug(GAIM_DEBUG_INFO, "oscar", 6091 gaim_debug_info("oscar",
6092 "ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); 6092 "ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn);
6093 serv_got_typing(gc, sn, 0, GAIM_TYPING); 6093 serv_got_typing(gc, sn, 0, GAIM_TYPING);
6094 } else if (typing == 0x0001) 6094 } else if (typing == 0x0001)
6095 serv_got_typing(gc, sn, 0, GAIM_TYPED); 6095 serv_got_typing(gc, sn, 0, GAIM_TYPED);
6096 else 6096 else
6211 if (dim) { 6211 if (dim) {
6212 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ 6212 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */
6213 od->direct_ims = g_slist_remove(od->direct_ims, dim); 6213 od->direct_ims = g_slist_remove(od->direct_ims, dim);
6214 gaim_input_remove(dim->watcher); 6214 gaim_input_remove(dim->watcher);
6215 g_free(dim); 6215 g_free(dim);
6216 gaim_debug(GAIM_DEBUG_INFO, "oscar", 6216 gaim_debug_info("oscar",
6217 "Gave up on old direct IM, trying again\n"); 6217 "Gave up on old direct IM, trying again\n");
6218 } else { 6218 } else {
6219 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); 6219 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL);
6220 g_free(data->who); 6220 g_free(data->who);
6221 g_free(data); 6221 g_free(data);
6326 #ifdef NOSSI 6326 #ifdef NOSSI
6327 if (gc->account->perm_deny == 3) 6327 if (gc->account->perm_deny == 3)
6328 oscar_set_permit_deny(gc); 6328 oscar_set_permit_deny(gc);
6329 #else 6329 #else
6330 OscarData *od = (OscarData *)gc->proto_data; 6330 OscarData *od = (OscarData *)gc->proto_data;
6331 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); 6331 gaim_debug_info("oscar", "ssi: About to add a permit\n");
6332 if (od->sess->ssi.received_data) 6332 if (od->sess->ssi.received_data)
6333 aim_ssi_addpermit(od->sess, who); 6333 aim_ssi_addpermit(od->sess, who);
6334 #endif 6334 #endif
6335 } 6335 }
6336 6336
6338 #ifdef NOSSI 6338 #ifdef NOSSI
6339 if (gc->account->perm_deny == 4) 6339 if (gc->account->perm_deny == 4)
6340 oscar_set_permit_deny(gc); 6340 oscar_set_permit_deny(gc);
6341 #else 6341 #else
6342 OscarData *od = (OscarData *)gc->proto_data; 6342 OscarData *od = (OscarData *)gc->proto_data;
6343 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); 6343 gaim_debug_info("oscar", "ssi: About to add a deny\n");
6344 if (od->sess->ssi.received_data) 6344 if (od->sess->ssi.received_data)
6345 aim_ssi_adddeny(od->sess, who); 6345 aim_ssi_adddeny(od->sess, who);
6346 #endif 6346 #endif
6347 } 6347 }
6348 6348
6350 #ifdef NOSSI 6350 #ifdef NOSSI
6351 if (gc->account->perm_deny == 3) 6351 if (gc->account->perm_deny == 3)
6352 oscar_set_permit_deny(gc); 6352 oscar_set_permit_deny(gc);
6353 #else 6353 #else
6354 OscarData *od = (OscarData *)gc->proto_data; 6354 OscarData *od = (OscarData *)gc->proto_data;
6355 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); 6355 gaim_debug_info("oscar", "ssi: About to delete a permit\n");
6356 if (od->sess->ssi.received_data) 6356 if (od->sess->ssi.received_data)
6357 aim_ssi_delpermit(od->sess, who); 6357 aim_ssi_delpermit(od->sess, who);
6358 #endif 6358 #endif
6359 } 6359 }
6360 6360
6362 #ifdef NOSSI 6362 #ifdef NOSSI
6363 if (gc->account->perm_deny == 4) 6363 if (gc->account->perm_deny == 4)
6364 oscar_set_permit_deny(gc); 6364 oscar_set_permit_deny(gc);
6365 #else 6365 #else
6366 OscarData *od = (OscarData *)gc->proto_data; 6366 OscarData *od = (OscarData *)gc->proto_data;
6367 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); 6367 gaim_debug_info("oscar", "ssi: About to delete a deny\n");
6368 if (od->sess->ssi.received_data) 6368 if (od->sess->ssi.received_data)
6369 aim_ssi_deldeny(od->sess, who); 6369 aim_ssi_deldeny(od->sess, who);
6370 #endif 6370 #endif
6371 } 6371 }
6372 6372
6721 md5_append(state, buf, len); 6721 md5_append(state, buf, len);
6722 md5_finish(state, md5); 6722 md5_finish(state, md5);
6723 g_free(state); 6723 g_free(state);
6724 aim_ssi_seticon(sess, md5, 16); 6724 aim_ssi_seticon(sess, md5, 16);
6725 } else 6725 } else
6726 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 6726 gaim_debug_error("oscar",
6727 "Can't open buddy icon file!\n"); 6727 "Can't open buddy icon file!\n");
6728 g_free(buf); 6728 g_free(buf);
6729 } else 6729 } else
6730 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 6730 gaim_debug_error("oscar",
6731 "Can't stat buddy icon file!\n"); 6731 "Can't stat buddy icon file!\n");
6732 } 6732 }
6733 6733
6734 6734
6735 static GList *oscar_actions(GaimConnection *gc) 6735 static GList *oscar_actions(GaimConnection *gc)