grim/purple-plugin-pack
--leaks
org.guifications.plugins
2009-04-15, darkrain42
* Adds a command to flip a coin in a conversation and outputs the result * Copyright (C) 2005 Gary Kramlich <grim@reaperworld.com> * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. #include "../common/pp_internal.h" #include <conversation.h> static PurpleCmdId flip_cmd_id = 0; flip_it(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar *error, void *data) msg = g_strdup_printf("Flips a coin: %s", (heads) ? "HEADS" : "TAILS"); if(conv->type == PURPLE_CONV_TYPE_IM) purple_conv_im_send(PURPLE_CONV_IM(conv), msg); else if(conv->type == PURPLE_CONV_TYPE_CHAT) purple_conv_chat_send(PURPLE_CONV_CHAT(conv), msg); return PURPLE_CMD_RET_OK; plugin_load(PurplePlugin *plugin) { flip_cmd_id = purple_cmd_register("flip", "", PURPLE_CMD_P_PLUGIN, PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT, NULL, PURPLE_CMD_FUNC(flip_it), _("Outputs the results of flipping a coin"), plugin_unload(PurplePlugin *plugin) { purple_cmd_unregister(flip_cmd_id); static PurplePluginInfo info = PURPLE_PLUGIN_MAGIC, /**< magic */ PURPLE_MAJOR_VERSION, /**< major version */ PURPLE_MINOR_VERSION, /**< minor version */ PURPLE_PLUGIN_STANDARD, /**< type */ NULL, /**< ui_requirement */ NULL, /**< dependencies */ PURPLE_PRIORITY_DEFAULT, /**< priority */ "core-plugin_pack-flip", /**< id */ PP_VERSION, /**< version */ "Gary Kramlich <grim@reaperworld.com>", /**< author */ PP_WEBSITE, /**< homepage */ plugin_load, /**< load */ plugin_unload, /**< unload */ init_plugin(PurplePlugin *plugin) { bindtextdomain(GETTEXT_PACKAGE, PP_LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); info.name = _("Coin Flip"); info.summary = _("Flips a coin and outputs the result"); info.description = _("Adds a command (/flip) to flip a coin and " "outputs the result in the active conversation"); PURPLE_INIT_PLUGIN(flip, init_plugin, info)