Make return clearer
[pidgin-git.git] / libpurple / plugins / buddynote.c
bloba57c749e0d3d5a79834192b32b64d837a734ebff
1 /*
2 * BuddyNote - Store notes on particular buddies
3 * Copyright (C) 2004 Stu Tomlinson <stu@nosnilmot.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
19 #include "internal.h"
21 #include <purple.h>
23 static void
24 dont_do_it_cb(PurpleBlistNode *node, const char *note)
28 static void
29 do_it_cb(PurpleBlistNode *node, const char *note)
31 purple_blist_node_set_string(node, "notes", note);
34 static void
35 buddynote_edit_cb(PurpleBlistNode *node, gpointer data)
37 const char *note;
39 note = purple_blist_node_get_string(node, "notes");
41 purple_request_input(node, _("Notes"),
42 _("Enter your notes below..."),
43 NULL,
44 note, TRUE, FALSE, "html",
45 _("Save"), G_CALLBACK(do_it_cb),
46 _("Cancel"), G_CALLBACK(dont_do_it_cb),
47 NULL, node);
50 static void
51 buddynote_extended_menu_cb(PurpleBlistNode *node, GList **m)
53 PurpleActionMenu *bna = NULL;
55 if (purple_blist_node_is_transient(node))
56 return;
58 *m = g_list_append(*m, bna);
59 bna = purple_action_menu_new(_("Edit Notes..."), PURPLE_CALLBACK(buddynote_edit_cb), NULL, NULL);
60 *m = g_list_append(*m, bna);
63 static PurplePluginInfo *
64 plugin_query(GError **error)
66 const gchar * const authors[] = {
67 "Stu Tomlinson <stu@nosnilmot.com>",
68 NULL
71 return purple_plugin_info_new(
72 "id", "core-plugin_pack-buddynote",
73 "name", N_("Buddy Notes"),
74 "version", DISPLAY_VERSION,
75 "category", N_("Utility"),
76 "summary", N_("Store notes on particular buddies."),
77 "description", N_("Adds the option to store notes for buddies on your "
78 "buddy list."),
79 "authors", authors,
80 "website", PURPLE_WEBSITE,
81 "abi-version", PURPLE_ABI_VERSION,
82 NULL
86 static gboolean
87 plugin_load(PurplePlugin *plugin, GError **error)
90 purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu",
91 plugin, PURPLE_CALLBACK(buddynote_extended_menu_cb), NULL);
93 return TRUE;
96 static gboolean
97 plugin_unload(PurplePlugin *plugin, GError **error)
99 return TRUE;
102 PURPLE_PLUGIN_INIT(buddynote, plugin_query, plugin_load, plugin_unload);