| 498 } |
498 } |
| 499 |
499 |
| 500 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
500 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
| 501 aim_conn_t *conn = (aim_conn_t *)data; |
501 aim_conn_t *conn = (aim_conn_t *)data; |
| 502 aim_session_t *sess = aim_conn_getsess(conn); |
502 aim_session_t *sess = aim_conn_getsess(conn); |
| 503 struct gaim_connection *gc = sess ? sess->aux_data : NULL; |
503 GaimConnection *gc = sess ? sess->aux_data : NULL; |
| 504 struct oscar_data *od; |
504 struct oscar_data *od; |
| 505 |
505 |
| 506 if (!gc) { |
506 if (!gc) { |
| 507 /* gc is null. we return, else we seg SIGSEG on next line. */ |
507 /* gc is null. we return, else we seg SIGSEG on next line. */ |
| 508 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
508 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 611 |
611 |
| 612 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
612 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
| 613 char *s = g_strdup_vprintf(format, va); |
613 char *s = g_strdup_vprintf(format, va); |
| 614 char buf[256]; |
614 char buf[256]; |
| 615 char *t; |
615 char *t; |
| 616 struct gaim_connection *gc = sess->aux_data; |
616 GaimConnection *gc = sess->aux_data; |
| 617 |
617 |
| 618 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level); |
618 g_snprintf(buf, sizeof(buf), "%s %d: ", gaim_account_get_username(gaim_connection_get_account(gc)), level); |
| 619 t = g_strconcat(buf, s, NULL); |
619 t = g_strconcat(buf, s, NULL); |
| 620 gaim_debug(GAIM_DEBUG_INFO, "oscar", t); |
620 gaim_debug(GAIM_DEBUG_INFO, "oscar", t); |
| 621 if (t[strlen(t)-1] != '\n') |
621 if (t[strlen(t)-1] != '\n') |
| 622 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
622 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
| 623 g_free(t); |
623 g_free(t); |
| 624 g_free(s); |
624 g_free(s); |
| 625 } |
625 } |
| 626 |
626 |
| 627 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
627 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
| 628 { |
628 { |
| 629 struct gaim_connection *gc = data; |
629 GaimConnection *gc = data; |
| 630 struct oscar_data *od; |
630 struct oscar_data *od; |
| 631 aim_session_t *sess; |
631 aim_session_t *sess; |
| 632 aim_conn_t *conn; |
632 aim_conn_t *conn; |
| 633 |
633 |
| 634 if (!g_slist_find(connections, gc)) { |
634 if (!g_slist_find(connections, gc)) { |
| 652 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
652 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
| 653 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
653 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 654 "Password sent, waiting for response\n"); |
654 "Password sent, waiting for response\n"); |
| 655 } |
655 } |
| 656 |
656 |
| 657 static void oscar_login(struct gaim_account *account) { |
657 static void oscar_login(GaimAccount *account) { |
| 658 aim_session_t *sess; |
658 aim_session_t *sess; |
| 659 aim_conn_t *conn; |
659 aim_conn_t *conn; |
| 660 char buf[256]; |
660 char buf[256]; |
| 661 struct gaim_connection *gc = new_gaim_conn(account); |
661 GaimConnection *gc = gaim_account_get_connection(account); |
| 662 struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1); |
662 struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1); |
| 663 |
663 |
| 664 gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); |
664 gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); |
| 665 |
665 |
| 666 if (isdigit(*account->username)) { |
666 if (isdigit(*(gaim_account_get_username(account)))) { |
| 667 od->icq = TRUE; |
667 od->icq = TRUE; |
| 668 gc->password[8] = 0; |
|
| 669 } else { |
668 } else { |
| 670 gc->flags |= OPT_CONN_HTML; |
669 gc->flags |= OPT_CONN_HTML; |
| 671 gc->flags |= OPT_CONN_AUTO_RESP; |
670 gc->flags |= OPT_CONN_AUTO_RESP; |
| 672 } |
671 } |
| 673 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
672 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
| 690 hide_login_progress(gc, _("Unable to login to AIM")); |
689 hide_login_progress(gc, _("Unable to login to AIM")); |
| 691 signoff(gc); |
690 signoff(gc); |
| 692 return; |
691 return; |
| 693 } |
692 } |
| 694 |
693 |
| 695 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); |
694 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account)); |
| 696 set_login_progress(gc, 2, buf); |
695 set_login_progress(gc, 2, buf); |
| 697 |
696 |
| 698 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
697 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
| 699 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
698 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
| 700 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); |
699 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); |
| 701 |
700 |
| 702 conn->status |= AIM_CONN_STATUS_INPROGRESS; |
701 conn->status |= AIM_CONN_STATUS_INPROGRESS; |
| 703 if (proxy_connect(account, account->proto_opt[USEROPT_AUTH][0] ? |
702 if (proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
| 704 account->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER, |
703 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
| 705 account->proto_opt[USEROPT_AUTHPORT][0] ? |
704 oscar_login_connect, gc) < 0) { |
| 706 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, |
|
| 707 oscar_login_connect, gc) < 0) { |
|
| 708 hide_login_progress(gc, _("Couldn't connect to host")); |
705 hide_login_progress(gc, _("Couldn't connect to host")); |
| 709 signoff(gc); |
706 signoff(gc); |
| 710 return; |
707 return; |
| 711 } |
708 } |
| 712 aim_request_login(sess, conn, gc->username); |
709 aim_request_login(sess, conn, gaim_account_get_username(account)); |
| 713 } |
710 } |
| 714 |
711 |
| 715 static void oscar_close(struct gaim_connection *gc) { |
712 static void oscar_close(GaimConnection *gc) { |
| 716 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
713 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 717 |
714 |
| 718 while (od->oscar_chats) { |
715 while (od->oscar_chats) { |
| 719 struct chat_connection *n = od->oscar_chats->data; |
716 struct chat_connection *n = od->oscar_chats->data; |
| 720 if (n->inpa > 0) |
717 if (n->inpa > 0) |
| 780 gc->proto_data = NULL; |
777 gc->proto_data = NULL; |
| 781 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
778 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
| 782 } |
779 } |
| 783 |
780 |
| 784 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
781 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
| 785 struct gaim_connection *gc = data; |
782 GaimConnection *gc = data; |
| 786 struct oscar_data *od; |
783 struct oscar_data *od; |
| 787 aim_session_t *sess; |
784 aim_session_t *sess; |
| 788 aim_conn_t *bosconn; |
785 aim_conn_t *bosconn; |
| 789 |
786 |
| 790 if (!g_slist_find(connections, gc)) { |
787 if (!g_slist_find(connections, gc)) { |
| 880 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
877 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
| 881 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
878 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
| 882 if (oft_info->conn) { |
879 if (oft_info->conn) { |
| 883 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; |
880 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; |
| 884 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); |
881 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); |
| 885 oft_info->conn->fd = xfer->fd = proxy_connect(gc->account, xfer->remote_ip, xfer->remote_port, oscar_sendfile_connected, xfer); |
882 oft_info->conn->fd = xfer->fd = proxy_connect(gaim_connection_get_account(gc), xfer->remote_ip, xfer->remote_port, |
| |
883 oscar_sendfile_connected, xfer); |
| 886 if (xfer->fd == -1) { |
884 if (xfer->fd == -1) { |
| 887 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
885 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
| 888 _("Unable to establish file descriptor.")); |
886 _("Unable to establish file descriptor.")); |
| 889 /* gaim_xfer_cancel_remote(xfer); */ |
887 /* gaim_xfer_cancel_remote(xfer); */ |
| 890 } |
888 } |
| 906 } |
904 } |
| 907 |
905 |
| 908 static void oscar_xfer_end(struct gaim_xfer *xfer) |
906 static void oscar_xfer_end(struct gaim_xfer *xfer) |
| 909 { |
907 { |
| 910 struct aim_oft_info *oft_info = xfer->data; |
908 struct aim_oft_info *oft_info = xfer->data; |
| 911 struct gaim_connection *gc = oft_info->sess->aux_data; |
909 GaimConnection *gc = oft_info->sess->aux_data; |
| 912 struct oscar_data *od = gc->proto_data; |
910 struct oscar_data *od = gc->proto_data; |
| 913 |
911 |
| 914 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
912 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
| 915 |
913 |
| 916 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
914 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
| 925 } |
923 } |
| 926 |
924 |
| 927 static void oscar_xfer_cancel_send(struct gaim_xfer *xfer) |
925 static void oscar_xfer_cancel_send(struct gaim_xfer *xfer) |
| 928 { |
926 { |
| 929 struct aim_oft_info *oft_info = xfer->data; |
927 struct aim_oft_info *oft_info = xfer->data; |
| 930 struct gaim_connection *gc = oft_info->sess->aux_data; |
928 GaimConnection *gc = oft_info->sess->aux_data; |
| 931 struct oscar_data *od = gc->proto_data; |
929 struct oscar_data *od = gc->proto_data; |
| 932 |
930 |
| 933 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
931 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 934 "AAA - in oscar_xfer_cancel_send\n"); |
932 "AAA - in oscar_xfer_cancel_send\n"); |
| 935 |
933 |
| 942 } |
940 } |
| 943 |
941 |
| 944 static void oscar_xfer_cancel_recv(struct gaim_xfer *xfer) |
942 static void oscar_xfer_cancel_recv(struct gaim_xfer *xfer) |
| 945 { |
943 { |
| 946 struct aim_oft_info *oft_info = xfer->data; |
944 struct aim_oft_info *oft_info = xfer->data; |
| 947 struct gaim_connection *gc = oft_info->sess->aux_data; |
945 GaimConnection *gc = oft_info->sess->aux_data; |
| 948 struct oscar_data *od = gc->proto_data; |
946 struct oscar_data *od = gc->proto_data; |
| 949 |
947 |
| 950 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
948 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 951 "AAA - in oscar_xfer_cancel_recv\n"); |
949 "AAA - in oscar_xfer_cancel_recv\n"); |
| 952 |
950 |
| 1013 } |
1011 } |
| 1014 |
1012 |
| 1015 return NULL; |
1013 return NULL; |
| 1016 } |
1014 } |
| 1017 |
1015 |
| 1018 static void oscar_ask_sendfile(struct gaim_connection *gc, const char *destsn) { |
1016 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
| 1019 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
1017 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 1020 struct gaim_xfer *xfer; |
1018 struct gaim_xfer *xfer; |
| 1021 struct aim_oft_info *oft_info; |
1019 struct aim_oft_info *oft_info; |
| 1022 aim_conn_t *conn; |
1020 aim_conn_t *conn; |
| 1023 |
1021 |
| 1024 /* You want to send a file to someone else, you're so generous */ |
1022 /* You want to send a file to someone else, you're so generous */ |
| 1025 |
1023 |
| 1026 /* Build the file transfer handle */ |
1024 /* Build the file transfer handle */ |
| 1027 xfer = gaim_xfer_new(gc->account, GAIM_XFER_SEND, destsn); |
1025 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
| 1028 if ((conn = aim_conn_findbygroup(od->sess, 0x0004))) |
1026 if ((conn = aim_conn_findbygroup(od->sess, 0x0004))) |
| 1029 xfer->local_ip = gaim_getip_from_fd(conn->fd); |
1027 xfer->local_ip = gaim_getip_from_fd(conn->fd); |
| 1030 xfer->local_port = 5190; |
1028 xfer->local_port = 5190; |
| 1031 |
1029 |
| 1032 /* Create the oscar-specific data */ |
1030 /* Create the oscar-specific data */ |
| 1051 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
1049 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 1052 va_list ap; |
1050 va_list ap; |
| 1053 struct aim_authresp_info *info; |
1051 struct aim_authresp_info *info; |
| 1054 int i, rc; |
1052 int i, rc; |
| 1055 char *host; int port; |
1053 char *host; int port; |
| 1056 struct gaim_account *account; |
1054 GaimAccount *account; |
| 1057 aim_conn_t *bosconn; |
1055 aim_conn_t *bosconn; |
| 1058 |
1056 |
| 1059 struct gaim_connection *gc = sess->aux_data; |
1057 GaimConnection *gc = sess->aux_data; |
| 1060 struct oscar_data *od = gc->proto_data; |
1058 struct oscar_data *od = gc->proto_data; |
| 1061 account = gc->account; |
1059 account = gc->account; |
| 1062 port = account->proto_opt[USEROPT_AUTHPORT][0] ? |
1060 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
| 1063 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, |
|
| 1064 |
1061 |
| 1065 va_start(ap, fr); |
1062 va_start(ap, fr); |
| 1066 info = va_arg(ap, struct aim_authresp_info *); |
1063 info = va_arg(ap, struct aim_authresp_info *); |
| 1067 va_end(ap); |
1064 va_end(ap); |
| 1068 |
1065 |
| 1352 } |
1349 } |
| 1353 |
1350 |
| 1354 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
1351 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 1355 char *key; |
1352 char *key; |
| 1356 va_list ap; |
1353 va_list ap; |
| 1357 struct gaim_connection *gc = sess->aux_data; |
1354 GaimConnection *gc = sess->aux_data; |
| |
1355 GaimAccount *ac = gaim_connection_get_account(gc); |
| |
1356 char pass[9]; |
| 1358 struct oscar_data *od = gc->proto_data; |
1357 struct oscar_data *od = gc->proto_data; |
| 1359 |
1358 |
| 1360 va_start(ap, fr); |
1359 va_start(ap, fr); |
| 1361 key = va_arg(ap, char *); |
1360 key = va_arg(ap, char *); |
| 1362 va_end(ap); |
1361 va_end(ap); |
| 1363 |
1362 |
| |
1363 /* Truncate the password at 8 characters */ |
| |
1364 g_snprintf(pass, sizeof(pass), gaim_account_get_password(ac)); |
| |
1365 |
| 1364 if (od->icq) { |
1366 if (od->icq) { |
| 1365 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
1367 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
| 1366 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key); |
1368 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), pass, &info, key); |
| 1367 } else { |
1369 } else { |
| 1368 #if 0 |
1370 #if 0 |
| 1369 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; |
1371 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; |
| 1370 #endif |
1372 #endif |
| 1371 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; |
1373 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; |
| 1372 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key); |
1374 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), pass, &info, key); |
| 1373 } |
1375 } |
| 1374 |
1376 |
| 1375 return 1; |
1377 return 1; |
| 1376 } |
1378 } |
| 1377 |
1379 |
| 1378 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
1380 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 1379 struct gaim_connection *gc = sess->aux_data; |
1381 GaimConnection *gc = sess->aux_data; |
| 1380 struct chat_connection *chatcon; |
1382 struct chat_connection *chatcon; |
| 1381 static int id = 1; |
1383 static int id = 1; |
| 1382 |
1384 |
| 1383 aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0); |
1385 aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0); |
| 1384 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
1386 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
| 1418 |
1420 |
| 1419 return 1; |
1421 return 1; |
| 1420 } |
1422 } |
| 1421 |
1423 |
| 1422 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
1424 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 1423 struct gaim_connection *gc = sess->aux_data; |
1425 GaimConnection *gc = sess->aux_data; |
| 1424 struct oscar_data *od = gc->proto_data; |
1426 struct oscar_data *od = gc->proto_data; |
| 1425 |
1427 |
| 1426 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); |
1428 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); |
| 1427 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); |
1429 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); |
| 1428 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); |
1430 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); |
| 1437 |
1439 |
| 1438 return 1; |
1440 return 1; |
| 1439 } |
1441 } |
| 1440 |
1442 |
| 1441 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
1443 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
| 1442 struct gaim_connection *gc = data; |
1444 GaimConnection *gc = data; |
| 1443 struct oscar_data *od; |
1445 struct oscar_data *od; |
| 1444 aim_session_t *sess; |
1446 aim_session_t *sess; |
| 1445 aim_conn_t *tstconn; |
1447 aim_conn_t *tstconn; |
| 1446 |
1448 |
| 1447 if (!g_slist_find(connections, gc)) { |
1449 if (!g_slist_find(connections, gc)) { |
| 1466 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
1468 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
| 1467 } |
1469 } |
| 1468 |
1470 |
| 1469 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
1471 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
| 1470 { |
1472 { |
| 1471 struct gaim_connection *gc = data; |
1473 GaimConnection *gc = data; |
| 1472 struct oscar_data *od; |
1474 struct oscar_data *od; |
| 1473 aim_session_t *sess; |
1475 aim_session_t *sess; |
| 1474 aim_conn_t *tstconn; |
1476 aim_conn_t *tstconn; |
| 1475 |
1477 |
| 1476 if (!g_slist_find(connections, gc)) { |
1478 if (!g_slist_find(connections, gc)) { |
| 1496 } |
1498 } |
| 1497 |
1499 |
| 1498 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
1500 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
| 1499 { |
1501 { |
| 1500 struct chat_connection *ccon = data; |
1502 struct chat_connection *ccon = data; |
| 1501 struct gaim_connection *gc = ccon->gc; |
1503 GaimConnection *gc = ccon->gc; |
| 1502 struct oscar_data *od; |
1504 struct oscar_data *od; |
| 1503 aim_session_t *sess; |
1505 aim_session_t *sess; |
| 1504 aim_conn_t *tstconn; |
1506 aim_conn_t *tstconn; |
| 1505 |
1507 |
| 1506 if (!g_slist_find(connections, gc)) { |
1508 if (!g_slist_find(connections, gc)) { |
| 1528 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
1530 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
| 1529 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); |
1531 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); |
| 1530 } |
1532 } |
| 1531 |
1533 |
| 1532 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
1534 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
| 1533 struct gaim_connection *gc = data; |
1535 GaimConnection *gc = data; |
| 1534 struct oscar_data *od; |
1536 struct oscar_data *od; |
| 1535 aim_session_t *sess; |
1537 aim_session_t *sess; |
| 1536 aim_conn_t *tstconn; |
1538 aim_conn_t *tstconn; |
| 1537 |
1539 |
| 1538 if (!g_slist_find(connections, gc)) { |
1540 if (!g_slist_find(connections, gc)) { |
| 1557 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
1559 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 1558 "email: connected\n"); |
1560 "email: connected\n"); |
| 1559 } |
1561 } |
| 1560 |
1562 |
| 1561 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
1563 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
| 1562 struct gaim_connection *gc = data; |
1564 GaimConnection *gc = data; |
| 1563 struct oscar_data *od; |
1565 struct oscar_data *od; |
| 1564 aim_session_t *sess; |
1566 aim_session_t *sess; |
| 1565 aim_conn_t *tstconn; |
1567 aim_conn_t *tstconn; |
| 1566 |
1568 |
| 1567 if (!g_slist_find(connections, gc)) { |
1569 if (!g_slist_find(connections, gc)) { |
| 1586 gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); |
1588 gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); |
| 1587 } |
1589 } |
| 1588 |
1590 |
| 1589 /* Hrmph. I don't know how to make this look better. --mid */ |
1591 /* Hrmph. I don't know how to make this look better. --mid */ |
| 1590 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
1592 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 1591 struct gaim_connection *gc = sess->aux_data; |
1593 GaimConnection *gc = sess->aux_data; |
| 1592 struct gaim_account *account = gc->account; |
1594 GaimAccount *account = gaim_connection_get_account(gc); |
| 1593 aim_conn_t *tstconn; |
1595 aim_conn_t *tstconn; |
| 1594 int i; |
1596 int i; |
| 1595 char *host; |
1597 char *host; |
| 1596 int port; |
1598 int port; |
| 1597 va_list ap; |
1599 va_list ap; |
| 1598 struct aim_redirect_data *redir; |
1600 struct aim_redirect_data *redir; |
| 1599 |
1601 |
| 1600 port = account->proto_opt[USEROPT_AUTHPORT][0] ? |
1602 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
| 1601 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, |
|
| 1602 |
1603 |
| 1603 va_start(ap, fr); |
1604 va_start(ap, fr); |
| 1604 redir = va_arg(ap, struct aim_redirect_data *); |
1605 redir = va_arg(ap, struct aim_redirect_data *); |
| 1605 va_end(ap); |
1606 va_end(ap); |
| 1606 |
1607 |
| 1805 } |
1806 } |
| 1806 |
1807 |
| 1807 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
1808 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
| 1808 signon = time(NULL) - info->sessionlen; |
1809 signon = time(NULL) - info->sessionlen; |
| 1809 |
1810 |
| 1810 if (!aim_sncmp(gc->username, info->sn)) |
1811 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
| 1811 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn); |
1812 gaim_connection_set_display_name(gc, info->sn); |
| 1812 |
1813 |
| 1813 bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn)); |
1814 bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn)); |
| 1814 if (!bi) { |
1815 if (!bi) { |
| 1815 bi = g_new0(struct buddyinfo, 1); |
1816 bi = g_new0(struct buddyinfo, 1); |
| 1816 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi); |
1817 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi); |
| 1872 g_free(d); |
1873 g_free(d); |
| 1873 } |
1874 } |
| 1874 |
1875 |
| 1875 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
1876 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
| 1876 struct direct_im *dim = data; |
1877 struct direct_im *dim = data; |
| 1877 struct gaim_connection *gc = dim->gc; |
1878 GaimConnection *gc = dim->gc; |
| 1878 struct oscar_data *od = gc->proto_data; |
1879 struct oscar_data *od = gc->proto_data; |
| 1879 struct gaim_conversation *cnv; |
1880 struct gaim_conversation *cnv; |
| 1880 char buf[256]; |
1881 char buf[256]; |
| 1881 struct sockaddr name; |
1882 struct sockaddr name; |
| 1882 socklen_t name_len = 1; |
1883 socklen_t name_len = 1; |
| 1912 * This is called after a remote AIM user has connected to us. We |
1913 * This is called after a remote AIM user has connected to us. We |
| 1913 * want to do some voodoo with the socket file descriptors, add a |
1914 * want to do some voodoo with the socket file descriptors, add a |
| 1914 * callback or two, and then send the AIM_CB_OFT_PROMPT. |
1915 * callback or two, and then send the AIM_CB_OFT_PROMPT. |
| 1915 */ |
1916 */ |
| 1916 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
1917 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 1917 struct gaim_connection *gc = sess->aux_data; |
1918 GaimConnection *gc = sess->aux_data; |
| 1918 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
1919 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 1919 struct gaim_xfer *xfer; |
1920 struct gaim_xfer *xfer; |
| 1920 struct aim_oft_info *oft_info; |
1921 struct aim_oft_info *oft_info; |
| 1921 va_list ap; |
1922 va_list ap; |
| 1922 aim_conn_t *conn, *listenerconn; |
1923 aim_conn_t *conn, *listenerconn; |
| 1985 * are sending a file to you, and you have just established a connection to them. |
1986 * are sending a file to you, and you have just established a connection to them. |
| 1986 * You should send them the exact same info except use the real cookie. We also |
1987 * You should send them the exact same info except use the real cookie. We also |
| 1987 * get like totally ready to like, receive the file, kay? |
1988 * get like totally ready to like, receive the file, kay? |
| 1988 */ |
1989 */ |
| 1989 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
1990 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 1990 struct gaim_connection *gc = sess->aux_data; |
1991 GaimConnection *gc = sess->aux_data; |
| 1991 struct oscar_data *od = gc->proto_data; |
1992 struct oscar_data *od = gc->proto_data; |
| 1992 struct gaim_xfer *xfer; |
1993 struct gaim_xfer *xfer; |
| 1993 struct aim_oft_info *oft_info; |
1994 struct aim_oft_info *oft_info; |
| 1994 va_list ap; |
1995 va_list ap; |
| 1995 aim_conn_t *conn; |
1996 aim_conn_t *conn; |
| 2030 /* |
2031 /* |
| 2031 * We are sending a file to someone else. They have just acknowledged our |
2032 * We are sending a file to someone else. They have just acknowledged our |
| 2032 * prompt, so we want to start sending data like there's no tomorrow. |
2033 * prompt, so we want to start sending data like there's no tomorrow. |
| 2033 */ |
2034 */ |
| 2034 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2035 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 2035 struct gaim_connection *gc = sess->aux_data; |
2036 GaimConnection *gc = sess->aux_data; |
| 2036 struct oscar_data *od = gc->proto_data; |
2037 struct oscar_data *od = gc->proto_data; |
| 2037 struct gaim_xfer *xfer; |
2038 struct gaim_xfer *xfer; |
| 2038 va_list ap; |
2039 va_list ap; |
| 2039 aim_conn_t *conn; |
2040 aim_conn_t *conn; |
| 2040 fu8_t *cookie; |
2041 fu8_t *cookie; |
| 2062 /* |
2063 /* |
| 2063 * We just sent a file to someone. They said they got it and everything, |
2064 * We just sent a file to someone. They said they got it and everything, |
| 2064 * so we can close our direct connection and what not. |
2065 * so we can close our direct connection and what not. |
| 2065 */ |
2066 */ |
| 2066 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { |
2067 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 2067 struct gaim_connection *gc = sess->aux_data; |
2068 GaimConnection *gc = sess->aux_data; |
| 2068 struct oscar_data *od = gc->proto_data; |
2069 struct oscar_data *od = gc->proto_data; |
| 2069 struct gaim_xfer *xfer; |
2070 struct gaim_xfer *xfer; |
| 2070 va_list ap; |
2071 va_list ap; |
| 2071 aim_conn_t *conn; |
2072 aim_conn_t *conn; |
| 2072 fu8_t *cookie; |
2073 fu8_t *cookie; |
| 2146 |
2147 |
| 2147 return; |
2148 return; |
| 2148 } |
2149 } |
| 2149 |
2150 |
| 2150 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
2151 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
| 2151 struct gaim_connection *gc = sess->aux_data; |
2152 GaimConnection *gc = sess->aux_data; |
| 2152 struct oscar_data *od = gc->proto_data; |
2153 struct oscar_data *od = gc->proto_data; |
| 2153 char *tmp; |
2154 char *tmp; |
| 2154 int flags = 0; |
2155 int flags = 0; |
| 2155 int convlen; |
2156 int convlen; |
| 2156 GError *err = NULL; |
2157 GError *err = NULL; |
| 2157 struct buddyinfo *bi; |
2158 struct buddyinfo *bi; |
| |
2159 const char *iconfile; |
| 2158 |
2160 |
| 2159 bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn)); |
2161 bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn)); |
| 2160 if (!bi) { |
2162 if (!bi) { |
| 2161 bi = g_new0(struct buddyinfo, 1); |
2163 bi = g_new0(struct buddyinfo, 1); |
| 2162 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(userinfo->sn)), bi); |
2164 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(userinfo->sn)), bi); |
| 2179 bi->ico_csum = args->iconsum; |
2181 bi->ico_csum = args->iconsum; |
| 2180 bi->ico_time = args->iconstamp; |
2182 bi->ico_time = args->iconstamp; |
| 2181 } |
2183 } |
| 2182 } |
2184 } |
| 2183 |
2185 |
| 2184 if (gc->account->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { |
2186 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && |
| |
2187 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { |
| 2185 FILE *file; |
2188 FILE *file; |
| 2186 struct stat st; |
2189 struct stat st; |
| 2187 |
2190 |
| 2188 if (!stat(gc->account->iconfile, &st)) { |
2191 if (!stat(iconfile, &st)) { |
| 2189 char *buf = g_malloc(st.st_size); |
2192 char *buf = g_malloc(st.st_size); |
| 2190 file = fopen(gc->account->iconfile, "rb"); |
2193 file = fopen(iconfile, "rb"); |
| 2191 if (file) { |
2194 if (file) { |
| 2192 int len = fread(buf, 1, st.st_size, file); |
2195 int len = fread(buf, 1, st.st_size, file); |
| 2193 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
2196 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 2194 "Sending buddy icon to %s (%d bytes, " |
2197 "Sending buddy icon to %s (%d bytes, " |
| 2195 "%lu reported)\n", |
2198 "%lu reported)\n", |
| 2258 |
2261 |
| 2259 return 1; |
2262 return 1; |
| 2260 } |
2263 } |
| 2261 |
2264 |
| 2262 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
2265 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
| 2263 struct gaim_connection *gc = sess->aux_data; |
2266 GaimConnection *gc = sess->aux_data; |
| 2264 struct oscar_data *od = gc->proto_data; |
2267 struct oscar_data *od = gc->proto_data; |
| |
2268 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); |
| 2265 |
2269 |
| 2266 if (!args) |
2270 if (!args) |
| 2267 return 0; |
2271 return 0; |
| 2268 |
2272 |
| 2269 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
2273 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
| 2384 return 1; |
2388 return 1; |
| 2385 } |
2389 } |
| 2386 |
2390 |
| 2387 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
2391 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 2388 "%s received direct im request from %s (%s)\n", |
2392 "%s received direct im request from %s (%s)\n", |
| 2389 gc->username, userinfo->sn, args->verifiedip); |
2393 username, userinfo->sn, args->verifiedip); |
| 2390 |
2394 |
| 2391 d->gc = gc; |
2395 d->gc = gc; |
| 2392 d->sn = g_strdup(userinfo->sn); |
2396 d->sn = g_strdup(userinfo->sn); |
| 2393 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2397 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
| 2394 memcpy(d->cookie, args->cookie, 8); |
2398 memcpy(d->cookie, args->cookie, 8); |
| 2395 g_snprintf(buf, sizeof buf, _("%s has just asked to directly connect to %s"), userinfo->sn, gc->username); |
2399 g_snprintf(buf, sizeof buf, _("%s has just asked to directly connect to %s"), userinfo->sn, username); |
| 2396 |
2400 |
| 2397 gaim_request_action(gc, NULL, buf, |
2401 gaim_request_action(gc, NULL, buf, |
| 2398 _("This requires a direct connection between " |
2402 _("This requires a direct connection between " |
| 2399 "the two computers and is necessary for IM " |
2403 "the two computers and is necessary for IM " |
| 2400 "Images. Because your IP address will be " |
2404 "Images. Because your IP address will be " |
| 2415 * Most of these are callbacks from dialogs. They're used by both |
2419 * Most of these are callbacks from dialogs. They're used by both |
| 2416 * methods of authorization (SSI and old-school channel 4 ICBM) |
2420 * methods of authorization (SSI and old-school channel 4 ICBM) |
| 2417 */ |
2421 */ |
| 2418 /* When you ask other people for authorization */ |
2422 /* When you ask other people for authorization */ |
| 2419 static void gaim_auth_request(struct name_data *data, char *msg) { |
2423 static void gaim_auth_request(struct name_data *data, char *msg) { |
| 2420 struct gaim_connection *gc = data->gc; |
2424 GaimConnection *gc = data->gc; |
| 2421 |
2425 |
| 2422 if (g_slist_find(connections, gc)) { |
2426 if (g_slist_find(connections, gc)) { |
| 2423 struct oscar_data *od = gc->proto_data; |
2427 struct oscar_data *od = gc->proto_data; |
| 2424 struct buddy *buddy = gaim_find_buddy(gc->account, data->name); |
2428 struct buddy *buddy = gaim_find_buddy(gc->account, data->name); |
| 2425 struct group *group = gaim_find_buddys_group(buddy); |
2429 struct group *group = gaim_find_buddys_group(buddy); |
| 2441 _("Cancel"), G_CALLBACK(gaim_free_name_data), |
2445 _("Cancel"), G_CALLBACK(gaim_free_name_data), |
| 2442 data); |
2446 data); |
| 2443 } |
2447 } |
| 2444 |
2448 |
| 2445 static void gaim_auth_dontrequest(struct name_data *data) { |
2449 static void gaim_auth_dontrequest(struct name_data *data) { |
| 2446 struct gaim_connection *gc = data->gc; |
2450 GaimConnection *gc = data->gc; |
| 2447 |
2451 |
| 2448 if (g_slist_find(connections, gc)) { |
2452 if (g_slist_find(connections, gc)) { |
| 2449 /* struct oscar_data *od = gc->proto_data; */ |
2453 /* struct oscar_data *od = gc->proto_data; */ |
| 2450 /* XXX - Take the buddy out of our buddy list */ |
2454 /* XXX - Take the buddy out of our buddy list */ |
| 2451 } |
2455 } |
| 2452 |
2456 |
| 2453 gaim_free_name_data(data); |
2457 gaim_free_name_data(data); |
| 2454 } |
2458 } |
| 2455 |
2459 |
| 2456 static void gaim_auth_sendrequest(struct gaim_connection *gc, const char *name) { |
2460 static void gaim_auth_sendrequest(GaimConnection *gc, const char *name) { |
| 2457 struct name_data *data = g_new(struct name_data, 1); |
2461 struct name_data *data = g_new(struct name_data, 1); |
| 2458 struct buddy *buddy; |
2462 struct buddy *buddy; |
| 2459 gchar *dialog_msg, *nombre; |
2463 gchar *dialog_msg, *nombre; |
| 2460 |
2464 |
| 2461 buddy = gaim_find_buddy(gc->account, name); |
2465 buddy = gaim_find_buddy(gc->account, name); |
| 2500 gaim_free_name_data(data); |
2504 gaim_free_name_data(data); |
| 2501 } |
2505 } |
| 2502 |
2506 |
| 2503 /* When other people ask you for authorization */ |
2507 /* When other people ask you for authorization */ |
| 2504 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
2508 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
| 2505 struct gaim_connection *gc = data->gc; |
2509 GaimConnection *gc = data->gc; |
| 2506 |
2510 |
| 2507 if (g_slist_find(connections, gc)) { |
2511 if (g_slist_find(connections, gc)) { |
| 2508 struct oscar_data *od = gc->proto_data; |
2512 struct oscar_data *od = gc->proto_data; |
| 2509 #ifdef NOSSI |
2513 #ifdef NOSSI |
| 2510 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
2514 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
| 2522 data); |
2526 data); |
| 2523 } |
2527 } |
| 2524 |
2528 |
| 2525 /* When someone sends you contacts */ |
2529 /* When someone sends you contacts */ |
| 2526 static void gaim_icq_contactadd(struct name_data *data) { |
2530 static void gaim_icq_contactadd(struct name_data *data) { |
| 2527 struct gaim_connection *gc = data->gc; |
2531 GaimConnection *gc = data->gc; |
| 2528 |
2532 |
| 2529 if (g_slist_find(connections, gc)) { |
2533 if (g_slist_find(connections, gc)) { |
| 2530 show_add_buddy(gc, data->name, NULL, data->nick); |
2534 show_add_buddy(gc, data->name, NULL, data->nick); |
| 2531 } |
2535 } |
| 2532 |
2536 |
| 2533 gaim_free_name_data(data); |
2537 gaim_free_name_data(data); |
| 2534 } |
2538 } |
| 2535 |
2539 |
| 2536 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) { |
2540 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) { |
| 2537 struct gaim_connection *gc = sess->aux_data; |
2541 GaimConnection *gc = sess->aux_data; |
| 2538 gchar **msg1, **msg2; |
2542 gchar **msg1, **msg2; |
| 2539 GError *err = NULL; |
2543 GError *err = NULL; |
| 2540 int i; |
2544 int i; |
| 2541 |
2545 |
| 2542 if (!args->type || !args->msg || !args->uin) |
2546 if (!args->type || !args->msg || !args->uin) |
| 2829 else |
2833 else |
| 2830 return g_strdup_printf(_("Online")); |
2834 return g_strdup_printf(_("Online")); |
| 2831 } |
2835 } |
| 2832 |
2836 |
| 2833 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
2837 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
| 2834 struct gaim_connection *gc = sess->aux_data; |
2838 GaimConnection *gc = sess->aux_data; |
| 2835 struct oscar_data *od = gc->proto_data; |
2839 struct oscar_data *od = gc->proto_data; |
| 2836 |
2840 |
| 2837 /* BBB */ |
2841 /* BBB */ |
| 2838 switch (reason) { |
2842 switch (reason) { |
| 2839 case 3: { /* Decline sendfile. */ |
2843 case 3: { /* Decline sendfile. */ |
| 2854 |
2858 |
| 2855 return 0; |
2859 return 0; |
| 2856 } |
2860 } |
| 2857 |
2861 |
| 2858 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
2862 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
| 2859 struct gaim_connection *gc = sess->aux_data; |
2863 GaimConnection *gc = sess->aux_data; |
| 2860 |
2864 |
| 2861 switch(reason) { |
2865 switch(reason) { |
| 2862 case 0x0003: { /* Reply from an ICQ status message request */ |
2866 case 0x0003: { /* Reply from an ICQ status message request */ |
| 2863 char *status_msg = gaim_icq_status(state); |
2867 char *status_msg = gaim_icq_status(state); |
| 2864 char *dialog_msg, **splitmsg; |
2868 char *dialog_msg, **splitmsg; |
| 3130 } |
3134 } |
| 3131 return buf; |
3135 return buf; |
| 3132 } |
3136 } |
| 3133 |
3137 |
| 3134 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
3138 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 3135 struct gaim_connection *gc = sess->aux_data; |
3139 GaimConnection *gc = sess->aux_data; |
| 3136 struct oscar_data *od = gc->proto_data; |
3140 struct oscar_data *od = gc->proto_data; |
| 3137 gchar *header; |
3141 gchar *header; |
| 3138 GSList *l = od->evilhack; |
3142 GSList *l = od->evilhack; |
| 3139 gboolean evilhack = FALSE; |
3143 gboolean evilhack = FALSE; |
| 3140 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; |
3144 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; |
| 3141 va_list ap; |
3145 va_list ap; |
| 3142 aim_userinfo_t *info; |
3146 aim_userinfo_t *info; |
| 3143 fu16_t infotype; |
3147 fu16_t infotype; |
| 3144 char *text_enc = NULL, *text = NULL, *utf8 = NULL; |
3148 char *text_enc = NULL, *text = NULL, *utf8 = NULL; |
| 3145 int text_len; |
3149 int text_len; |
| |
3150 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); |
| 3146 |
3151 |
| 3147 va_start(ap, fr); |
3152 va_start(ap, fr); |
| 3148 info = va_arg(ap, aim_userinfo_t *); |
3153 info = va_arg(ap, aim_userinfo_t *); |
| 3149 infotype = (fu16_t) va_arg(ap, unsigned int); |
3154 infotype = (fu16_t) va_arg(ap, unsigned int); |
| 3150 text_enc = va_arg(ap, char *); |
3155 text_enc = va_arg(ap, char *); |
| 3206 |
3211 |
| 3207 if (infotype == AIM_GETINFO_AWAYMESSAGE) { |
3212 if (infotype == AIM_GETINFO_AWAYMESSAGE) { |
| 3208 if (evilhack) { |
3213 if (evilhack) { |
| 3209 g_show_info_text(gc, info->sn, 2, |
3214 g_show_info_text(gc, info->sn, 2, |
| 3210 header, |
3215 header, |
| 3211 (utf8 && *utf8) ? away_subs(utf8, gc->username) : |
3216 (utf8 && *utf8) ? away_subs(utf8, username) : |
| 3212 _("<i>User has no away message</i>"), NULL); |
3217 _("<i>User has no away message</i>"), NULL); |
| 3213 } else { |
3218 } else { |
| 3214 g_show_info_text(gc, info->sn, 0, |
3219 g_show_info_text(gc, info->sn, 0, |
| 3215 header, |
3220 header, |
| 3216 (utf8 && *utf8) ? away_subs(utf8, gc->username) : NULL, |
3221 (utf8 && *utf8) ? away_subs(utf8, username) : NULL, |
| 3217 (utf8 && *utf8) ? "<hr>" : NULL, |
3222 (utf8 && *utf8) ? "<hr>" : NULL, |
| 3218 NULL); |
3223 NULL); |
| 3219 } |
3224 } |
| 3220 } else if (infotype == AIM_GETINFO_CAPABILITIES) { |
3225 } else if (infotype == AIM_GETINFO_CAPABILITIES) { |
| 3221 g_show_info_text(gc, info->sn, 2, |
3226 g_show_info_text(gc, info->sn, 2, |
| 3387 char *roomname; |
3392 char *roomname; |
| 3388 int usercount; |
3393 int usercount; |
| 3389 char *roomdesc; |
3394 char *roomdesc; |
| 3390 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
3395 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
| 3391 fu32_t creationtime; |
3396 fu32_t creationtime; |
| 3392 struct gaim_connection *gc = sess->aux_data; |
3397 GaimConnection *gc = sess->aux_data; |
| 3393 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
3398 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
| 3394 |
3399 |
| 3395 va_start(ap, fr); |
3400 va_start(ap, fr); |
| 3396 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
3401 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
| 3397 roomname = va_arg(ap, char *); |
3402 roomname = va_arg(ap, char *); |
| 3433 return 1; |
3438 return 1; |
| 3434 } |
3439 } |
| 3435 |
3440 |
| 3436 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
3441 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 3437 va_list ap; |
3442 va_list ap; |
| 3438 struct gaim_connection *gc = sess->aux_data; |
3443 GaimConnection *gc = sess->aux_data; |
| 3439 struct aim_emailinfo *emailinfo; |
3444 struct aim_emailinfo *emailinfo; |
| 3440 int havenewmail; |
3445 int havenewmail; |
| 3441 |
3446 |
| 3442 va_start(ap, fr); |
3447 va_start(ap, fr); |
| 3443 emailinfo = va_arg(ap, struct aim_emailinfo *); |
3448 emailinfo = va_arg(ap, struct aim_emailinfo *); |
| 3444 havenewmail = va_arg(ap, int); |
3449 havenewmail = va_arg(ap, int); |
| 3445 va_end(ap); |
3450 va_end(ap); |
| 3446 |
3451 |
| 3447 if (emailinfo) { |
3452 if (emailinfo) { |
| 3448 gchar *to = g_strdup_printf("%s@%s", gc->username, emailinfo->domain); |
3453 gchar *to = g_strdup_printf("%s@%s", gaim_account_get_username(gaim_connection_get_account(gc)), emailinfo->domain); |
| 3449 if (emailinfo->unread && havenewmail) |
3454 if (emailinfo->unread && havenewmail) |
| 3450 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); |
3455 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); |
| 3451 g_free(to); |
3456 g_free(to); |
| 3452 } |
3457 } |
| 3453 |
3458 |
| 3454 return 1; |
3459 return 1; |
| 3455 } |
3460 } |
| 3456 |
3461 |
| 3457 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
3462 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 3458 struct gaim_connection *gc = sess->aux_data; |
3463 GaimConnection *gc = sess->aux_data; |
| 3459 struct oscar_data *od = gc->proto_data; |
3464 struct oscar_data *od = gc->proto_data; |
| 3460 char *sn; |
3465 char *sn; |
| 3461 |
3466 |
| 3462 sn = od->requesticon->data; |
3467 sn = od->requesticon->data; |
| 3463 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
3468 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
| 3624 |
3629 |
| 3625 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
3630 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 3626 va_list ap; |
3631 va_list ap; |
| 3627 fu16_t newevil; |
3632 fu16_t newevil; |
| 3628 aim_userinfo_t *userinfo; |
3633 aim_userinfo_t *userinfo; |
| 3629 struct gaim_connection *gc = sess->aux_data; |
3634 GaimConnection *gc = sess->aux_data; |
| 3630 |
3635 |
| 3631 va_start(ap, fr); |
3636 va_start(ap, fr); |
| 3632 newevil = (fu16_t) va_arg(ap, unsigned int); |
3637 newevil = (fu16_t) va_arg(ap, unsigned int); |
| 3633 userinfo = va_arg(ap, aim_userinfo_t *); |
3638 userinfo = va_arg(ap, aim_userinfo_t *); |
| 3634 va_end(ap); |
3639 va_end(ap); |
| 3703 |
3708 |
| 3704 return 1; |
3709 return 1; |
| 3705 } |
3710 } |
| 3706 |
3711 |
| 3707 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
3712 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 3708 struct gaim_connection *gc = sess->aux_data; |
3713 GaimConnection *gc = sess->aux_data; |
| 3709 struct oscar_data *od = gc->proto_data; |
3714 struct oscar_data *od = gc->proto_data; |
| 3710 |
3715 |
| 3711 aim_clientready(sess, fr->conn); |
3716 aim_clientready(sess, fr->conn); |
| 3712 gaim_debug(GAIM_DEBUG_INFO, "oscar", "connected to admin\n"); |
3717 gaim_debug(GAIM_DEBUG_INFO, "oscar", "connected to admin\n"); |
| 3713 |
3718 |
| 3799 } |
3804 } |
| 3800 |
3805 |
| 3801 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
3806 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 3802 va_list ap; |
3807 va_list ap; |
| 3803 fu16_t maxbuddies, maxwatchers; |
3808 fu16_t maxbuddies, maxwatchers; |
| 3804 struct gaim_connection *gc = sess->aux_data; |
3809 GaimConnection *gc = sess->aux_data; |
| 3805 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
3810 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 3806 |
3811 |
| 3807 va_start(ap, fr); |
3812 va_start(ap, fr); |
| 3808 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3813 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
| 3809 maxwatchers = (fu16_t) va_arg(ap, unsigned int); |
3814 maxwatchers = (fu16_t) va_arg(ap, unsigned int); |
| 3819 } |
3824 } |
| 3820 |
3825 |
| 3821 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
3826 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 3822 fu16_t maxpermits, maxdenies; |
3827 fu16_t maxpermits, maxdenies; |
| 3823 va_list ap; |
3828 va_list ap; |
| 3824 struct gaim_connection *gc = sess->aux_data; |
3829 GaimConnection *gc = sess->aux_data; |
| 3825 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
3830 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 3826 |
3831 |
| 3827 va_start(ap, fr); |
3832 va_start(ap, fr); |
| 3828 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3833 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
| 3829 maxdenies = (fu16_t) va_arg(ap, unsigned int); |
3834 maxdenies = (fu16_t) va_arg(ap, unsigned int); |
| 4088 |
4093 |
| 4089 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
4094 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 4090 fu16_t status; |
4095 fu16_t status; |
| 4091 va_list ap; |
4096 va_list ap; |
| 4092 char msg[256]; |
4097 char msg[256]; |
| 4093 struct gaim_connection *gc = sess->aux_data; |
4098 GaimConnection *gc = sess->aux_data; |
| 4094 |
4099 |
| 4095 va_start(ap, fr); |
4100 va_start(ap, fr); |
| 4096 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
4101 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
| 4097 va_end(ap); |
4102 va_end(ap); |
| 4098 |
4103 |
| 4099 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4104 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 4100 "account confirmation returned status 0x%04x (%s)\n", status, |
4105 "account confirmation returned status 0x%04x (%s)\n", status, |
| 4101 status ? "unknown" : "email sent"); |
4106 status ? "unknown" : "email sent"); |
| 4102 if (!status) { |
4107 if (!status) { |
| 4103 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
4108 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
| 4104 gc->username); |
4109 gaim_account_get_username(gaim_connection_get_account(gc))); |
| 4105 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
4110 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
| 4106 } |
4111 } |
| 4107 |
4112 |
| 4108 return 1; |
4113 return 1; |
| 4109 } |
4114 } |
| 4110 |
4115 |
| 4111 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
4116 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 4112 struct gaim_connection *gc = sess->aux_data; |
4117 GaimConnection *gc = sess->aux_data; |
| 4113 va_list ap; |
4118 va_list ap; |
| 4114 fu16_t perms, err; |
4119 fu16_t perms, err; |
| 4115 char *url, *sn, *email; |
4120 char *url, *sn, *email; |
| 4116 int change; |
4121 int change; |
| 4117 |
4122 |
| 4165 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
4170 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
| 4166 g_free(dialog_msg); |
4171 g_free(dialog_msg); |
| 4167 } |
4172 } |
| 4168 |
4173 |
| 4169 if (email) { |
4174 if (email) { |
| 4170 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), gc->username, email); |
4175 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), |
| |
4176 gaim_account_get_username(gaim_connection_get_account(gc)), email); |
| 4171 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
4177 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
| 4172 g_free(dialog_msg); |
4178 g_free(dialog_msg); |
| 4173 } |
4179 } |
| 4174 |
4180 |
| 4175 return 1; |
4181 return 1; |
| 4176 } |
4182 } |
| 4177 |
4183 |
| 4178 static void oscar_keepalive(struct gaim_connection *gc) { |
4184 static void oscar_keepalive(GaimConnection *gc) { |
| 4179 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4185 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4180 aim_flap_nop(od->sess, od->conn); |
4186 aim_flap_nop(od->sess, od->conn); |
| 4181 } |
4187 } |
| 4182 |
4188 |
| 4183 static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) { |
4189 static int oscar_send_typing(GaimConnection *gc, char *name, int typing) { |
| 4184 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4190 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4185 struct direct_im *dim = find_direct_im(od, name); |
4191 struct direct_im *dim = find_direct_im(od, name); |
| 4186 if (dim) |
4192 if (dim) |
| 4187 if (typing == TYPING) |
4193 if (typing == TYPING) |
| 4188 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
4194 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
| 4206 } |
4212 } |
| 4207 } |
4213 } |
| 4208 } |
4214 } |
| 4209 return 0; |
4215 return 0; |
| 4210 } |
4216 } |
| 4211 static void oscar_ask_direct_im(struct gaim_connection *gc, const char *name); |
4217 static void oscar_ask_direct_im(GaimConnection *gc, const char *name); |
| 4212 |
4218 |
| 4213 static int oscar_send_im(struct gaim_connection *gc, const char *name, const char *message, int len, int imflags) { |
4219 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, int len, int imflags) { |
| 4214 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4220 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4215 struct direct_im *dim = find_direct_im(od, name); |
4221 struct direct_im *dim = find_direct_im(od, name); |
| 4216 int ret = 0; |
4222 int ret = 0; |
| 4217 GError *err = NULL; |
4223 GError *err = NULL; |
| |
4224 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); |
| 4218 |
4225 |
| 4219 if (dim && dim->connected) { |
4226 if (dim && dim->connected) { |
| 4220 /* If we're directly connected, send a direct IM */ |
4227 /* If we're directly connected, send a direct IM */ |
| 4221 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ |
4228 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ |
| 4222 if (imflags & IM_FLAG_AWAY) |
4229 if (imflags & IM_FLAG_AWAY) |
| 4257 "Sending buddy icon request with message\n"); |
4264 "Sending buddy icon request with message\n"); |
| 4258 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4265 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
| 4259 bi->ico_need = FALSE; |
4266 bi->ico_need = FALSE; |
| 4260 } |
4267 } |
| 4261 |
4268 |
| 4262 if (gc->account->iconfile[0] && !stat(gc->account->iconfile, &st)) { |
4269 if (iconfile && !stat(iconfile, &st)) { |
| 4263 FILE *file = fopen(gc->account->iconfile, "r"); |
4270 FILE *file = fopen(iconfile, "r"); |
| 4264 if (file) { |
4271 if (file) { |
| 4265 char *buf = g_malloc(st.st_size); |
4272 char *buf = g_malloc(st.st_size); |
| 4266 fread(buf, 1, st.st_size, file); |
4273 fread(buf, 1, st.st_size, file); |
| 4267 |
4274 |
| 4268 args.iconlen = st.st_size; |
4275 args.iconlen = st.st_size; |
| 4339 if (ret >= 0) |
4346 if (ret >= 0) |
| 4340 return 1; |
4347 return 1; |
| 4341 return ret; |
4348 return ret; |
| 4342 } |
4349 } |
| 4343 |
4350 |
| 4344 static void oscar_get_info(struct gaim_connection *g, const char *name) { |
4351 static void oscar_get_info(GaimConnection *g, const char *name) { |
| 4345 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4352 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
| 4346 if (od->icq) |
4353 if (od->icq) |
| 4347 aim_icq_getallinfo(od->sess, name); |
4354 aim_icq_getallinfo(od->sess, name); |
| 4348 else |
4355 else |
| 4349 /* people want the away message on the top, so we get the away message |
4356 /* people want the away message on the top, so we get the away message |
| 4350 * first and then get the regular info, since it's too difficult to |
4357 * first and then get the regular info, since it's too difficult to |
| 4351 * insert in the middle. i hate people. */ |
4358 * insert in the middle. i hate people. */ |
| 4352 aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE); |
4359 aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE); |
| 4353 } |
4360 } |
| 4354 |
4361 |
| 4355 static void oscar_get_away(struct gaim_connection *g, const char *who) { |
4362 static void oscar_get_away(GaimConnection *g, const char *who) { |
| 4356 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4363 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
| 4357 if (od->icq) { |
4364 if (od->icq) { |
| 4358 struct buddy *budlight = gaim_find_buddy(g->account, who); |
4365 struct buddy *budlight = gaim_find_buddy(g->account, who); |
| 4359 if (budlight) |
4366 if (budlight) |
| 4360 if ((budlight->uc & 0xffff0000) >> 16) |
4367 if ((budlight->uc & 0xffff0000) >> 16) |
| 4367 "Error: Could not find %s in local contact list, therefore unable to request status message.\n", who); |
4374 "Error: Could not find %s in local contact list, therefore unable to request status message.\n", who); |
| 4368 } else |
4375 } else |
| 4369 aim_getinfo(od->sess, od->conn, who, AIM_GETINFO_GENERALINFO); |
4376 aim_getinfo(od->sess, od->conn, who, AIM_GETINFO_GENERALINFO); |
| 4370 } |
4377 } |
| 4371 |
4378 |
| 4372 static void oscar_set_dir(struct gaim_connection *g, const char *first, const char *middle, const char *last, |
4379 static void oscar_set_dir(GaimConnection *g, const char *first, const char *middle, const char *last, |
| 4373 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4380 const char *maiden, const char *city, const char *state, const char *country, int web) { |
| 4374 /* XXX - some of these things are wrong, but i'm lazy */ |
4381 /* XXX - some of these things are wrong, but i'm lazy */ |
| 4375 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4382 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
| 4376 aim_setdirectoryinfo(od->sess, od->conn, first, middle, last, |
4383 aim_setdirectoryinfo(od->sess, od->conn, first, middle, last, |
| 4377 maiden, NULL, NULL, city, state, NULL, 0, web); |
4384 maiden, NULL, NULL, city, state, NULL, 0, web); |
| 4378 } |
4385 } |
| 4379 |
4386 |
| 4380 static void oscar_set_idle(struct gaim_connection *gc, int time) { |
4387 static void oscar_set_idle(GaimConnection *gc, int time) { |
| 4381 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4388 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4382 aim_bos_setidle(od->sess, od->conn, time); |
4389 aim_bos_setidle(od->sess, od->conn, time); |
| 4383 } |
4390 } |
| 4384 |
4391 |
| 4385 static void oscar_set_info(struct gaim_connection *gc, char *text) { |
4392 static void oscar_set_info(GaimConnection *gc, char *text) { |
| 4386 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4393 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4387 fu32_t flags = 0; |
4394 fu32_t flags = 0; |
| 4388 char *msg = NULL; |
4395 char *msg = NULL; |
| 4389 int msglen = 0; |
4396 int msglen = 0; |
| 4390 |
4397 |
| 4484 } |
4491 } |
| 4485 |
4492 |
| 4486 return; |
4493 return; |
| 4487 } |
4494 } |
| 4488 |
4495 |
| 4489 static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message) |
4496 static void oscar_set_away_icq(GaimConnection *gc, struct oscar_data *od, const char *state, const char *message) |
| 4490 { |
4497 { |
| 4491 |
4498 GaimAccount *account = gaim_connection_get_account(gc); |
| 4492 if (gc->away) { |
4499 if (gc->away) { |
| 4493 g_free(gc->away); |
4500 g_free(gc->away); |
| 4494 gc->away = NULL; |
4501 gc->away = NULL; |
| 4495 } |
4502 } |
| 4496 |
4503 |
| 4497 if (strcmp(state, _("Invisible"))) { |
4504 if (strcmp(state, _("Invisible"))) { |
| 4498 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != gc->account->permdeny)) |
4505 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
| 4499 aim_ssi_setpermdeny(od->sess, gc->account->permdeny, 0xffffffff); |
4506 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); |
| 4500 gc->account->permdeny = 4; |
4507 account->perm_deny = 4; |
| 4501 } else { |
4508 } else { |
| 4502 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)) |
4509 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)) |
| 4503 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); |
4510 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); |
| 4504 gc->account->permdeny = 3; |
4511 account->perm_deny = 3; |
| 4505 } |
4512 } |
| 4506 |
4513 |
| 4507 if (!strcmp(state, _("Online"))) |
4514 if (!strcmp(state, _("Online"))) |
| 4508 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4515 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
| 4509 else if (!strcmp(state, _("Away"))) { |
4516 else if (!strcmp(state, _("Away"))) { |
| 4546 oscar_set_away_aim(gc, od, message); |
4553 oscar_set_away_aim(gc, od, message); |
| 4547 |
4554 |
| 4548 return; |
4555 return; |
| 4549 } |
4556 } |
| 4550 |
4557 |
| 4551 static void oscar_warn(struct gaim_connection *gc, char *name, int anon) { |
4558 static void oscar_warn(GaimConnection *gc, char *name, int anon) { |
| 4552 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4559 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4553 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); |
4560 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); |
| 4554 } |
4561 } |
| 4555 |
4562 |
| 4556 static void oscar_dir_search(struct gaim_connection *gc, const char *first, const char *middle, const char *last, |
4563 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, |
| 4557 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
4564 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
| 4558 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4565 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4559 if (strlen(email)) |
4566 if (strlen(email)) |
| 4560 aim_usersearch_address(od->sess, od->conn, email); |
4567 aim_usersearch_address(od->sess, od->conn, email); |
| 4561 } |
4568 } |
| 4562 |
4569 |
| 4563 static void oscar_add_buddy(struct gaim_connection *gc, const char *name) { |
4570 static void oscar_add_buddy(GaimConnection *gc, const char *name) { |
| 4564 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4571 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4565 #ifdef NOSSI |
4572 #ifdef NOSSI |
| 4566 aim_add_buddy(od->sess, od->conn, name); |
4573 aim_add_buddy(od->sess, od->conn, name); |
| 4567 #else |
4574 #else |
| 4568 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { |
4575 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { |
| 4620 aim_ssi_delbuddy(od->sess, name, group); |
4627 aim_ssi_delbuddy(od->sess, name, group); |
| 4621 } |
4628 } |
| 4622 #endif |
4629 #endif |
| 4623 } |
4630 } |
| 4624 |
4631 |
| 4625 static void oscar_remove_buddies(struct gaim_connection *gc, GList *buddies, const char *group) { |
4632 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
| 4626 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4633 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4627 #ifdef NOSSI |
4634 #ifdef NOSSI |
| 4628 GList *cur; |
4635 GList *cur; |
| 4629 for (cur=buddies; cur; cur=cur->next) |
4636 for (cur=buddies; cur; cur=cur->next) |
| 4630 aim_remove_buddy(od->sess, od->conn, cur->data); |
4637 aim_remove_buddy(od->sess, od->conn, cur->data); |
| 4639 } |
4646 } |
| 4640 #endif |
4647 #endif |
| 4641 } |
4648 } |
| 4642 |
4649 |
| 4643 #ifndef NOSSI |
4650 #ifndef NOSSI |
| 4644 static void oscar_move_buddy(struct gaim_connection *gc, const char *name, const char *old_group, const char *new_group) { |
4651 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
| 4645 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4652 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4646 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { |
4653 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { |
| 4647 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4654 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 4648 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4655 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
| 4649 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4656 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
| 4650 } |
4657 } |
| 4651 } |
4658 } |
| 4652 |
4659 |
| 4653 static void oscar_alias_buddy(struct gaim_connection *gc, const char *name, const char *alias) { |
4660 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
| 4654 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4661 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4655 if (od->sess->ssi.received_data) { |
4662 if (od->sess->ssi.received_data) { |
| 4656 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); |
4663 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); |
| 4657 if (gname) { |
4664 if (gname) { |
| 4658 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4665 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 4660 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4667 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
| 4661 } |
4668 } |
| 4662 } |
4669 } |
| 4663 } |
4670 } |
| 4664 |
4671 |
| 4665 static void oscar_rename_group(struct gaim_connection *g, const char *old_group, const char *new_group, GList *members) { |
4672 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { |
| 4666 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4673 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
| 4667 |
4674 |
| 4668 if (od->sess->ssi.received_data) { |
4675 if (od->sess->ssi.received_data) { |
| 4669 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { |
4676 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { |
| 4670 oscar_remove_buddies(g, members, old_group); |
4677 oscar_remove_buddies(g, members, old_group); |
| 4737 |
4744 |
| 4738 return 1; |
4745 return 1; |
| 4739 } |
4746 } |
| 4740 |
4747 |
| 4741 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { |
4748 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 4742 struct gaim_connection *gc = sess->aux_data; |
4749 GaimConnection *gc = sess->aux_data; |
| |
4750 GaimAccount *account = gaim_connection_get_account(gc); |
| 4743 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4751 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 4744 struct aim_ssi_item *curitem; |
4752 struct aim_ssi_item *curitem; |
| 4745 int tmp; |
4753 int tmp; |
| 4746 gboolean export = FALSE; |
4754 gboolean export = FALSE; |
| 4747 /* XXX - use these? |
4755 /* XXX - use these? |
| 4804 |
4812 |
| 4805 case 0x0002: { /* Permit buddy */ |
4813 case 0x0002: { /* Permit buddy */ |
| 4806 if (curitem->name) { |
4814 if (curitem->name) { |
| 4807 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
4815 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
| 4808 GSList *list; |
4816 GSList *list; |
| 4809 for (list=gc->account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
4817 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
| 4810 if (!list) { |
4818 if (!list) { |
| 4811 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4819 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 4812 "ssi: adding permit buddy %s to local list\n", curitem->name); |
4820 "ssi: adding permit buddy %s to local list\n", curitem->name); |
| 4813 gaim_privacy_permit_add(gc->account, curitem->name); |
4821 gaim_privacy_permit_add(account, curitem->name); |
| 4814 build_allow_list(); |
4822 build_allow_list(); |
| 4815 export = TRUE; |
4823 export = TRUE; |
| 4816 } |
4824 } |
| 4817 } |
4825 } |
| 4818 } break; |
4826 } break; |
| 4819 |
4827 |
| 4820 case 0x0003: { /* Deny buddy */ |
4828 case 0x0003: { /* Deny buddy */ |
| 4821 if (curitem->name) { |
4829 if (curitem->name) { |
| 4822 GSList *list; |
4830 GSList *list; |
| 4823 for (list=gc->account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
4831 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
| 4824 if (!list) { |
4832 if (!list) { |
| 4825 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4833 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 4826 "ssi: adding deny buddy %s to local list\n", curitem->name); |
4834 "ssi: adding deny buddy %s to local list\n", curitem->name); |
| 4827 gaim_privacy_deny_add(gc->account, curitem->name); |
4835 gaim_privacy_deny_add(account, curitem->name); |
| 4828 build_block_list(); |
4836 build_block_list(); |
| 4829 export = TRUE; |
4837 export = TRUE; |
| 4830 } |
4838 } |
| 4831 } |
4839 } |
| 4832 } break; |
4840 } break; |
| 4833 |
4841 |
| 4834 case 0x0004: { /* Permit/deny setting */ |
4842 case 0x0004: { /* Permit/deny setting */ |
| 4835 if (curitem->data) { |
4843 if (curitem->data) { |
| 4836 fu8_t permdeny; |
4844 fu8_t permdeny; |
| 4837 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != gc->account->permdeny)) { |
4845 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != account->perm_deny)) { |
| 4838 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4846 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 4839 "ssi: changing permdeny from %d to %hhu\n", gc->account->permdeny, permdeny); |
4847 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
| 4840 gc->account->permdeny = permdeny; |
4848 account->perm_deny = permdeny; |
| 4841 if (od->icq && gc->account->permdeny == 0x03) { |
4849 if (od->icq && account->perm_deny == 0x03) { |
| 4842 serv_set_away(gc, "Invisible", ""); |
4850 serv_set_away(gc, "Invisible", ""); |
| 4843 } |
4851 } |
| 4844 export = TRUE; |
4852 export = TRUE; |
| 4845 } |
4853 } |
| 4846 } |
4854 } |
| 5132 m = g_list_append(m, pce); |
5140 m = g_list_append(m, pce); |
| 5133 |
5141 |
| 5134 return m; |
5142 return m; |
| 5135 } |
5143 } |
| 5136 |
5144 |
| 5137 static void oscar_join_chat(struct gaim_connection *g, GHashTable *data) { |
5145 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { |
| 5138 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
5146 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
| 5139 aim_conn_t *cur; |
5147 aim_conn_t *cur; |
| 5140 char *name, *exchange; |
5148 char *name, *exchange; |
| 5141 |
5149 |
| 5142 name = g_hash_table_lookup(data, "room"); |
5150 name = g_hash_table_lookup(data, "room"); |
| 5158 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5166 od->create_rooms = g_slist_append(od->create_rooms, cr); |
| 5159 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); |
5167 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); |
| 5160 } |
5168 } |
| 5161 } |
5169 } |
| 5162 |
5170 |
| 5163 static void oscar_chat_invite(struct gaim_connection *g, int id, const char *message, const char *name) { |
5171 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { |
| 5164 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
5172 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
| 5165 struct chat_connection *ccon = find_oscar_chat(g, id); |
5173 struct chat_connection *ccon = find_oscar_chat(g, id); |
| 5166 |
5174 |
| 5167 if (!ccon) |
5175 if (!ccon) |
| 5168 return; |
5176 return; |
| 5169 |
5177 |
| 5170 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
5178 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
| 5171 ccon->exchange, ccon->name, 0x0); |
5179 ccon->exchange, ccon->name, 0x0); |
| 5172 } |
5180 } |
| 5173 |
5181 |
| 5174 static void oscar_chat_leave(struct gaim_connection *g, int id) { |
5182 static void oscar_chat_leave(GaimConnection *g, int id) { |
| 5175 struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL; |
5183 struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL; |
| 5176 GSList *bcs = g->buddy_chats; |
5184 GSList *bcs = g->buddy_chats; |
| 5177 struct gaim_conversation *b = NULL; |
5185 struct gaim_conversation *b = NULL; |
| 5178 struct chat_connection *c = NULL; |
5186 struct chat_connection *c = NULL; |
| 5179 int count = 0; |
5187 int count = 0; |
| 5207 } |
5215 } |
| 5208 /* we do this because with Oscar it doesn't tell us we left */ |
5216 /* we do this because with Oscar it doesn't tell us we left */ |
| 5209 serv_got_chat_left(g, gaim_chat_get_id(GAIM_CHAT(b))); |
5217 serv_got_chat_left(g, gaim_chat_get_id(GAIM_CHAT(b))); |
| 5210 } |
5218 } |
| 5211 |
5219 |
| 5212 static int oscar_chat_send(struct gaim_connection *g, int id, char *message) { |
5220 static int oscar_chat_send(GaimConnection *g, int id, char *message) { |
| 5213 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
5221 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
| 5214 GSList *bcs = g->buddy_chats; |
5222 GSList *bcs = g->buddy_chats; |
| 5215 struct gaim_conversation *b = NULL; |
5223 struct gaim_conversation *b = NULL; |
| 5216 struct chat_connection *c = NULL; |
5224 struct chat_connection *c = NULL; |
| 5217 char *buf, *buf2; |
5225 char *buf, *buf2; |
| 5283 { |
5291 { |
| 5284 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
5292 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
| 5285 int i = 0; |
5293 int i = 0; |
| 5286 |
5294 |
| 5287 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5295 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
| 5288 struct gaim_account *account; |
5296 GaimAccount *account; |
| 5289 struct gaim_connection *gc; |
5297 GaimConnection *gc; |
| 5290 struct oscar_data *od; |
5298 struct oscar_data *od; |
| 5291 char *gname; |
5299 char *gname; |
| 5292 if ((b->name) && (account = b->account) && (gc = account->gc) && |
5300 if ((b->name) && (account = b->account) && (gc = account->gc) && |
| 5293 (od = gc->proto_data) && (od->sess->ssi.received_data) && |
5301 (od = gc->proto_data) && (od->sess->ssi.received_data) && |
| 5294 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
5302 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
| 5332 *nw = emblems[2]; |
5340 *nw = emblems[2]; |
| 5333 *ne = emblems[3]; |
5341 *ne = emblems[3]; |
| 5334 } |
5342 } |
| 5335 |
5343 |
| 5336 static char *oscar_tooltip_text(struct buddy *b) { |
5344 static char *oscar_tooltip_text(struct buddy *b) { |
| 5337 struct gaim_connection *gc = b->account->gc; |
5345 GaimConnection *gc = b->account->gc; |
| 5338 struct oscar_data *od = gc->proto_data; |
5346 struct oscar_data *od = gc->proto_data; |
| 5339 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); |
5347 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); |
| 5340 gchar *tmp, *yay = g_strdup(""); |
5348 gchar *tmp, *yay = g_strdup(""); |
| 5341 |
5349 |
| 5342 if (GAIM_BUDDY_IS_ONLINE(b)) { |
5350 if (GAIM_BUDDY_IS_ONLINE(b)) { |
| 5406 |
5414 |
| 5407 /* |
5415 /* |
| 5408 * We have just established a socket with the other dude, so set up some handlers. |
5416 * We have just established a socket with the other dude, so set up some handlers. |
| 5409 */ |
5417 */ |
| 5410 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5418 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 5411 struct gaim_connection *gc = sess->aux_data; |
5419 GaimConnection *gc = sess->aux_data; |
| 5412 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5420 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 5413 struct gaim_conversation *cnv; |
5421 struct gaim_conversation *cnv; |
| 5414 struct direct_im *dim; |
5422 struct direct_im *dim; |
| 5415 char buf[256]; |
5423 char buf[256]; |
| 5416 char *sn; |
5424 char *sn; |
| 5529 return 1; |
5537 return 1; |
| 5530 } |
5538 } |
| 5531 |
5539 |
| 5532 struct ask_do_dir_im { |
5540 struct ask_do_dir_im { |
| 5533 char *who; |
5541 char *who; |
| 5534 struct gaim_connection *gc; |
5542 GaimConnection *gc; |
| 5535 }; |
5543 }; |
| 5536 |
5544 |
| 5537 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5545 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
| 5538 g_free(data->who); |
5546 g_free(data->who); |
| 5539 g_free(data); |
5547 g_free(data); |
| 5540 } |
5548 } |
| 5541 |
5549 |
| 5542 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5550 static void oscar_direct_im(struct ask_do_dir_im *data) { |
| 5543 struct gaim_connection *gc = data->gc; |
5551 GaimConnection *gc = data->gc; |
| 5544 struct oscar_data *od; |
5552 struct oscar_data *od; |
| 5545 struct direct_im *dim; |
5553 struct direct_im *dim; |
| 5546 |
5554 |
| 5547 if (!g_slist_find(connections, gc)) { |
5555 if (!g_slist_find(connections, gc)) { |
| 5548 g_free(data->who); |
5556 g_free(data->who); |
| 5602 _("Connect"), G_CALLBACK(oscar_direct_im), |
5610 _("Connect"), G_CALLBACK(oscar_direct_im), |
| 5603 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
5611 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
| 5604 g_free(buf); |
5612 g_free(buf); |
| 5605 } |
5613 } |
| 5606 |
5614 |
| 5607 static void oscar_set_permit_deny(struct gaim_connection *gc) { |
5615 static void oscar_set_permit_deny(GaimConnection *gc) { |
| |
5616 GaimAccount *account = gaim_connection_get_account(gc); |
| 5608 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5617 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 5609 #ifdef NOSSI |
5618 #ifdef NOSSI |
| 5610 GSList *list, *g = gaim_blist_groups(), *g1; |
5619 GSList *list, *g = gaim_blist_groups(), *g1; |
| 5611 char buf[MAXMSGLEN]; |
5620 char buf[MAXMSGLEN]; |
| 5612 int at; |
5621 int at; |
| 5613 |
5622 |
| 5614 switch(gc->account->permdeny) { |
5623 switch(account->perm_deny) { |
| 5615 case 1: |
5624 case 1: |
| 5616 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username); |
5625 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
| 5617 break; |
5626 break; |
| 5618 case 2: |
5627 case 2: |
| 5619 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username); |
5628 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
| 5620 break; |
5629 break; |
| 5621 case 3: |
5630 case 3: |
| 5622 list = gc->account->permit; |
5631 list = account->permit; |
| 5623 at = 0; |
5632 at = 0; |
| 5624 while (list) { |
5633 while (list) { |
| 5625 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); |
5634 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); |
| 5626 list = list->next; |
5635 list = list->next; |
| 5627 } |
5636 } |
| 5628 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); |
5637 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); |
| 5629 break; |
5638 break; |
| 5630 case 4: |
5639 case 4: |
| 5631 list = gc->account->deny; |
5640 list = account->deny; |
| 5632 at = 0; |
5641 at = 0; |
| 5633 while (list) { |
5642 while (list) { |
| 5634 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); |
5643 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); |
| 5635 list = list->next; |
5644 list = list->next; |
| 5636 } |
5645 } |
| 5642 while (g1) { |
5651 while (g1) { |
| 5643 list = gaim_blist_members((struct group *)g->data); |
5652 list = gaim_blist_members((struct group *)g->data); |
| 5644 GSList list1 = list; |
5653 GSList list1 = list; |
| 5645 while (list1) { |
5654 while (list1) { |
| 5646 struct buddy *b = list1->data; |
5655 struct buddy *b = list1->data; |
| 5647 if(b->account == gc->account) |
5656 if(b->account == account) |
| 5648 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); |
5657 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); |
| 5649 list1 = list1->next; |
5658 list1 = list1->next; |
| 5650 } |
5659 } |
| 5651 g_slist_free(list); |
5660 g_slist_free(list); |
| 5652 g1 = g1->next; |
5661 g1 = g1->next; |
| 5658 break; |
5667 break; |
| 5659 } |
5668 } |
| 5660 signoff_blocked(gc); |
5669 signoff_blocked(gc); |
| 5661 #else |
5670 #else |
| 5662 if (od->sess->ssi.received_data) |
5671 if (od->sess->ssi.received_data) |
| 5663 aim_ssi_setpermdeny(od->sess, gc->account->permdeny, 0xffffffff); |
5672 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); |
| 5664 #endif |
5673 #endif |
| 5665 } |
5674 } |
| 5666 |
5675 |
| 5667 static void oscar_add_permit(struct gaim_connection *gc, const char *who) { |
5676 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
| 5668 #ifdef NOSSI |
5677 #ifdef NOSSI |
| 5669 if (gc->account->permdeny == 3) |
5678 if (gc->account->permdeny == 3) |
| 5670 oscar_set_permit_deny(gc); |
5679 oscar_set_permit_deny(gc); |
| 5671 #else |
5680 #else |
| 5672 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5681 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 5674 if (od->sess->ssi.received_data) |
5683 if (od->sess->ssi.received_data) |
| 5675 aim_ssi_addpermit(od->sess, who); |
5684 aim_ssi_addpermit(od->sess, who); |
| 5676 #endif |
5685 #endif |
| 5677 } |
5686 } |
| 5678 |
5687 |
| 5679 static void oscar_add_deny(struct gaim_connection *gc, const char *who) { |
5688 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
| 5680 #ifdef NOSSI |
5689 #ifdef NOSSI |
| 5681 if (gc->account->permdeny == 4) |
5690 if (gc->account->permdeny == 4) |
| 5682 oscar_set_permit_deny(gc); |
5691 oscar_set_permit_deny(gc); |
| 5683 #else |
5692 #else |
| 5684 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5693 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 5686 if (od->sess->ssi.received_data) |
5695 if (od->sess->ssi.received_data) |
| 5687 aim_ssi_adddeny(od->sess, who); |
5696 aim_ssi_adddeny(od->sess, who); |
| 5688 #endif |
5697 #endif |
| 5689 } |
5698 } |
| 5690 |
5699 |
| 5691 static void oscar_rem_permit(struct gaim_connection *gc, const char *who) { |
5700 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
| 5692 #ifdef NOSSI |
5701 #ifdef NOSSI |
| 5693 if (gc->account->permdeny == 3) |
5702 if (gc->account->permdeny == 3) |
| 5694 oscar_set_permit_deny(gc); |
5703 oscar_set_permit_deny(gc); |
| 5695 #else |
5704 #else |
| 5696 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5705 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 5698 if (od->sess->ssi.received_data) |
5707 if (od->sess->ssi.received_data) |
| 5699 aim_ssi_delpermit(od->sess, who); |
5708 aim_ssi_delpermit(od->sess, who); |
| 5700 #endif |
5709 #endif |
| 5701 } |
5710 } |
| 5702 |
5711 |
| 5703 static void oscar_rem_deny(struct gaim_connection *gc, const char *who) { |
5712 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
| 5704 #ifdef NOSSI |
5713 #ifdef NOSSI |
| 5705 if (gc->account->permdeny == 4) |
5714 if (gc->account->permdeny == 4) |
| 5706 oscar_set_permit_deny(gc); |
5715 oscar_set_permit_deny(gc); |
| 5707 #else |
5716 #else |
| 5708 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5717 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
| 5745 m = g_list_append(m, pbm); |
5754 m = g_list_append(m, pbm); |
| 5746 #endif |
5755 #endif |
| 5747 } else { |
5756 } else { |
| 5748 struct buddy *b = gaim_find_buddy(gc->account, who); |
5757 struct buddy *b = gaim_find_buddy(gc->account, who); |
| 5749 |
5758 |
| 5750 if ((aim_sncmp(gc->username, who)) && GAIM_BUDDY_IS_ONLINE(b)) { |
5759 if ((aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who)) && GAIM_BUDDY_IS_ONLINE(b)) { |
| 5751 pbm = g_new0(struct proto_buddy_menu, 1); |
5760 pbm = g_new0(struct proto_buddy_menu, 1); |
| 5752 pbm->label = _("Direct IM"); |
5761 pbm->label = _("Direct IM"); |
| 5753 pbm->callback = oscar_ask_direct_im; |
5762 pbm->callback = oscar_ask_direct_im; |
| 5754 pbm->gc = gc; |
5763 pbm->gc = gc; |
| 5755 m = g_list_append(m, pbm); |
5764 m = g_list_append(m, pbm); |
| 5781 } |
5790 } |
| 5782 |
5791 |
| 5783 return m; |
5792 return m; |
| 5784 } |
5793 } |
| 5785 |
5794 |
| 5786 static void oscar_format_screenname(struct gaim_connection *gc, const char *nick) { |
5795 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
| 5787 struct oscar_data *od = gc->proto_data; |
5796 struct oscar_data *od = gc->proto_data; |
| 5788 if (!aim_sncmp(gc->username, nick)) { |
5797 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
| 5789 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
5798 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
| 5790 od->setnick = TRUE; |
5799 od->setnick = TRUE; |
| 5791 od->newsn = g_strdup(nick); |
5800 od->newsn = g_strdup(nick); |
| 5792 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
5801 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
| 5793 } else { |
5802 } else { |
| 5797 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
5806 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
| 5798 _("Screenname formatting can change only capitalization and whitespace.")); |
5807 _("Screenname formatting can change only capitalization and whitespace.")); |
| 5799 } |
5808 } |
| 5800 } |
5809 } |
| 5801 |
5810 |
| 5802 static void oscar_show_format_screenname(struct gaim_connection *gc) |
5811 static void oscar_show_format_screenname(GaimConnection *gc) |
| 5803 { |
5812 { |
| 5804 gaim_request_input(gc, NULL, _("New screenname formatting:"), NULL, |
5813 gaim_request_input(gc, NULL, _("New screenname formatting:"), NULL, |
| 5805 gc->displayname, FALSE, |
5814 gaim_connection_get_display_name(gc), FALSE, |
| 5806 _("OK"), G_CALLBACK(oscar_format_screenname), |
5815 _("OK"), G_CALLBACK(oscar_format_screenname), |
| 5807 _("Cancel"), NULL, |
5816 _("Cancel"), NULL, |
| 5808 gc); |
5817 gc); |
| 5809 } |
5818 } |
| 5810 |
5819 |
| 5811 static void oscar_confirm_account(struct gaim_connection *gc) |
5820 static void oscar_confirm_account(GaimConnection *gc) |
| 5812 { |
5821 { |
| 5813 struct oscar_data *od = gc->proto_data; |
5822 struct oscar_data *od = gc->proto_data; |
| 5814 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
5823 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
| 5815 |
5824 |
| 5816 if (conn) { |
5825 if (conn) { |
| 5832 od->reqemail = TRUE; |
5841 od->reqemail = TRUE; |
| 5833 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
5842 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
| 5834 } |
5843 } |
| 5835 } |
5844 } |
| 5836 |
5845 |
| 5837 static void oscar_change_email(struct gaim_connection *gc, const char *email) |
5846 static void oscar_change_email(GaimConnection *gc, const char *email) |
| 5838 { |
5847 { |
| 5839 struct oscar_data *od = gc->proto_data; |
5848 struct oscar_data *od = gc->proto_data; |
| 5840 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
5849 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
| 5841 |
5850 |
| 5842 if (conn) { |
5851 if (conn) { |
| 5846 od->email = g_strdup(email); |
5855 od->email = g_strdup(email); |
| 5847 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
5856 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
| 5848 } |
5857 } |
| 5849 } |
5858 } |
| 5850 |
5859 |
| 5851 static void oscar_show_change_email(struct gaim_connection *gc) |
5860 static void oscar_show_change_email(GaimConnection *gc) |
| 5852 { |
5861 { |
| 5853 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, FALSE, |
5862 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, FALSE, |
| 5854 _("OK"), G_CALLBACK(oscar_change_email), |
5863 _("OK"), G_CALLBACK(oscar_change_email), |
| 5855 _("Cancel"), NULL, |
5864 _("Cancel"), NULL, |
| 5856 gc); |
5865 gc); |
| 5857 } |
5866 } |
| 5858 |
5867 |
| 5859 static void oscar_show_awaitingauth(struct gaim_connection *gc) |
5868 static void oscar_show_awaitingauth(GaimConnection *gc) |
| 5860 { |
5869 { |
| 5861 struct oscar_data *od = gc->proto_data; |
5870 struct oscar_data *od = gc->proto_data; |
| 5862 gchar *nombre, *text, *tmp; |
5871 gchar *nombre, *text, *tmp; |
| 5863 GaimBlistNode *gnode,*bnode; |
5872 GaimBlistNode *gnode,*bnode; |
| 5864 int num=0; |
5873 int num=0; |
| 5894 } |
5903 } |
| 5895 |
5904 |
| 5896 tmp = g_strdup_printf(_("%s<BR><BR>You can re-request authorization from these buddies by right-clicking on them and clicking \"Re-request authorization.\""), text); |
5905 tmp = g_strdup_printf(_("%s<BR><BR>You can re-request authorization from these buddies by right-clicking on them and clicking \"Re-request authorization.\""), text); |
| 5897 g_free(text); |
5906 g_free(text); |
| 5898 text = tmp; |
5907 text = tmp; |
| 5899 g_show_info_text(gc, gc->username, 2, text, NULL); |
5908 g_show_info_text(gc, gaim_account_get_username(gaim_connection_get_account(gc)), 2, text, NULL); |
| 5900 g_free(text); |
5909 g_free(text); |
| 5901 } |
5910 } |
| 5902 |
5911 |
| 5903 static void oscar_show_chpassurl(struct gaim_connection *gc) |
5912 static void oscar_show_chpassurl(GaimConnection *gc) |
| 5904 { |
5913 { |
| 5905 struct oscar_data *od = gc->proto_data; |
5914 struct oscar_data *od = gc->proto_data; |
| 5906 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gc->username); |
5915 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); |
| 5907 open_url(NULL, substituted); |
5916 open_url(NULL, substituted); |
| 5908 g_free(substituted); |
5917 g_free(substituted); |
| 5909 } |
5918 } |
| 5910 |
5919 |
| 5911 static GList *oscar_actions(struct gaim_connection *gc) |
5920 static GList *oscar_actions(GaimConnection *gc) |
| 5912 { |
5921 { |
| 5913 struct oscar_data *od = gc->proto_data; |
5922 struct oscar_data *od = gc->proto_data; |
| 5914 struct proto_actions_menu *pam; |
5923 struct proto_actions_menu *pam; |
| 5915 GList *m = NULL; |
5924 GList *m = NULL; |
| 5916 |
5925 |