Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- External commands test
- */
- #include "xchat-plugin.h"
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #define PNAME "Command test"
- #define PDESC "8====D~~~~~~"
- #define PVERSION "0.01"
- static xchat_plugin *ph; /* plugin handle */
- // 1 2 3 4 (search for -A and begin from there)
- // NB_ExtCmd replycmd command nick -A arguments
- static int nb_extcmdtest_cb(char *word[], char *word_eol[], void *userdata) {
- if(NULL != word[3] && !strcasecmp(word[3], "extcmdtest") && NULL != word[2] && NULL != word[4]) {
- xchat_commandf(ph, "%s used by %s", word[2], word[4]);
- return XCHAT_EAT_ALL; // command matches so don't let NovaBot complain about it
- }
- return XCHAT_EAT_NONE; // let other plugins see it
- }
- void xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved) {
- *name = PNAME;
- *desc = PDESC;
- *version = PVERSION;
- }
- int xchat_plugin_deinit() {
- return 1;
- }
- int xchat_plugin_init(xchat_plugin *plugin_handle,
- char **plugin_name,
- char **plugin_desc,
- char **plugin_version,
- char *arg) {
- /* we need to save this for use with any xchat_* functions */
- ph = plugin_handle;
- /* tell xchat our info */
- *plugin_name = PNAME; *plugin_desc = PDESC; *plugin_version = PVERSION;
- xchat_hook_command(ph, "NB_ExtCmd", XCHAT_PRI_NORM, nb_extcmdtest_cb, NULL, 0);
- return 1; /* return 1 for success */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement