Mercurial > pidgin.yaz
comparison src/protocols/oscar/oscar.c @ 7283:b8fcbff88438
[gaim-migrate @ 7863]
I renamed struct oscar_data to typdef OscarData, which makes
this a freaking huge change to oscar.c
I think I added another progress meter step, giving oscar a
total of 8.
And a patch from Siberion (siberion):
Moving the mouse cursor over an ICQ buddy whose IP is
visible will show negative numbers in the IP for any
parts that exceed 127.
Example: 12.-37.-16.X
With the path applied, this shows as: 12.219.240.X
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 16 Oct 2003 20:57:59 +0000 |
parents | ad243bc63184 |
children | a50eea7628cb |
comparison
equal
deleted
inserted
replaced
7282:ad243bc63184 | 7283:b8fcbff88438 |
---|---|
53 #define UC_WIRELESS 0x40 | 53 #define UC_WIRELESS 0x40 |
54 #define UC_HIPTOP 0x80 | 54 #define UC_HIPTOP 0x80 |
55 | 55 |
56 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" | 56 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
57 | 57 |
58 #define OSCAR_CONNECT_STEPS 6 | |
59 | |
58 static GaimPlugin *my_protocol = NULL; | 60 static GaimPlugin *my_protocol = NULL; |
59 | 61 |
60 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE; | 62 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE; |
61 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE; | 63 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE; |
62 | 64 |
63 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; | 65 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
64 static fu8_t features_icq[] = {0x01, 0x06}; | 66 static fu8_t features_icq[] = {0x01, 0x06}; |
65 | 67 |
66 struct oscar_data { | 68 typedef struct _OscarData OscarData; |
69 struct _OscarData { | |
67 aim_session_t *sess; | 70 aim_session_t *sess; |
68 aim_conn_t *conn; | 71 aim_conn_t *conn; |
69 | 72 |
70 guint cnpa; | 73 guint cnpa; |
71 guint paspa; | 74 guint paspa; |
374 } | 377 } |
375 | 378 |
376 return utf8; | 379 return utf8; |
377 } | 380 } |
378 | 381 |
379 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { | 382 static struct direct_im *find_direct_im(OscarData *od, const char *who) { |
380 GSList *d = od->direct_ims; | 383 GSList *d = od->direct_ims; |
381 struct direct_im *m = NULL; | 384 struct direct_im *m = NULL; |
382 | 385 |
383 while (d) { | 386 while (d) { |
384 m = (struct direct_im *)d->data; | 387 m = (struct direct_im *)d->data; |
418 tmp[j] = 0; | 421 tmp[j] = 0; |
419 return tmp; | 422 return tmp; |
420 } | 423 } |
421 | 424 |
422 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { | 425 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
423 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; | 426 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
424 struct chat_connection *c = NULL; | 427 struct chat_connection *c = NULL; |
425 | 428 |
426 while (g) { | 429 while (g) { |
427 c = (struct chat_connection *)g->data; | 430 c = (struct chat_connection *)g->data; |
428 if (c->id == id) | 431 if (c->id == id) |
434 return c; | 437 return c; |
435 } | 438 } |
436 | 439 |
437 static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, | 440 static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, |
438 aim_conn_t *conn) { | 441 aim_conn_t *conn) { |
439 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; | 442 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
440 struct chat_connection *c = NULL; | 443 struct chat_connection *c = NULL; |
441 | 444 |
442 while (g) { | 445 while (g) { |
443 c = (struct chat_connection *)g->data; | 446 c = (struct chat_connection *)g->data; |
444 if (c->conn == conn) | 447 if (c->conn == conn) |
450 return c; | 453 return c; |
451 } | 454 } |
452 | 455 |
453 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { | 456 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
454 GaimConnection *gc = sess->aux_data; | 457 GaimConnection *gc = sess->aux_data; |
455 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 458 OscarData *od = (OscarData *)gc->proto_data; |
456 GaimConversation *cnv; | 459 GaimConversation *cnv; |
457 struct direct_im *dim; | 460 struct direct_im *dim; |
458 char *sn; | 461 char *sn; |
459 char buf[256]; | 462 char buf[256]; |
460 | 463 |
486 | 489 |
487 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { | 490 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
488 aim_conn_t *conn = (aim_conn_t *)data; | 491 aim_conn_t *conn = (aim_conn_t *)data; |
489 aim_session_t *sess = aim_conn_getsess(conn); | 492 aim_session_t *sess = aim_conn_getsess(conn); |
490 GaimConnection *gc = sess ? sess->aux_data : NULL; | 493 GaimConnection *gc = sess ? sess->aux_data : NULL; |
491 struct oscar_data *od; | 494 OscarData *od; |
492 | 495 |
493 if (!gc) { | 496 if (!gc) { |
494 /* gc is null. we return, else we seg SIGSEG on next line. */ | 497 /* gc is null. we return, else we seg SIGSEG on next line. */ |
495 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 498 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
496 "oscar callback for closed connection (1).\n"); | 499 "oscar callback for closed connection (1).\n"); |
497 return; | 500 return; |
498 } | 501 } |
499 | 502 |
500 od = (struct oscar_data *)gc->proto_data; | 503 od = (OscarData *)gc->proto_data; |
501 | 504 |
502 if (!g_list_find(gaim_connections_get_all(), gc)) { | 505 if (!g_list_find(gaim_connections_get_all(), gc)) { |
503 /* oh boy. this is probably bad. i guess the only thing we | 506 /* oh boy. this is probably bad. i guess the only thing we |
504 * can really do is return? */ | 507 * can really do is return? */ |
505 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 508 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
613 } | 616 } |
614 | 617 |
615 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) | 618 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
616 { | 619 { |
617 GaimConnection *gc = data; | 620 GaimConnection *gc = data; |
618 struct oscar_data *od; | 621 OscarData *od; |
619 aim_session_t *sess; | 622 aim_session_t *sess; |
620 aim_conn_t *conn; | 623 aim_conn_t *conn; |
621 | 624 |
622 if (!g_list_find(gaim_connections_get_all(), gc)) { | 625 if (!g_list_find(gaim_connections_get_all(), gc)) { |
623 close(source); | 626 close(source); |
638 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); | 641 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
639 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); | 642 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); |
640 | 643 |
641 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 644 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
642 "Screen name sent, waiting for response\n"); | 645 "Screen name sent, waiting for response\n"); |
643 gaim_connection_update_progress(gc, _("Screen name sent"), 1, 6); | 646 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); |
644 } | 647 } |
645 | 648 |
646 static void oscar_login(GaimAccount *account) { | 649 static void oscar_login(GaimAccount *account) { |
647 aim_session_t *sess; | 650 aim_session_t *sess; |
648 aim_conn_t *conn; | 651 aim_conn_t *conn; |
649 GaimConnection *gc = gaim_account_get_connection(account); | 652 GaimConnection *gc = gaim_account_get_connection(account); |
650 struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1); | 653 OscarData *od = gc->proto_data = g_new0(OscarData, 1); |
651 | 654 |
652 gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); | 655 gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); |
653 | 656 |
654 if (isdigit(*(gaim_account_get_username(account)))) { | 657 if (isdigit(*(gaim_account_get_username(account)))) { |
655 od->icq = TRUE; | 658 od->icq = TRUE; |
688 oscar_login_connect, gc) < 0) { | 691 oscar_login_connect, gc) < 0) { |
689 gaim_connection_error(gc, _("Couldn't connect to host")); | 692 gaim_connection_error(gc, _("Couldn't connect to host")); |
690 return; | 693 return; |
691 } | 694 } |
692 | 695 |
693 gaim_connection_update_progress(gc, _("Connecting"), 0, 6); | 696 gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); |
694 } | 697 } |
695 | 698 |
696 static void oscar_close(GaimConnection *gc) { | 699 static void oscar_close(GaimConnection *gc) { |
697 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 700 OscarData *od = (OscarData *)gc->proto_data; |
698 | 701 |
699 while (od->oscar_chats) { | 702 while (od->oscar_chats) { |
700 struct chat_connection *n = od->oscar_chats->data; | 703 struct chat_connection *n = od->oscar_chats->data; |
701 if (n->inpa > 0) | 704 if (n->inpa > 0) |
702 gaim_input_remove(n->inpa); | 705 gaim_input_remove(n->inpa); |
758 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); | 761 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
759 } | 762 } |
760 | 763 |
761 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { | 764 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
762 GaimConnection *gc = data; | 765 GaimConnection *gc = data; |
763 struct oscar_data *od; | 766 OscarData *od; |
764 aim_session_t *sess; | 767 aim_session_t *sess; |
765 aim_conn_t *bosconn; | 768 aim_conn_t *bosconn; |
766 | 769 |
767 if (!g_list_find(gaim_connections_get_all(), gc)) { | 770 if (!g_list_find(gaim_connections_get_all(), gc)) { |
768 close(source); | 771 close(source); |
779 return; | 782 return; |
780 } | 783 } |
781 | 784 |
782 aim_conn_completeconnect(sess, bosconn); | 785 aim_conn_completeconnect(sess, bosconn); |
783 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); | 786 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
787 | |
784 gaim_connection_update_progress(gc, | 788 gaim_connection_update_progress(gc, |
785 _("Connection established, cookie sent"), 4, 6); | 789 _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); |
786 } | 790 } |
787 | 791 |
788 /* BBB */ | 792 /* BBB */ |
789 /* | 793 /* |
790 * This little area in oscar.c is the nexus of file transfer code, | 794 * This little area in oscar.c is the nexus of file transfer code, |
819 /* XXX - This function is pretty ugly */ | 823 /* XXX - This function is pretty ugly */ |
820 static void oscar_xfer_init(GaimXfer *xfer) | 824 static void oscar_xfer_init(GaimXfer *xfer) |
821 { | 825 { |
822 struct aim_oft_info *oft_info = xfer->data; | 826 struct aim_oft_info *oft_info = xfer->data; |
823 GaimConnection *gc = oft_info->sess->aux_data; | 827 GaimConnection *gc = oft_info->sess->aux_data; |
824 struct oscar_data *od = gc->proto_data; | 828 OscarData *od = gc->proto_data; |
825 | 829 |
826 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | 830 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { |
827 int i; | 831 int i; |
828 | 832 |
829 xfer->filename = g_path_get_basename(xfer->local_filename); | 833 xfer->filename = g_path_get_basename(xfer->local_filename); |
885 | 889 |
886 static void oscar_xfer_end(GaimXfer *xfer) | 890 static void oscar_xfer_end(GaimXfer *xfer) |
887 { | 891 { |
888 struct aim_oft_info *oft_info = xfer->data; | 892 struct aim_oft_info *oft_info = xfer->data; |
889 GaimConnection *gc = oft_info->sess->aux_data; | 893 GaimConnection *gc = oft_info->sess->aux_data; |
890 struct oscar_data *od = gc->proto_data; | 894 OscarData *od = gc->proto_data; |
891 | 895 |
892 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); | 896 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
893 | 897 |
894 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | 898 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
895 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | 899 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); |
904 | 908 |
905 static void oscar_xfer_cancel_send(GaimXfer *xfer) | 909 static void oscar_xfer_cancel_send(GaimXfer *xfer) |
906 { | 910 { |
907 struct aim_oft_info *oft_info = xfer->data; | 911 struct aim_oft_info *oft_info = xfer->data; |
908 GaimConnection *gc = oft_info->sess->aux_data; | 912 GaimConnection *gc = oft_info->sess->aux_data; |
909 struct oscar_data *od = gc->proto_data; | 913 OscarData *od = gc->proto_data; |
910 | 914 |
911 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 915 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
912 "AAA - in oscar_xfer_cancel_send\n"); | 916 "AAA - in oscar_xfer_cancel_send\n"); |
913 | 917 |
914 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | 918 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); |
921 | 925 |
922 static void oscar_xfer_cancel_recv(GaimXfer *xfer) | 926 static void oscar_xfer_cancel_recv(GaimXfer *xfer) |
923 { | 927 { |
924 struct aim_oft_info *oft_info = xfer->data; | 928 struct aim_oft_info *oft_info = xfer->data; |
925 GaimConnection *gc = oft_info->sess->aux_data; | 929 GaimConnection *gc = oft_info->sess->aux_data; |
926 struct oscar_data *od = gc->proto_data; | 930 OscarData *od = gc->proto_data; |
927 | 931 |
928 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 932 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
929 "AAA - in oscar_xfer_cancel_recv\n"); | 933 "AAA - in oscar_xfer_cancel_recv\n"); |
930 | 934 |
931 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | 935 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); |
992 | 996 |
993 return NULL; | 997 return NULL; |
994 } | 998 } |
995 | 999 |
996 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { | 1000 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
997 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 1001 OscarData *od = (OscarData *)gc->proto_data; |
998 GaimXfer *xfer; | 1002 GaimXfer *xfer; |
999 struct aim_oft_info *oft_info; | 1003 struct aim_oft_info *oft_info; |
1000 | 1004 |
1001 /* You want to send a file to someone else, you're so generous */ | 1005 /* You want to send a file to someone else, you're so generous */ |
1002 | 1006 |
1023 gaim_xfer_request(xfer); | 1027 gaim_xfer_request(xfer); |
1024 } | 1028 } |
1025 | 1029 |
1026 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { | 1030 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
1027 GaimConnection *gc = sess->aux_data; | 1031 GaimConnection *gc = sess->aux_data; |
1028 struct oscar_data *od = gc->proto_data; | 1032 OscarData *od = gc->proto_data; |
1029 GaimAccount *account = gc->account; | 1033 GaimAccount *account = gc->account; |
1030 aim_conn_t *bosconn; | 1034 aim_conn_t *bosconn; |
1031 char *host; int port; | 1035 char *host; int port; |
1032 int i, rc; | 1036 int i, rc; |
1033 va_list ap; | 1037 va_list ap; |
1148 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | 1152 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); |
1149 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | 1153 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); |
1150 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | 1154 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); |
1151 #endif | 1155 #endif |
1152 | 1156 |
1153 ((struct oscar_data *)gc->proto_data)->conn = bosconn; | 1157 od->conn = bosconn; |
1154 for (i = 0; i < (int)strlen(info->bosip); i++) { | 1158 for (i = 0; i < (int)strlen(info->bosip); i++) { |
1155 if (info->bosip[i] == ':') { | 1159 if (info->bosip[i] == ':') { |
1156 port = atoi(&(info->bosip[i+1])); | 1160 port = atoi(&(info->bosip[i+1])); |
1157 break; | 1161 break; |
1158 } | 1162 } |
1167 return 0; | 1171 return 0; |
1168 } | 1172 } |
1169 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); | 1173 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
1170 gaim_input_remove(gc->inpa); | 1174 gaim_input_remove(gc->inpa); |
1171 | 1175 |
1172 gaim_connection_update_progress(gc, _("Received authorization"), 4, 6); | 1176 gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); |
1173 | 1177 |
1174 return 1; | 1178 return 1; |
1175 } | 1179 } |
1176 | 1180 |
1177 struct pieceofcrap { | 1181 struct pieceofcrap { |
1185 }; | 1189 }; |
1186 | 1190 |
1187 static void damn_you(gpointer data, gint source, GaimInputCondition c) | 1191 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
1188 { | 1192 { |
1189 struct pieceofcrap *pos = data; | 1193 struct pieceofcrap *pos = data; |
1190 struct oscar_data *od = pos->gc->proto_data; | 1194 OscarData *od = pos->gc->proto_data; |
1191 char in = '\0'; | 1195 char in = '\0'; |
1192 int x = 0; | 1196 int x = 0; |
1193 unsigned char m[17]; | 1197 unsigned char m[17]; |
1194 | 1198 |
1195 while (read(pos->fd, &in, 1) == 1) { | 1199 while (read(pos->fd, &in, 1) == 1) { |
1331 return 1; | 1335 return 1; |
1332 } | 1336 } |
1333 | 1337 |
1334 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { | 1338 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
1335 GaimConnection *gc = sess->aux_data; | 1339 GaimConnection *gc = sess->aux_data; |
1336 struct oscar_data *od = gc->proto_data; | 1340 OscarData *od = gc->proto_data; |
1337 GaimAccount *account = gaim_connection_get_account(gc); | 1341 GaimAccount *account = gaim_connection_get_account(gc); |
1338 GaimAccount *ac = gaim_connection_get_account(gc); | 1342 GaimAccount *ac = gaim_connection_get_account(gc); |
1339 #if 0 | 1343 #if 0 |
1340 struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; | 1344 struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; |
1341 #endif | 1345 #endif |
1354 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | 1358 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; |
1355 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), | 1359 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
1356 gaim_account_get_password(account), &info, key); | 1360 gaim_account_get_password(account), &info, key); |
1357 } | 1361 } |
1358 | 1362 |
1359 gaim_connection_update_progress(gc, _("Password sent"), 3, 6); | 1363 gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); |
1360 | 1364 |
1361 return 1; | 1365 return 1; |
1362 } | 1366 } |
1363 | 1367 |
1364 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { | 1368 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
1405 return 1; | 1409 return 1; |
1406 } | 1410 } |
1407 | 1411 |
1408 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { | 1412 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
1409 GaimConnection *gc = sess->aux_data; | 1413 GaimConnection *gc = sess->aux_data; |
1410 struct oscar_data *od = gc->proto_data; | 1414 OscarData *od = gc->proto_data; |
1411 | 1415 |
1412 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | 1416 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); |
1413 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | 1417 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); |
1414 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | 1418 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); |
1415 | 1419 |
1424 return 1; | 1428 return 1; |
1425 } | 1429 } |
1426 | 1430 |
1427 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { | 1431 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
1428 GaimConnection *gc = data; | 1432 GaimConnection *gc = data; |
1429 struct oscar_data *od; | 1433 OscarData *od; |
1430 aim_session_t *sess; | 1434 aim_session_t *sess; |
1431 aim_conn_t *tstconn; | 1435 aim_conn_t *tstconn; |
1432 | 1436 |
1433 if (!g_list_find(gaim_connections_get_all(), gc)) { | 1437 if (!g_list_find(gaim_connections_get_all(), gc)) { |
1434 close(source); | 1438 close(source); |
1453 } | 1457 } |
1454 | 1458 |
1455 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) | 1459 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
1456 { | 1460 { |
1457 GaimConnection *gc = data; | 1461 GaimConnection *gc = data; |
1458 struct oscar_data *od; | 1462 OscarData *od; |
1459 aim_session_t *sess; | 1463 aim_session_t *sess; |
1460 aim_conn_t *tstconn; | 1464 aim_conn_t *tstconn; |
1461 | 1465 |
1462 if (!g_list_find(gaim_connections_get_all(), gc)) { | 1466 if (!g_list_find(gaim_connections_get_all(), gc)) { |
1463 close(source); | 1467 close(source); |
1483 | 1487 |
1484 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) | 1488 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
1485 { | 1489 { |
1486 struct chat_connection *ccon = data; | 1490 struct chat_connection *ccon = data; |
1487 GaimConnection *gc = ccon->gc; | 1491 GaimConnection *gc = ccon->gc; |
1488 struct oscar_data *od; | 1492 OscarData *od; |
1489 aim_session_t *sess; | 1493 aim_session_t *sess; |
1490 aim_conn_t *tstconn; | 1494 aim_conn_t *tstconn; |
1491 | 1495 |
1492 if (!g_list_find(gaim_connections_get_all(), gc)) { | 1496 if (!g_list_find(gaim_connections_get_all(), gc)) { |
1493 close(source); | 1497 close(source); |
1515 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | 1519 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); |
1516 } | 1520 } |
1517 | 1521 |
1518 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { | 1522 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
1519 GaimConnection *gc = data; | 1523 GaimConnection *gc = data; |
1520 struct oscar_data *od; | 1524 OscarData *od; |
1521 aim_session_t *sess; | 1525 aim_session_t *sess; |
1522 aim_conn_t *tstconn; | 1526 aim_conn_t *tstconn; |
1523 | 1527 |
1524 if (!g_list_find(gaim_connections_get_all(), gc)) { | 1528 if (!g_list_find(gaim_connections_get_all(), gc)) { |
1525 close(source); | 1529 close(source); |
1544 "email: connected\n"); | 1548 "email: connected\n"); |
1545 } | 1549 } |
1546 | 1550 |
1547 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { | 1551 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
1548 GaimConnection *gc = data; | 1552 GaimConnection *gc = data; |
1549 struct oscar_data *od; | 1553 OscarData *od; |
1550 aim_session_t *sess; | 1554 aim_session_t *sess; |
1551 aim_conn_t *tstconn; | 1555 aim_conn_t *tstconn; |
1552 | 1556 |
1553 if (!g_list_find(gaim_connections_get_all(), gc)) { | 1557 if (!g_list_find(gaim_connections_get_all(), gc)) { |
1554 close(source); | 1558 close(source); |
1737 return 1; | 1741 return 1; |
1738 } | 1742 } |
1739 | 1743 |
1740 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { | 1744 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
1741 GaimConnection *gc = sess->aux_data; | 1745 GaimConnection *gc = sess->aux_data; |
1742 struct oscar_data *od = gc->proto_data; | 1746 OscarData *od = gc->proto_data; |
1743 struct buddyinfo *bi; | 1747 struct buddyinfo *bi; |
1744 time_t time_idle = 0, signon = 0; | 1748 time_t time_idle = 0, signon = 0; |
1745 int type = 0; | 1749 int type = 0; |
1746 int caps = 0; | 1750 int caps = 0; |
1747 va_list ap; | 1751 va_list ap; |
1857 return 1; | 1861 return 1; |
1858 } | 1862 } |
1859 | 1863 |
1860 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { | 1864 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
1861 GaimConnection *gc = sess->aux_data; | 1865 GaimConnection *gc = sess->aux_data; |
1862 struct oscar_data *od = gc->proto_data; | 1866 OscarData *od = gc->proto_data; |
1863 va_list ap; | 1867 va_list ap; |
1864 aim_userinfo_t *info; | 1868 aim_userinfo_t *info; |
1865 | 1869 |
1866 va_start(ap, fr); | 1870 va_start(ap, fr); |
1867 info = va_arg(ap, aim_userinfo_t *); | 1871 info = va_arg(ap, aim_userinfo_t *); |
1882 } | 1886 } |
1883 | 1887 |
1884 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { | 1888 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
1885 struct direct_im *dim = data; | 1889 struct direct_im *dim = data; |
1886 GaimConnection *gc = dim->gc; | 1890 GaimConnection *gc = dim->gc; |
1887 struct oscar_data *od = gc->proto_data; | 1891 OscarData *od = gc->proto_data; |
1888 GaimConversation *cnv; | 1892 GaimConversation *cnv; |
1889 char buf[256]; | 1893 char buf[256]; |
1890 struct sockaddr name; | 1894 struct sockaddr name; |
1891 socklen_t name_len = 1; | 1895 socklen_t name_len = 1; |
1892 | 1896 |
1921 * want to do some voodoo with the socket file descriptors, add a | 1925 * want to do some voodoo with the socket file descriptors, add a |
1922 * callback or two, and then send the AIM_CB_OFT_PROMPT. | 1926 * callback or two, and then send the AIM_CB_OFT_PROMPT. |
1923 */ | 1927 */ |
1924 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { | 1928 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
1925 GaimConnection *gc = sess->aux_data; | 1929 GaimConnection *gc = sess->aux_data; |
1926 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 1930 OscarData *od = (OscarData *)gc->proto_data; |
1927 GaimXfer *xfer; | 1931 GaimXfer *xfer; |
1928 struct aim_oft_info *oft_info; | 1932 struct aim_oft_info *oft_info; |
1929 va_list ap; | 1933 va_list ap; |
1930 aim_conn_t *conn, *listenerconn; | 1934 aim_conn_t *conn, *listenerconn; |
1931 | 1935 |
1994 * You should send them the exact same info except use the real cookie. We also | 1998 * You should send them the exact same info except use the real cookie. We also |
1995 * get like totally ready to like, receive the file, kay? | 1999 * get like totally ready to like, receive the file, kay? |
1996 */ | 2000 */ |
1997 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { | 2001 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
1998 GaimConnection *gc = sess->aux_data; | 2002 GaimConnection *gc = sess->aux_data; |
1999 struct oscar_data *od = gc->proto_data; | 2003 OscarData *od = gc->proto_data; |
2000 GaimXfer *xfer; | 2004 GaimXfer *xfer; |
2001 struct aim_oft_info *oft_info; | 2005 struct aim_oft_info *oft_info; |
2002 va_list ap; | 2006 va_list ap; |
2003 aim_conn_t *conn; | 2007 aim_conn_t *conn; |
2004 fu8_t *cookie; | 2008 fu8_t *cookie; |
2039 * We are sending a file to someone else. They have just acknowledged our | 2043 * We are sending a file to someone else. They have just acknowledged our |
2040 * prompt, so we want to start sending data like there's no tomorrow. | 2044 * prompt, so we want to start sending data like there's no tomorrow. |
2041 */ | 2045 */ |
2042 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { | 2046 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2043 GaimConnection *gc = sess->aux_data; | 2047 GaimConnection *gc = sess->aux_data; |
2044 struct oscar_data *od = gc->proto_data; | 2048 OscarData *od = gc->proto_data; |
2045 GaimXfer *xfer; | 2049 GaimXfer *xfer; |
2046 va_list ap; | 2050 va_list ap; |
2047 aim_conn_t *conn; | 2051 aim_conn_t *conn; |
2048 fu8_t *cookie; | 2052 fu8_t *cookie; |
2049 struct aim_fileheader_t *fh; | 2053 struct aim_fileheader_t *fh; |
2071 * We just sent a file to someone. They said they got it and everything, | 2075 * We just sent a file to someone. They said they got it and everything, |
2072 * so we can close our direct connection and what not. | 2076 * so we can close our direct connection and what not. |
2073 */ | 2077 */ |
2074 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | 2078 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { |
2075 GaimConnection *gc = sess->aux_data; | 2079 GaimConnection *gc = sess->aux_data; |
2076 struct oscar_data *od = gc->proto_data; | 2080 OscarData *od = gc->proto_data; |
2077 GaimXfer *xfer; | 2081 GaimXfer *xfer; |
2078 va_list ap; | 2082 va_list ap; |
2079 aim_conn_t *conn; | 2083 aim_conn_t *conn; |
2080 fu8_t *cookie; | 2084 fu8_t *cookie; |
2081 struct aim_fileheader_t *fh; | 2085 struct aim_fileheader_t *fh; |
2096 return 0; | 2100 return 0; |
2097 } | 2101 } |
2098 | 2102 |
2099 static void accept_direct_im(struct ask_direct *d) { | 2103 static void accept_direct_im(struct ask_direct *d) { |
2100 GaimConnection *gc = d->gc; | 2104 GaimConnection *gc = d->gc; |
2101 struct oscar_data *od; | 2105 OscarData *od; |
2102 struct direct_im *dim; | 2106 struct direct_im *dim; |
2103 char *host; int port = 4443; | 2107 char *host; int port = 4443; |
2104 int i, rc; | 2108 int i, rc; |
2105 | 2109 |
2106 if (!g_list_find(gaim_connections_get_all(), gc)) { | 2110 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2107 cancel_direct_im(d); | 2111 cancel_direct_im(d); |
2108 return; | 2112 return; |
2109 } | 2113 } |
2110 | 2114 |
2111 od = (struct oscar_data *)gc->proto_data; | 2115 od = (OscarData *)gc->proto_data; |
2112 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); | 2116 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); |
2113 | 2117 |
2114 dim = find_direct_im(od, d->sn); | 2118 dim = find_direct_im(od, d->sn); |
2115 if (dim) { | 2119 if (dim) { |
2116 cancel_direct_im(d); /* 40 */ | 2120 cancel_direct_im(d); /* 40 */ |
2155 return; | 2159 return; |
2156 } | 2160 } |
2157 | 2161 |
2158 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { | 2162 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
2159 GaimConnection *gc = sess->aux_data; | 2163 GaimConnection *gc = sess->aux_data; |
2160 struct oscar_data *od = gc->proto_data; | 2164 OscarData *od = gc->proto_data; |
2161 char *tmp; | 2165 char *tmp; |
2162 GaimConvImFlags flags = 0; | 2166 GaimConvImFlags flags = 0; |
2163 gsize convlen; | 2167 gsize convlen; |
2164 GError *err = NULL; | 2168 GError *err = NULL; |
2165 struct buddyinfo *bi; | 2169 struct buddyinfo *bi; |
2269 return 1; | 2273 return 1; |
2270 } | 2274 } |
2271 | 2275 |
2272 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { | 2276 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
2273 GaimConnection *gc = sess->aux_data; | 2277 GaimConnection *gc = sess->aux_data; |
2274 struct oscar_data *od = gc->proto_data; | 2278 OscarData *od = gc->proto_data; |
2275 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); | 2279 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); |
2276 | 2280 |
2277 if (!args) | 2281 if (!args) |
2278 return 0; | 2282 return 0; |
2279 | 2283 |
2430 /* When you ask other people for authorization */ | 2434 /* When you ask other people for authorization */ |
2431 static void gaim_auth_request(struct name_data *data, char *msg) { | 2435 static void gaim_auth_request(struct name_data *data, char *msg) { |
2432 GaimConnection *gc = data->gc; | 2436 GaimConnection *gc = data->gc; |
2433 | 2437 |
2434 if (g_list_find(gaim_connections_get_all(), gc)) { | 2438 if (g_list_find(gaim_connections_get_all(), gc)) { |
2435 struct oscar_data *od = gc->proto_data; | 2439 OscarData *od = gc->proto_data; |
2436 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); | 2440 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); |
2437 GaimGroup *group = gaim_find_buddys_group(buddy); | 2441 GaimGroup *group = gaim_find_buddys_group(buddy); |
2438 if (buddy && group) { | 2442 if (buddy && group) { |
2439 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 2443 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
2440 "ssi: adding buddy %s to group %s\n", | 2444 "ssi: adding buddy %s to group %s\n", |
2456 | 2460 |
2457 static void gaim_auth_dontrequest(struct name_data *data) { | 2461 static void gaim_auth_dontrequest(struct name_data *data) { |
2458 GaimConnection *gc = data->gc; | 2462 GaimConnection *gc = data->gc; |
2459 | 2463 |
2460 if (g_list_find(gaim_connections_get_all(), gc)) { | 2464 if (g_list_find(gaim_connections_get_all(), gc)) { |
2461 /* struct oscar_data *od = gc->proto_data; */ | 2465 /* OscarData *od = gc->proto_data; */ |
2462 /* XXX - Take the buddy out of our buddy list */ | 2466 /* XXX - Take the buddy out of our buddy list */ |
2463 } | 2467 } |
2464 | 2468 |
2465 oscar_free_name_data(data); | 2469 oscar_free_name_data(data); |
2466 } | 2470 } |
2494 /* When other people ask you for authorization */ | 2498 /* When other people ask you for authorization */ |
2495 static void gaim_auth_grant(struct name_data *data) { | 2499 static void gaim_auth_grant(struct name_data *data) { |
2496 GaimConnection *gc = data->gc; | 2500 GaimConnection *gc = data->gc; |
2497 | 2501 |
2498 if (g_list_find(gaim_connections_get_all(), gc)) { | 2502 if (g_list_find(gaim_connections_get_all(), gc)) { |
2499 struct oscar_data *od = gc->proto_data; | 2503 OscarData *od = gc->proto_data; |
2500 #ifdef NOSSI | 2504 #ifdef NOSSI |
2501 GaimBuddy *buddy; | 2505 GaimBuddy *buddy; |
2502 gchar message; | 2506 gchar message; |
2503 message = 0; | 2507 message = 0; |
2504 buddy = gaim_find_buddy(gc->account, data->name); | 2508 buddy = gaim_find_buddy(gc->account, data->name); |
2515 /* When other people ask you for authorization */ | 2519 /* When other people ask you for authorization */ |
2516 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { | 2520 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
2517 GaimConnection *gc = data->gc; | 2521 GaimConnection *gc = data->gc; |
2518 | 2522 |
2519 if (g_list_find(gaim_connections_get_all(), gc)) { | 2523 if (g_list_find(gaim_connections_get_all(), gc)) { |
2520 struct oscar_data *od = gc->proto_data; | 2524 OscarData *od = gc->proto_data; |
2521 #ifdef NOSSI | 2525 #ifdef NOSSI |
2522 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); | 2526 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
2523 #else | 2527 #else |
2524 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); | 2528 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
2525 #endif | 2529 #endif |
2843 return g_strdup_printf(_("Online")); | 2847 return g_strdup_printf(_("Online")); |
2844 } | 2848 } |
2845 | 2849 |
2846 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { | 2850 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
2847 GaimConnection *gc = sess->aux_data; | 2851 GaimConnection *gc = sess->aux_data; |
2848 struct oscar_data *od = gc->proto_data; | 2852 OscarData *od = gc->proto_data; |
2849 | 2853 |
2850 /* BBB */ | 2854 /* BBB */ |
2851 switch (reason) { | 2855 switch (reason) { |
2852 case 3: { /* Decline sendfile. */ | 2856 case 3: { /* Decline sendfile. */ |
2853 GaimXfer *xfer; | 2857 GaimXfer *xfer; |
2947 } | 2951 } |
2948 | 2952 |
2949 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { | 2953 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2950 #if 0 | 2954 #if 0 |
2951 GaimConnection *gc = sess->aux_data; | 2955 GaimConnection *gc = sess->aux_data; |
2952 struct oscar_data *od = gc->proto_data; | 2956 OscarData *od = gc->proto_data; |
2953 GaimXfer *xfer; | 2957 GaimXfer *xfer; |
2954 #endif | 2958 #endif |
2955 va_list ap; | 2959 va_list ap; |
2956 fu16_t reason; | 2960 fu16_t reason; |
2957 char *data, *buf; | 2961 char *data, *buf; |
3211 | 3215 |
3212 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { | 3216 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
3213 va_list ap; | 3217 va_list ap; |
3214 fu16_t type; | 3218 fu16_t type; |
3215 GaimConnection *gc = sess->aux_data; | 3219 GaimConnection *gc = sess->aux_data; |
3216 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 3220 OscarData *od = (OscarData *)gc->proto_data; |
3217 | 3221 |
3218 va_start(ap, fr); | 3222 va_start(ap, fr); |
3219 type = (fu16_t) va_arg(ap, unsigned int); | 3223 type = (fu16_t) va_arg(ap, unsigned int); |
3220 | 3224 |
3221 switch(type) { | 3225 switch(type) { |
3408 return 1; | 3412 return 1; |
3409 } | 3413 } |
3410 | 3414 |
3411 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { | 3415 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
3412 GaimConnection *gc = sess->aux_data; | 3416 GaimConnection *gc = sess->aux_data; |
3413 struct oscar_data *od = gc->proto_data; | 3417 OscarData *od = gc->proto_data; |
3414 char *sn; | 3418 char *sn; |
3415 | 3419 |
3416 sn = od->requesticon->data; | 3420 sn = od->requesticon->data; |
3417 gaim_debug(GAIM_DEBUG_MISC, "oscar", | 3421 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
3418 "removing %s from hash table\n", sn); | 3422 "removing %s from hash table\n", sn); |
3426 return 1; | 3430 return 1; |
3427 } | 3431 } |
3428 | 3432 |
3429 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | 3433 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { |
3430 GaimConnection *gc = sess->aux_data; | 3434 GaimConnection *gc = sess->aux_data; |
3431 struct oscar_data *od = gc->proto_data; | 3435 OscarData *od = gc->proto_data; |
3432 GSList *cur; | 3436 GSList *cur; |
3433 va_list ap; | 3437 va_list ap; |
3434 char *sn; | 3438 char *sn; |
3435 fu8_t *iconcsum, *icon; | 3439 fu8_t *iconcsum, *icon; |
3436 fu16_t iconcsumlen, iconlen; | 3440 fu16_t iconcsumlen, iconlen; |
3474 return 1; | 3478 return 1; |
3475 } | 3479 } |
3476 | 3480 |
3477 static gboolean gaim_icon_timerfunc(gpointer data) { | 3481 static gboolean gaim_icon_timerfunc(gpointer data) { |
3478 GaimConnection *gc = data; | 3482 GaimConnection *gc = data; |
3479 struct oscar_data *od = gc->proto_data; | 3483 OscarData *od = gc->proto_data; |
3480 aim_userinfo_t *userinfo; | 3484 aim_userinfo_t *userinfo; |
3481 aim_conn_t *conn; | 3485 aim_conn_t *conn; |
3482 | 3486 |
3483 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | 3487 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); |
3484 if (!conn) { | 3488 if (!conn) { |
3637 return 1; | 3641 return 1; |
3638 } | 3642 } |
3639 | 3643 |
3640 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { | 3644 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
3641 GaimConnection *gc = sess->aux_data; | 3645 GaimConnection *gc = sess->aux_data; |
3642 struct oscar_data *od = gc->proto_data; | 3646 OscarData *od = gc->proto_data; |
3643 va_list ap; | 3647 va_list ap; |
3644 fu16_t code; | 3648 fu16_t code; |
3645 char *msg; | 3649 char *msg; |
3646 | 3650 |
3647 va_start(ap, fr); | 3651 va_start(ap, fr); |
3663 | 3667 |
3664 return 1; | 3668 return 1; |
3665 } | 3669 } |
3666 | 3670 |
3667 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { | 3671 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
3672 GaimConnection *gc = sess->aux_data; | |
3668 | 3673 |
3669 aim_reqpersonalinfo(sess, fr->conn); | 3674 aim_reqpersonalinfo(sess, fr->conn); |
3670 | 3675 |
3671 #ifndef NOSSI | 3676 #ifndef NOSSI |
3672 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting ssi list\n"); | 3677 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting ssi list\n"); |
3682 #ifdef NOSSI | 3687 #ifdef NOSSI |
3683 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); | 3688 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
3684 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | 3689 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); |
3685 #endif | 3690 #endif |
3686 | 3691 |
3692 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); | |
3693 | |
3687 return 1; | 3694 return 1; |
3688 } | 3695 } |
3689 | 3696 |
3690 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { | 3697 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
3691 GaimConnection *gc = sess->aux_data; | 3698 GaimConnection *gc = sess->aux_data; |
3692 struct oscar_data *od = gc->proto_data; | 3699 OscarData *od = gc->proto_data; |
3693 | 3700 |
3694 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); | 3701 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); |
3695 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); | 3702 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); |
3696 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); | 3703 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); |
3697 | 3704 |
3762 } | 3769 } |
3763 | 3770 |
3764 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) | 3771 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3765 { | 3772 { |
3766 GaimConnection *gc = sess->aux_data; | 3773 GaimConnection *gc = sess->aux_data; |
3767 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 3774 OscarData *od = (OscarData *)gc->proto_data; |
3768 va_list ap; | 3775 va_list ap; |
3769 fu16_t maxsiglen; | 3776 fu16_t maxsiglen; |
3770 | 3777 |
3771 va_start(ap, fr); | 3778 va_start(ap, fr); |
3772 maxsiglen = (fu16_t) va_arg(ap, int); | 3779 maxsiglen = (fu16_t) va_arg(ap, int); |
3787 | 3794 |
3788 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { | 3795 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
3789 va_list ap; | 3796 va_list ap; |
3790 fu16_t maxbuddies, maxwatchers; | 3797 fu16_t maxbuddies, maxwatchers; |
3791 GaimConnection *gc = sess->aux_data; | 3798 GaimConnection *gc = sess->aux_data; |
3792 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 3799 OscarData *od = (OscarData *)gc->proto_data; |
3793 | 3800 |
3794 va_start(ap, fr); | 3801 va_start(ap, fr); |
3795 maxbuddies = (fu16_t) va_arg(ap, unsigned int); | 3802 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3796 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | 3803 maxwatchers = (fu16_t) va_arg(ap, unsigned int); |
3797 va_end(ap); | 3804 va_end(ap); |
3807 | 3814 |
3808 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { | 3815 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
3809 fu16_t maxpermits, maxdenies; | 3816 fu16_t maxpermits, maxdenies; |
3810 va_list ap; | 3817 va_list ap; |
3811 GaimConnection *gc = sess->aux_data; | 3818 GaimConnection *gc = sess->aux_data; |
3812 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 3819 OscarData *od = (OscarData *)gc->proto_data; |
3813 | 3820 |
3814 va_start(ap, fr); | 3821 va_start(ap, fr); |
3815 maxpermits = (fu16_t) va_arg(ap, unsigned int); | 3822 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3816 maxdenies = (fu16_t) va_arg(ap, unsigned int); | 3823 maxdenies = (fu16_t) va_arg(ap, unsigned int); |
3817 va_end(ap); | 3824 va_end(ap); |
4176 | 4183 |
4177 return 1; | 4184 return 1; |
4178 } | 4185 } |
4179 | 4186 |
4180 static void oscar_keepalive(GaimConnection *gc) { | 4187 static void oscar_keepalive(GaimConnection *gc) { |
4181 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4188 OscarData *od = (OscarData *)gc->proto_data; |
4182 aim_flap_nop(od->sess, od->conn); | 4189 aim_flap_nop(od->sess, od->conn); |
4183 } | 4190 } |
4184 | 4191 |
4185 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { | 4192 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { |
4186 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4193 OscarData *od = (OscarData *)gc->proto_data; |
4187 struct direct_im *dim = find_direct_im(od, name); | 4194 struct direct_im *dim = find_direct_im(od, name); |
4188 if (dim) | 4195 if (dim) |
4189 if (typing == GAIM_TYPING) | 4196 if (typing == GAIM_TYPING) |
4190 aim_odc_send_typing(od->sess, dim->conn, 0x0002); | 4197 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
4191 else if (typing == GAIM_TYPED) | 4198 else if (typing == GAIM_TYPED) |
4212 } | 4219 } |
4213 static void oscar_ask_direct_im(GaimConnection *gc, const char *name); | 4220 static void oscar_ask_direct_im(GaimConnection *gc, const char *name); |
4214 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags); | 4221 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags); |
4215 | 4222 |
4216 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { | 4223 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { |
4217 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4224 OscarData *od = (OscarData *)gc->proto_data; |
4218 struct direct_im *dim = find_direct_im(od, name); | 4225 struct direct_im *dim = find_direct_im(od, name); |
4219 int ret = 0; | 4226 int ret = 0; |
4220 GError *err = NULL; | 4227 GError *err = NULL; |
4221 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | 4228 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); |
4222 char *tmpmsg = NULL; | 4229 char *tmpmsg = NULL; |
4350 | 4357 |
4351 return ret; | 4358 return ret; |
4352 } | 4359 } |
4353 | 4360 |
4354 static void oscar_get_info(GaimConnection *gc, const char *name) { | 4361 static void oscar_get_info(GaimConnection *gc, const char *name) { |
4355 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4362 OscarData *od = (OscarData *)gc->proto_data; |
4356 | 4363 |
4357 if (od->icq && isdigit(name[0])) | 4364 if (od->icq && isdigit(name[0])) |
4358 aim_icq_getallinfo(od->sess, name); | 4365 aim_icq_getallinfo(od->sess, name); |
4359 else | 4366 else |
4360 aim_locate_getinfoshort(od->sess, name, 0x00000003); | 4367 aim_locate_getinfoshort(od->sess, name, 0x00000003); |
4361 } | 4368 } |
4362 | 4369 |
4363 static void oscar_get_away(GaimConnection *gc, const char *who) { | 4370 static void oscar_get_away(GaimConnection *gc, const char *who) { |
4364 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4371 OscarData *od = (OscarData *)gc->proto_data; |
4365 if (od->icq) { | 4372 if (od->icq) { |
4366 GaimBuddy *budlight = gaim_find_buddy(gc->account, who); | 4373 GaimBuddy *budlight = gaim_find_buddy(gc->account, who); |
4367 if (budlight) | 4374 if (budlight) |
4368 if ((budlight->uc & 0xffff0000) >> 16) | 4375 if ((budlight->uc & 0xffff0000) >> 16) |
4369 aim_im_sendch2_geticqaway(od->sess, who, (budlight->uc & 0xffff0000) >> 16); | 4376 aim_im_sendch2_geticqaway(od->sess, who, (budlight->uc & 0xffff0000) >> 16); |
4378 } | 4385 } |
4379 | 4386 |
4380 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, | 4387 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, |
4381 const char *maiden, const char *city, const char *state, const char *country, int web) { | 4388 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4382 /* XXX - some of these things are wrong, but i'm lazy */ | 4389 /* XXX - some of these things are wrong, but i'm lazy */ |
4383 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4390 OscarData *od = (OscarData *)gc->proto_data; |
4384 aim_locate_setdirinfo(od->sess, first, middle, last, | 4391 aim_locate_setdirinfo(od->sess, first, middle, last, |
4385 maiden, NULL, NULL, city, state, NULL, 0, web); | 4392 maiden, NULL, NULL, city, state, NULL, 0, web); |
4386 } | 4393 } |
4387 | 4394 |
4388 static void oscar_set_idle(GaimConnection *gc, int time) { | 4395 static void oscar_set_idle(GaimConnection *gc, int time) { |
4389 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4396 OscarData *od = (OscarData *)gc->proto_data; |
4390 aim_bos_setidle(od->sess, od->conn, time); | 4397 aim_bos_setidle(od->sess, od->conn, time); |
4391 } | 4398 } |
4392 | 4399 |
4393 static void oscar_set_info(GaimConnection *gc, const char *text) { | 4400 static void oscar_set_info(GaimConnection *gc, const char *text) { |
4394 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4401 OscarData *od = (OscarData *)gc->proto_data; |
4395 fu32_t flags = 0; | 4402 fu32_t flags = 0; |
4396 char *text_html = NULL; | 4403 char *text_html = NULL; |
4397 char *msg = NULL; | 4404 char *msg = NULL; |
4398 gsize msglen = 0; | 4405 gsize msglen = 0; |
4399 | 4406 |
4443 } | 4450 } |
4444 | 4451 |
4445 return; | 4452 return; |
4446 } | 4453 } |
4447 | 4454 |
4448 static void oscar_set_away_aim(GaimConnection *gc, struct oscar_data *od, const char *text) | 4455 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *text) |
4449 { | 4456 { |
4450 fu32_t flags = 0; | 4457 fu32_t flags = 0; |
4451 gchar *text_html = NULL; | 4458 gchar *text_html = NULL; |
4452 char *msg = NULL; | 4459 char *msg = NULL; |
4453 gsize msglen = 0; | 4460 gsize msglen = 0; |
4505 | 4512 |
4506 g_free(text_html); | 4513 g_free(text_html); |
4507 return; | 4514 return; |
4508 } | 4515 } |
4509 | 4516 |
4510 static void oscar_set_away_icq(GaimConnection *gc, struct oscar_data *od, const char *state, const char *message) | 4517 static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message) |
4511 { | 4518 { |
4512 GaimAccount *account = gaim_connection_get_account(gc); | 4519 GaimAccount *account = gaim_connection_get_account(gc); |
4513 if (gc->away) { | 4520 if (gc->away) { |
4514 g_free(gc->away); | 4521 g_free(gc->away); |
4515 gc->away = NULL; | 4522 gc->away = NULL; |
4557 return; | 4564 return; |
4558 } | 4565 } |
4559 | 4566 |
4560 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) | 4567 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) |
4561 { | 4568 { |
4562 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4569 OscarData *od = (OscarData *)gc->proto_data; |
4563 | 4570 |
4564 if (od->icq) | 4571 if (od->icq) |
4565 oscar_set_away_icq(gc, od, state, message); | 4572 oscar_set_away_icq(gc, od, state, message); |
4566 else | 4573 else |
4567 oscar_set_away_aim(gc, od, message); | 4574 oscar_set_away_aim(gc, od, message); |
4568 | 4575 |
4569 return; | 4576 return; |
4570 } | 4577 } |
4571 | 4578 |
4572 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { | 4579 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { |
4573 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4580 OscarData *od = (OscarData *)gc->proto_data; |
4574 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); | 4581 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); |
4575 } | 4582 } |
4576 | 4583 |
4577 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, | 4584 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, |
4578 const char *maiden, const char *city, const char *state, const char *country, const char *email) { | 4585 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
4579 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4586 OscarData *od = (OscarData *)gc->proto_data; |
4580 if (strlen(email)) | 4587 if (strlen(email)) |
4581 aim_search_address(od->sess, od->conn, email); | 4588 aim_search_address(od->sess, od->conn, email); |
4582 } | 4589 } |
4583 | 4590 |
4584 static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { | 4591 static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { |
4585 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4592 OscarData *od = (OscarData *)gc->proto_data; |
4586 #ifdef NOSSI | 4593 #ifdef NOSSI |
4587 aim_add_buddy(od->sess, od->conn, name); | 4594 aim_add_buddy(od->sess, od->conn, name); |
4588 #else | 4595 #else |
4589 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | 4596 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { |
4590 GaimBuddy *buddy = gaim_find_buddy(gc->account, name); | 4597 GaimBuddy *buddy = gaim_find_buddy(gc->account, name); |
4599 if (od->icq) | 4606 if (od->icq) |
4600 aim_icq_getalias(od->sess, name); | 4607 aim_icq_getalias(od->sess, name); |
4601 } | 4608 } |
4602 | 4609 |
4603 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { | 4610 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
4604 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4611 OscarData *od = (OscarData *)gc->proto_data; |
4605 #ifdef NOSSI | 4612 #ifdef NOSSI |
4606 char buf[MSG_LEN]; | 4613 char buf[MSG_LEN]; |
4607 int n=0; | 4614 int n=0; |
4608 while (buddies) { | 4615 while (buddies) { |
4609 if (n > MSG_LEN - 18) { | 4616 if (n > MSG_LEN - 18) { |
4629 } | 4636 } |
4630 #endif | 4637 #endif |
4631 } | 4638 } |
4632 | 4639 |
4633 static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { | 4640 static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { |
4634 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4641 OscarData *od = (OscarData *)gc->proto_data; |
4635 #ifdef NOSSI | 4642 #ifdef NOSSI |
4636 aim_remove_buddy(od->sess, od->conn, name); | 4643 aim_remove_buddy(od->sess, od->conn, name); |
4637 #else | 4644 #else |
4638 if (od->sess->ssi.received_data) { | 4645 if (od->sess->ssi.received_data) { |
4639 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 4646 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4642 } | 4649 } |
4643 #endif | 4650 #endif |
4644 } | 4651 } |
4645 | 4652 |
4646 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { | 4653 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
4647 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4654 OscarData *od = (OscarData *)gc->proto_data; |
4648 #ifdef NOSSI | 4655 #ifdef NOSSI |
4649 GList *cur; | 4656 GList *cur; |
4650 for (cur=buddies; cur; cur=cur->next) | 4657 for (cur=buddies; cur; cur=cur->next) |
4651 aim_remove_buddy(od->sess, od->conn, cur->data); | 4658 aim_remove_buddy(od->sess, od->conn, cur->data); |
4652 #else | 4659 #else |
4661 #endif | 4668 #endif |
4662 } | 4669 } |
4663 | 4670 |
4664 #ifndef NOSSI | 4671 #ifndef NOSSI |
4665 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { | 4672 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
4666 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4673 OscarData *od = (OscarData *)gc->proto_data; |
4667 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { | 4674 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { |
4668 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 4675 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4669 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); | 4676 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4670 aim_ssi_movebuddy(od->sess, old_group, new_group, name); | 4677 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4671 } | 4678 } |
4672 } | 4679 } |
4673 | 4680 |
4674 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { | 4681 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
4675 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4682 OscarData *od = (OscarData *)gc->proto_data; |
4676 if (od->sess->ssi.received_data) { | 4683 if (od->sess->ssi.received_data) { |
4677 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | 4684 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); |
4678 if (gname) { | 4685 if (gname) { |
4679 gaim_debug(GAIM_DEBUG_INFO, "oscar", | 4686 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
4680 "ssi: changing the alias for buddy %s to %s\n", name, alias); | 4687 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4682 } | 4689 } |
4683 } | 4690 } |
4684 } | 4691 } |
4685 | 4692 |
4686 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { | 4693 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { |
4687 struct oscar_data *od = (struct oscar_data *)g->proto_data; | 4694 OscarData *od = (OscarData *)g->proto_data; |
4688 | 4695 |
4689 if (od->sess->ssi.received_data) { | 4696 if (od->sess->ssi.received_data) { |
4690 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | 4697 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { |
4691 oscar_remove_buddies(g, members, old_group); | 4698 oscar_remove_buddies(g, members, old_group); |
4692 oscar_add_buddies(g, members); | 4699 oscar_add_buddies(g, members); |
4706 return FALSE; | 4713 return FALSE; |
4707 } | 4714 } |
4708 | 4715 |
4709 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { | 4716 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4710 GaimConnection *gc = sess->aux_data; | 4717 GaimConnection *gc = sess->aux_data; |
4711 struct oscar_data *od = gc->proto_data; | 4718 OscarData *od = gc->proto_data; |
4712 va_list ap; | 4719 va_list ap; |
4713 fu16_t reason; | 4720 fu16_t reason; |
4714 | 4721 |
4715 va_start(ap, fr); | 4722 va_start(ap, fr); |
4716 reason = (fu16_t)va_arg(ap, unsigned int); | 4723 reason = (fu16_t)va_arg(ap, unsigned int); |
4733 return 1; | 4740 return 1; |
4734 } | 4741 } |
4735 | 4742 |
4736 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { | 4743 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
4737 GaimConnection *gc = sess->aux_data; | 4744 GaimConnection *gc = sess->aux_data; |
4738 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4745 OscarData *od = (OscarData *)gc->proto_data; |
4739 int numtypes, i; | 4746 int numtypes, i; |
4740 fu16_t *maxitems; | 4747 fu16_t *maxitems; |
4741 va_list ap; | 4748 va_list ap; |
4742 | 4749 |
4743 va_start(ap, fr); | 4750 va_start(ap, fr); |
4766 } | 4773 } |
4767 | 4774 |
4768 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | 4775 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { |
4769 GaimConnection *gc = sess->aux_data; | 4776 GaimConnection *gc = sess->aux_data; |
4770 GaimAccount *account = gaim_connection_get_account(gc); | 4777 GaimAccount *account = gaim_connection_get_account(gc); |
4771 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4778 OscarData *od = (OscarData *)gc->proto_data; |
4772 struct aim_ssi_item *curitem; | 4779 struct aim_ssi_item *curitem; |
4773 int tmp; | 4780 int tmp; |
4774 gboolean export = FALSE; | 4781 gboolean export = FALSE; |
4775 /* XXX - use these? | 4782 /* XXX - use these? |
4776 va_list ap; | 4783 va_list ap; |
5163 | 5170 |
5164 return m; | 5171 return m; |
5165 } | 5172 } |
5166 | 5173 |
5167 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { | 5174 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { |
5168 struct oscar_data *od = (struct oscar_data *)g->proto_data; | 5175 OscarData *od = (OscarData *)g->proto_data; |
5169 aim_conn_t *cur; | 5176 aim_conn_t *cur; |
5170 char *name, *exchange; | 5177 char *name, *exchange; |
5171 | 5178 |
5172 name = g_hash_table_lookup(data, "room"); | 5179 name = g_hash_table_lookup(data, "room"); |
5173 exchange = g_hash_table_lookup(data, "exchange"); | 5180 exchange = g_hash_table_lookup(data, "exchange"); |
5189 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | 5196 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); |
5190 } | 5197 } |
5191 } | 5198 } |
5192 | 5199 |
5193 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { | 5200 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { |
5194 struct oscar_data *od = (struct oscar_data *)g->proto_data; | 5201 OscarData *od = (OscarData *)g->proto_data; |
5195 struct chat_connection *ccon = find_oscar_chat(g, id); | 5202 struct chat_connection *ccon = find_oscar_chat(g, id); |
5196 | 5203 |
5197 if (!ccon) | 5204 if (!ccon) |
5198 return; | 5205 return; |
5199 | 5206 |
5200 aim_chat_invite(od->sess, od->conn, name, message ? message : "", | 5207 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
5201 ccon->exchange, ccon->name, 0x0); | 5208 ccon->exchange, ccon->name, 0x0); |
5202 } | 5209 } |
5203 | 5210 |
5204 static void oscar_chat_leave(GaimConnection *g, int id) { | 5211 static void oscar_chat_leave(GaimConnection *g, int id) { |
5205 struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL; | 5212 OscarData *od = g ? (OscarData *)g->proto_data : NULL; |
5206 GSList *bcs = g->buddy_chats; | 5213 GSList *bcs = g->buddy_chats; |
5207 GaimConversation *b = NULL; | 5214 GaimConversation *b = NULL; |
5208 struct chat_connection *c = NULL; | 5215 struct chat_connection *c = NULL; |
5209 int count = 0; | 5216 int count = 0; |
5210 | 5217 |
5238 /* we do this because with Oscar it doesn't tell us we left */ | 5245 /* we do this because with Oscar it doesn't tell us we left */ |
5239 serv_got_chat_left(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); | 5246 serv_got_chat_left(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
5240 } | 5247 } |
5241 | 5248 |
5242 static int oscar_chat_send(GaimConnection *g, int id, const char *message) { | 5249 static int oscar_chat_send(GaimConnection *g, int id, const char *message) { |
5243 struct oscar_data *od = (struct oscar_data *)g->proto_data; | 5250 OscarData *od = (OscarData *)g->proto_data; |
5244 GSList *bcs = g->buddy_chats; | 5251 GSList *bcs = g->buddy_chats; |
5245 GaimConversation *b = NULL; | 5252 GaimConversation *b = NULL; |
5246 struct chat_connection *c = NULL; | 5253 struct chat_connection *c = NULL; |
5247 char *buf, *buf2; | 5254 char *buf, *buf2; |
5248 int i, j; | 5255 int i, j; |
5315 int i = 0; | 5322 int i = 0; |
5316 | 5323 |
5317 if (!GAIM_BUDDY_IS_ONLINE(b)) { | 5324 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5318 GaimAccount *account; | 5325 GaimAccount *account; |
5319 GaimConnection *gc; | 5326 GaimConnection *gc; |
5320 struct oscar_data *od; | 5327 OscarData *od; |
5321 char *gname; | 5328 char *gname; |
5322 if ((b->name) && (account = b->account) && (gc = account->gc) && | 5329 if ((b->name) && (account = b->account) && (gc = account->gc) && |
5323 (od = gc->proto_data) && (od->sess->ssi.received_data) && | 5330 (od = gc->proto_data) && (od->sess->ssi.received_data) && |
5324 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && | 5331 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
5325 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | 5332 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { |
5365 *ne = emblems[3]; | 5372 *ne = emblems[3]; |
5366 } | 5373 } |
5367 | 5374 |
5368 static char *oscar_tooltip_text(GaimBuddy *b) { | 5375 static char *oscar_tooltip_text(GaimBuddy *b) { |
5369 GaimConnection *gc = b->account->gc; | 5376 GaimConnection *gc = b->account->gc; |
5370 struct oscar_data *od = gc->proto_data; | 5377 OscarData *od = gc->proto_data; |
5371 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); | 5378 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
5372 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); | 5379 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); |
5373 gchar *tmp = NULL, *ret = g_strdup(""); | 5380 gchar *tmp = NULL, *ret = g_strdup(""); |
5374 | 5381 |
5375 if (GAIM_BUDDY_IS_ONLINE(b)) { | 5382 if (GAIM_BUDDY_IS_ONLINE(b)) { |
5390 g_free(tmp); | 5397 g_free(tmp); |
5391 g_free(tstr); | 5398 g_free(tstr); |
5392 } | 5399 } |
5393 | 5400 |
5394 if ((bi != NULL) && (bi->ipaddr)) { | 5401 if ((bi != NULL) && (bi->ipaddr)) { |
5395 char *tstr = g_strdup_printf("%hhd.%hhd.%hhd.%hhd", | 5402 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", |
5396 (bi->ipaddr & 0xff000000) >> 24, | 5403 (bi->ipaddr & 0xff000000) >> 24, |
5397 (bi->ipaddr & 0x00ff0000) >> 16, | 5404 (bi->ipaddr & 0x00ff0000) >> 16, |
5398 (bi->ipaddr & 0x0000ff00) >> 8, | 5405 (bi->ipaddr & 0x0000ff00) >> 8, |
5399 (bi->ipaddr & 0x000000ff)); | 5406 (bi->ipaddr & 0x000000ff)); |
5400 tmp = ret; | 5407 tmp = ret; |
5455 return ret; | 5462 return ret; |
5456 } | 5463 } |
5457 | 5464 |
5458 static char *oscar_status_text(GaimBuddy *b) { | 5465 static char *oscar_status_text(GaimBuddy *b) { |
5459 GaimConnection *gc = b->account->gc; | 5466 GaimConnection *gc = b->account->gc; |
5460 struct oscar_data *od = gc->proto_data; | 5467 OscarData *od = gc->proto_data; |
5461 gchar *ret = NULL; | 5468 gchar *ret = NULL; |
5462 | 5469 |
5463 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | 5470 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { |
5464 if (isdigit(b->name[0])) | 5471 if (isdigit(b->name[0])) |
5465 ret = gaim_icq_status((b->uc & 0xffff0000) >> 16); | 5472 ret = gaim_icq_status((b->uc & 0xffff0000) >> 16); |
5481 } | 5488 } |
5482 | 5489 |
5483 | 5490 |
5484 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { | 5491 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5485 GaimConnection *gc = sess->aux_data; | 5492 GaimConnection *gc = sess->aux_data; |
5486 struct oscar_data *od = gc->proto_data; | 5493 OscarData *od = gc->proto_data; |
5487 va_list ap; | 5494 va_list ap; |
5488 fu16_t type; | 5495 fu16_t type; |
5489 fu8_t flags = 0, length = 0; | 5496 fu8_t flags = 0, length = 0; |
5490 char *md5 = NULL; | 5497 char *md5 = NULL; |
5491 | 5498 |
5543 /* | 5550 /* |
5544 * We have just established a socket with the other dude, so set up some handlers. | 5551 * We have just established a socket with the other dude, so set up some handlers. |
5545 */ | 5552 */ |
5546 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { | 5553 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5547 GaimConnection *gc = sess->aux_data; | 5554 GaimConnection *gc = sess->aux_data; |
5548 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 5555 OscarData *od = (OscarData *)gc->proto_data; |
5549 GaimConversation *cnv; | 5556 GaimConversation *cnv; |
5550 struct direct_im *dim; | 5557 struct direct_im *dim; |
5551 char buf[256]; | 5558 char buf[256]; |
5552 char *sn; | 5559 char *sn; |
5553 va_list ap; | 5560 va_list ap; |
5591 static int gaim_odc_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | 5598 static int gaim_odc_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { |
5592 va_list ap; | 5599 va_list ap; |
5593 char *sn; | 5600 char *sn; |
5594 double percent; | 5601 double percent; |
5595 GaimConnection *gc = sess->aux_data; | 5602 GaimConnection *gc = sess->aux_data; |
5596 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 5603 OscarData *od = (OscarData *)gc->proto_data; |
5597 GaimConversation *c; | 5604 GaimConversation *c; |
5598 struct direct_im *dim; | 5605 struct direct_im *dim; |
5599 | 5606 |
5600 va_start(ap, fr); | 5607 va_start(ap, fr); |
5601 sn = va_arg(ap, char *); | 5608 sn = va_arg(ap, char *); |
5881 g_free(data); | 5888 g_free(data); |
5882 } | 5889 } |
5883 | 5890 |
5884 static void oscar_direct_im(struct ask_do_dir_im *data) { | 5891 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5885 GaimConnection *gc = data->gc; | 5892 GaimConnection *gc = data->gc; |
5886 struct oscar_data *od; | 5893 OscarData *od; |
5887 struct direct_im *dim; | 5894 struct direct_im *dim; |
5888 | 5895 |
5889 if (!g_list_find(gaim_connections_get_all(), gc)) { | 5896 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5890 g_free(data->who); | 5897 g_free(data->who); |
5891 g_free(data); | 5898 g_free(data); |
5892 return; | 5899 return; |
5893 } | 5900 } |
5894 | 5901 |
5895 od = (struct oscar_data *)gc->proto_data; | 5902 od = (OscarData *)gc->proto_data; |
5896 | 5903 |
5897 dim = find_direct_im(od, data->who); | 5904 dim = find_direct_im(od, data->who); |
5898 if (dim) { | 5905 if (dim) { |
5899 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ | 5906 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
5900 od->direct_ims = g_slist_remove(od->direct_ims, dim); | 5907 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
5946 g_free(buf); | 5953 g_free(buf); |
5947 } | 5954 } |
5948 | 5955 |
5949 static void oscar_set_permit_deny(GaimConnection *gc) { | 5956 static void oscar_set_permit_deny(GaimConnection *gc) { |
5950 GaimAccount *account = gaim_connection_get_account(gc); | 5957 GaimAccount *account = gaim_connection_get_account(gc); |
5951 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 5958 OscarData *od = (OscarData *)gc->proto_data; |
5952 #ifdef NOSSI | 5959 #ifdef NOSSI |
5953 GSList *list, *g = gaim_blist_groups(), *g1; | 5960 GSList *list, *g = gaim_blist_groups(), *g1; |
5954 char buf[MAXMSGLEN]; | 5961 char buf[MAXMSGLEN]; |
5955 int at; | 5962 int at; |
5956 | 5963 |
6010 static void oscar_add_permit(GaimConnection *gc, const char *who) { | 6017 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
6011 #ifdef NOSSI | 6018 #ifdef NOSSI |
6012 if (gc->account->permdeny == 3) | 6019 if (gc->account->permdeny == 3) |
6013 oscar_set_permit_deny(gc); | 6020 oscar_set_permit_deny(gc); |
6014 #else | 6021 #else |
6015 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 6022 OscarData *od = (OscarData *)gc->proto_data; |
6016 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); | 6023 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); |
6017 if (od->sess->ssi.received_data) | 6024 if (od->sess->ssi.received_data) |
6018 aim_ssi_addpermit(od->sess, who); | 6025 aim_ssi_addpermit(od->sess, who); |
6019 #endif | 6026 #endif |
6020 } | 6027 } |
6022 static void oscar_add_deny(GaimConnection *gc, const char *who) { | 6029 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
6023 #ifdef NOSSI | 6030 #ifdef NOSSI |
6024 if (gc->account->permdeny == 4) | 6031 if (gc->account->permdeny == 4) |
6025 oscar_set_permit_deny(gc); | 6032 oscar_set_permit_deny(gc); |
6026 #else | 6033 #else |
6027 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 6034 OscarData *od = (OscarData *)gc->proto_data; |
6028 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); | 6035 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); |
6029 if (od->sess->ssi.received_data) | 6036 if (od->sess->ssi.received_data) |
6030 aim_ssi_adddeny(od->sess, who); | 6037 aim_ssi_adddeny(od->sess, who); |
6031 #endif | 6038 #endif |
6032 } | 6039 } |
6034 static void oscar_rem_permit(GaimConnection *gc, const char *who) { | 6041 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
6035 #ifdef NOSSI | 6042 #ifdef NOSSI |
6036 if (gc->account->permdeny == 3) | 6043 if (gc->account->permdeny == 3) |
6037 oscar_set_permit_deny(gc); | 6044 oscar_set_permit_deny(gc); |
6038 #else | 6045 #else |
6039 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 6046 OscarData *od = (OscarData *)gc->proto_data; |
6040 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); | 6047 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); |
6041 if (od->sess->ssi.received_data) | 6048 if (od->sess->ssi.received_data) |
6042 aim_ssi_delpermit(od->sess, who); | 6049 aim_ssi_delpermit(od->sess, who); |
6043 #endif | 6050 #endif |
6044 } | 6051 } |
6046 static void oscar_rem_deny(GaimConnection *gc, const char *who) { | 6053 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
6047 #ifdef NOSSI | 6054 #ifdef NOSSI |
6048 if (gc->account->permdeny == 4) | 6055 if (gc->account->permdeny == 4) |
6049 oscar_set_permit_deny(gc); | 6056 oscar_set_permit_deny(gc); |
6050 #else | 6057 #else |
6051 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 6058 OscarData *od = (OscarData *)gc->proto_data; |
6052 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); | 6059 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); |
6053 if (od->sess->ssi.received_data) | 6060 if (od->sess->ssi.received_data) |
6054 aim_ssi_deldeny(od->sess, who); | 6061 aim_ssi_deldeny(od->sess, who); |
6055 #endif | 6062 #endif |
6056 } | 6063 } |
6057 | 6064 |
6058 static GList *oscar_away_states(GaimConnection *gc) | 6065 static GList *oscar_away_states(GaimConnection *gc) |
6059 { | 6066 { |
6060 struct oscar_data *od = gc->proto_data; | 6067 OscarData *od = gc->proto_data; |
6061 GList *m = NULL; | 6068 GList *m = NULL; |
6062 | 6069 |
6063 if (!od->icq) | 6070 if (!od->icq) |
6064 return g_list_append(m, GAIM_AWAY_CUSTOM); | 6071 return g_list_append(m, GAIM_AWAY_CUSTOM); |
6065 | 6072 |
6073 | 6080 |
6074 return m; | 6081 return m; |
6075 } | 6082 } |
6076 | 6083 |
6077 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { | 6084 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { |
6078 struct oscar_data *od = data->gc->proto_data; | 6085 OscarData *od = data->gc->proto_data; |
6079 GaimBuddy *b; | 6086 GaimBuddy *b; |
6080 GaimGroup *g; | 6087 GaimGroup *g; |
6081 | 6088 |
6082 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { | 6089 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { |
6083 oscar_free_name_data(data); | 6090 oscar_free_name_data(data); |
6092 aim_ssi_editcomment(od->sess, g->name, data->name, text); | 6099 aim_ssi_editcomment(od->sess, g->name, data->name, text); |
6093 oscar_free_name_data(data); | 6100 oscar_free_name_data(data); |
6094 } | 6101 } |
6095 | 6102 |
6096 static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { | 6103 static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { |
6097 struct oscar_data *od = gc->proto_data; | 6104 OscarData *od = gc->proto_data; |
6098 struct name_data *data = g_new(struct name_data, 1); | 6105 struct name_data *data = g_new(struct name_data, 1); |
6099 GaimBuddy *b; | 6106 GaimBuddy *b; |
6100 GaimGroup *g; | 6107 GaimGroup *g; |
6101 char *comment; | 6108 char *comment; |
6102 gchar *comment_utf8; | 6109 gchar *comment_utf8; |
6121 free(comment); | 6128 free(comment); |
6122 g_free(comment_utf8); | 6129 g_free(comment_utf8); |
6123 } | 6130 } |
6124 | 6131 |
6125 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { | 6132 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
6126 struct oscar_data *od = gc->proto_data; | 6133 OscarData *od = gc->proto_data; |
6127 GList *m = NULL; | 6134 GList *m = NULL; |
6128 struct proto_buddy_menu *pbm; | 6135 struct proto_buddy_menu *pbm; |
6129 | 6136 |
6130 pbm = g_new0(struct proto_buddy_menu, 1); | 6137 pbm = g_new0(struct proto_buddy_menu, 1); |
6131 pbm->label = _("Edit Buddy Comment"); | 6138 pbm->label = _("Edit Buddy Comment"); |
6189 | 6196 |
6190 return m; | 6197 return m; |
6191 } | 6198 } |
6192 | 6199 |
6193 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { | 6200 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
6194 struct oscar_data *od = gc->proto_data; | 6201 OscarData *od = gc->proto_data; |
6195 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { | 6202 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
6196 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { | 6203 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
6197 od->setnick = TRUE; | 6204 od->setnick = TRUE; |
6198 od->newsn = g_strdup(nick); | 6205 od->newsn = g_strdup(nick); |
6199 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | 6206 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
6215 gc); | 6222 gc); |
6216 } | 6223 } |
6217 | 6224 |
6218 static void oscar_confirm_account(GaimConnection *gc) | 6225 static void oscar_confirm_account(GaimConnection *gc) |
6219 { | 6226 { |
6220 struct oscar_data *od = gc->proto_data; | 6227 OscarData *od = gc->proto_data; |
6221 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | 6228 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6222 | 6229 |
6223 if (conn) { | 6230 if (conn) { |
6224 aim_admin_reqconfirm(od->sess, conn); | 6231 aim_admin_reqconfirm(od->sess, conn); |
6225 } else { | 6232 } else { |
6228 } | 6235 } |
6229 } | 6236 } |
6230 | 6237 |
6231 static void oscar_show_email(GaimConnection *gc) | 6238 static void oscar_show_email(GaimConnection *gc) |
6232 { | 6239 { |
6233 struct oscar_data *od = gc->proto_data; | 6240 OscarData *od = gc->proto_data; |
6234 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | 6241 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6235 | 6242 |
6236 if (conn) { | 6243 if (conn) { |
6237 aim_admin_getinfo(od->sess, conn, 0x11); | 6244 aim_admin_getinfo(od->sess, conn, 0x11); |
6238 } else { | 6245 } else { |
6241 } | 6248 } |
6242 } | 6249 } |
6243 | 6250 |
6244 static void oscar_change_email(GaimConnection *gc, const char *email) | 6251 static void oscar_change_email(GaimConnection *gc, const char *email) |
6245 { | 6252 { |
6246 struct oscar_data *od = gc->proto_data; | 6253 OscarData *od = gc->proto_data; |
6247 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | 6254 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6248 | 6255 |
6249 if (conn) { | 6256 if (conn) { |
6250 aim_admin_setemail(od->sess, conn, email); | 6257 aim_admin_setemail(od->sess, conn, email); |
6251 } else { | 6258 } else { |
6264 gc); | 6271 gc); |
6265 } | 6272 } |
6266 | 6273 |
6267 static void oscar_show_awaitingauth(GaimConnection *gc) | 6274 static void oscar_show_awaitingauth(GaimConnection *gc) |
6268 { | 6275 { |
6269 struct oscar_data *od = gc->proto_data; | 6276 OscarData *od = gc->proto_data; |
6270 gchar *nombre, *text, *tmp; | 6277 gchar *nombre, *text, *tmp; |
6271 GaimBlistNode *gnode, *cnode, *bnode; | 6278 GaimBlistNode *gnode, *cnode, *bnode; |
6272 int num=0; | 6279 int num=0; |
6273 | 6280 |
6274 text = g_strdup(""); | 6281 text = g_strdup(""); |
6328 _("Cancel"), NULL, gc); | 6335 _("Cancel"), NULL, gc); |
6329 } | 6336 } |
6330 | 6337 |
6331 #if 0 | 6338 #if 0 |
6332 static void oscar_setavailmsg(GaimConnection *gc, char *text) { | 6339 static void oscar_setavailmsg(GaimConnection *gc, char *text) { |
6333 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 6340 OscarData *od = (OscarData *)gc->proto_data; |
6334 | 6341 |
6335 aim_srv_setavailmsg(od->sess, text); | 6342 aim_srv_setavailmsg(od->sess, text); |
6336 } | 6343 } |
6337 | 6344 |
6338 static void oscar_show_setavailmsg(GaimConnection *gc) | 6345 static void oscar_show_setavailmsg(GaimConnection *gc) |
6355 gaim_account_request_change_password(gaim_connection_get_account(gc)); | 6362 gaim_account_request_change_password(gaim_connection_get_account(gc)); |
6356 } | 6363 } |
6357 | 6364 |
6358 static void oscar_show_chpassurl(GaimConnection *gc) | 6365 static void oscar_show_chpassurl(GaimConnection *gc) |
6359 { | 6366 { |
6360 struct oscar_data *od = gc->proto_data; | 6367 OscarData *od = gc->proto_data; |
6361 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); | 6368 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); |
6362 gaim_notify_uri(gc, substituted); | 6369 gaim_notify_uri(gc, substituted); |
6363 g_free(substituted); | 6370 g_free(substituted); |
6364 } | 6371 } |
6365 | 6372 |
6368 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); | 6375 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); |
6369 } | 6376 } |
6370 | 6377 |
6371 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) | 6378 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) |
6372 { | 6379 { |
6373 struct oscar_data *od = gc->proto_data; | 6380 OscarData *od = gc->proto_data; |
6374 aim_session_t *sess = od->sess; | 6381 aim_session_t *sess = od->sess; |
6375 FILE *file; | 6382 FILE *file; |
6376 struct stat st; | 6383 struct stat st; |
6377 | 6384 |
6378 if (iconfile == NULL) { | 6385 if (iconfile == NULL) { |
6401 } | 6408 } |
6402 | 6409 |
6403 | 6410 |
6404 static GList *oscar_actions(GaimConnection *gc) | 6411 static GList *oscar_actions(GaimConnection *gc) |
6405 { | 6412 { |
6406 struct oscar_data *od = gc->proto_data; | 6413 OscarData *od = gc->proto_data; |
6407 struct proto_actions_menu *pam; | 6414 struct proto_actions_menu *pam; |
6408 GList *m = NULL; | 6415 GList *m = NULL; |
6409 | 6416 |
6410 pam = g_new0(struct proto_actions_menu, 1); | 6417 pam = g_new0(struct proto_actions_menu, 1); |
6411 pam->label = _("Set User Info"); | 6418 pam->label = _("Set User Info"); |
6497 return m; | 6504 return m; |
6498 } | 6505 } |
6499 | 6506 |
6500 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) | 6507 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
6501 { | 6508 { |
6502 struct oscar_data *od = gc->proto_data; | 6509 OscarData *od = gc->proto_data; |
6503 | 6510 |
6504 if (od->icq) { | 6511 if (od->icq) { |
6505 aim_icq_changepasswd(od->sess, new); | 6512 aim_icq_changepasswd(od->sess, new); |
6506 } else { | 6513 } else { |
6507 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | 6514 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6516 } | 6523 } |
6517 } | 6524 } |
6518 | 6525 |
6519 static void oscar_convo_closed(GaimConnection *gc, const char *who) | 6526 static void oscar_convo_closed(GaimConnection *gc, const char *who) |
6520 { | 6527 { |
6521 struct oscar_data *od = gc->proto_data; | 6528 OscarData *od = gc->proto_data; |
6522 struct direct_im *dim = find_direct_im(od, who); | 6529 struct direct_im *dim = find_direct_im(od, who); |
6523 | 6530 |
6524 if (!dim) | 6531 if (!dim) |
6525 return; | 6532 return; |
6526 | 6533 |