Mercurial > pidgin
comparison src/protocols/yahoo/yahoochat.c @ 9376:3aa848ccf986
[gaim-migrate @ 10184]
*** Danger Will Robinson!!!
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Thu, 24 Jun 2004 07:08:33 +0000 |
parents | d42f3e4fd7ad |
children | 8b2451878e26 |
comparison
equal
deleted
inserted
replaced
9375:49b7b30f6e4e | 9376:3aa848ccf986 |
---|---|
39 #include "multi.h" | 39 #include "multi.h" |
40 #include "internal.h" | 40 #include "internal.h" |
41 | 41 |
42 #include "yahoo.h" | 42 #include "yahoo.h" |
43 #include "yahoochat.h" | 43 #include "yahoochat.h" |
44 #include "ycht.h" | |
44 | 45 |
45 #define YAHOO_CHAT_ID (1) | 46 #define YAHOO_CHAT_ID (1) |
46 | 47 |
47 /* prototype(s) */ | 48 /* prototype(s) */ |
48 static void yahoo_chat_leave(GaimConnection *gc, const char *room, const char *dn, gboolean logout); | 49 static void yahoo_chat_leave(GaimConnection *gc, const char *room, const char *dn, gboolean logout); |
51 static void yahoo_chat_online(GaimConnection *gc) | 52 static void yahoo_chat_online(GaimConnection *gc) |
52 { | 53 { |
53 struct yahoo_data *yd = gc->proto_data; | 54 struct yahoo_data *yd = gc->proto_data; |
54 struct yahoo_packet *pkt; | 55 struct yahoo_packet *pkt; |
55 | 56 |
57 if (yd->wm) { | |
58 ycht_connection_open(gc); | |
59 return; | |
60 } | |
56 | 61 |
57 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATONLINE, YAHOO_STATUS_AVAILABLE,0); | 62 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATONLINE, YAHOO_STATUS_AVAILABLE,0); |
58 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 63 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); |
59 yahoo_packet_hash(pkt, 109, gaim_connection_get_display_name(gc)); | 64 yahoo_packet_hash(pkt, 109, gaim_connection_get_display_name(gc)); |
60 yahoo_packet_hash(pkt, 6, "abcde"); | 65 yahoo_packet_hash(pkt, 6, "abcde"); |
68 { | 73 { |
69 return strcmp(a, b); | 74 return strcmp(a, b); |
70 } | 75 } |
71 | 76 |
72 /* this is slow, and different from the gaim_* version in that it (hopefully) won't add a user twice */ | 77 /* this is slow, and different from the gaim_* version in that it (hopefully) won't add a user twice */ |
73 static void yahoo_chat_add_users(GaimConvChat *chat, GList *newusers) | 78 void yahoo_chat_add_users(GaimConvChat *chat, GList *newusers) |
74 { | 79 { |
75 GList *users, *i, *j; | 80 GList *users, *i, *j; |
76 | 81 |
77 users = gaim_conv_chat_get_users(chat); | 82 users = gaim_conv_chat_get_users(chat); |
78 | 83 |
82 continue; | 87 continue; |
83 gaim_conv_chat_add_user(chat, i->data, NULL); | 88 gaim_conv_chat_add_user(chat, i->data, NULL); |
84 } | 89 } |
85 } | 90 } |
86 | 91 |
87 static void yahoo_chat_add_user(GaimConvChat *chat, const char *user, const char *reason) | 92 void yahoo_chat_add_user(GaimConvChat *chat, const char *user, const char *reason) |
88 { | 93 { |
89 GList *users; | 94 GList *users; |
90 | 95 |
91 users = gaim_conv_chat_get_users(chat); | 96 users = gaim_conv_chat_get_users(chat); |
92 | 97 |
712 struct yahoo_packet *pkt; | 717 struct yahoo_packet *pkt; |
713 GaimConversation *c; | 718 GaimConversation *c; |
714 char *eroom; | 719 char *eroom; |
715 gboolean utf8 = 1; | 720 gboolean utf8 = 1; |
716 | 721 |
722 if (yd->wm) { | |
723 g_return_if_fail(yd->ycht != NULL); | |
724 | |
725 ycht_chat_leave(yd->ycht, room, logout); | |
726 return; | |
727 } | |
728 | |
717 eroom = yahoo_string_encode(gc, room, &utf8); | 729 eroom = yahoo_string_encode(gc, room, &utf8); |
718 | 730 |
719 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATEXIT, YAHOO_STATUS_AVAILABLE, 0); | 731 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATEXIT, YAHOO_STATUS_AVAILABLE, 0); |
720 | 732 |
721 yahoo_packet_hash(pkt, 104, eroom); | 733 yahoo_packet_hash(pkt, 104, eroom); |
793 struct yahoo_data *yd = gc->proto_data; | 805 struct yahoo_data *yd = gc->proto_data; |
794 struct yahoo_packet *pkt; | 806 struct yahoo_packet *pkt; |
795 int me = 0; | 807 int me = 0; |
796 char *msg1, *msg2, *room2; | 808 char *msg1, *msg2, *room2; |
797 gboolean utf8 = TRUE; | 809 gboolean utf8 = TRUE; |
810 | |
811 if (yd->wm) { | |
812 g_return_val_if_fail(yd->ycht != NULL, 1); | |
813 | |
814 return ycht_chat_send(yd->ycht, room, what); | |
815 } | |
798 | 816 |
799 msg1 = g_strdup(what); | 817 msg1 = g_strdup(what); |
800 | 818 |
801 if (meify(msg1, -1)) | 819 if (meify(msg1, -1)) |
802 me = 1; | 820 me = 1; |
833 struct yahoo_data *yd = gc->proto_data; | 851 struct yahoo_data *yd = gc->proto_data; |
834 struct yahoo_packet *pkt; | 852 struct yahoo_packet *pkt; |
835 char *room2; | 853 char *room2; |
836 gboolean utf8 = TRUE; | 854 gboolean utf8 = TRUE; |
837 | 855 |
856 if (yd->wm) { | |
857 g_return_if_fail(yd->ycht != NULL); | |
858 | |
859 ycht_chat_join(yd->ycht, room); | |
860 return; | |
861 } | |
862 | |
838 /* apparently room names are always utf8, or else always not utf8, | 863 /* apparently room names are always utf8, or else always not utf8, |
839 * so we don't have to actually pass the flag in the packet. Or something. */ | 864 * so we don't have to actually pass the flag in the packet. Or something. */ |
840 room2 = yahoo_string_encode(gc, room, &utf8); | 865 room2 = yahoo_string_encode(gc, room, &utf8); |
841 | 866 |
842 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, 0); | 867 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, 0); |
857 { | 882 { |
858 struct yahoo_data *yd = gc->proto_data; | 883 struct yahoo_data *yd = gc->proto_data; |
859 struct yahoo_packet *pkt; | 884 struct yahoo_packet *pkt; |
860 char *room2, *msg2 = NULL; | 885 char *room2, *msg2 = NULL; |
861 gboolean utf8 = TRUE; | 886 gboolean utf8 = TRUE; |
887 | |
888 if (yd->wm) { | |
889 g_return_if_fail(yd->ycht != NULL); | |
890 | |
891 ycht_chat_send_invite(yd->ycht, room, buddy, msg); | |
892 return; | |
893 } | |
862 | 894 |
863 room2 = yahoo_string_encode(gc, room, &utf8); | 895 room2 = yahoo_string_encode(gc, room, &utf8); |
864 if (msg) | 896 if (msg) |
865 msg2 = yahoo_string_encode(gc, msg, NULL); | 897 msg2 = yahoo_string_encode(gc, msg, NULL); |
866 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATADDINVITE, YAHOO_STATUS_AVAILABLE, 0); | 898 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATADDINVITE, YAHOO_STATUS_AVAILABLE, 0); |
883 { | 915 { |
884 struct yahoo_data *yd; | 916 struct yahoo_data *yd; |
885 struct yahoo_packet *pkt; | 917 struct yahoo_packet *pkt; |
886 | 918 |
887 yd = gc->proto_data; | 919 yd = gc->proto_data; |
920 | |
921 if (yd->wm) { | |
922 g_return_if_fail(yd->ycht != NULL); | |
923 | |
924 ycht_chat_goto_user(yd->ycht, name); | |
925 return; | |
926 } | |
888 | 927 |
889 if (!yd->chat_online) | 928 if (!yd->chat_online) |
890 yahoo_chat_online(gc); | 929 yahoo_chat_online(gc); |
891 | 930 |
892 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, 0); | 931 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, 0); |