Mercurial > pidgin
comparison libgaim/protocols/qq/qq.c @ 14404:8ff8f1c897b5
[gaim-migrate @ 17112]
Fixed chat support.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Huetsch <markhuetsch> |
---|---|
date | Fri, 01 Sep 2006 11:03:18 +0000 |
parents | 01f13d2e73de |
children | ae0f94b7f396 |
comparison
equal
deleted
inserted
replaced
14403:646dcf11b4eb | 14404:8ff8f1c897b5 |
---|---|
151 qq_buddy *q_bud; | 151 qq_buddy *q_bud; |
152 | 152 |
153 /* do not use g_return_val_if_fail, as it is not assertion */ | 153 /* do not use g_return_val_if_fail, as it is not assertion */ |
154 if (b == NULL || b->proto_data == NULL) | 154 if (b == NULL || b->proto_data == NULL) |
155 return "qq"; | 155 return "qq"; |
156 | 156 |
157 q_bud = (qq_buddy *) b->proto_data; | 157 q_bud = (qq_buddy *) b->proto_data; |
158 filename = get_icon_name(q_bud->icon / 3 + 1); | 158 filename = get_icon_name(q_bud->icon / 3 + 1); |
159 | 159 |
160 return filename; | 160 return filename; |
161 } | 161 } |
563 "OpenQ", FALSE, FALSE, NULL, | 563 "OpenQ", FALSE, FALSE, NULL, |
564 _("Create"), G_CALLBACK(qq_group_create_with_name), _("Cancel"), NULL, gc); | 564 _("Create"), G_CALLBACK(qq_group_create_with_name), _("Cancel"), NULL, gc); |
565 } | 565 } |
566 */ | 566 */ |
567 | 567 |
568 /* XXX re-enable this | |
569 static void _qq_menu_unsubscribe_group(GaimBlistNode * node) | 568 static void _qq_menu_unsubscribe_group(GaimBlistNode * node) |
570 { | 569 { |
571 GaimChat *chat = (GaimChat *)node; | 570 GaimChat *chat = (GaimChat *)node; |
572 GaimConnection *gc = gaim_account_get_connection(chat->account); | 571 GaimConnection *gc = gaim_account_get_connection(chat->account); |
573 GHashTable *components = chat -> components; | 572 GHashTable *components = chat -> components; |
576 | 575 |
577 g_return_if_fail(gc != NULL && components != NULL); | 576 g_return_if_fail(gc != NULL && components != NULL); |
578 qq_group_exit(gc, components); | 577 qq_group_exit(gc, components); |
579 } | 578 } |
580 | 579 |
581 // XXX re-enable this | 580 /* |
582 static void _qq_menu_manage_group(GaimBlistNode * node) | 581 static void _qq_menu_manage_group(GaimBlistNode * node) |
583 { | 582 { |
584 GaimChat *chat = (GaimChat *)node; | 583 GaimChat *chat = (GaimChat *)node; |
585 GaimConnection *gc = gaim_account_get_connection(chat->account); | 584 GaimConnection *gc = gaim_account_get_connection(chat->account); |
586 GHashTable *components = chat -> components; | 585 GHashTable *components = chat -> components; |
858 | 857 |
859 return m; | 858 return m; |
860 } | 859 } |
861 | 860 |
862 /* chat-related (QQ Qun) menu shown up with right-click */ | 861 /* chat-related (QQ Qun) menu shown up with right-click */ |
863 /* TODO re-enable this | |
864 static GList *_qq_chat_menu(GaimBlistNode *node) | 862 static GList *_qq_chat_menu(GaimBlistNode *node) |
865 { | 863 { |
866 GList *m; | 864 GList *m; |
867 GaimMenuAction *act; | 865 GaimMenuAction *act; |
868 | 866 |
869 m = NULL; | 867 m = NULL; |
870 act = gaim_menu_action_new(_("Exit this QQ Qun"), GAIM_CALLBACK(_qq_menu_unsubscribe_group), NULL, NULL); | 868 act = gaim_menu_action_new(_("Exit this QQ Qun"), GAIM_CALLBACK(_qq_menu_unsubscribe_group), NULL, NULL); |
871 m = g_list_append(m, act); | 869 m = g_list_append(m, act); |
872 | 870 |
871 /* TODO: enable this | |
873 act = gaim_menu_action_new(_("Show Details"), GAIM_CALLBACK(_qq_menu_manage_group), NULL, NULL); | 872 act = gaim_menu_action_new(_("Show Details"), GAIM_CALLBACK(_qq_menu_manage_group), NULL, NULL); |
874 m = g_list_append(m, act); | 873 m = g_list_append(m, act); |
874 */ | |
875 | 875 |
876 return m; | 876 return m; |
877 } | 877 } |
878 */ | 878 |
879 /* buddy-related menu shown up with right-click */ | 879 /* buddy-related menu shown up with right-click */ |
880 /* TODO re-enable this | |
881 static GList *_qq_buddy_menu(GaimBlistNode * node) | 880 static GList *_qq_buddy_menu(GaimBlistNode * node) |
882 { | 881 { |
883 GList *m; | 882 GList *m; |
884 | 883 |
885 if(GAIM_BLIST_NODE_IS_CHAT(node)) | 884 if(GAIM_BLIST_NODE_IS_CHAT(node)) |
886 return _qq_chat_menu(node); | 885 return _qq_chat_menu(node); |
887 | 886 |
888 m = NULL; | 887 m = NULL; |
889 */ | 888 return m; |
889 } | |
890 | |
890 /* TODO : not working, temp commented out by gfhuang | 891 /* TODO : not working, temp commented out by gfhuang |
891 | 892 |
892 act = gaim_menu_action_new(_("Block this buddy"), GAIM_CALLBACK(_qq_menu_block_buddy), NULL, NULL); //add NULL by gfhuang | 893 act = gaim_menu_action_new(_("Block this buddy"), GAIM_CALLBACK(_qq_menu_block_buddy), NULL, NULL); //add NULL by gfhuang |
893 m = g_list_append(m, act); | 894 m = g_list_append(m, act); |
894 // if (q_bud && is_online(q_bud->status)) { | 895 // if (q_bud && is_online(q_bud->status)) { |
916 while (list != NULL) { | 917 while (list != NULL) { |
917 group = (qq_group *) list->data; | 918 group = (qq_group *) list->data; |
918 if (group->my_status == QQ_GROUP_MEMBER_STATUS_IS_MEMBER || | 919 if (group->my_status == QQ_GROUP_MEMBER_STATUS_IS_MEMBER || |
919 group->my_status == QQ_GROUP_MEMBER_STATUS_IS_ADMIN) | 920 group->my_status == QQ_GROUP_MEMBER_STATUS_IS_ADMIN) |
920 /* no need to get info time and time again, online members enough */ | 921 /* no need to get info time and time again, online members enough */ |
921 qq_send_cmd_group_get_online_member(gc, group); | 922 qq_send_cmd_group_get_online_members(gc, group); |
922 | 923 |
923 list = list->next; | 924 list = list->next; |
924 } | 925 } |
925 | 926 |
926 qq_send_packet_keep_alive(gc); | 927 qq_send_packet_keep_alive(gc); |
932 static void _qq_get_chat_buddy_info(GaimConnection *gc, gint channel, const gchar *who) | 933 static void _qq_get_chat_buddy_info(GaimConnection *gc, gint channel, const gchar *who) |
933 { | 934 { |
934 gchar *gaim_name; | 935 gchar *gaim_name; |
935 g_return_if_fail(gc != NULL && gc->proto_data != NULL && who != NULL); | 936 g_return_if_fail(gc != NULL && gc->proto_data != NULL && who != NULL); |
936 | 937 |
937 gaim_name = qq_group_find_member_by_channel_and_nickname(gc, channel, who); | 938 gaim_name = chat_name_to_gaim_name(who); |
938 if (gaim_name != NULL) | 939 if (gaim_name != NULL) |
939 _qq_get_info(gc, gaim_name); | 940 _qq_get_info(gc, gaim_name); |
940 } | 941 } |
941 | 942 |
942 /* convert chat nickname to qq-uid to invite individual IM to buddy */ | 943 /* convert chat nickname to qq-uid to invite individual IM to buddy */ |
943 /* who is the nickname of buddy in QQ chat-room (Qun) */ | 944 /* who is the nickname of buddy in QQ chat-room (Qun) */ |
944 static gchar *_qq_get_chat_buddy_real_name(GaimConnection *gc, gint channel, const gchar *who) | 945 static gchar *_qq_get_chat_buddy_real_name(GaimConnection *gc, gint channel, const gchar *who) |
945 { | 946 { |
946 g_return_val_if_fail(gc != NULL && gc->proto_data != NULL && who != NULL, NULL); | 947 g_return_val_if_fail(gc != NULL && gc->proto_data != NULL && who != NULL, NULL); |
947 return qq_group_find_member_by_channel_and_nickname(gc, channel, who); | 948 return chat_name_to_gaim_name(who); |
948 } | 949 } |
949 | 950 |
950 void qq_function_not_implemented(GaimConnection *gc) | 951 void qq_function_not_implemented(GaimConnection *gc) |
951 { | 952 { |
952 gaim_notify_warning(gc, NULL, | 953 gaim_notify_warning(gc, NULL, |
962 _qq_list_icon, /* list_icon */ | 963 _qq_list_icon, /* list_icon */ |
963 _qq_list_emblems, /* list_emblems */ | 964 _qq_list_emblems, /* list_emblems */ |
964 _qq_status_text, /* status_text */ | 965 _qq_status_text, /* status_text */ |
965 _qq_tooltip_text, /* tooltip_text */ | 966 _qq_tooltip_text, /* tooltip_text */ |
966 _qq_away_states, /* away_states */ | 967 _qq_away_states, /* away_states */ |
967 NULL, /* blist_node_menu */ | 968 _qq_buddy_menu, /* blist_node_menu */ |
968 NULL, /* chat_info */ | 969 qq_chat_info, /* chat_info */ |
969 NULL, /* chat_info_defaults */ | 970 qq_chat_info_defaults, /* chat_info_defaults */ |
970 _qq_login, /* login */ | 971 _qq_login, /* login */ |
971 _qq_close, /* close */ | 972 _qq_close, /* close */ |
972 _qq_send_im, /* send_im */ | 973 _qq_send_im, /* send_im */ |
973 NULL, /* set_info */ | 974 NULL, /* set_info */ |
974 NULL, /* send_typing */ | 975 NULL, /* send_typing */ |
1041 NULL, /**< unload */ | 1042 NULL, /**< unload */ |
1042 NULL, /**< destroy */ | 1043 NULL, /**< destroy */ |
1043 | 1044 |
1044 NULL, /**< ui_info */ | 1045 NULL, /**< ui_info */ |
1045 &prpl_info, /**< extra_info */ | 1046 &prpl_info, /**< extra_info */ |
1046 NULL, /**< prefs_info */ | 1047 NULL, /**< prefs_info */ |
1047 _qq_actions | 1048 _qq_actions |
1048 }; | 1049 }; |
1049 | 1050 |
1050 | 1051 |
1051 static void init_plugin(GaimPlugin *plugin) | 1052 static void init_plugin(GaimPlugin *plugin) |