/*This is the first version of nipponsei_voice. As for now it only assumes ^ is already in the channel.
Hopefully I will figure out how to get the list of users in the channel so I can do a check*/
#include "/usr/include/xchat/xchat-plugin.h"
#include "string.h"
#define PNAME "The Nipponsei Voicer!";
#define PDESC "I get free voice in #nipponsei on Rizon";
#define PVERSION "0.1"
static xchat_plugin *ph; /* plugin handle */
static int nipponsei_voice(char *word[], char *word_eol[], void *userdata)
{
void *myhost;
const void *mynick;
/*xchat_list *users;*/
myhost = word[1];
mynick = xchat_get_info(ph, "nick");
if (strcmp(word[3],":#nipponsei") == 0 && strstr(myhost, mynick) != NULL) {
xchat_commandf(ph, "notice ^ [Fserve Active] - Trigger:[/ctcp %s Disabled] - Sends:[0/1] - Queues:[0/10] - Record CPS:[0B/s by None] - Bytes Sent:[0B] - Files Sent:[0] - Accesses:[0] - Upload Speed:[0B/s] - Download Speed:[0B/s] - Current Bandwidth:[0B/s] - X-Chat Reserve 0.10", mynick);
/*
int c;
c = 0;
users = xchat_list_get(ph, "users");
while(xchat_list_next(ph, users))
{
xchat_printf(ph, "%s\n",
xchat_list_str(ph, users, "host"));
c++;
}
xchat_printf(ph, "%d test", c);
xchat_list_free(ph, users);
*/
}
return XCHAT_EAT_NONE; /* Don't eat too much fatty! */
}
int xchat_plugin_init(xchat_plugin *plugin_handle,
char **plugin_name,
char **plugin_desc,
char **plugin_version,
char *arg)
{
ph = plugin_handle;
*plugin_name = PNAME;
*plugin_desc = PDESC;
*plugin_version = PVERSION;
xchat_hook_server(ph, "JOIN", XCHAT_PRI_NORM, nipponsei_voice, NULL);
xchat_print(ph, "#Nipponsei Voice Script Loaded!\n");
return 1; /* Success!*/
}