comparison src/protocols/yahoo/yahoo.c @ 12919:248b8b39c671

[gaim-migrate @ 15272] Replace GaimBlistNodeAction with the more generic GaimMenuAction, this is in preparation for letting the chat room user list have extensible menus like the blist entries do. (I know it's not exactly the prettiest, and the callback isn't exactly type-safe, when we eventually gobjectify everything we can get some safety back by using (GObject, gpointer) but that's for later.) I'm planning to look into merging GaimPluginActions into GaimMenuActions as well. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Tue, 17 Jan 2006 23:22:19 +0000
parents ba82ecb2d6f5
children 82e918444965
comparison
equal deleted inserted replaced
12918:a05fbd9dcc31 12919:248b8b39c671
2856 yahoo_chat_goto(gc, buddy->name); 2856 yahoo_chat_goto(gc, buddy->name);
2857 } 2857 }
2858 2858
2859 static GList *build_presence_submenu(YahooFriend *f, GaimConnection *gc) { 2859 static GList *build_presence_submenu(YahooFriend *f, GaimConnection *gc) {
2860 GList *m = NULL; 2860 GList *m = NULL;
2861 GaimBlistNodeAction *act; 2861 GaimMenuAction *act;
2862 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; 2862 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
2863 2863
2864 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { 2864 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
2865 if (f->presence != YAHOO_PRESENCE_ONLINE) { 2865 if (f->presence != YAHOO_PRESENCE_ONLINE) {
2866 act = gaim_blist_node_action_new(_("Appear Online"), 2866 act = gaim_menu_action_new(_("Appear Online"),
2867 yahoo_presence_settings, 2867 GAIM_CALLBACK(yahoo_presence_settings),
2868 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE), 2868 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE),
2869 NULL); 2869 NULL);
2870 m = g_list_append(m, act); 2870 m = g_list_append(m, act);
2871 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) { 2871 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) {
2872 act = gaim_blist_node_action_new(_("Appear Offline"), 2872 act = gaim_menu_action_new(_("Appear Offline"),
2873 yahoo_presence_settings, 2873 GAIM_CALLBACK(yahoo_presence_settings),
2874 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), 2874 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
2875 NULL); 2875 NULL);
2876 m = g_list_append(m, act); 2876 m = g_list_append(m, act);
2877 } 2877 }
2878 } 2878 }
2879 2879
2880 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { 2880 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
2881 act = gaim_blist_node_action_new( 2881 act = gaim_menu_action_new(
2882 _("Don't Appear Permanently Offline"), 2882 _("Don't Appear Permanently Offline"),
2883 yahoo_presence_settings, 2883 GAIM_CALLBACK(yahoo_presence_settings),
2884 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), NULL); 2884 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), NULL);
2885 m = g_list_append(m, act); 2885 m = g_list_append(m, act);
2886 } else { 2886 } else {
2887 act = gaim_blist_node_action_new( 2887 act = gaim_menu_action_new(_("Appear Permanently Offline"),
2888 _("Appear Permanently Offline"), 2888 GAIM_CALLBACK(yahoo_presence_settings),
2889 yahoo_presence_settings,
2890 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE), 2889 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE),
2891 NULL); 2890 NULL);
2892 m = g_list_append(m, act); 2891 m = g_list_append(m, act);
2893 } 2892 }
2894 2893
2904 } 2903 }
2905 2904
2906 static GList *yahoo_buddy_menu(GaimBuddy *buddy) 2905 static GList *yahoo_buddy_menu(GaimBuddy *buddy)
2907 { 2906 {
2908 GList *m = NULL; 2907 GList *m = NULL;
2909 GaimBlistNodeAction *act; 2908 GaimMenuAction *act;
2910 2909
2911 GaimConnection *gc = gaim_account_get_connection(buddy->account); 2910 GaimConnection *gc = gaim_account_get_connection(buddy->account);
2912 struct yahoo_data *yd = gc->proto_data; 2911 struct yahoo_data *yd = gc->proto_data;
2913 static char buf2[1024]; 2912 static char buf2[1024];
2914 YahooFriend *f; 2913 YahooFriend *f;
2915 2914
2916 f = yahoo_friend_find(gc, buddy->name); 2915 f = yahoo_friend_find(gc, buddy->name);
2917 2916
2918 if (!f && !yd->wm) { 2917 if (!f && !yd->wm) {
2919 act = gaim_blist_node_action_new(_("Add Buddy"), 2918 act = gaim_menu_action_new(_("Add Buddy"),
2920 yahoo_addbuddyfrommenu_cb, NULL, NULL); 2919 GAIM_CALLBACK(yahoo_addbuddyfrommenu_cb),
2920 NULL, NULL);
2921 m = g_list_append(m, act); 2921 m = g_list_append(m, act);
2922 2922
2923 return m; 2923 return m;
2924 2924
2925 } 2925 }
2926 2926
2927 if (f && f->status != YAHOO_STATUS_OFFLINE) { 2927 if (f && f->status != YAHOO_STATUS_OFFLINE) {
2928 if (!yd->wm) { 2928 if (!yd->wm) {
2929 act = gaim_blist_node_action_new(_("Join in Chat"), 2929 act = gaim_menu_action_new(_("Join in Chat"),
2930 yahoo_chat_goto_menu, NULL, NULL); 2930 GAIM_CALLBACK(yahoo_chat_goto_menu),
2931 NULL, NULL);
2931 m = g_list_append(m, act); 2932 m = g_list_append(m, act);
2932 } 2933 }
2933 2934
2934 act = gaim_blist_node_action_new(_("Initiate Conference"), 2935 act = gaim_menu_action_new(_("Initiate Conference"),
2935 yahoo_initiate_conference, NULL, NULL); 2936 GAIM_CALLBACK(yahoo_initiate_conference),
2937 NULL, NULL);
2936 m = g_list_append(m, act); 2938 m = g_list_append(m, act);
2937 2939
2938 if (yahoo_friend_get_game(f)) { 2940 if (yahoo_friend_get_game(f)) {
2939 const char *game = yahoo_friend_get_game(f); 2941 const char *game = yahoo_friend_get_game(f);
2940 char *room; 2942 char *room;
2947 while (*t != '\n') 2949 while (*t != '\n')
2948 t++; /* replace the \n with a space */ 2950 t++; /* replace the \n with a space */
2949 *t = ' '; 2951 *t = ' ';
2950 g_snprintf(buf2, sizeof buf2, "%s", room); 2952 g_snprintf(buf2, sizeof buf2, "%s", room);
2951 2953
2952 act = gaim_blist_node_action_new(buf2, yahoo_game, NULL, NULL); 2954 act = gaim_menu_action_new(buf2,
2955 GAIM_CALLBACK(yahoo_game),
2956 NULL, NULL);
2953 m = g_list_append(m, act); 2957 m = g_list_append(m, act);
2954 } 2958 }
2955 } 2959 }
2956 } 2960 }
2957 2961
2958 if (f) { 2962 if (f) {
2959 act = gaim_blist_node_action_new(_("Presence Settings"), 2963 act = gaim_menu_action_new(_("Presence Settings"), NULL, NULL,
2960 NULL, NULL, build_presence_submenu(f, gc)); 2964 build_presence_submenu(f, gc));
2961 m = g_list_append(m, act); 2965 m = g_list_append(m, act);
2962 } 2966 }
2963 2967
2964 if (f) { 2968 if (f) {
2965 act = gaim_blist_node_action_new(_("Start Doodling"), 2969 act = gaim_menu_action_new(_("Start Doodling"),
2966 yahoo_doodle_blist_node, NULL, NULL); 2970 GAIM_CALLBACK(yahoo_doodle_blist_node),
2971 NULL, NULL);
2967 m = g_list_append(m, act); 2972 m = g_list_append(m, act);
2968 } 2973 }
2969 2974
2970 return m; 2975 return m;
2971 } 2976 }