Mercurial > pidgin
comparison src/protocols/oscar/oscar.c @ 5575:ca4762df72d1
[gaim-migrate @ 5979]
Well... this compiles.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 31 May 2003 01:58:52 +0000 |
parents | 8ab1875e6d09 |
children | 8c398efc88f2 |
comparison
equal
deleted
inserted
replaced
5574:a95e872e58dc | 5575:ca4762df72d1 |
---|---|
137 fu16_t instance; | 137 fu16_t instance; |
138 int fd; /* this is redundant since we have the conn below */ | 138 int fd; /* this is redundant since we have the conn below */ |
139 aim_conn_t *conn; | 139 aim_conn_t *conn; |
140 int inpa; | 140 int inpa; |
141 int id; | 141 int id; |
142 struct gaim_connection *gc; /* i hate this. */ | 142 GaimConnection *gc; /* i hate this. */ |
143 struct gaim_conversation *cnv; /* bah. */ | 143 struct gaim_conversation *cnv; /* bah. */ |
144 int maxlen; | 144 int maxlen; |
145 int maxvis; | 145 int maxvis; |
146 }; | 146 }; |
147 | 147 |
148 struct direct_im { | 148 struct direct_im { |
149 struct gaim_connection *gc; | 149 GaimConnection *gc; |
150 char name[80]; | 150 char name[80]; |
151 int watcher; | 151 int watcher; |
152 aim_conn_t *conn; | 152 aim_conn_t *conn; |
153 gboolean connected; | 153 gboolean connected; |
154 }; | 154 }; |
155 | 155 |
156 struct ask_direct { | 156 struct ask_direct { |
157 struct gaim_connection *gc; | 157 GaimConnection *gc; |
158 char *sn; | 158 char *sn; |
159 char ip[64]; | 159 char ip[64]; |
160 fu8_t cookie[8]; | 160 fu8_t cookie[8]; |
161 }; | 161 }; |
162 | 162 |
179 fu16_t iconcsumlen; | 179 fu16_t iconcsumlen; |
180 fu8_t iconcsum[30]; | 180 fu8_t iconcsum[30]; |
181 }; | 181 }; |
182 | 182 |
183 struct name_data { | 183 struct name_data { |
184 struct gaim_connection *gc; | 184 GaimConnection *gc; |
185 gchar *name; | 185 gchar *name; |
186 gchar *nick; | 186 gchar *nick; |
187 }; | 187 }; |
188 | 188 |
189 static char *msgerrreason[] = { | 189 static char *msgerrreason[] = { |
288 | 288 |
289 /* for icons */ | 289 /* for icons */ |
290 static gboolean gaim_icon_timerfunc(gpointer data); | 290 static gboolean gaim_icon_timerfunc(gpointer data); |
291 | 291 |
292 /* prpl actions - remove this at some point */ | 292 /* prpl actions - remove this at some point */ |
293 static void oscar_set_info(struct gaim_connection *gc, char *text); | 293 static void oscar_set_info(GaimConnection *gc, char *text); |
294 | 294 |
295 int ill_just_write_my_own_damn_round_function(double val) { | 295 int ill_just_write_my_own_damn_round_function(double val) { |
296 if ((val - (int)val) > 0.5) | 296 if ((val - (int)val) > 0.5) |
297 return val+1; | 297 return val+1; |
298 else | 298 else |
431 | 431 |
432 tmp[j] = 0; | 432 tmp[j] = 0; |
433 return tmp; | 433 return tmp; |
434 } | 434 } |
435 | 435 |
436 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) { | 436 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
437 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; | 437 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
438 struct chat_connection *c = NULL; | 438 struct chat_connection *c = NULL; |
439 | 439 |
440 while (g) { | 440 while (g) { |
441 c = (struct chat_connection *)g->data; | 441 c = (struct chat_connection *)g->data; |
446 } | 446 } |
447 | 447 |
448 return c; | 448 return c; |
449 } | 449 } |
450 | 450 |
451 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc, | 451 static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, |
452 aim_conn_t *conn) { | 452 aim_conn_t *conn) { |
453 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; | 453 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
454 struct chat_connection *c = NULL; | 454 struct chat_connection *c = NULL; |
455 | 455 |
456 while (g) { | 456 while (g) { |
463 | 463 |
464 return c; | 464 return c; |
465 } | 465 } |
466 | 466 |
467 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { | 467 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
468 struct gaim_connection *gc = sess->aux_data; | 468 GaimConnection *gc = sess->aux_data; |
469 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 469 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
470 struct gaim_conversation *cnv; | 470 struct gaim_conversation *cnv; |
471 struct direct_im *dim; | 471 struct direct_im *dim; |
472 char *sn; | 472 char *sn; |
473 char buf[256]; | 473 char buf[256]; |
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)) { |
841 | 838 |
842 /* XXX - This function is pretty ugly */ | 839 /* XXX - This function is pretty ugly */ |
843 static void oscar_xfer_init(struct gaim_xfer *xfer) | 840 static void oscar_xfer_init(struct gaim_xfer *xfer) |
844 { | 841 { |
845 struct aim_oft_info *oft_info = xfer->data; | 842 struct aim_oft_info *oft_info = xfer->data; |
846 struct gaim_connection *gc = oft_info->sess->aux_data; | 843 GaimConnection *gc = oft_info->sess->aux_data; |
847 struct oscar_data *od = gc->proto_data; | 844 struct oscar_data *od = gc->proto_data; |
848 | 845 |
849 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | 846 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { |
850 int i; | 847 int i; |
851 | 848 |
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 |
1193 | 1190 |
1194 return 1; | 1191 return 1; |
1195 } | 1192 } |
1196 | 1193 |
1197 struct pieceofcrap { | 1194 struct pieceofcrap { |
1198 struct gaim_connection *gc; | 1195 GaimConnection *gc; |
1199 unsigned long offset; | 1196 unsigned long offset; |
1200 unsigned long len; | 1197 unsigned long len; |
1201 char *modname; | 1198 char *modname; |
1202 int fd; | 1199 int fd; |
1203 aim_conn_t *conn; | 1200 aim_conn_t *conn; |
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 |
1754 g_free(host); | 1755 g_free(host); |
1755 return 1; | 1756 return 1; |
1756 } | 1757 } |
1757 | 1758 |
1758 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { | 1759 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
1759 struct gaim_connection *gc = sess->aux_data; | 1760 GaimConnection *gc = sess->aux_data; |
1760 struct oscar_data *od = gc->proto_data; | 1761 struct oscar_data *od = gc->proto_data; |
1761 struct buddyinfo *bi; | 1762 struct buddyinfo *bi; |
1762 time_t time_idle = 0, signon = 0; | 1763 time_t time_idle = 0, signon = 0; |
1763 int type = 0; | 1764 int type = 0; |
1764 int caps = 0; | 1765 int caps = 0; |
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); |
1850 | 1851 |
1851 return 1; | 1852 return 1; |
1852 } | 1853 } |
1853 | 1854 |
1854 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { | 1855 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
1855 struct gaim_connection *gc = sess->aux_data; | 1856 GaimConnection *gc = sess->aux_data; |
1856 va_list ap; | 1857 va_list ap; |
1857 aim_userinfo_t *info; | 1858 aim_userinfo_t *info; |
1858 | 1859 |
1859 va_start(ap, fr); | 1860 va_start(ap, fr); |
1860 info = va_arg(ap, aim_userinfo_t *); | 1861 info = va_arg(ap, aim_userinfo_t *); |
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; |
2087 | 2088 |
2088 return 0; | 2089 return 0; |
2089 } | 2090 } |
2090 | 2091 |
2091 static void accept_direct_im(struct ask_direct *d) { | 2092 static void accept_direct_im(struct ask_direct *d) { |
2092 struct gaim_connection *gc = d->gc; | 2093 GaimConnection *gc = d->gc; |
2093 struct oscar_data *od; | 2094 struct oscar_data *od; |
2094 struct direct_im *dim; | 2095 struct direct_im *dim; |
2095 char *host; int port = 4443; | 2096 char *host; int port = 4443; |
2096 int i, rc; | 2097 int i, rc; |
2097 | 2098 |
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); |
2479 g_free(nombre); | 2483 g_free(nombre); |
2480 } | 2484 } |
2481 | 2485 |
2482 /* When other people ask you for authorization */ | 2486 /* When other people ask you for authorization */ |
2483 static void gaim_auth_grant(struct name_data *data) { | 2487 static void gaim_auth_grant(struct name_data *data) { |
2484 struct gaim_connection *gc = data->gc; | 2488 GaimConnection *gc = data->gc; |
2485 | 2489 |
2486 if (g_slist_find(connections, gc)) { | 2490 if (g_slist_find(connections, gc)) { |
2487 struct oscar_data *od = gc->proto_data; | 2491 struct oscar_data *od = gc->proto_data; |
2488 #ifdef NOSSI | 2492 #ifdef NOSSI |
2489 struct buddy *buddy; | 2493 struct buddy *buddy; |
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; |
2952 return 1; | 2956 return 1; |
2953 } | 2957 } |
2954 | 2958 |
2955 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { | 2959 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2956 #if 0 | 2960 #if 0 |
2957 struct gaim_connection *gc = sess->aux_data; | 2961 GaimConnection *gc = sess->aux_data; |
2958 struct oscar_data *od = gc->proto_data; | 2962 struct oscar_data *od = gc->proto_data; |
2959 struct gaim_xfer *xfer; | 2963 struct gaim_xfer *xfer; |
2960 #endif | 2964 #endif |
2961 va_list ap; | 2965 va_list ap; |
2962 fu16_t reason; | 2966 fu16_t reason; |
2987 | 2991 |
2988 return 1; | 2992 return 1; |
2989 } | 2993 } |
2990 | 2994 |
2991 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { | 2995 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
2992 struct gaim_connection *gc = sess->aux_data; | 2996 GaimConnection *gc = sess->aux_data; |
2993 va_list ap; | 2997 va_list ap; |
2994 fu16_t type1, type2; | 2998 fu16_t type1, type2; |
2995 char *sn; | 2999 char *sn; |
2996 | 3000 |
2997 va_start(ap, fr); | 3001 va_start(ap, fr); |
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, |
3224 caps_string(info->capabilities), | 3229 caps_string(info->capabilities), |
3225 "</i>", | 3230 "</i>", |
3226 NULL); | 3231 NULL); |
3227 } else { | 3232 } else { |
3228 g_show_info_text(gc, info->sn, 1, | 3233 g_show_info_text(gc, info->sn, 1, |
3229 (utf8 && *utf8) ? away_subs(utf8, gc->username) : _("<i>No Information Provided</i>"), | 3234 (utf8 && *utf8) ? away_subs(utf8, username) : _("<i>No Information Provided</i>"), |
3230 NULL); | 3235 NULL); |
3231 } | 3236 } |
3232 | 3237 |
3233 g_free(header); | 3238 g_free(header); |
3234 g_free(utf8); | 3239 g_free(utf8); |
3256 } | 3261 } |
3257 | 3262 |
3258 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { | 3263 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
3259 va_list ap; | 3264 va_list ap; |
3260 fu16_t type; | 3265 fu16_t type; |
3261 struct gaim_connection *gc = sess->aux_data; | 3266 GaimConnection *gc = sess->aux_data; |
3262 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 3267 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
3263 | 3268 |
3264 va_start(ap, fr); | 3269 va_start(ap, fr); |
3265 type = (fu16_t) va_arg(ap, unsigned int); | 3270 type = (fu16_t) va_arg(ap, unsigned int); |
3266 | 3271 |
3336 | 3341 |
3337 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { | 3342 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
3338 va_list ap; | 3343 va_list ap; |
3339 int count, i; | 3344 int count, i; |
3340 aim_userinfo_t *info; | 3345 aim_userinfo_t *info; |
3341 struct gaim_connection *g = sess->aux_data; | 3346 GaimConnection *g = sess->aux_data; |
3342 | 3347 |
3343 struct chat_connection *c = NULL; | 3348 struct chat_connection *c = NULL; |
3344 | 3349 |
3345 va_start(ap, fr); | 3350 va_start(ap, fr); |
3346 count = va_arg(ap, int); | 3351 count = va_arg(ap, int); |
3359 | 3364 |
3360 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { | 3365 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
3361 va_list ap; | 3366 va_list ap; |
3362 int count, i; | 3367 int count, i; |
3363 aim_userinfo_t *info; | 3368 aim_userinfo_t *info; |
3364 struct gaim_connection *g = sess->aux_data; | 3369 GaimConnection *g = sess->aux_data; |
3365 | 3370 |
3366 struct chat_connection *c = NULL; | 3371 struct chat_connection *c = NULL; |
3367 | 3372 |
3368 va_start(ap, fr); | 3373 va_start(ap, fr); |
3369 count = va_arg(ap, int); | 3374 count = va_arg(ap, int); |
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 *); |
3415 | 3420 |
3416 return 1; | 3421 return 1; |
3417 } | 3422 } |
3418 | 3423 |
3419 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { | 3424 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
3420 struct gaim_connection *gc = sess->aux_data; | 3425 GaimConnection *gc = sess->aux_data; |
3421 va_list ap; | 3426 va_list ap; |
3422 aim_userinfo_t *info; | 3427 aim_userinfo_t *info; |
3423 char *msg; | 3428 char *msg; |
3424 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); | 3429 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
3425 | 3430 |
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", |
3471 | 3476 |
3472 return 1; | 3477 return 1; |
3473 } | 3478 } |
3474 | 3479 |
3475 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | 3480 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { |
3476 struct gaim_connection *gc = sess->aux_data; | 3481 GaimConnection *gc = sess->aux_data; |
3477 struct oscar_data *od = gc->proto_data; | 3482 struct oscar_data *od = gc->proto_data; |
3478 GSList *cur; | 3483 GSList *cur; |
3479 va_list ap; | 3484 va_list ap; |
3480 char *sn; | 3485 char *sn; |
3481 fu8_t *iconcsum, *icon; | 3486 fu8_t *iconcsum, *icon; |
3518 | 3523 |
3519 return 1; | 3524 return 1; |
3520 } | 3525 } |
3521 | 3526 |
3522 static gboolean gaim_icon_timerfunc(gpointer data) { | 3527 static gboolean gaim_icon_timerfunc(gpointer data) { |
3523 struct gaim_connection *gc = data; | 3528 GaimConnection *gc = data; |
3524 struct oscar_data *od = gc->proto_data; | 3529 struct oscar_data *od = gc->proto_data; |
3525 struct buddyinfo *bi; | 3530 struct buddyinfo *bi; |
3526 aim_conn_t *conn; | 3531 aim_conn_t *conn; |
3527 | 3532 |
3528 if (!od->requesticon) { | 3533 if (!od->requesticon) { |
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); |
3639 } | 3644 } |
3640 | 3645 |
3641 static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { | 3646 static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
3642 va_list ap; | 3647 va_list ap; |
3643 aim_userinfo_t *info; | 3648 aim_userinfo_t *info; |
3644 struct gaim_connection *gc = sess->aux_data; | 3649 GaimConnection *gc = sess->aux_data; |
3645 | 3650 |
3646 va_start(ap, fr); | 3651 va_start(ap, fr); |
3647 info = va_arg(ap, aim_userinfo_t *); | 3652 info = va_arg(ap, aim_userinfo_t *); |
3648 va_end(ap); | 3653 va_end(ap); |
3649 | 3654 |
3654 | 3659 |
3655 return 1; | 3660 return 1; |
3656 } | 3661 } |
3657 | 3662 |
3658 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { | 3663 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
3659 struct gaim_connection *gc = sess->aux_data; | 3664 GaimConnection *gc = sess->aux_data; |
3660 struct oscar_data *od = gc->proto_data; | 3665 struct oscar_data *od = gc->proto_data; |
3661 va_list ap; | 3666 va_list ap; |
3662 fu16_t code; | 3667 fu16_t code; |
3663 char *msg; | 3668 char *msg; |
3664 | 3669 |
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 |
3774 return 1; | 3779 return 1; |
3775 } | 3780 } |
3776 | 3781 |
3777 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) | 3782 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3778 { | 3783 { |
3779 struct gaim_connection *gc = sess->aux_data; | 3784 GaimConnection *gc = sess->aux_data; |
3780 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 3785 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
3781 va_list ap; | 3786 va_list ap; |
3782 fu16_t maxsiglen; | 3787 fu16_t maxsiglen; |
3783 | 3788 |
3784 va_start(ap, fr); | 3789 va_start(ap, fr); |
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); |
3885 return 1; | 3890 return 1; |
3886 } | 3891 } |
3887 | 3892 |
3888 static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) | 3893 static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) |
3889 { | 3894 { |
3890 struct gaim_connection *gc = sess->aux_data; | 3895 GaimConnection *gc = sess->aux_data; |
3891 gchar *buf, *tmp, *utf8; | 3896 gchar *buf, *tmp, *utf8; |
3892 gchar who[16]; | 3897 gchar who[16]; |
3893 va_list ap; | 3898 va_list ap; |
3894 struct aim_icq_info *info; | 3899 struct aim_icq_info *info; |
3895 | 3900 |
4004 return 1; | 4009 return 1; |
4005 } | 4010 } |
4006 | 4011 |
4007 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) | 4012 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
4008 { | 4013 { |
4009 struct gaim_connection *gc = sess->aux_data; | 4014 GaimConnection *gc = sess->aux_data; |
4010 gchar who[16], *utf8; | 4015 gchar who[16], *utf8; |
4011 struct buddy *b; | 4016 struct buddy *b; |
4012 va_list ap; | 4017 va_list ap; |
4013 struct aim_icq_info *info; | 4018 struct aim_icq_info *info; |
4014 | 4019 |
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 |
4428 } | 4435 } |
4429 | 4436 |
4430 return; | 4437 return; |
4431 } | 4438 } |
4432 | 4439 |
4433 static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *text) | 4440 static void oscar_set_away_aim(GaimConnection *gc, struct oscar_data *od, const char *text) |
4434 { | 4441 { |
4435 fu32_t flags = 0; | 4442 fu32_t flags = 0; |
4436 char *msg = NULL; | 4443 char *msg = NULL; |
4437 int msglen = 0; | 4444 int msglen = 0; |
4438 | 4445 |
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"))) { |
4534 } | 4541 } |
4535 | 4542 |
4536 return; | 4543 return; |
4537 } | 4544 } |
4538 | 4545 |
4539 static void oscar_set_away(struct gaim_connection *gc, char *state, char *message) | 4546 static void oscar_set_away(GaimConnection *gc, char *state, char *message) |
4540 { | 4547 { |
4541 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4548 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4542 | 4549 |
4543 if (od->icq) | 4550 if (od->icq) |
4544 oscar_set_away_icq(gc, od, state, message); | 4551 oscar_set_away_icq(gc, od, state, message); |
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))) { |
4577 #endif | 4584 #endif |
4578 if (od->icq) | 4585 if (od->icq) |
4579 aim_icq_getalias(od->sess, name); | 4586 aim_icq_getalias(od->sess, name); |
4580 } | 4587 } |
4581 | 4588 |
4582 static void oscar_add_buddies(struct gaim_connection *gc, GList *buddies) { | 4589 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
4583 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4590 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4584 #ifdef NOSSI | 4591 #ifdef NOSSI |
4585 char buf[MSG_LEN]; | 4592 char buf[MSG_LEN]; |
4586 int n=0; | 4593 int n=0; |
4587 while (buddies) { | 4594 while (buddies) { |
4607 } | 4614 } |
4608 } | 4615 } |
4609 #endif | 4616 #endif |
4610 } | 4617 } |
4611 | 4618 |
4612 static void oscar_remove_buddy(struct gaim_connection *gc, char *name, char *group) { | 4619 static void oscar_remove_buddy(GaimConnection *gc, char *name, char *group) { |
4613 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4620 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4614 #ifdef NOSSI | 4621 #ifdef NOSSI |
4615 aim_remove_buddy(od->sess, od->conn, name); | 4622 aim_remove_buddy(od->sess, od->conn, name); |
4616 #else | 4623 #else |
4617 if (od->sess->ssi.received_data) { | 4624 if (od->sess->ssi.received_data) { |
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); |
4678 } | 4685 } |
4679 } | 4686 } |
4680 } | 4687 } |
4681 | 4688 |
4682 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { | 4689 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4683 struct gaim_connection *gc = sess->aux_data; | 4690 GaimConnection *gc = sess->aux_data; |
4684 struct oscar_data *od = gc->proto_data; | 4691 struct oscar_data *od = gc->proto_data; |
4685 va_list ap; | 4692 va_list ap; |
4686 fu16_t reason; | 4693 fu16_t reason; |
4687 | 4694 |
4688 va_start(ap, fr); | 4695 va_start(ap, fr); |
4705 | 4712 |
4706 return 1; | 4713 return 1; |
4707 } | 4714 } |
4708 | 4715 |
4709 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { | 4716 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
4710 struct gaim_connection *gc = sess->aux_data; | 4717 GaimConnection *gc = sess->aux_data; |
4711 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4718 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4712 int numtypes, i; | 4719 int numtypes, i; |
4713 fu16_t *maxitems; | 4720 fu16_t *maxitems; |
4714 va_list ap; | 4721 va_list ap; |
4715 | 4722 |
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 } |
4932 | 4940 |
4933 return 1; | 4941 return 1; |
4934 } | 4942 } |
4935 | 4943 |
4936 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | 4944 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { |
4937 struct gaim_connection *gc = sess->aux_data; | 4945 GaimConnection *gc = sess->aux_data; |
4938 va_list ap; | 4946 va_list ap; |
4939 struct aim_ssi_tmp *retval; | 4947 struct aim_ssi_tmp *retval; |
4940 | 4948 |
4941 va_start(ap, fr); | 4949 va_start(ap, fr); |
4942 retval = va_arg(ap, struct aim_ssi_tmp *); | 4950 retval = va_arg(ap, struct aim_ssi_tmp *); |
4978 | 4986 |
4979 return 1; | 4987 return 1; |
4980 } | 4988 } |
4981 | 4989 |
4982 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { | 4990 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { |
4983 struct gaim_connection *gc = sess->aux_data; | 4991 GaimConnection *gc = sess->aux_data; |
4984 va_list ap; | 4992 va_list ap; |
4985 char *sn, *msg; | 4993 char *sn, *msg; |
4986 gchar *dialog_msg, *nombre; | 4994 gchar *dialog_msg, *nombre; |
4987 struct name_data *data; | 4995 struct name_data *data; |
4988 struct buddy *buddy; | 4996 struct buddy *buddy; |
5017 | 5025 |
5018 return 1; | 5026 return 1; |
5019 } | 5027 } |
5020 | 5028 |
5021 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | 5029 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
5022 struct gaim_connection *gc = sess->aux_data; | 5030 GaimConnection *gc = sess->aux_data; |
5023 va_list ap; | 5031 va_list ap; |
5024 char *sn, *msg; | 5032 char *sn, *msg; |
5025 gchar *dialog_msg, *nombre; | 5033 gchar *dialog_msg, *nombre; |
5026 struct name_data *data; | 5034 struct name_data *data; |
5027 struct buddy *buddy; | 5035 struct buddy *buddy; |
5056 | 5064 |
5057 return 1; | 5065 return 1; |
5058 } | 5066 } |
5059 | 5067 |
5060 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | 5068 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { |
5061 struct gaim_connection *gc = sess->aux_data; | 5069 GaimConnection *gc = sess->aux_data; |
5062 va_list ap; | 5070 va_list ap; |
5063 char *sn, *msg; | 5071 char *sn, *msg; |
5064 gchar *dialog_msg, *nombre; | 5072 gchar *dialog_msg, *nombre; |
5065 fu8_t reply; | 5073 fu8_t reply; |
5066 struct buddy *buddy; | 5074 struct buddy *buddy; |
5094 | 5102 |
5095 return 1; | 5103 return 1; |
5096 } | 5104 } |
5097 | 5105 |
5098 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | 5106 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { |
5099 struct gaim_connection *gc = sess->aux_data; | 5107 GaimConnection *gc = sess->aux_data; |
5100 va_list ap; | 5108 va_list ap; |
5101 char *sn; | 5109 char *sn; |
5102 struct buddy *buddy; | 5110 struct buddy *buddy; |
5103 | 5111 |
5104 va_start(ap, fr); | 5112 va_start(ap, fr); |
5112 | 5120 |
5113 return 1; | 5121 return 1; |
5114 } | 5122 } |
5115 #endif | 5123 #endif |
5116 | 5124 |
5117 static GList *oscar_chat_info(struct gaim_connection *gc) { | 5125 static GList *oscar_chat_info(GaimConnection *gc) { |
5118 GList *m = NULL; | 5126 GList *m = NULL; |
5119 struct proto_chat_entry *pce; | 5127 struct proto_chat_entry *pce; |
5120 | 5128 |
5121 pce = g_new0(struct proto_chat_entry, 1); | 5129 pce = g_new0(struct proto_chat_entry, 1); |
5122 pce->label = _("Join what group:"); | 5130 pce->label = _("Join what group:"); |
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; |
5264 aim_chat_send_im(od->sess, c->conn, 0, buf, strlen(buf)); | 5272 aim_chat_send_im(od->sess, c->conn, 0, buf, strlen(buf)); |
5265 g_free(buf); | 5273 g_free(buf); |
5266 return 0; | 5274 return 0; |
5267 } | 5275 } |
5268 | 5276 |
5269 static const char *oscar_list_icon(struct gaim_account *a, struct buddy *b) { | 5277 static const char *oscar_list_icon(GaimAccount *a, struct buddy *b) { |
5270 if (!b || (b && b->name && b->name[0] == '+')) { | 5278 if (!b || (b && b->name && b->name[0] == '+')) { |
5271 if (isdigit(a->username[0])) | 5279 if (isdigit(a->username[0])) |
5272 return "icq"; | 5280 return "icq"; |
5273 else | 5281 else |
5274 return "aim"; | 5282 return "aim"; |
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)) { |
5382 yay[strlen(yay)-1] = '\0'; | 5390 yay[strlen(yay)-1] = '\0'; |
5383 return yay; | 5391 return yay; |
5384 } | 5392 } |
5385 | 5393 |
5386 static char *oscar_status_text(struct buddy *b) { | 5394 static char *oscar_status_text(struct buddy *b) { |
5387 struct gaim_connection *gc = b->account->gc; | 5395 GaimConnection *gc = b->account->gc; |
5388 struct oscar_data *od = gc->proto_data; | 5396 struct oscar_data *od = gc->proto_data; |
5389 gchar *ret = NULL; | 5397 gchar *ret = NULL; |
5390 | 5398 |
5391 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | 5399 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { |
5392 if (isdigit(b->name[0])) | 5400 if (isdigit(b->name[0])) |
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; |
5450 | 5458 |
5451 static int gaim_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | 5459 static int gaim_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { |
5452 va_list ap; | 5460 va_list ap; |
5453 char *sn; | 5461 char *sn; |
5454 double percent; | 5462 double percent; |
5455 struct gaim_connection *gc = sess->aux_data; | 5463 GaimConnection *gc = sess->aux_data; |
5456 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 5464 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5457 struct gaim_conversation *c; | 5465 struct gaim_conversation *c; |
5458 struct direct_im *dim; | 5466 struct direct_im *dim; |
5459 | 5467 |
5460 va_start(ap, fr); | 5468 va_start(ap, fr); |
5478 | 5486 |
5479 return 1; | 5487 return 1; |
5480 } | 5488 } |
5481 | 5489 |
5482 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { | 5490 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5483 struct gaim_connection *gc = sess->aux_data; | 5491 GaimConnection *gc = sess->aux_data; |
5484 int imflags = 0; | 5492 int imflags = 0; |
5485 va_list ap; | 5493 va_list ap; |
5486 char *sn, *msg; | 5494 char *sn, *msg; |
5487 int len, encoding, isawaymsg; | 5495 int len, encoding, isawaymsg; |
5488 | 5496 |
5508 | 5516 |
5509 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { | 5517 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5510 va_list ap; | 5518 va_list ap; |
5511 char *sn; | 5519 char *sn; |
5512 int typing; | 5520 int typing; |
5513 struct gaim_connection *gc = sess->aux_data; | 5521 GaimConnection *gc = sess->aux_data; |
5514 | 5522 |
5515 va_start(ap, fr); | 5523 va_start(ap, fr); |
5516 sn = va_arg(ap, char *); | 5524 sn = va_arg(ap, char *); |
5517 typing = va_arg(ap, int); | 5525 typing = va_arg(ap, int); |
5518 va_end(ap); | 5526 va_end(ap); |
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); |
5585 | 5593 |
5586 g_free(data->who); | 5594 g_free(data->who); |
5587 g_free(data); | 5595 g_free(data); |
5588 } | 5596 } |
5589 | 5597 |
5590 static void oscar_ask_direct_im(struct gaim_connection *gc, const char *who) { | 5598 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
5591 gchar *buf; | 5599 gchar *buf; |
5592 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); | 5600 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
5593 data->who = g_strdup(who); | 5601 data->who = g_strdup(who); |
5594 data->gc = gc; | 5602 data->gc = gc; |
5595 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), who); | 5603 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), 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; |
5710 if (od->sess->ssi.received_data) | 5719 if (od->sess->ssi.received_data) |
5711 aim_ssi_deldeny(od->sess, who); | 5720 aim_ssi_deldeny(od->sess, who); |
5712 #endif | 5721 #endif |
5713 } | 5722 } |
5714 | 5723 |
5715 static GList *oscar_away_states(struct gaim_connection *gc) | 5724 static GList *oscar_away_states(GaimConnection *gc) |
5716 { | 5725 { |
5717 struct oscar_data *od = gc->proto_data; | 5726 struct oscar_data *od = gc->proto_data; |
5718 GList *m = NULL; | 5727 GList *m = NULL; |
5719 | 5728 |
5720 if (!od->icq) | 5729 if (!od->icq) |
5729 m = g_list_append(m, _("Invisible")); | 5738 m = g_list_append(m, _("Invisible")); |
5730 | 5739 |
5731 return m; | 5740 return m; |
5732 } | 5741 } |
5733 | 5742 |
5734 static GList *oscar_buddy_menu(struct gaim_connection *gc, const char *who) { | 5743 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
5735 struct oscar_data *od = gc->proto_data; | 5744 struct oscar_data *od = gc->proto_data; |
5736 GList *m = NULL; | 5745 GList *m = NULL; |
5737 struct proto_buddy_menu *pbm; | 5746 struct proto_buddy_menu *pbm; |
5738 | 5747 |
5739 if (od->icq) { | 5748 if (od->icq) { |
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) { |
5819 od->conf = TRUE; | 5828 od->conf = TRUE; |
5820 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | 5829 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
5821 } | 5830 } |
5822 } | 5831 } |
5823 | 5832 |
5824 static void oscar_show_email(struct gaim_connection *gc) | 5833 static void oscar_show_email(GaimConnection *gc) |
5825 { | 5834 { |
5826 struct oscar_data *od = gc->proto_data; | 5835 struct oscar_data *od = gc->proto_data; |
5827 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | 5836 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
5828 | 5837 |
5829 if (conn) { | 5838 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 |
5986 m = g_list_append(m, pam); */ | 5995 m = g_list_append(m, pam); */ |
5987 | 5996 |
5988 return m; | 5997 return m; |
5989 } | 5998 } |
5990 | 5999 |
5991 static void oscar_change_passwd(struct gaim_connection *gc, const char *old, const char *new) | 6000 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
5992 { | 6001 { |
5993 struct oscar_data *od = gc->proto_data; | 6002 struct oscar_data *od = gc->proto_data; |
5994 | 6003 |
5995 if (od->icq) { | 6004 if (od->icq) { |
5996 aim_icq_changepasswd(od->sess, new); | 6005 aim_icq_changepasswd(od->sess, new); |
6005 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | 6014 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
6006 } | 6015 } |
6007 } | 6016 } |
6008 } | 6017 } |
6009 | 6018 |
6010 static void oscar_convo_closed(struct gaim_connection *gc, char *who) | 6019 static void oscar_convo_closed(GaimConnection *gc, char *who) |
6011 { | 6020 { |
6012 struct oscar_data *od = gc->proto_data; | 6021 struct oscar_data *od = gc->proto_data; |
6013 struct direct_im *dim = find_direct_im(od, who); | 6022 struct direct_im *dim = find_direct_im(od, who); |
6014 | 6023 |
6015 if (!dim) | 6024 if (!dim) |