comparison libpurple/protocols/yahoo/yahoochat.c @ 27694:908be3822215

Move from "struct yahoo_data" to "YahooData" to be consistent with other structs in the prpl. I'm sure someone is going to want to shoot me over this, but I'm tired of seeing "struct yahoo_data" everywhere in this prpl.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sun, 26 Jul 2009 17:25:18 +0000
parents 0501a295985e
children 7c871249318b
comparison
equal deleted inserted replaced
27693:8bc9087b5ec2 27694:908be3822215
51 static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout); 51 static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout);
52 52
53 /* special function to log us on to the yahoo chat service */ 53 /* special function to log us on to the yahoo chat service */
54 static void yahoo_chat_online(PurpleConnection *gc) 54 static void yahoo_chat_online(PurpleConnection *gc)
55 { 55 {
56 struct yahoo_data *yd = gc->proto_data; 56 YahooData *yd = gc->proto_data;
57 struct yahoo_packet *pkt; 57 struct yahoo_packet *pkt;
58 const char *rll; 58 const char *rll;
59 59
60 if (yd->wm) { 60 if (yd->wm) {
61 ycht_connection_open(gc); 61 ycht_connection_open(gc);
96 purple_conv_chat_add_user(chat, user, reason, PURPLE_CBFLAGS_NONE, TRUE); 96 purple_conv_chat_add_user(chat, user, reason, PURPLE_CBFLAGS_NONE, TRUE);
97 } 97 }
98 98
99 static PurpleConversation *yahoo_find_conference(PurpleConnection *gc, const char *name) 99 static PurpleConversation *yahoo_find_conference(PurpleConnection *gc, const char *name)
100 { 100 {
101 struct yahoo_data *yd; 101 YahooData *yd;
102 GSList *l; 102 GSList *l;
103 103
104 yd = gc->proto_data; 104 yd = gc->proto_data;
105 105
106 for (l = yd->confs; l; l = l->next) { 106 for (l = yd->confs; l; l = l->next) {
371 g_free(room); 371 g_free(room);
372 } 372 }
373 373
374 static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id) 374 static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id)
375 { 375 {
376 struct yahoo_data *yd = gc->proto_data; 376 YahooData *yd = gc->proto_data;
377 struct yahoo_packet *pkt; 377 struct yahoo_packet *pkt;
378 char *room2; 378 char *room2;
379 gboolean utf8 = TRUE; 379 gboolean utf8 = TRUE;
380 380
381 if (yd->wm) { 381 if (yd->wm) {
399 } 399 }
400 400
401 /* this is a confirmation of yahoo_chat_online(); */ 401 /* this is a confirmation of yahoo_chat_online(); */
402 void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt) 402 void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt)
403 { 403 {
404 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; 404 YahooData *yd = (YahooData *) gc->proto_data;
405 405
406 if (pkt->status == 1) { 406 if (pkt->status == 1) {
407 yd->chat_online = TRUE; 407 yd->chat_online = TRUE;
408 408
409 /* We need to goto a user in chat */ 409 /* We need to goto a user in chat */
431 } 431 }
432 432
433 /* this is basicly the opposite of chat_online */ 433 /* this is basicly the opposite of chat_online */
434 void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) 434 void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt)
435 { 435 {
436 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; 436 YahooData *yd = (YahooData *) gc->proto_data;
437 GSList *l; 437 GSList *l;
438 438
439 for (l = pkt->hash; l; l = l->next) { 439 for (l = pkt->hash; l; l = l->next) {
440 struct yahoo_pair *pair = l->data; 440 struct yahoo_pair *pair = l->data;
441 441
461 } 461 }
462 462
463 void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt) 463 void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt)
464 { 464 {
465 PurpleAccount *account = purple_connection_get_account(gc); 465 PurpleAccount *account = purple_connection_get_account(gc);
466 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; 466 YahooData *yd = (YahooData *) gc->proto_data;
467 PurpleConversation *c = NULL; 467 PurpleConversation *c = NULL;
468 GSList *l; 468 GSList *l;
469 GList *members = NULL; 469 GList *members = NULL;
470 GList *roomies = NULL; 470 GList *roomies = NULL;
471 char *room = NULL; 471 char *room = NULL;
616 void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt) 616 void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt)
617 { 617 {
618 char *who = NULL; 618 char *who = NULL;
619 char *room = NULL; 619 char *room = NULL;
620 GSList *l; 620 GSList *l;
621 struct yahoo_data *yd; 621 YahooData *yd;
622 622
623 yd = gc->proto_data; 623 yd = gc->proto_data;
624 624
625 for (l = pkt->hash; l; l = l->next) { 625 for (l = pkt->hash; l; l = l->next) {
626 struct yahoo_pair *pair = l->data; 626 struct yahoo_pair *pair = l->data;
767 /* 767 /*
768 * Functions dealing with conferences 768 * Functions dealing with conferences
769 * I think conference names are always ascii. 769 * I think conference names are always ascii.
770 */ 770 */
771 771
772 void yahoo_conf_leave(struct yahoo_data *yd, const char *room, const char *dn, GList *who) 772 void yahoo_conf_leave(YahooData *yd, const char *room, const char *dn, GList *who)
773 { 773 {
774 struct yahoo_packet *pkt; 774 struct yahoo_packet *pkt;
775 GList *w; 775 GList *w;
776 776
777 purple_debug_misc("yahoo", "leaving conference %s\n", room); 777 purple_debug_misc("yahoo", "leaving conference %s\n", room);
789 } 789 }
790 790
791 static int yahoo_conf_send(PurpleConnection *gc, const char *dn, const char *room, 791 static int yahoo_conf_send(PurpleConnection *gc, const char *dn, const char *room,
792 GList *members, const char *what) 792 GList *members, const char *what)
793 { 793 {
794 struct yahoo_data *yd = gc->proto_data; 794 YahooData *yd = gc->proto_data;
795 struct yahoo_packet *pkt; 795 struct yahoo_packet *pkt;
796 GList *who; 796 GList *who;
797 char *msg, *msg2; 797 char *msg, *msg2;
798 int utf8 = 1; 798 int utf8 = 1;
799 799
816 g_free(msg2); 816 g_free(msg2);
817 817
818 return 0; 818 return 0;
819 } 819 }
820 820
821 static void yahoo_conf_join(struct yahoo_data *yd, PurpleConversation *c, const char *dn, const char *room, 821 static void yahoo_conf_join(YahooData *yd, PurpleConversation *c, const char *dn, const char *room,
822 const char *topic, const char *members) 822 const char *topic, const char *members)
823 { 823 {
824 struct yahoo_packet *pkt; 824 struct yahoo_packet *pkt;
825 char **memarr = NULL; 825 char **memarr = NULL;
826 int i; 826 int i;
846 } 846 }
847 847
848 static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c, 848 static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c,
849 const char *dn, const char *buddy, const char *room, const char *msg) 849 const char *dn, const char *buddy, const char *room, const char *msg)
850 { 850 {
851 struct yahoo_data *yd = gc->proto_data; 851 YahooData *yd = gc->proto_data;
852 struct yahoo_packet *pkt; 852 struct yahoo_packet *pkt;
853 GList *members; 853 GList *members;
854 char *msg2 = NULL; 854 char *msg2 = NULL;
855 855
856 if (msg) 856 if (msg)
876 * Functions dealing with chats 876 * Functions dealing with chats
877 */ 877 */
878 878
879 static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout) 879 static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout)
880 { 880 {
881 struct yahoo_data *yd = gc->proto_data; 881 YahooData *yd = gc->proto_data;
882 struct yahoo_packet *pkt; 882 struct yahoo_packet *pkt;
883 PurpleConversation *c; 883 PurpleConversation *c;
884 884
885 char *eroom; 885 char *eroom;
886 gboolean utf8 = 1; 886 gboolean utf8 = 1;
928 g_free(eroom); 928 g_free(eroom);
929 } 929 }
930 930
931 static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags) 931 static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags)
932 { 932 {
933 struct yahoo_data *yd = gc->proto_data; 933 YahooData *yd = gc->proto_data;
934 struct yahoo_packet *pkt; 934 struct yahoo_packet *pkt;
935 int me = 0; 935 int me = 0;
936 char *msg1, *msg2, *room2; 936 char *msg1, *msg2, *room2;
937 gboolean utf8 = TRUE; 937 gboolean utf8 = TRUE;
938 938
973 973
974 974
975 static void yahoo_chat_invite(PurpleConnection *gc, const char *dn, const char *buddy, 975 static void yahoo_chat_invite(PurpleConnection *gc, const char *dn, const char *buddy,
976 const char *room, const char *msg) 976 const char *room, const char *msg)
977 { 977 {
978 struct yahoo_data *yd = gc->proto_data; 978 YahooData *yd = gc->proto_data;
979 struct yahoo_packet *pkt; 979 struct yahoo_packet *pkt;
980 char *room2, *msg2 = NULL; 980 char *room2, *msg2 = NULL;
981 gboolean utf8 = TRUE; 981 gboolean utf8 = TRUE;
982 982
983 if (yd->wm) { 983 if (yd->wm) {
998 g_free(msg2); 998 g_free(msg2);
999 } 999 }
1000 1000
1001 void yahoo_chat_goto(PurpleConnection *gc, const char *name) 1001 void yahoo_chat_goto(PurpleConnection *gc, const char *name)
1002 { 1002 {
1003 struct yahoo_data *yd; 1003 YahooData *yd;
1004 struct yahoo_packet *pkt; 1004 struct yahoo_packet *pkt;
1005 1005
1006 yd = gc->proto_data; 1006 yd = gc->proto_data;
1007 1007
1008 if (yd->wm) { 1008 if (yd->wm) {
1033 * which get called for both chats and conferences. 1033 * which get called for both chats and conferences.
1034 */ 1034 */
1035 1035
1036 void yahoo_c_leave(PurpleConnection *gc, int id) 1036 void yahoo_c_leave(PurpleConnection *gc, int id)
1037 { 1037 {
1038 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; 1038 YahooData *yd = (YahooData *) gc->proto_data;
1039 PurpleConversation *c; 1039 PurpleConversation *c;
1040 1040
1041 if (!yd) 1041 if (!yd)
1042 return; 1042 return;
1043 1043
1058 1058
1059 int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) 1059 int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags)
1060 { 1060 {
1061 PurpleConversation *c; 1061 PurpleConversation *c;
1062 int ret; 1062 int ret;
1063 struct yahoo_data *yd; 1063 YahooData *yd;
1064 1064
1065 yd = (struct yahoo_data *) gc->proto_data; 1065 yd = (YahooData *) gc->proto_data;
1066 if (!yd) 1066 if (!yd)
1067 return -1; 1067 return -1;
1068 1068
1069 c = purple_find_chat(gc, id); 1069 c = purple_find_chat(gc, id);
1070 if (!c) 1070 if (!c)
1114 return g_strdup(g_hash_table_lookup(data, "room")); 1114 return g_strdup(g_hash_table_lookup(data, "room"));
1115 } 1115 }
1116 1116
1117 void yahoo_c_join(PurpleConnection *gc, GHashTable *data) 1117 void yahoo_c_join(PurpleConnection *gc, GHashTable *data)
1118 { 1118 {
1119 struct yahoo_data *yd; 1119 YahooData *yd;
1120 char *room, *topic, *type; 1120 char *room, *topic, *type;
1121 PurpleConversation *c; 1121 PurpleConversation *c;
1122 1122
1123 yd = (struct yahoo_data *) gc->proto_data; 1123 yd = (YahooData *) gc->proto_data;
1124 if (!yd) 1124 if (!yd)
1125 return; 1125 return;
1126 1126
1127 room = g_hash_table_lookup(data, "room"); 1127 room = g_hash_table_lookup(data, "room");
1128 if (!room) 1128 if (!room)
1478 1478
1479 static void yahoo_roomlist_got_connected(gpointer data, gint source, const gchar *error_message) 1479 static void yahoo_roomlist_got_connected(gpointer data, gint source, const gchar *error_message)
1480 { 1480 {
1481 struct yahoo_roomlist *yrl = data; 1481 struct yahoo_roomlist *yrl = data;
1482 PurpleRoomlist *list = yrl->list; 1482 PurpleRoomlist *list = yrl->list;
1483 struct yahoo_data *yd = purple_account_get_connection(list->account)->proto_data; 1483 YahooData *yd = purple_account_get_connection(list->account)->proto_data;
1484 1484
1485 if (source < 0) { 1485 if (source < 0) {
1486 purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); 1486 purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed."));
1487 yahoo_roomlist_cleanup(list, yrl); 1487 yahoo_roomlist_cleanup(list, yrl);
1488 return; 1488 return;