Full example of plugin, which adds a /double command, which displays two times arguments on current channel (ok that's not very useful, but that's just an example!):
#include <stdlib.h> #include "weechat-plugin.h" char plugin_name[] = "Double"; char plugin_version[] = "0.1"; char plugin_description[] = "Test plugin for WeeChat"; /* "/double" command manager */ int double_cmd (t_weechat_plugin *plugin, char *server, char *command, char *arguments, char *handler_args, void *handler_pointer) { if (arguments && arguments[0] && (arguments[0] != '/')) { plugin->exec_command (plugin, NULL, NULL, arguments); plugin->exec_command (plugin, NULL, NULL, arguments); } return PLUGIN_RC_OK; } int weechat_plugin_init (t_weechat_plugin *plugin) { plugin->cmd_handler_add (plugin, "double", "Display two times a message", "msg", "msg: message to display two times", NULL, &double_cmd, NULL, NULL); return PLUGIN_RC_OK; } void weechat_plugin_end (t_weechat_plugin *plugin) { /* nothing done here */ }