Wed, 11 Apr 2007 19:45:20 +0000
Whitespace
| 15230 | 1 | /* |
| 2 | * BuddyNote - Store notes on particular buddies | |
| 3 | * Copyright (C) 2004 Stu Tomlinson <stu@nosnilmot.com> | |
| 4 | * | |
| 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. | |
| 9 | * | |
| 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. | |
| 14 | * | |
| 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 18 | */ | |
| 19 | #include "internal.h" | |
| 20 | ||
| 21 | #include <debug.h> | |
| 22 | #include <notify.h> | |
| 23 | #include <request.h> | |
| 24 | #include <signals.h> | |
| 25 | #include <util.h> | |
| 26 | #include <version.h> | |
| 27 | ||
| 28 | static void | |
| 15884 | 29 | dont_do_it_cb(PurpleBlistNode *node, const char *note) |
| 15230 | 30 | { |
| 31 | } | |
| 32 | ||
| 33 | static void | |
| 15884 | 34 | do_it_cb(PurpleBlistNode *node, const char *note) |
| 15230 | 35 | { |
| 15884 | 36 | purple_blist_node_set_string(node, "notes", note); |
| 15230 | 37 | } |
| 38 | ||
| 39 | static void | |
| 15884 | 40 | buddynote_edit_cb(PurpleBlistNode *node, gpointer data) |
| 15230 | 41 | { |
| 42 | const char *note; | |
| 43 | ||
| 15884 | 44 | note = purple_blist_node_get_string(node, "notes"); |
| 15230 | 45 | |
| 15884 | 46 | purple_request_input(node, _("Notes"), |
| 15230 | 47 | _("Enter your notes below..."), |
| 48 | NULL, | |
| 49 | note, TRUE, FALSE, "html", | |
| 50 | _("Save"), G_CALLBACK(do_it_cb), | |
| 51 | _("Cancel"), G_CALLBACK(dont_do_it_cb), | |
| 52 | node); | |
| 53 | } | |
| 54 | ||
| 55 | static void | |
| 15884 | 56 | buddynote_extended_menu_cb(PurpleBlistNode *node, GList **m) |
| 15230 | 57 | { |
| 15884 | 58 | PurpleMenuAction *bna = NULL; |
| 15230 | 59 | |
| 60 | *m = g_list_append(*m, bna); | |
| 15884 | 61 | bna = purple_menu_action_new(_("Edit Notes..."), PURPLE_CALLBACK(buddynote_edit_cb), NULL, NULL); |
| 15230 | 62 | *m = g_list_append(*m, bna); |
| 63 | } | |
| 64 | ||
| 65 | static gboolean | |
| 15884 | 66 | plugin_load(PurplePlugin *plugin) |
| 15230 | 67 | { |
| 68 | ||
| 15884 | 69 | purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", |
| 70 | plugin, PURPLE_CALLBACK(buddynote_extended_menu_cb), NULL); | |
| 15230 | 71 | |
| 72 | return TRUE; | |
| 73 | } | |
| 74 | ||
| 15884 | 75 | static PurplePluginInfo info = |
| 15230 | 76 | { |
| 15884 | 77 | PURPLE_PLUGIN_MAGIC, |
| 16131 | 78 | PURPLE_MAJOR_VERSION, /**< major version */ |
| 79 | PURPLE_MINOR_VERSION, /**< minor version */ | |
| 15884 | 80 | PURPLE_PLUGIN_STANDARD, /**< type */ |
| 15230 | 81 | NULL, /**< ui_requirement */ |
| 82 | 0, /**< flags */ | |
| 83 | NULL, /**< dependencies */ | |
| 16131 | 84 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 15230 | 85 | "core-plugin_pack-buddynote", /**< id */ |
| 86 | N_("Buddy Notes"), /**< name */ | |
| 87 | VERSION, /**< version */ | |
| 16131 | 88 | N_("Store notes on particular buddies."), /**< summary */ |
| 15230 | 89 | N_("Adds the option to store notes for buddies " |
| 16131 | 90 | "on your buddy list."), /**< description */ |
| 15230 | 91 | "Stu Tomlinson <stu@nosnilmot.com>", /**< author */ |
| 15884 | 92 | PURPLE_WEBSITE, /**< homepage */ |
| 15230 | 93 | plugin_load, /**< load */ |
| 94 | NULL, /**< unload */ | |
| 95 | NULL, /**< destroy */ | |
| 96 | NULL, /**< ui_info */ | |
| 97 | NULL, /**< extra_info */ | |
| 98 | NULL, /**< prefs_info */ | |
| 99 | NULL /**< actions */ | |
| 100 | }; | |
| 101 | ||
| 102 | ||
| 103 | static void | |
| 15884 | 104 | init_plugin(PurplePlugin *plugin) { |
| 15230 | 105 | } |
| 106 | ||
| 15884 | 107 | PURPLE_INIT_PLUGIN(buddynote, init_plugin, info) |