PurpleCmdId purple_perl_cmd_register(PurplePlugin *plugin, const gchar *command, const gchar *args, PurpleCmdPriority priority, PurpleCmdFlag flag, const gchar *prpl_id, SV *callback, const gchar *helpstr, SV *data) { PurplePerlCmdHandler *handler; handler = g_new0(PurplePerlCmdHandler, 1); handler->plugin = plugin; handler->cmd = g_strdup(command); handler->prpl_id = g_strdup(prpl_id); if (callback != NULL && callback != &PL_sv_undef) handler->callback = newSVsv(callback); else handler->callback = NULL; if (data != NULL && data != &PL_sv_undef) handler->data = newSVsv(data); else handler->data = NULL; cmd_handlers = g_slist_append(cmd_handlers, handler); handler->id = purple_cmd_register(command, args, priority, flag, prpl_id, PURPLE_CMD_FUNC(perl_cmd_cb), helpstr, handler); return handler->id; }
static gboolean plugin_load(PurplePlugin *plugin) { cmd_id = purple_cmd_register("all", "s", PURPLE_CMD_P_PLUGIN, PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT, NULL, PURPLE_CMD_FUNC(send_to_all), "Sends message to all open windows", NULL); return TRUE; }
/** * @brief The implementation function that is called when the plugin is loaded into memory. * @arg plugin The libpurple plugin instance. * @return A boolean value indicating if the plugin has been successfully loaded. */ static gboolean plugin_load (PurplePlugin * plugin) { const char * help = "bitly: replaces the argument URL with one through the bit.ly service"; curl_global_init(CURL_GLOBAL_ALL); bitly_url = g_string_new(""); curl_handle = curl_easy_init(); bitly_cmd_id = purple_cmd_register( "bitly", "wws", PURPLE_CMD_P_PLUGIN, PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, PURPLE_CMD_FUNC (purple_cmd_bitly), help, NULL ); return TRUE; }
/****************************************************************************** * "API" *****************************************************************************/ void irssi_window_init(PurplePlugin *plugin) { const gchar *help; if(irssi_window_cmd_id != 0 || irssi_win_cmd_id != 0) return; /* * XXX: Translators: DO NOT TRANSLATE the first occurance of the word * "window" below, or "close", "next", "previous", "left", or "right" * at the *beginning* of the lines below! The options to /window are * NOT going to be translatable. Also, please don't translate the HTML * tags. */ help = _("<pre>window <option>: Operations for windows (tabs). " "Valid options are:\n" "close - closes the current conversation\n" "next - move to the next conversation\n" "previous - move to the previous conversation\n" "left - move one conversation to the left\n" "right - move one conversation to the right\n" "<number> - go to tab <number>\n" "</pre>"); irssi_window_cmd_id = purple_cmd_register("window", "w", PURPLE_CMD_P_PLUGIN, PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT, NULL, PURPLE_CMD_FUNC(irssi_window_cmd_cb), help, NULL); /* same thing as above, except for the /win command */ help = _("<pre>win: THis command is synonymous with /window. Try /help " "window for further details.</pre>"); irssi_win_cmd_id = purple_cmd_register("win", "w", PURPLE_CMD_P_PLUGIN, PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT, NULL, PURPLE_CMD_FUNC(irssi_window_cmd_cb), help, NULL); }
static gboolean plugin_load(PurplePlugin *plugin) { const gchar *bash_help, *qdb_help; PurpleCmdFlag flags = PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS; bash_help = _("bash [n]: sends a link to a bash.org quote. Specify a" " number for n and it will send a link to the quote with the" " specified number."); qdb_help = _("qdb [n]: sends a link to a qdb.us quote. Specify a number " "for n and it will send a link to the quite with the specified " "number."); bash = purple_cmd_register("bash", "w", PURPLE_CMD_P_PLUGIN, flags, NULL, PURPLE_CMD_FUNC(cmd_func), bash_help, NULL); qdb = purple_cmd_register("qdb", "w", PURPLE_CMD_P_PLUGIN, flags, NULL, PURPLE_CMD_FUNC(cmd_func), qdb_help, NULL); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { // purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin loaded.\n"); void *conv_handle = purple_conversations_get_handle(); purple_signal_connect(conv_handle, "conversation-created", plugin, PURPLE_CALLBACK(nouvelle_convers), NULL); /*purple_signal_connect(conv_handle, "receiving-chat-msg", plugin, PURPLE_CALLBACK(message_recu), NULL);*/ purple_signal_connect(conv_handle, "receiving-im-msg", plugin, PURPLE_CALLBACK(message_recu2), NULL); purple_cmd_register("jeu", "w", PURPLE_CMD_P_PLUGIN, PURPLE_CMD_FLAG_IM|PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, PURPLE_CMD_FUNC(commande), "jeu nom_du_jeu",NULL); return TRUE; }