Rebranding for the rest of plugin*

This commit is contained in:
Berke Viktor 2012-10-30 08:42:48 +01:00
parent 97dc13fde7
commit e681eafa78
64 changed files with 1875 additions and 1875 deletions

View File

@ -51,7 +51,7 @@
#define BUFSIZE 32768
#define DEFAULT_LIMIT 256 /* default size is 256 MiB */
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static char name[] = "Checksum";
static char desc[] = "Calculate checksum for DCC file transfers";
static char version[] = "3.1";
@ -129,25 +129,25 @@ set_limit (char* size)
if (buffer > 0 && buffer < INT_MAX)
{
if (xchat_pluginpref_set_int (ph, "limit", buffer))
if (hexchat_pluginpref_set_int (ph, "limit", buffer))
{
xchat_printf (ph, "File size limit has successfully been set to: %d MiB\n", buffer);
hexchat_printf (ph, "File size limit has successfully been set to: %d MiB\n", buffer);
}
else
{
xchat_printf (ph, "File access error while saving!\n");
hexchat_printf (ph, "File access error while saving!\n");
}
}
else
{
xchat_printf (ph, "Invalid input!\n");
hexchat_printf (ph, "Invalid input!\n");
}
}
static int
get_limit ()
{
int size = xchat_pluginpref_get_int (ph, "limit");
int size = hexchat_pluginpref_get_int (ph, "limit");
if (size <= -1 || size >= INT_MAX)
{
@ -162,7 +162,7 @@ get_limit ()
static void
print_limit ()
{
xchat_printf (ph, "File size limit for checksums: %d MiB", get_limit ());
hexchat_printf (ph, "File size limit for checksums: %d MiB", get_limit ());
}
static int
@ -179,18 +179,18 @@ dccrecv_cb (char *word[], void *userdata)
{
sha256_file (word[2], sum); /* word[2] is the full filename */
/* try to print the checksum in the privmsg tab of the sender */
xchat_set_context (ph, xchat_find_context (ph, NULL, word[3]));
xchat_printf (ph, "SHA-256 checksum for %s (local): %s\n", word[1], sum);
hexchat_set_context (ph, hexchat_find_context (ph, NULL, word[3]));
hexchat_printf (ph, "SHA-256 checksum for %s (local): %s\n", word[1], sum);
}
else
{
xchat_set_context (ph, xchat_find_context (ph, NULL, word[3]));
xchat_printf (ph, "SHA-256 checksum for %s (local): (size limit reached, no checksum calculated, you can increase it with /CHECKSUM INC)\n", word[1]);
hexchat_set_context (ph, hexchat_find_context (ph, NULL, word[3]));
hexchat_printf (ph, "SHA-256 checksum for %s (local): (size limit reached, no checksum calculated, you can increase it with /CHECKSUM INC)\n", word[1]);
}
}
else
{
xchat_printf (ph, "File access error!\n");
hexchat_printf (ph, "File access error!\n");
}
return HEXCHAT_EAT_NONE;
@ -209,17 +209,17 @@ dccoffer_cb (char *word[], void *userdata)
if (buffer.st_size <= (unsigned long long) get_limit () * 1048576)
{
sha256_file (word[3], sum); /* word[3] is the full filename */
xchat_commandf (ph, "quote PRIVMSG %s :SHA-256 checksum for %s (remote): %s", word[2], word[1], sum);
hexchat_commandf (ph, "quote PRIVMSG %s :SHA-256 checksum for %s (remote): %s", word[2], word[1], sum);
}
else
{
xchat_set_context (ph, xchat_find_context (ph, NULL, word[3]));
xchat_printf (ph, "quote PRIVMSG %s :SHA-256 checksum for %s (remote): (size limit reached, no checksum calculated)", word[2], word[1]);
hexchat_set_context (ph, hexchat_find_context (ph, NULL, word[3]));
hexchat_printf (ph, "quote PRIVMSG %s :SHA-256 checksum for %s (remote): (size limit reached, no checksum calculated)", word[2], word[1]);
}
}
else
{
xchat_printf (ph, "File access error!\n");
hexchat_printf (ph, "File access error!\n");
}
return HEXCHAT_EAT_NONE;
@ -238,16 +238,16 @@ checksum (char *word[], char *word_eol[], void *userdata)
}
else
{
xchat_printf (ph, "Usage: /CHECKSUM GET|INC|DEC\n");
xchat_printf (ph, " GET - print the maximum file size (in MiB) to be hashed\n");
xchat_printf (ph, " SET <filesize> - set the maximum file size (in MiB) to be hashed\n");
hexchat_printf (ph, "Usage: /CHECKSUM GET|INC|DEC\n");
hexchat_printf (ph, " GET - print the maximum file size (in MiB) to be hashed\n");
hexchat_printf (ph, " SET <filesize> - set the maximum file size (in MiB) to be hashed\n");
}
return HEXCHAT_EAT_NONE;
}
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
@ -256,22 +256,22 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
*plugin_version = version;
/* this is required for the very first run */
if (xchat_pluginpref_get_int (ph, "limit") == -1)
if (hexchat_pluginpref_get_int (ph, "limit") == -1)
{
xchat_pluginpref_set_int (ph, "limit", DEFAULT_LIMIT);
hexchat_pluginpref_set_int (ph, "limit", DEFAULT_LIMIT);
}
xchat_hook_command (ph, "CHECKSUM", HEXCHAT_PRI_NORM, checksum, "Usage: /CHECKSUM GET|SET", 0);
xchat_hook_print (ph, "DCC RECV Complete", HEXCHAT_PRI_NORM, dccrecv_cb, NULL);
xchat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_NORM, dccoffer_cb, NULL);
hexchat_hook_command (ph, "CHECKSUM", HEXCHAT_PRI_NORM, checksum, "Usage: /CHECKSUM GET|SET", 0);
hexchat_hook_print (ph, "DCC RECV Complete", HEXCHAT_PRI_NORM, dccrecv_cb, NULL);
hexchat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_NORM, dccoffer_cb, NULL);
xchat_printf (ph, "%s plugin loaded\n", name);
hexchat_printf (ph, "%s plugin loaded\n", name);
return 1;
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_printf (ph, "%s plugin unloaded\n", name);
hexchat_printf (ph, "%s plugin unloaded\n", name);
return 1;
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -53,7 +53,7 @@
#define PIPE_WRITE 1
#define MAX_HOSTNAME 128
static xchat_plugin *ph;
static hexchat_plugin *ph;
static thread *active_thread = NULL;
@ -210,19 +210,19 @@ dns_read_cb (int fd, int flags, thread *th, void *source)
case '0': /* got data to show */
waitline (source, buf2, sizeof (buf2));
if (buf2[0] == 0)
xchat_printf(ph, HEAD"\002Numerical\002: %s\n", buf + 1);
hexchat_printf(ph, HEAD"\002Numerical\002: %s\n", buf + 1);
else
xchat_printf(ph, HEAD"\002Canonical\002: %s \002Numerical\002: %s\n", buf2, buf + 1);
hexchat_printf(ph, HEAD"\002Canonical\002: %s \002Numerical\002: %s\n", buf2, buf + 1);
return 1;
case '1': /* failed */
xchat_printf(ph, HEAD"Lookup failed. %s\n", gai_strerrorA (atoi (buf + 1)));
hexchat_printf(ph, HEAD"Lookup failed. %s\n", gai_strerrorA (atoi (buf + 1)));
case '2': /* done */
// close (th->pipe_fd[PIPE_WRITE]);
// close (th->pipe_fd[PIPE_READ]);
xchat_hook_timer(ph, 3000, dns_close_pipe, (void *)th->pipe_fd[PIPE_WRITE]);
xchat_hook_timer(ph, 4000, dns_close_pipe, (void *)th->pipe_fd[PIPE_READ]);
hexchat_hook_timer(ph, 3000, dns_close_pipe, (void *)th->pipe_fd[PIPE_WRITE]);
hexchat_hook_timer(ph, 4000, dns_close_pipe, (void *)th->pipe_fd[PIPE_READ]);
free (th->userdata); /* hostname strdup'ed */
free (th);
return 0;
@ -237,19 +237,19 @@ dns_read_cb (int fd, int flags, thread *th, void *source)
static char *
find_nick_host (char *nick)
{
xchat_list *list;
hexchat_list *list;
char *at;
const char *host;
list = xchat_list_get (ph, "users");
list = hexchat_list_get (ph, "users");
if (!list)
return NULL;
while (xchat_list_next (ph, list))
while (hexchat_list_next (ph, list))
{
if (stricmp (nick, xchat_list_str (ph, list, "nick")) == 0)
if (stricmp (nick, hexchat_list_str (ph, list, "nick")) == 0)
{
host = xchat_list_str (ph, list, "host");
host = hexchat_list_str (ph, list, "host");
if (host)
{
at = strrchr (host, '@');
@ -271,7 +271,7 @@ dns_cmd_cb (char *word[], char *word_eol[], void *ud)
if (!word[2][0])
{
xchat_print (ph, HELP);
hexchat_print (ph, HELP);
return HEXCHAT_EAT_ALL;
}
@ -281,17 +281,17 @@ dns_cmd_cb (char *word[], char *word_eol[], void *ud)
nickhost = find_nick_host (word[2]);
if (nickhost)
{
xchat_printf (ph, HEAD"Looking up %s (%s)...\n", nickhost, word[2]);
hexchat_printf (ph, HEAD"Looking up %s (%s)...\n", nickhost, word[2]);
th->userdata = strdup (nickhost);
} else
{
xchat_printf (ph, HEAD"Looking up %s...\n", word[2]);
hexchat_printf (ph, HEAD"Looking up %s...\n", word[2]);
th->userdata = strdup (word[2]);
}
if (thread_start (th, thread_function, th))
{
xchat_hook_fd(ph, th->pipe_fd[PIPE_READ],
hexchat_hook_fd(ph, th->pipe_fd[PIPE_READ],
HEXCHAT_FD_READ | HEXCHAT_FD_EXCEPTION | HEXCHAT_FD_NOTSOCKET,
(void *)dns_read_cb, th);
@ -302,19 +302,19 @@ dns_cmd_cb (char *word[], char *word_eol[], void *ud)
}
int
xchat_plugin_deinit (xchat_plugin *plugin_handle)
hexchat_plugin_deinit (hexchat_plugin *plugin_handle)
{
while (active_thread) /* children will set this var to NULL soon... */
{
Sleep (1000);
}
xchat_printf (ph, "DNS plugin unloaded\n");
hexchat_printf (ph, "DNS plugin unloaded\n");
return 1;
}
int
xchat_plugin_init
(xchat_plugin *plugin_handle, char **plugin_name,
hexchat_plugin_init
(hexchat_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 */
@ -324,8 +324,8 @@ xchat_plugin_init
*plugin_desc = "Threaded IPv4/6 DNS Command";
*plugin_version = DNS_VERSION;
xchat_hook_command(ph, "DNS", HEXCHAT_PRI_LOW, dns_cmd_cb, HELP, 0);
xchat_printf (ph, "DNS plugin loaded\n");
hexchat_hook_command(ph, "DNS", HEXCHAT_PRI_LOW, dns_cmd_cb, HELP, 0);
hexchat_printf (ph, "DNS plugin loaded\n");
return 1; /* return 1 for success */
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -10,7 +10,7 @@
#include <stdio.h>
#include "hexchat-plugin.h"
static xchat_plugin *ph;
static hexchat_plugin *ph;
static int
parse_command( char *word[], char *word_eol[], void *userdata ) {
@ -19,7 +19,7 @@ parse_command( char *word[], char *word_eol[], void *userdata ) {
char *str1 = NULL;
char *delimiter = NULL;
xchat_context *ctx = NULL;
hexchat_context *ctx = NULL;
if( word[2] != NULL && word[3] != NULL ) {
for( str1 = word[2]; ; str1 = NULL ) {
@ -52,9 +52,9 @@ parse_command( char *word[], char *word_eol[], void *userdata ) {
/* printf( "channel[%s] server[%s]\n", channel, server );*/
if( (ctx = xchat_find_context( ph, server, channel ) ) != NULL ) {
if( xchat_set_context( ph, ctx ) ) {
xchat_command( ph, word_eol[3] );
if( (ctx = hexchat_find_context( ph, server, channel ) ) != NULL ) {
if( hexchat_set_context( ph, ctx ) ) {
hexchat_command( ph, word_eol[3] );
}
}
@ -71,7 +71,7 @@ parse_command( char *word[], char *word_eol[], void *userdata ) {
}
int
xchat_plugin_init( xchat_plugin * plugin_handle, char **plugin_name,
hexchat_plugin_init( hexchat_plugin * plugin_handle, char **plugin_name,
char **plugin_desc, char **plugin_version, char *arg ) {
ph = plugin_handle;
@ -79,16 +79,16 @@ xchat_plugin_init( xchat_plugin * plugin_handle, char **plugin_name,
*plugin_version = "1.0001";
*plugin_desc = "Perform an arbitrary command on multiple channels";
xchat_hook_command( ph, "doat", HEXCHAT_PRI_NORM, parse_command, "DOAT [channel,list,/network] [command], perform a command on multiple contexts", NULL );
hexchat_hook_command( ph, "doat", HEXCHAT_PRI_NORM, parse_command, "DOAT [channel,list,/network] [command], perform a command on multiple contexts", NULL );
xchat_print (ph, "Do At plugin loaded\n");
hexchat_print (ph, "Do At plugin loaded\n");
return 1;
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_print (ph, "Do At plugin unloaded\n");
hexchat_print (ph, "Do At plugin unloaded\n");
return 1;
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <windows.h>
#include "hexchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static int enable = 1;
// For example, circularstrstr("winamp", "pwi", 3) would return 5 (the index of p)
@ -98,25 +98,25 @@ static int wcmd_cb(char *word[], char *word_eol[], void *userdata)
HWND hwndWinamp = NULL;
if ((hwndWinamp = FindWindow("Winamp v1.x",NULL)) == NULL) {
xchat_print(ph, "Winamp's window not found - Is winamp really running?\n");
hexchat_print(ph, "Winamp's window not found - Is winamp really running?\n");
}
else {
if (strcmp(word[1], "") == 0)
xchat_print(ph, "Usage: wcmd [command]\n");
hexchat_print(ph, "Usage: wcmd [command]\n");
else if (strcmp(word[2], "next") == 0) {
xchat_print(ph, "Loading next song...\n");
hexchat_print(ph, "Loading next song...\n");
SendMessage (hwndWinamp, WM_COMMAND, 40048, 0);
}
else if (strcmp(word[2], "prev") == 0) {
xchat_print(ph, "Loading previous song...\n");
hexchat_print(ph, "Loading previous song...\n");
SendMessage (hwndWinamp, WM_COMMAND, 40044, 0);
}
else if (strcmp(word[2], "play") == 0) {
xchat_print(ph, "Playin'...\n");
hexchat_print(ph, "Playin'...\n");
SendMessage (hwndWinamp, WM_COMMAND, 40045, 0);
}
else if (strcmp(word[2], "stop") == 0) {
xchat_print(ph, "Winamp stopped!...\n");
hexchat_print(ph, "Winamp stopped!...\n");
SendMessage (hwndWinamp, WM_COMMAND, 40047, 0);
}
else if (strcmp(word[2], "pause") == 0) {
@ -138,28 +138,28 @@ static int wp_cb(char *word[], char *word_eol[], void *userdata)
char this_title[1024];
if ((hwndWinamp = FindWindow("Winamp v1.x",NULL)) == NULL)
xchat_print(ph, "Winamp's window not found - Is winamp really running?\n");
hexchat_print(ph, "Winamp's window not found - Is winamp really running?\n");
else {
//Winamp's running
// Seems buggy when winamp2's agent is running, and winamp not (or winamp3) -> crashes xchat.
SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)125);
if ((samplerate = SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)126)) == 0) {
xchat_print(ph, "Could not get current song's samplerate... !?\n");
hexchat_print(ph, "Could not get current song's samplerate... !?\n");
return HEXCHAT_EAT_ALL;
}
if ((bitrate = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)126)) == 0) {
xchat_print(ph, "Could not get current song's bitrate... !?\n");
hexchat_print(ph, "Could not get current song's bitrate... !?\n");
return HEXCHAT_EAT_ALL;
}
if ((nbchannels = SendMessage(hwndWinamp, WM_USER, (WPARAM)2, (LPARAM)126)) == 0) {
xchat_print(ph, "Could not get the number of channels... !?\n");
hexchat_print(ph, "Could not get the number of channels... !?\n");
return HEXCHAT_EAT_ALL;
}
if ((length = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)105)) == 0) {
// Could be buggy when streaming audio or video, returned length is unexpected;
// How to detect is Winamp is streaming, and display ??:?? in that case?
xchat_print(ph, "Could not get current song's length... !?\n");
hexchat_print(ph, "Could not get current song's length... !?\n");
return HEXCHAT_EAT_ALL;
}
else {
@ -172,7 +172,7 @@ static int wp_cb(char *word[], char *word_eol[], void *userdata)
wsprintf(totaltime, "%d:0%d", minutes, seconds);
}
if ((elapsed = SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)105)) == 0) {
xchat_print(ph, "Could not get current song's elapsed time... !?\n");
hexchat_print(ph, "Could not get current song's elapsed time... !?\n");
return HEXCHAT_EAT_ALL;
}
else {
@ -186,13 +186,13 @@ static int wp_cb(char *word[], char *word_eol[], void *userdata)
}
if ((bitrate = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)126)) == 0) {
xchat_print(ph, "Could not get current song's bitrate... !?\n");
hexchat_print(ph, "Could not get current song's bitrate... !?\n");
return HEXCHAT_EAT_ALL;
}
GetCurrentSongsName(hwndWinamp, this_title, 1024);
xchat_commandf(ph, "dispcurrsong %d %d %d %s %s %s", samplerate, bitrate, nbchannels, elapsedtime, totaltime, this_title);
hexchat_commandf(ph, "dispcurrsong %d %d %d %s %s %s", samplerate, bitrate, nbchannels, elapsedtime, totaltime, this_title);
}
return HEXCHAT_EAT_ALL; /* eat this command so xchat and other plugins can't process it */
@ -200,7 +200,7 @@ static int wp_cb(char *word[], char *word_eol[], void *userdata)
int xchat_plugin_init(xchat_plugin *plugin_handle,
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
char **plugin_name,
char **plugin_desc,
char **plugin_version,
@ -213,19 +213,19 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
*plugin_desc = "Some commands to remotely control winamp";
*plugin_version = "1.2";
xchat_hook_command(ph, "wp", HEXCHAT_PRI_NORM, wp_cb,
hexchat_hook_command(ph, "wp", HEXCHAT_PRI_NORM, wp_cb,
"Usage: wp", 0);
xchat_hook_command(ph, "wcmd", HEXCHAT_PRI_NORM, wcmd_cb,
hexchat_hook_command(ph, "wcmd", HEXCHAT_PRI_NORM, wcmd_cb,
"Usage: wcmd [play|pause|stop|prev|next]", 0);
xchat_print(ph, "EasyWinampControl plugin loaded\n");
hexchat_print(ph, "EasyWinampControl plugin loaded\n");
return 1; /* return 1 for success */
}
int xchat_plugin_deinit(void)
int hexchat_plugin_deinit(void)
{
xchat_print(ph, "EasyWinampControl plugin unloaded\n");
hexchat_print(ph, "EasyWinampControl plugin unloaded\n");
return 1;
}

View File

@ -5,8 +5,8 @@ all: ewc.obj ewc.def
ewc.def:
echo EXPORTS > ewc.def
echo xchat_plugin_init >> ewc.def
echo xchat_plugin_deinit >> ewc.def
echo hexchat_plugin_init >> ewc.def
echo hexchat_plugin_deinit >> ewc.def
ewc.obj: ewc.c makefile.mak
cl $(CFLAGS) ewc.c

View File

@ -25,7 +25,7 @@
#include "hexchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static char name[] = "Exec";
static char desc[] = "Execute commands inside HexChat";
static char version[] = "1.1";
@ -58,7 +58,7 @@ run_command (char *word[], char *word_eol[], void *userdata)
if (!stricmp("-O", word[2]))
{
/*strcat (commandLine, word_eol[3]);*/
xchat_printf (ph, "Printing Exec output to others is not supported yet.\n");
hexchat_printf (ph, "Printing Exec output to others is not supported yet.\n");
return HEXCHAT_EAT_XCHAT;
}
else
@ -88,7 +88,7 @@ run_command (char *word[], char *word_eol[], void *userdata)
{
/* avoid garbage */
buffer[dwRead] = '\0';
xchat_printf (ph, "%s", buffer);
hexchat_printf (ph, "%s", buffer);
}
}
else
@ -101,11 +101,11 @@ run_command (char *word[], char *word_eol[], void *userdata)
}
/* display a newline to separate things */
xchat_printf (ph, "\n");
hexchat_printf (ph, "\n");
if (timeElapsed >= 10)
{
xchat_printf (ph, "Command took too much time to run, execution aborted.\n");
hexchat_printf (ph, "Command took too much time to run, execution aborted.\n");
}
CloseHandle (readPipe);
@ -116,7 +116,7 @@ run_command (char *word[], char *word_eol[], void *userdata)
}
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
@ -124,15 +124,15 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
*plugin_desc = desc;
*plugin_version = version;
xchat_hook_command (ph, "EXEC", HEXCHAT_PRI_NORM, run_command, "Usage: /EXEC [-O] - execute commands inside XChat", 0);
xchat_printf (ph, "%s plugin loaded\n", name);
hexchat_hook_command (ph, "EXEC", HEXCHAT_PRI_NORM, run_command, "Usage: /EXEC [-O] - execute commands inside XChat", 0);
hexchat_printf (ph, "%s plugin loaded\n", name);
return 1; /* return 1 for success */
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_printf (ph, "%s plugin unloaded\n", name);
hexchat_printf (ph, "%s plugin unloaded\n", name);
return 1;
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -1,4 +1,4 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
xchat_plugin_get_info
hexchat_plugin_init
hexchat_plugin_deinit
hexchat_plugin_get_info

View File

@ -45,14 +45,14 @@ static const char plugin_version[] = "0.0.16";
static const char usage_setkey[] = "Usage: SETKEY [<nick or #channel>] <password>, sets the key for a channel or nick";
static const char usage_delkey[] = "Usage: DELKEY <nick or #channel>, deletes the key for a channel or nick";
static xchat_plugin *ph;
static hexchat_plugin *ph;
/**
* Returns the path to the key store file.
*/
gchar *get_config_filename() {
return g_build_filename(xchat_get_info(ph, "xchatdirfs"), "addon_fishlim.conf", NULL);
return g_build_filename(hexchat_get_info(ph, "xchatdirfs"), "addon_fishlim.conf", NULL);
}
/**
@ -74,11 +74,11 @@ static bool append(char **s, size_t *length, const char *data) {
/*static int handle_debug(char *word[], char *word_eol[], void *userdata) {
xchat_printf(ph, "debug incoming: ");
hexchat_printf(ph, "debug incoming: ");
for (size_t i = 1; word[i] != NULL && word[i][0] != '\0'; i++) {
xchat_printf(ph, ">%s< ", word[i]);
hexchat_printf(ph, ">%s< ", word[i]);
}
xchat_printf(ph, "\n");
hexchat_printf(ph, "\n");
return HEXCHAT_EAT_NONE;
}*/
@ -88,16 +88,16 @@ static bool append(char **s, size_t *length, const char *data) {
static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
const char *own_nick;
// Encrypt the message if possible
const char *channel = xchat_get_info(ph, "channel");
const char *channel = hexchat_get_info(ph, "channel");
char *encrypted = fish_encrypt_for_nick(channel, word_eol[1]);
if (!encrypted) return HEXCHAT_EAT_NONE;
// Display message
own_nick = xchat_get_info(ph, "nick");
xchat_emit_print(ph, "Your Message", own_nick, word_eol[1], NULL);
own_nick = hexchat_get_info(ph, "nick");
hexchat_emit_print(ph, "Your Message", own_nick, word_eol[1], NULL);
// Send message
xchat_commandf(ph, "PRIVMSG %s :+OK %s", channel, encrypted);
hexchat_commandf(ph, "PRIVMSG %s :+OK %s", channel, encrypted);
free(encrypted);
return HEXCHAT_EAT_XCHAT;
@ -173,8 +173,8 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) {
free(decrypted);
// Simulate unencrypted message
//xchat_printf(ph, "simulating: %s\n", message);
xchat_command(ph, message);
//hexchat_printf(ph, "simulating: %s\n", message);
hexchat_command(ph, message);
free(message);
free(sender_nick);
@ -195,13 +195,13 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
// Check syntax
if (*word[2] == '\0') {
xchat_printf(ph, "%s\n", usage_setkey);
hexchat_printf(ph, "%s\n", usage_setkey);
return HEXCHAT_EAT_XCHAT;
}
if (*word[3] == '\0') {
// /setkey password
nick = xchat_get_info(ph, "channel");
nick = hexchat_get_info(ph, "channel");
key = word_eol[2];
} else {
// /setkey #channel password
@ -211,9 +211,9 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
// Set password
if (keystore_store_key(nick, key)) {
xchat_printf(ph, "Stored key for %s\n", nick);
hexchat_printf(ph, "Stored key for %s\n", nick);
} else {
xchat_printf(ph, "\00305Failed to store key in blow.ini\n", nick, key);
hexchat_printf(ph, "\00305Failed to store key in blow.ini\n", nick, key);
}
return HEXCHAT_EAT_XCHAT;
@ -227,7 +227,7 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
// Check syntax
if (*word[2] == '\0' || *word[3] != '\0') {
xchat_printf(ph, "%s\n", usage_delkey);
hexchat_printf(ph, "%s\n", usage_delkey);
return HEXCHAT_EAT_XCHAT;
}
@ -235,9 +235,9 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
// Delete the given nick from the key store
if (keystore_delete_nick(nick)) {
xchat_printf(ph, "Deleted key for %s\n", nick);
hexchat_printf(ph, "Deleted key for %s\n", nick);
} else {
xchat_printf(ph, "\00305Failed to delete key in blow.ini!\n", nick);
hexchat_printf(ph, "\00305Failed to delete key in blow.ini!\n", nick);
}
return HEXCHAT_EAT_XCHAT;
@ -246,7 +246,7 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
/**
* Returns the plugin name version information.
*/
void xchat_plugin_get_info(const char **name, const char **desc,
void hexchat_plugin_get_info(const char **name, const char **desc,
const char **version, void **reserved) {
*name = plugin_name;
*desc = plugin_desc;
@ -256,7 +256,7 @@ void xchat_plugin_get_info(const char **name, const char **desc,
/**
* Plugin entry point.
*/
int xchat_plugin_init(xchat_plugin *plugin_handle,
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
const char **name,
const char **desc,
const char **version,
@ -269,24 +269,24 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
*version = plugin_version;
/* Register commands */
xchat_hook_command(ph, "SETKEY", HEXCHAT_PRI_NORM, handle_setkey, usage_setkey, NULL);
xchat_hook_command(ph, "DELKEY", HEXCHAT_PRI_NORM, handle_delkey, usage_delkey, NULL);
hexchat_hook_command(ph, "SETKEY", HEXCHAT_PRI_NORM, handle_setkey, usage_setkey, NULL);
hexchat_hook_command(ph, "DELKEY", HEXCHAT_PRI_NORM, handle_delkey, usage_delkey, NULL);
/* Add handlers */
xchat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL);
xchat_hook_server(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL);
xchat_hook_server(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL);
//xchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL);
xchat_hook_server(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL);
xchat_hook_server(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL);
hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL);
hexchat_hook_server(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL);
hexchat_hook_server(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL);
//hexchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL);
hexchat_hook_server(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL);
hexchat_hook_server(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL);
xchat_printf(ph, "%s plugin loaded\n", plugin_name);
hexchat_printf(ph, "%s plugin loaded\n", plugin_name);
/* Return success */
return 1;
}
int xchat_plugin_deinit(void) {
xchat_printf(ph, "%s plugin unloaded\n", plugin_name);
int hexchat_plugin_deinit(void) {
hexchat_printf(ph, "%s plugin unloaded\n", plugin_name);
return 1;
}

View File

@ -24,7 +24,7 @@
#include "hexchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static void
launch_tool ()
@ -38,7 +38,7 @@ launch_tool ()
if (!CreateProcess ( NULL, "gtk2-prefs.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
xchat_print (ph, "Error launching the GTK+ Preference Tool! Maybe the executable is missing?");
hexchat_print (ph, "Error launching the GTK+ Preference Tool! Maybe the executable is missing?");
}
CloseHandle (pi.hProcess);
@ -46,7 +46,7 @@ launch_tool ()
}
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
@ -54,16 +54,16 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
*plugin_desc = "GTK+ Preference Tool Launcher";
*plugin_version = "1.0";
xchat_hook_command (ph, "GTKPREF", HEXCHAT_PRI_NORM, launch_tool, 0, 0);
xchat_command (ph, "MENU -ietc\\gtkpref.png ADD \"Settings/GTK+ Preferences\" \"GTKPREF\"");
hexchat_hook_command (ph, "GTKPREF", HEXCHAT_PRI_NORM, launch_tool, 0, 0);
hexchat_command (ph, "MENU -ietc\\gtkpref.png ADD \"Settings/GTK+ Preferences\" \"GTKPREF\"");
return 1; /* return 1 for success */
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_command (ph, "MENU DEL \"Settings/GTK+ Preferences\"");
hexchat_command (ph, "MENU DEL \"Settings/GTK+ Preferences\"");
return 1;
}

View File

@ -5,8 +5,8 @@ all: gtkpref.obj gtkpref.def
gtkpref.def:
echo EXPORTS > gtkpref.def
echo xchat_plugin_init >> gtkpref.def
echo xchat_plugin_deinit >> gtkpref.def
echo hexchat_plugin_init >> gtkpref.def
echo hexchat_plugin_deinit >> gtkpref.def
gtkpref.obj: gtkpref.c makefile.mak
cl $(CFLAGS) $(GLIB) /I.. gtkpref.c

View File

@ -90,12 +90,12 @@ int event_cb(char *word[], void *userdata)
{
case CHAN_HILIGHT:
_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
_snprintf(szName, 64, "Highlight: %s", xchat_get_info (ph, "channel"));
_snprintf(szName, 64, "Highlight: %s", hexchat_get_info (ph, "channel"));
dwInfoFlags = NIIF_INFO;
break;
case CHAN_MESSAGE:
_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
_snprintf(szName, 64, "Channel Message: %s", xchat_get_info (ph, "channel"));
_snprintf(szName, 64, "Channel Message: %s", hexchat_get_info (ph, "channel"));
dwInfoFlags = NIIF_INFO;
break;
case CHAN_TOPIC_CHANGE:
@ -154,7 +154,7 @@ int event_cb(char *word[], void *userdata)
/***** Use windows instead of balloons, and if its a window should we keep it open ****/
/***** indefinitely? ****/
/**************************************************************************************/
szTemp = xchat_strip_color(szInfo);
szTemp = hexchat_strip_color(szInfo);
if(g_dwPrefs & (1<<PREF_UWIOB))
{
@ -186,7 +186,7 @@ int command_cb(char *word[], char *word_eol[], void *userdata)
int iTime = g_iTime*1000;
_snprintf(szInfo, 512, word_eol[2]);
szTemp = xchat_strip_color(szInfo);
szTemp = hexchat_strip_color(szInfo);
if(g_dwPrefs & (1<<PREF_KAOI))
{
@ -223,7 +223,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
/*******************************************/
if(g_dwPrefs & (1<<PREF_AOM))
{
xchat_globally_away(g_szAway);
hexchat_globally_away(g_szAway);
}
/**************************************************/
@ -266,7 +266,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
/*******************************************/
if(g_dwPrefs & (1<<PREF_AOM))
{
xchat_globally_away(g_szAway);
hexchat_globally_away(g_szAway);
}
/**************************************************/
@ -299,7 +299,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
if(g_dwPrefs & (1<<PREF_AOM))
{
xchat_globally_back();
hexchat_globally_back();
}
}
else
@ -344,7 +344,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
if(msg == RegisterWindowMessage(_T("TaskbarCreated")))
{
char szVersion[64];
_snprintf(szVersion, 64, "HexChat [%s]", xchat_get_info(ph, "version"));
_snprintf(szVersion, 64, "HexChat [%s]", hexchat_get_info(ph, "version"));
AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG);
}
}
@ -378,7 +378,7 @@ LRESULT CALLBACK sdTrayProc(HWND hWnd, int msg)
if((!g_iIsActive) && (g_dwPrefs & (1<<PREF_AOM)))
{
xchat_globally_back();
hexchat_globally_back();
g_iIsActive = 1;
}
}
@ -390,27 +390,27 @@ LRESULT CALLBACK sdTrayProc(HWND hWnd, int msg)
break;
case ACT_AWAY:
{
xchat_globally_away(g_szAway);
hexchat_globally_away(g_szAway);
}
break;
case ACT_BACK:
{
xchat_globally_back();
hexchat_globally_back();
}
break;
default:
{
if(msg > 0)
{
xchat_set_context(ph, xchat_find_server(msg-1));
hexchat_set_context(ph, hexchat_find_server(msg-1));
if(!xchat_get_info(ph, "away"))
if(!hexchat_get_info(ph, "away"))
{
xchat_away(g_szAway);
hexchat_away(g_szAway);
}
else
{
xchat_back();
hexchat_back();
}
}
}

View File

@ -29,7 +29,7 @@
#include "utility.h"
// from util.c of xchat source code ( slightly modified to fit X-Tray Syntax )
char *xchat_strip_color (char *text)
char *hexchat_strip_color (char *text)
{
int nc = 0;
int i = 0;
@ -155,7 +155,7 @@ void check_special_chars (char *cmd)
}
}
void xchat_globally_away(TCHAR *tszAway)
void hexchat_globally_away(TCHAR *tszAway)
{
char szTemp[512];
char szAway[512];
@ -163,10 +163,10 @@ void xchat_globally_away(TCHAR *tszAway)
ConvertString(tszAway, szAway, 512);
_snprintf(szTemp, 512, "ALLSERV AWAY %s\0", szAway);
check_special_chars(szTemp);
xchat_exec(szTemp);
hexchat_exec(szTemp);
}
void xchat_away(TCHAR *tszAway)
void hexchat_away(TCHAR *tszAway)
{
char szTemp[512];
char szAway[512];
@ -174,42 +174,42 @@ void xchat_away(TCHAR *tszAway)
ConvertString(tszAway, szAway, 512);
_snprintf(szTemp, 512, szAway);
check_special_chars(szTemp);
xchat_commandf(ph, "AWAY %s\0", szTemp);
hexchat_commandf(ph, "AWAY %s\0", szTemp);
}
void xchat_globally_back()
void hexchat_globally_back()
{
std::vector<int> xs;
std::vector<int>::iterator xsi;
xchat_list *xl = xchat_list_get(ph, "channels");
hexchat_list *xl = hexchat_list_get(ph, "channels");
if(xl)
{
while(xchat_list_next(ph, xl))
while(hexchat_list_next(ph, xl))
{
xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id"));
xsi = std::find(xs.begin(), xs.end(), hexchat_list_int(ph, xl, "id"));
if((xsi == xs.end()) &&
((strlen(xchat_list_str(ph, xl, "server")) > 0) ||
(strlen(xchat_list_str(ph, xl, "channel")) > 0)))
((strlen(hexchat_list_str(ph, xl, "server")) > 0) ||
(strlen(hexchat_list_str(ph, xl, "channel")) > 0)))
{
xs.push_back(xchat_list_int(ph, xl, "id"));
xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context"));
xchat_back();
xs.push_back(hexchat_list_int(ph, xl, "id"));
hexchat_set_context(ph, (hexchat_context *)hexchat_list_str(ph, xl, "context"));
hexchat_back();
}
}
xchat_list_free(ph, xl);
hexchat_list_free(ph, xl);
}
}
void xchat_back()
void hexchat_back()
{
if(xchat_get_info(ph, "away"))
if(hexchat_get_info(ph, "away"))
{
xchat_command(ph, "BACK");
hexchat_command(ph, "BACK");
}
}
@ -222,7 +222,7 @@ HMENU setServerMenu()
std::vector<int> xs;
std::vector<int>::iterator xsi;
xchat_list *xl = xchat_list_get(ph, "channels");
hexchat_list *xl = hexchat_list_get(ph, "channels");
AppendMenu(sTemp, MF_STRING, ACT_AWAY, _T("Set Globally Away"));
AppendMenu(sTemp, MF_STRING, ACT_BACK, _T("Set Globally Back"));
@ -230,20 +230,20 @@ HMENU setServerMenu()
if(xl)
{
while(xchat_list_next(ph, xl))
while(hexchat_list_next(ph, xl))
{
xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id"));
xsi = std::find(xs.begin(), xs.end(), hexchat_list_int(ph, xl, "id"));
if( (xsi == xs.end()) &&
((strlen(xchat_list_str(ph, xl, "server")) > 0) ||
(strlen(xchat_list_str(ph, xl, "channel")) > 0)))
((strlen(hexchat_list_str(ph, xl, "server")) > 0) ||
(strlen(hexchat_list_str(ph, xl, "channel")) > 0)))
{
xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context"));
xs.push_back(xchat_list_int(ph, xl, "id"));
hexchat_set_context(ph, (hexchat_context *)hexchat_list_str(ph, xl, "context"));
xs.push_back(hexchat_list_int(ph, xl, "id"));
char *network = _strdup(xchat_list_str(ph, xl, "network"));
char *server = _strdup(xchat_list_str(ph, xl, "server"));
char *nick = _strdup(xchat_get_info(ph, "nick"));
char *network = _strdup(hexchat_list_str(ph, xl, "network"));
char *server = _strdup(hexchat_list_str(ph, xl, "server"));
char *nick = _strdup(hexchat_get_info(ph, "nick"));
if(network != NULL)
{
@ -259,13 +259,13 @@ HMENU setServerMenu()
ConvertString(nick, wszNick, 128);
_sntprintf(wszMenuEntry, 256, _T("%s @ %s\0"), wszNick, wszServer);
if(!xchat_get_info(ph, "away"))
if(!hexchat_get_info(ph, "away"))
{
AppendMenu(sTemp, MF_STRING, (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
AppendMenu(sTemp, MF_STRING, (hexchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
}
else
{
AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (hexchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
}
}
@ -275,24 +275,24 @@ HMENU setServerMenu()
}
}
xchat_list_free(ph, xl);
hexchat_list_free(ph, xl);
}
return sTemp;
}
struct _xchat_context *xchat_find_server(int find_id)
struct _hexchat_context *hexchat_find_server(int find_id)
{
xchat_context *xc;
xchat_list *xl = xchat_list_get(ph, "channels");
hexchat_context *xc;
hexchat_list *xl = hexchat_list_get(ph, "channels");
int id;
if(!xl)
return NULL;
while(xchat_list_next(ph, xl))
while(hexchat_list_next(ph, xl))
{
id = xchat_list_int(ph, xl, "id");
id = hexchat_list_int(ph, xl, "id");
if(id == -1)
{
@ -300,21 +300,21 @@ struct _xchat_context *xchat_find_server(int find_id)
}
else if(id == find_id)
{
xc = (xchat_context *)xchat_list_str(ph, xl, "context");
xc = (hexchat_context *)hexchat_list_str(ph, xl, "context");
xchat_list_free(ph, xl);
hexchat_list_free(ph, xl);
return xc;
}
}
xchat_list_free(ph, xl);
hexchat_list_free(ph, xl);
return NULL;
}
void xchat_exec(char *command)
void hexchat_exec(char *command)
{
xchat_set_context(ph, xchat_find_context(ph, NULL, NULL));
xchat_command(ph, command);
hexchat_set_context(ph, hexchat_find_context(ph, NULL, NULL));
hexchat_command(ph, command);
}

View File

@ -19,14 +19,14 @@
#ifndef _H_XCHAT_H
#define _H_XCHAT_H
void xchat_exec (char *);
char *xchat_strip_color (char *);
void xchat_parse (char *);
struct _xchat_context *xchat_find_server (int);
void xchat_globally_away (TCHAR *);
void xchat_away (TCHAR *);
void xchat_globally_back ();
void xchat_back ();
void hexchat_exec (char *);
char *hexchat_strip_color (char *);
void hexchat_parse (char *);
struct _hexchat_context *hexchat_find_server (int);
void hexchat_globally_away (TCHAR *);
void hexchat_away (TCHAR *);
void hexchat_globally_back ();
void hexchat_back ();
HMENU setServerMenu ();
#endif

View File

@ -34,13 +34,13 @@
/*****************************************************/
/**** Don't want to pollute the namespace do we? *****/
/*****************************************************/
std::list<xchat_hook *> g_vHooks;
std::list<hexchat_hook *> g_vHooks;
/*****************************************************/
/************ Global Identifiers *********************/
/*****************************************************/
WNDPROC g_hOldProc;
xchat_plugin *ph;
hexchat_plugin *ph;
/*****************************************************/
/***************** Resources *************************/
@ -69,7 +69,7 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpVoid)
return TRUE;
}
int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
@ -83,25 +83,25 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl
/************************* Initialize our preferences if they don't exist yet **********************************************/
/***************************************************************************************************************************/
if (xchat_pluginpref_get_int (ph, "settings") == -1)
if (hexchat_pluginpref_get_int (ph, "settings") == -1)
{
xchat_pluginpref_set_int (ph, "settings", HT_DEF_SET);
hexchat_pluginpref_set_int (ph, "settings", HT_DEF_SET);
}
if (xchat_pluginpref_get_int (ph, "aot") == -1)
if (hexchat_pluginpref_get_int (ph, "aot") == -1)
{
xchat_pluginpref_set_int (ph, "aot", HT_DEF_AOT);
hexchat_pluginpref_set_int (ph, "aot", HT_DEF_AOT);
}
if (xchat_pluginpref_get_int (ph, "key") == -1)
if (hexchat_pluginpref_get_int (ph, "key") == -1)
{
xchat_pluginpref_set_int (ph, "key", HT_DEF_KEY);
hexchat_pluginpref_set_int (ph, "key", HT_DEF_KEY);
}
if (xchat_pluginpref_get_int (ph, "mod") == -1)
if (hexchat_pluginpref_get_int (ph, "mod") == -1)
{
xchat_pluginpref_set_int (ph, "mod", HT_DEF_MOD);
hexchat_pluginpref_set_int (ph, "mod", HT_DEF_MOD);
}
if (xchat_pluginpref_get_str (ph, "away", buffer) == 0)
if (hexchat_pluginpref_get_str (ph, "away", buffer) == 0)
{
xchat_pluginpref_set_str (ph, "away", "");
hexchat_pluginpref_set_str (ph, "away", "");
}
/***************************************************************************************************************************/
@ -112,7 +112,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl
/***************************************************************************************************************************/
/************************* Finds the HexChat window and saves it for later use *********************************************/
/***************************************************************************************************************************/
g_hXchatWnd = (HWND)xchat_get_info(ph, "win_ptr");
g_hXchatWnd = (HWND)hexchat_get_info(ph, "win_ptr");
if(g_hXchatWnd == NULL)
{
@ -143,7 +143,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl
/************************* Add our icon to the tray ************************************************************************/
/***************************************************************************************************************************/
char szVersion[64];
_snprintf(szVersion, 64, "HexChat %s", xchat_get_info(ph, "version"));
_snprintf(szVersion, 64, "HexChat %s", hexchat_get_info(ph, "version"));
AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG);
/***************************************************************************************************************************/
@ -161,25 +161,25 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl
/***************************************************************************************************************************/
/************************* Set our hooks and save them for later so we can unhook them *************************************/
/***************************************************************************************************************************/
g_vHooks.push_back(xchat_hook_print(ph, "Channel Msg Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
g_vHooks.push_back(xchat_hook_print(ph, "Channel Message", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_MESSAGE));
g_vHooks.push_back(xchat_hook_print(ph, "Topic Change", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_TOPIC_CHANGE));
g_vHooks.push_back(xchat_hook_print(ph, "Channel Action Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
g_vHooks.push_back(xchat_hook_print(ph, "Channel INVITE", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_INVITE));
g_vHooks.push_back(xchat_hook_print(ph, "You Kicked", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_KICKED));
g_vHooks.push_back(xchat_hook_print(ph, "Banned", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_BANNED));
g_vHooks.push_back(xchat_hook_print(ph, "CTCP Generic", HEXCHAT_PRI_NORM, event_cb, (void *)CTCP_GENERIC));
g_vHooks.push_back(xchat_hook_print(ph, "Private Message", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
g_vHooks.push_back(xchat_hook_print(ph, "Private Message to Dialog", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
g_vHooks.push_back(xchat_hook_print(ph, "Disconnected", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_DISCONNECT));
g_vHooks.push_back(xchat_hook_print(ph, "Killed", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_KILLED));
g_vHooks.push_back(xchat_hook_print(ph, "Notice", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_NOTICE));
g_vHooks.push_back(xchat_hook_command(ph, "tray_alert", HEXCHAT_PRI_NORM, command_cb, "Create an Alert", NULL));
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Msg Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Message", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_MESSAGE));
g_vHooks.push_back(hexchat_hook_print(ph, "Topic Change", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_TOPIC_CHANGE));
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Action Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
g_vHooks.push_back(hexchat_hook_print(ph, "Channel INVITE", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_INVITE));
g_vHooks.push_back(hexchat_hook_print(ph, "You Kicked", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_KICKED));
g_vHooks.push_back(hexchat_hook_print(ph, "Banned", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_BANNED));
g_vHooks.push_back(hexchat_hook_print(ph, "CTCP Generic", HEXCHAT_PRI_NORM, event_cb, (void *)CTCP_GENERIC));
g_vHooks.push_back(hexchat_hook_print(ph, "Private Message", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
g_vHooks.push_back(hexchat_hook_print(ph, "Private Message to Dialog", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
g_vHooks.push_back(hexchat_hook_print(ph, "Disconnected", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_DISCONNECT));
g_vHooks.push_back(hexchat_hook_print(ph, "Killed", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_KILLED));
g_vHooks.push_back(hexchat_hook_print(ph, "Notice", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_NOTICE));
g_vHooks.push_back(hexchat_hook_command(ph, "tray_alert", HEXCHAT_PRI_NORM, command_cb, "Create an Alert", NULL));
return 1;
}
int xchat_plugin_deinit(xchat_plugin *plugin_handle)
int hexchat_plugin_deinit(hexchat_plugin *plugin_handle)
{
/******************************************/
/****** Remove the Icon from the tray *****/
@ -231,13 +231,13 @@ int xchat_plugin_deinit(xchat_plugin *plugin_handle)
sdCloseAlerts();
}
/******************************************/
/****** remove our xchat_hook_*s **********/
/****** remove our hexchat_hook_*s **********/
/******************************************/
while(!g_vHooks.empty())
{
if(g_vHooks.back() != NULL)
{
xchat_unhook(ph, g_vHooks.back());
hexchat_unhook(ph, g_vHooks.back());
}
g_vHooks.pop_back();
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -36,7 +36,7 @@ extern unsigned int g_dwPrefs;
extern TCHAR g_szAway[512];
extern int g_iTime;
extern WNDPROC g_hOldProc;
extern struct _xchat_plugin *ph;
extern struct _hexchat_plugin *ph;
/******************************************************/
/******************** Messages ************************/

View File

@ -74,11 +74,11 @@ WORD ModToHotkeyf(WORD modifiers)
void SavePrefs(int iDlg)
{
xchat_pluginpref_set_int (ph, "settings", g_dwPrefs);
xchat_pluginpref_set_int (ph, "aot", g_iTime);
xchat_pluginpref_set_int (ph, "key", g_hHotKey.key);
xchat_pluginpref_set_int (ph, "mod", g_hHotKey.mod);
xchat_pluginpref_set_str (ph, "away", (const char*) g_szAway);
hexchat_pluginpref_set_int (ph, "settings", g_dwPrefs);
hexchat_pluginpref_set_int (ph, "aot", g_iTime);
hexchat_pluginpref_set_int (ph, "key", g_hHotKey.key);
hexchat_pluginpref_set_int (ph, "mod", g_hHotKey.mod);
hexchat_pluginpref_set_str (ph, "away", (const char*) g_szAway);
}
void LoadPrefs()
@ -91,11 +91,11 @@ void LoadPrefs()
/*************************** Get the value for each of our preferances ****************************/
/**************************************************************************************************/
g_dwPrefs = xchat_pluginpref_get_int (ph, "settings");
g_iTime = xchat_pluginpref_get_int (ph, "aot");
g_hHotKey.key = xchat_pluginpref_get_int (ph, "key");
g_hHotKey.mod = xchat_pluginpref_get_int (ph, "mod");
xchat_pluginpref_get_str (ph, "away", (char *) g_szAway);
g_dwPrefs = hexchat_pluginpref_get_int (ph, "settings");
g_iTime = hexchat_pluginpref_get_int (ph, "aot");
g_hHotKey.key = hexchat_pluginpref_get_int (ph, "key");
g_hHotKey.mod = hexchat_pluginpref_get_int (ph, "mod");
hexchat_pluginpref_get_str (ph, "away", (char *) g_szAway);
/**************************************************************************************************/
/******************************** Register our hotkey with windows ********************************/

View File

@ -67,7 +67,7 @@
#include "hexchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
#define LXC_STRIP_COLOR 1
#define LXC_STRIP_ATTR 2
@ -76,7 +76,7 @@ static xchat_plugin *ph; /* plugin handle */
/* registered hooks */
struct lxc_hooks {
const char *name;
xchat_hook *hook;
hexchat_hook *hook;
struct lxc_hooks *next;
};
@ -104,7 +104,7 @@ struct lxc_userdata {
struct lxc_cbdata {
lua_State *state;
const char *func;
xchat_hook *hook; /* timer ... */
hexchat_hook *hook; /* timer ... */
struct lxc_userdata *data;
};
@ -379,7 +379,7 @@ lxc_load_file(const char *script)
L = lxc_new_state();
state = malloc(sizeof(struct lxc_States));
if (state == NULL) {
xchat_printf(ph, "malloc() failed: %s\n", strerror(errno));
hexchat_printf(ph, "malloc() failed: %s\n", strerror(errno));
lua_close(L);
return 0;
}
@ -391,7 +391,7 @@ lxc_load_file(const char *script)
state->gui = NULL;
if (luaL_loadfile(L, script) || lua_pcall(L, 0, 0, 0)) {
xchat_printf(ph, "Lua plugin: error loading script %s",
hexchat_printf(ph, "Lua plugin: error loading script %s",
lua_tostring(L, -1));
lua_close(L);
free(state);
@ -417,7 +417,7 @@ lxc_autoload_from_path(const char *path)
struct dirent *ent;
char *file;
int len;
/* xchat_printf(ph, "loading from %s\n", path); */
/* hexchat_printf(ph, "loading from %s\n", path); */
dir = opendir(path);
if (dir) {
while ((ent = readdir(dir))) {
@ -425,7 +425,7 @@ lxc_autoload_from_path(const char *path)
if (len > 4 && strcasecmp(".lua", ent->d_name + len - 4) == 0) {
file = malloc(len + strlen(path) + 2);
if (file == NULL) {
xchat_printf(ph, "lxc_autoload_from_path(): malloc failed: %s",
hexchat_printf(ph, "lxc_autoload_from_path(): malloc failed: %s",
strerror(errno));
break;
}
@ -449,14 +449,14 @@ void lxc_unload_script(struct lxc_States *state)
lua_gettable(L, LUA_GLOBALSINDEX);
if (lua_type(L, -1) == LUA_TFUNCTION) {
if (lua_pcall(L, 0, 0, 0)) {
xchat_printf(ph, "Lua plugin: error while unloading script %s",
hexchat_printf(ph, "Lua plugin: error while unloading script %s",
lua_tostring(L, -1));
lua_pop(L, 1);
}
}
if (state->gui)
xchat_plugingui_remove(ph, state->gui);
hexchat_plugingui_remove(ph, state->gui);
state->gui = NULL;
hooks = state->hooks;
@ -464,7 +464,7 @@ void lxc_unload_script(struct lxc_States *state)
h = hooks;
hooks = hooks->next;
cb = xchat_unhook(ph, h->hook);
cb = hexchat_unhook(ph, h->hook);
if (cb) {
ud = cb->data;
while (ud) {
@ -497,13 +497,13 @@ static int lxc_cb_load(char *word[], char *word_eol[], void *userdata)
buf = malloc(PATH_MAX + 1);
if (!buf) {
xchat_printf(ph, "malloc() failed: %s\n", strerror(errno));
hexchat_printf(ph, "malloc() failed: %s\n", strerror(errno));
return HEXCHAT_EAT_NONE;
}
st = malloc(sizeof(struct stat));
if (!st) {
xchat_printf(ph, "malloc() failed: %s\n", strerror(errno));
hexchat_printf(ph, "malloc() failed: %s\n", strerror(errno));
free(buf);
return HEXCHAT_EAT_NONE;
}
@ -524,7 +524,7 @@ static int lxc_cb_load(char *word[], char *word_eol[], void *userdata)
}
else
{
xdir = xchat_get_info (ph, "xchatdirfs");
xdir = hexchat_get_info (ph, "xchatdirfs");
snprintf (file, PATH_MAX, "%s/addons/%s", xdir, word[2]);
}
}
@ -543,7 +543,7 @@ static int lxc_cb_load(char *word[], char *word_eol[], void *userdata)
lua_pushstring(L, "xchat_register");
lua_gettable(L, LUA_GLOBALSINDEX);
if (lua_pcall(L, 0, 3, 0)) {
xchat_printf(ph, "Lua plugin: error registering script %s",
hexchat_printf(ph, "Lua plugin: error registering script %s",
lua_tostring(L, -1));
lua_pop(L, 1);
free(st);
@ -555,7 +555,7 @@ static int lxc_cb_load(char *word[], char *word_eol[], void *userdata)
desc = lua_tostring(L, -2);
vers = lua_tostring(L, -1);
lua_pop(L, 4); /* func + 3 ret value */
state->gui = xchat_plugingui_add(ph, state->file,
state->gui = hexchat_plugingui_add(ph, state->file,
name, desc, vers, NULL
);
@ -565,7 +565,7 @@ static int lxc_cb_load(char *word[], char *word_eol[], void *userdata)
lua_pop(L, 1);
else {
if (lua_pcall(L, 0, 0, 0)) {
xchat_printf(ph,
hexchat_printf(ph,
"Lua plugin: error calling xchat_init() %s",
lua_tostring(L, -1));
lua_pop(L, 1);
@ -612,7 +612,7 @@ static int lxc_cb_unload(char *word[], char *word_eol[], void *userdata)
prev->next = state->next;
else
lxc_states = state->next;
xchat_printf(ph, "Lua script %s unloaded", file);
hexchat_printf(ph, "Lua script %s unloaded", file);
free(state);
return HEXCHAT_EAT_ALL;
}
@ -627,11 +627,11 @@ static int lxc_cb_lua(char *word[], char *word_eol[], void *userdata)
{
lua_State *L = lxc_new_state();
if (word[2][0] == '\0') {
xchat_printf(ph, "LUA: Usage: /LUA LUA_CODE... execute LUA_CODE");
hexchat_printf(ph, "LUA: Usage: /LUA LUA_CODE... execute LUA_CODE");
return HEXCHAT_EAT_ALL;
}
if (luaL_loadbuffer(L, word_eol[2], strlen(word_eol[2]), "/LUA")) {
xchat_printf(ph, "LUA: error loading line %s", lua_tostring(L, -1));
hexchat_printf(ph, "LUA: error loading line %s", lua_tostring(L, -1));
lua_pop(L, 1);
}
@ -647,7 +647,7 @@ static int lxc_cb_lua(char *word[], char *word_eol[], void *userdata)
#endif
if (lua_pcall(L, 0, 0, 0)) {
xchat_printf(ph, "LUA: error executing line %s", lua_tostring(L, -1));
hexchat_printf(ph, "LUA: error executing line %s", lua_tostring(L, -1));
lua_pop(L, 1);
}
@ -655,7 +655,7 @@ static int lxc_cb_lua(char *word[], char *word_eol[], void *userdata)
return HEXCHAT_EAT_ALL;
}
int xchat_plugin_init(xchat_plugin *plugin_handle,
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
char **plugin_name,
char **plugin_desc,
char **plugin_version,
@ -674,17 +674,17 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
*plugin_desc = LXC_DESC;
*plugin_version = LXC_VERSION;
xchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, lxc_cb_load, NULL, NULL);
xchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, lxc_cb_unload, NULL, NULL);
xchat_hook_command(ph, "LUA", HEXCHAT_PRI_NORM, lxc_cb_lua, "Usage: LUA <code>, executes <code> in a new lua state", NULL);
hexchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, lxc_cb_load, NULL, NULL);
hexchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, lxc_cb_unload, NULL, NULL);
hexchat_hook_command(ph, "LUA", HEXCHAT_PRI_NORM, lxc_cb_lua, "Usage: LUA <code>, executes <code> in a new lua state", NULL);
xdir = xchat_get_info (ph, "xchatdirfs");
xdir = hexchat_get_info (ph, "xchatdirfs");
xsubdir = g_build_filename (xdir, "addons", NULL);
lxc_autoload_from_path (xsubdir);
g_free (xsubdir);
/* put this here, otherwise it's only displayed when a script is autoloaded upon start */
xchat_printf(ph, "Lua interface loaded");
hexchat_printf(ph, "Lua interface loaded");
if (!lxc_states) /* no scripts loaded */
return 1;
@ -695,7 +695,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
lua_pushstring(L, "xchat_register");
lua_gettable(L, LUA_GLOBALSINDEX);
if (lua_pcall(L, 0, 3, 0)) {
xchat_printf(ph, "Lua plugin: error registering script %s",
hexchat_printf(ph, "Lua plugin: error registering script %s",
lua_tostring(L, -1));
lua_pop(L, 1);
state = state->next;
@ -706,7 +706,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
desc = lua_tostring(L, -2);
vers = lua_tostring(L, -1);
lua_pop(L, 4); /* func + 3 ret value */
state->gui = xchat_plugingui_add(ph, state->file, name, desc, vers, NULL);
state->gui = hexchat_plugingui_add(ph, state->file, name, desc, vers, NULL);
lua_pushstring(L, "xchat_init");
lua_gettable(L, LUA_GLOBALSINDEX);
@ -714,7 +714,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
lua_pop(L, 1);
else {
if (lua_pcall(L, 0, 0, 0)) {
xchat_printf(ph, "Lua plugin: error calling xchat_init() %s",
hexchat_printf(ph, "Lua plugin: error calling xchat_init() %s",
lua_tostring(L, -1));
lua_pop(L, 1);
}
@ -724,19 +724,19 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
return 1;
}
int xchat_plugin_deinit(xchat_plugin *plug_handle)
int hexchat_plugin_deinit(hexchat_plugin *plug_handle)
{
struct lxc_States *state, *st;
state = lxc_states;
while (state) {
lxc_unload_script(state);
xchat_printf(ph, "Lua script %s unloaded", state->file);
hexchat_printf(ph, "Lua script %s unloaded", state->file);
st = state;
state = state->next;
free(st);
}
xchat_printf(plug_handle, "Lua interface unloaded");
hexchat_printf(plug_handle, "Lua interface unloaded");
return 1;
}
@ -801,7 +801,7 @@ static int lxc_run_hook(char *word[], char *word_eol[], void *data)
}
if (lua_pcall(L, 3, 1, 0)) {
xchat_printf(ph, "failed to call callback for '%s': %s",
hexchat_printf(ph, "failed to call callback for '%s': %s",
word[1], lua_tostring(L, -1)
);
lua_pop(L, 1);
@ -809,7 +809,7 @@ static int lxc_run_hook(char *word[], char *word_eol[], void *data)
}
if (lua_type(L, -1) != LUA_TNUMBER) {
xchat_printf(ph, "callback for '%s' did not return number...", word[1]);
hexchat_printf(ph, "callback for '%s' did not return number...", word[1]);
return HEXCHAT_EAT_NONE;
}
@ -843,7 +843,7 @@ static int lxc_get_userdata(int pos, struct lxc_cbdata *cb)
ud = malloc(sizeof(struct lxc_userdata));
if (!ud) {
xchat_printf(ph, "lxc_get_userdata(): failed to malloc: %s",
hexchat_printf(ph, "lxc_get_userdata(): failed to malloc: %s",
strerror(errno));
if (cb->data != NULL) {
ud = cb->data;
@ -911,7 +911,7 @@ static int lxc_get_userdata(int pos, struct lxc_cbdata *cb)
*/
static int lxc_hook_command(lua_State *L)
{
xchat_hook *hook;
hexchat_hook *hook;
const char *help, *command, *func;
double prio;
struct lxc_hooks *hooks, *h;
@ -924,7 +924,7 @@ static int lxc_hook_command(lua_State *L)
cb = malloc(sizeof(struct lxc_cbdata));
if (!cb) {
xchat_printf(ph, "lxc_hook_command(): failed to malloc: %s",
hexchat_printf(ph, "lxc_hook_command(): failed to malloc: %s",
strerror(errno));
lua_pushboolean(L, 0);
return 1;
@ -956,12 +956,12 @@ static int lxc_hook_command(lua_State *L)
else {
h = malloc(sizeof(struct lxc_hooks));
if (!h) {
xchat_printf(ph, "lxc_hook_command(): failed to malloc: %s",
hexchat_printf(ph, "lxc_hook_command(): failed to malloc: %s",
strerror(errno));
lua_pushboolean(L, 0);
return 1;
}
hook = xchat_hook_command(ph, command, prio, lxc_run_hook, help, cb);
hook = hexchat_hook_command(ph, command, prio, lxc_run_hook, help, cb);
h->hook = hook;
h->name = command;
h->next = NULL;
@ -1014,14 +1014,14 @@ static int lxc_run_print(char *word[], void *data)
}
if (lua_pcall(L, 1, 1, 0)) {
xchat_printf(ph, "failed to call callback for '%s': %s",
hexchat_printf(ph, "failed to call callback for '%s': %s",
word[1], lua_tostring(L, -1));
lua_pop(L, 1);
return 0;
}
if (lua_type(L, -1) != LUA_TNUMBER) {
xchat_printf(ph, "callback for '%s' didn't return number...", word[1]);
hexchat_printf(ph, "callback for '%s' didn't return number...", word[1]);
return HEXCHAT_EAT_NONE;
}
i = (int)lua_tonumber(L, -1);
@ -1034,7 +1034,7 @@ static int lxc_run_print(char *word[], void *data)
* desc: Registers a function to trap any print events. The event names may
* be any available in the "Advanced > Text Events" window. There are
* also some extra "special" events you may hook using this function,
* see: http://xchat.org/docs/plugin20.html#xchat_hook_print
* see: http://xchat.org/docs/plugin20.html#hexchat_hook_print
* ret: true... or false if something went wrong while registering hook
* args:
* * name (string): the name of the new command
@ -1046,7 +1046,7 @@ static int lxc_run_print(char *word[], void *data)
*/
static int lxc_hook_print(lua_State *L)
{
xchat_hook *hook;
hexchat_hook *hook;
struct lxc_hooks *hooks, *h;
struct lxc_States *st;
struct lxc_cbdata *cb = malloc(sizeof(struct lxc_cbdata));
@ -1078,12 +1078,12 @@ static int lxc_hook_print(lua_State *L)
else {
h = malloc(sizeof(struct lxc_hooks));
if (!h) {
xchat_printf(ph, "lxc_hook_print(): failed to malloc: %s",
hexchat_printf(ph, "lxc_hook_print(): failed to malloc: %s",
strerror(errno));
lua_pushboolean(L, 0);
return 1;
}
hook = xchat_hook_print(ph, name, prio, lxc_run_print, cb);
hook = hexchat_hook_print(ph, name, prio, lxc_run_print, cb);
h->hook = hook;
h->name = name;
h->next = NULL;
@ -1123,7 +1123,7 @@ static int lxc_hook_print(lua_State *L)
*/
static int lxc_hook_server(lua_State *L)
{
xchat_hook *hook;
hexchat_hook *hook;
struct lxc_hooks *hooks, *h;
struct lxc_States *st;
const char *name, *func;
@ -1131,7 +1131,7 @@ static int lxc_hook_server(lua_State *L)
struct lxc_cbdata *cb = malloc(sizeof(struct lxc_cbdata));
if (!cb) {
xchat_printf(ph, "lxc_hook_server(): failed to malloc: %s",
hexchat_printf(ph, "lxc_hook_server(): failed to malloc: %s",
strerror(errno));
lua_pushnil(L);
return 1;
@ -1157,12 +1157,12 @@ static int lxc_hook_server(lua_State *L)
else {
h = malloc(sizeof(struct lxc_hooks));
if (!h) {
xchat_printf(ph, "lxc_hook_server(): failed to malloc: %s",
hexchat_printf(ph, "lxc_hook_server(): failed to malloc: %s",
strerror(errno));
lua_pushboolean(L, 0);
return 1;
}
hook = xchat_hook_server(ph, name, prio, lxc_run_hook, cb);
hook = hexchat_hook_server(ph, name, prio, lxc_run_hook, cb);
h->hook = hook;
h->name = name;
h->next = NULL;
@ -1201,7 +1201,7 @@ static unsigned long long lxc_timer_count = 0;
static int lxc_hook_timer(lua_State *L)
{
xchat_hook *hook;
hexchat_hook *hook;
struct lxc_hooks *hooks, *h;
struct lxc_States *st;
double timeout;
@ -1234,7 +1234,7 @@ static int lxc_hook_timer(lua_State *L)
strerror(errno));
return 0;
}
hook = xchat_hook_timer(ph, timeout, lxc_run_timer, cb);
hook = hexchat_hook_timer(ph, timeout, lxc_run_timer, cb);
cb->hook = hook;
h->hook = hook;
h->next = NULL;
@ -1261,7 +1261,7 @@ static int lxc_hook_timer(lua_State *L)
return 1;
}
static void lxc_unhook_timer(lua_State *L, xchat_hook *hook)
static void lxc_unhook_timer(lua_State *L, hexchat_hook *hook)
{
struct lxc_States *state;
struct lxc_hooks *hooks, *h, *prev_hook;
@ -1281,7 +1281,7 @@ static void lxc_unhook_timer(lua_State *L, xchat_hook *hook)
else
state->hooks = hooks->next;
cb = xchat_unhook(ph, h->hook);
cb = hexchat_unhook(ph, h->hook);
if (cb) {
ud = cb->data;
while (ud) {
@ -1317,14 +1317,14 @@ static void lxc_unhook_timer(lua_State *L, xchat_hook *hook)
{
int ret;
struct lxc_cbdata *cb = data;
xchat_hook *hook = cb->hook;
hexchat_hook *hook = cb->hook;
lua_State *L = cb->state;
lua_pushstring(L, cb->func);
lua_gettable(L, LUA_GLOBALSINDEX);
if (lua_pcall(L, 0, 1, 0)) {
xchat_printf(ph, "failed to call timer callback for '%s': %s",
hexchat_printf(ph, "failed to call timer callback for '%s': %s",
cb->func, lua_tostring(L, -1));
lua_pop(L, 1);
lxc_unhook_timer(L, hook);
@ -1332,7 +1332,7 @@ static void lxc_unhook_timer(lua_State *L, xchat_hook *hook)
}
if (lua_type(L, -1) != LUA_TBOOLEAN) {
xchat_printf(ph,
hexchat_printf(ph,
"timer callback for '%s' didn't return a boolean", cb->func);
lua_pop(L, 1);
lxc_unhook_timer(L, hook);
@ -1380,7 +1380,7 @@ static int lxc_unhook(lua_State *L)
else
state->hooks = hooks->next;
cb = xchat_unhook(ph, h->hook);
cb = hexchat_unhook(ph, h->hook);
if (cb) {
ud = cb->data;
while (ud) {
@ -1422,7 +1422,7 @@ static int lxc_event(lua_State *L)
static int lxc_command(lua_State *L)
{
const char *command = luaL_checkstring(L, 1);
xchat_command(ph, command);
hexchat_command(ph, command);
return 0;
}
@ -1437,7 +1437,7 @@ static int lxc_print(lua_State *L)
{
const char *txt = luaL_checkstring(L, 1);
// FIXME? const char *txt = lua_tostring(L, 1);
xchat_print(ph, txt);
hexchat_print(ph, txt);
return 0;
}
@ -1476,19 +1476,19 @@ static int lxc_emit_print(lua_State *L)
}
switch (n-1) {
case 0:
i = xchat_emit_print(ph, event, NULL);
i = hexchat_emit_print(ph, event, NULL);
break;
case 1:
i = xchat_emit_print(ph, event, text[0], NULL);
i = hexchat_emit_print(ph, event, text[0], NULL);
break;
case 2:
i = xchat_emit_print(ph, event, text[0], text[1], NULL);
i = hexchat_emit_print(ph, event, text[0], text[1], NULL);
break;
case 3:
i = xchat_emit_print(ph, event, text[0], text[1], text[2], NULL);
i = hexchat_emit_print(ph, event, text[0], text[1], text[2], NULL);
break;
case 4:
i = xchat_emit_print(ph, event, text[0], text[1], text[2], text[3], NULL);
i = hexchat_emit_print(ph, event, text[0], text[1], text[2], text[3], NULL);
break;
}
lua_pushboolean(L, (i == 0) ? 0 : 1);
@ -1575,7 +1575,7 @@ static int lxc_send_modes(lua_State *L)
if (lua_gettop(L) == 4)
num = luaL_checknumber(L, 4);
xchat_send_modes(ph, targets, i-1, num, sign[0], mode[0]);
hexchat_send_modes(ph, targets, i-1, num, sign[0], mode[0]);
return 0;
}
@ -1598,7 +1598,7 @@ static int lxc_find_context(lua_State *L)
{
const char *srv, *chan;
long ctx;
xchat_context *ptr;
hexchat_context *ptr;
if (lua_type(L, 1) == LUA_TSTRING) {
srv = lua_tostring(L, 1);
@ -1616,7 +1616,7 @@ static int lxc_find_context(lua_State *L)
else
chan = NULL;
ptr = xchat_find_context(ph, srv, chan);
ptr = hexchat_find_context(ph, srv, chan);
ctx = (long)ptr;
#ifdef DEBUG
fprintf(stderr, "find_context(): %#lx\n", (long)ptr);
@ -1628,14 +1628,14 @@ static int lxc_find_context(lua_State *L)
/*
* lua: xchat.get_context()
* desc: Returns the current context for your plugin. You can use this later
* with xchat_set_context.
* with hexchat_set_context.
* ret: context number ... DON'T modifiy
* args: none
*/
static int lxc_get_context(lua_State *L)
{
long ptr;
xchat_context *ctx = xchat_get_context(ph);
hexchat_context *ctx = hexchat_get_context(ph);
ptr = (long)ctx;
#ifdef DEBUG
fprintf(stderr, "get_context(): %#lx\n", ptr);
@ -1654,7 +1654,7 @@ static int lxc_get_context(lua_State *L)
static int lxc_get_info(lua_State *L)
{
const char *id = luaL_checkstring(L, 1);
const char *value = xchat_get_info(ph, id);
const char *value = hexchat_get_info(ph, id);
if (value == NULL)
lua_pushnil(L);
else
@ -1717,8 +1717,8 @@ static int lxc_set_context(lua_State *L)
#ifdef DEBUG
fprintf(stderr, "set_context(): %#lx\n", (long)ctx);
#endif
xchat_context *xc = (void *)(long)ctx;
lua_pushboolean(L, xchat_set_context(ph, xc));
hexchat_context *xc = (void *)(long)ctx;
lua_pushboolean(L, hexchat_set_context(ph, xc));
return 1;
}
@ -1738,7 +1738,7 @@ static int lxc_nickcmp(lua_State *L)
{
const char *n1 = luaL_checkstring(L, 1);
const char *n2 = luaL_checkstring(L, 2);
lua_pushnumber(L, (double)xchat_nickcmp(ph, n1, n2));
lua_pushnumber(L, (double)hexchat_nickcmp(ph, n1, n2));
return 1;
}
@ -1761,8 +1761,8 @@ static int lxc_list_get(lua_State *L)
double num;
time_t date;
long ptr;
const char *const *fields = xchat_list_fields(ph, name);
xchat_list *list = xchat_list_get(ph, name);
const char *const *fields = hexchat_list_fields(ph, name);
hexchat_list *list = hexchat_list_get(ph, name);
if (!list) {
lua_pushnil(L);
@ -1771,14 +1771,14 @@ static int lxc_list_get(lua_State *L)
lua_newtable(L);
/* this is like the perl plugin does it ;-) */
l = 1;
while (xchat_list_next(ph, list)) {
while (hexchat_list_next(ph, list)) {
i = 0;
lua_pushnumber(L, l);
lua_newtable(L);
while (fields[i] != NULL) {
switch (fields[i][0]) {
case 's':
str = xchat_list_str(ph, list, fields [i] + 1);
str = hexchat_list_str(ph, list, fields [i] + 1);
lua_pushstring(L, fields[i]+1);
if (str != NULL)
lua_pushstring(L, str);
@ -1787,20 +1787,20 @@ static int lxc_list_get(lua_State *L)
lua_settable(L, -3);
break;
case 'p':
ptr = (long)xchat_list_str(ph, list, fields [i] + 1);
ptr = (long)hexchat_list_str(ph, list, fields [i] + 1);
num = (double)ptr;
lua_pushstring(L, fields[i]+1);
lua_pushnumber(L, num);
lua_settable(L, -3);
break;
case 'i':
num = (double)xchat_list_int(ph, list, fields[i] + 1);
num = (double)hexchat_list_int(ph, list, fields[i] + 1);
lua_pushstring(L, fields[i]+1);
lua_pushnumber(L, num);
lua_settable(L, -3);
break;
case 't':
date = xchat_list_time(ph, list, fields[i] + 1);
date = hexchat_list_time(ph, list, fields[i] + 1);
lua_pushstring(L, fields[i]+1);
lua_pushnumber(L, (double)date);
lua_settable(L, -3);
@ -1811,7 +1811,7 @@ static int lxc_list_get(lua_State *L)
lua_settable(L, -3);
l++;
}
xchat_list_free(ph, list);
hexchat_list_free(ph, list);
return 1;
}
@ -1826,7 +1826,7 @@ static int lxc_list_get(lua_State *L)
static int lxc_list_fields(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
const char *const *fields = xchat_list_fields(ph, name);
const char *const *fields = hexchat_list_fields(ph, name);
int i;
lua_newtable(L);
@ -1847,7 +1847,7 @@ static int lxc_list_fields(lua_State *L)
static int lxc_gettext(lua_State *L)
{
#if defined(_WIN32) || defined(LXC_XCHAT_GETTEXT)
lua_pushstring(L, xchat_gettext(ph, luaL_checkstring(L, 1)));
lua_pushstring(L, hexchat_gettext(ph, luaL_checkstring(L, 1)));
#else
const char *dom;
const char *msgid = luaL_checkstring(L, 1);

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -10,7 +10,7 @@
#include "hexchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static int
mail_items(char *file)
@ -63,7 +63,7 @@ xchat_mail_check (void)
if(size > last_size)
{
xchat_printf(ph,
hexchat_printf(ph,
"-\0033-\0039-\017\tYou have new mail (%d messages, %d bytes total).",
mail_items(maildir), size);
}
@ -78,7 +78,7 @@ static int timeout_cb(void *userdata)
return 1;
}
int xchat_plugin_init(xchat_plugin *plugin_handle,
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
char **plugin_name, char **plugin_desc, char **plugin_version,
char *arg)
{
@ -88,7 +88,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
*plugin_desc = "Checks your mailbox every 30 seconds";
*plugin_version = "0.1";
xchat_hook_timer(ph, 30000, timeout_cb, 0);
hexchat_hook_timer(ph, 30000, timeout_cb, 0);
return 1;
}

View File

@ -117,7 +117,7 @@ char *readLine(FILE *f){
else buffer[pos]=(char)cc;pos++;
}
}
if (buffer[pos]==EOF) xchat_printf(ph,"EOF: %i\n",pos);
if (buffer[pos]==EOF) hexchat_printf(ph,"EOF: %i\n",pos);
return buffer;
}

View File

@ -81,12 +81,12 @@ int str2int(char *text){
int ret=0;
for (i=1;i<=strlen(text);i++){
if ((text[strlen(text)-i]>57)||(text[strlen(text)-i]<48)){
xchat_printf(ph,"invalid char in string: %i",text[strlen(text)-i]);
hexchat_printf(ph,"invalid char in string: %i",text[strlen(text)-i]);
return 255;
}
ret+=((int)text[strlen(text)-i]-48)*iPow(10,i-1);
}
//xchat_printf(ph, "str2int(%s)=%i",text,ret);
//hexchat_printf(ph, "str2int(%s)=%i",text,ret);
//if (DEBUG==1) putlog("int converted");
return ret;
}
@ -135,7 +135,7 @@ static char *tagExtract(char *tag, int tagLen, char* info){
//if (DEBUG==1) putlog("extracting tag");
int pos, len, i;
pos=inStr(tag,tagLen,info);
//xchat_printf(ph,"pos=%i",pos);
//hexchat_printf(ph,"pos=%i",pos);
if (pos==-1) return "";//NULL;
//printf("position of %s = %i\n",info,pos);
len=0;
@ -163,7 +163,7 @@ struct tagInfo readID3V1(char *file){
ret.artist=NULL;
f=fopen(file,"rb");
if (f==NULL){
xchat_print(ph,"file not found while trying to read id3v1");
hexchat_print(ph,"file not found while trying to read id3v1");
//if (DEBUG==1) putlog("file not found while trying to read id3v1");
return ret;
}
@ -174,14 +174,14 @@ struct tagInfo readID3V1(char *file){
//printf("position= %li\n",pos);
for (i=0;i<128;i++) {
c=fgetc(f);
if (c==EOF) {xchat_printf(ph,"read ID3V1 failed\n");fclose(f);return ret;}
if (c==EOF) {hexchat_printf(ph,"read ID3V1 failed\n");fclose(f);return ret;}
tag[i]=(char)c;
}
fclose(f);
//printf("tag readed: \n");
id=substring(tag,0,3);
//printf("header: %s\n",id);
if (strcmp(id,"TAG")!=0){xchat_printf(ph,"no id3 v1 found\n");return ret;}
if (strcmp(id,"TAG")!=0){hexchat_printf(ph,"no id3 v1 found\n");return ret;}
ret.title=subString(tag,3,30,1);
ret.artist=subString(tag,33,30,1);
ret.album=subString(tag,63,30,1);
@ -191,15 +191,15 @@ struct tagInfo readID3V1(char *file){
val=(int)tmp[0];
if (val<0)val+=256;
//xchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]);
//hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]);
if ((val<148)&&(val>=0))
ret.genre=GENRES[val];//#############changed
else {
ret.genre="unknown";
//xchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]);
//hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]);
}
//xchat_printf(ph, "tmp: \"%s\" -> %i",tmp,tmp[0]);
//xchat_printf(ph,"genre \"%s\"",ret.genre);
//hexchat_printf(ph, "tmp: \"%s\" -> %i",tmp,tmp[0]);
//hexchat_printf(ph,"genre \"%s\"",ret.genre);
//if (DEBUG==1) putlog("id3v1 extracted");
return ret;
}
@ -214,7 +214,7 @@ char *extractID3Genre(char *tag){
}
else{
int i;
//xchat_print(ph, "Using 2 criteria");
//hexchat_print(ph, "Using 2 criteria");
for (i=0;i<strlen(tag);i++){
if (tag[i]==')'){ tag=&tag[i]+1;return tag;}
//return tag;
@ -232,10 +232,10 @@ struct tagInfo readID3V2(char *file){
struct tagInfo ret;
f = fopen(file,"rb");
//xchat_printf(ph,"file :%s",file);
//hexchat_printf(ph,"file :%s",file);
if (f==NULL)
{
xchat_print(ph,"file not found whilt trying to read ID3V2");
hexchat_print(ph,"file not found whilt trying to read ID3V2");
//if (DEBUG==1)putlog("file not found while trying to read ID3V2");
return ret;
}
@ -250,29 +250,29 @@ struct tagInfo readID3V2(char *file){
header[i]=(char)c;
}
if (strstr(header,"ID3")==header){
//xchat_printf(ph,"found id3v2\n");
//hexchat_printf(ph,"found id3v2\n");
len=0;
for (i=6;i<10;i++) len+=(int)header[i]*iPow(256,9-i);
//char *tag=(char*)malloc(sizeof(char)*len);
tag=(char*) calloc(len,sizeof(char)); //malloc(sizeof(char)*len);
for (i=0;i<len;i++){c=fgetc(f);tag[i]=(char)c;}
//xchat_printf(ph,"tag length: %i\n",len);
//xchat_printf(ph,"tag: %s\n",tag);
//hexchat_printf(ph,"tag length: %i\n",len);
//hexchat_printf(ph,"tag: %s\n",tag);
fclose(f);
ret.comment=tagExtract(tag,len,"COMM");
//xchat_printf(ph,"Comment: %s\n",ret.comment);
//hexchat_printf(ph,"Comment: %s\n",ret.comment);
ret.genre=tagExtract(tag,len,"TCON");
//if (strcmp(ret.genre,"(127)")==0) ret.genre="unknown";
//xchat_printf(ph, "ret.genre = %s",ret.genre);
//hexchat_printf(ph, "ret.genre = %s",ret.genre);
if ((ret.genre!=NULL)&&(ret.genre[0]=='(')) ret.genre=extractID3Genre(ret.genre);
//xchat_printf(ph,"genre: %s\n",ret.genre);
//hexchat_printf(ph,"genre: %s\n",ret.genre);
ret.title=tagExtract(tag,len,"TIT2");
//xchat_printf(ph,"Title: %s\n",ret.title);
//hexchat_printf(ph,"Title: %s\n",ret.title);
ret.album=tagExtract(tag,len,"TALB");
//xchat_printf(ph,"Album: %s\n",ret.album);
//hexchat_printf(ph,"Album: %s\n",ret.album);
ret.artist=tagExtract(tag,len,"TPE1");
//xchat_printf(ph,"Artist: %s\n",ret.artist);
//hexchat_printf(ph,"Artist: %s\n",ret.artist);
}
else{fclose(f);printf("no id3v2 tag found\n"); return ret;}
//printf("id2v2 done\n");
@ -294,7 +294,7 @@ struct tagInfo readHeader(char *file){
f = fopen(file,"rb");
if (f==NULL)
{
xchat_print(ph,"file not found while trying to read mp3 header");
hexchat_print(ph,"file not found while trying to read mp3 header");
//if (DEBUG==1) putlog("file not found while trying to read mp3 header");
return info;
}

View File

@ -24,7 +24,7 @@ static char *VERSION="0.0.6";
#include <ctype.h>
#include <math.h>
#include "hexchat-plugin.h"
static xchat_plugin *ph;
static hexchat_plugin *ph;
#include "functions.c"
#include "mp3Info.c"
@ -46,23 +46,23 @@ static int mpc_tell(char *word[], char *word_eol[], void *userdata){
char *tTitle, *zero, *oggLine, *line;
struct tagInfo info;
HWND hwnd = FindWindow("MediaPlayerClassicW",NULL);
if (hwnd==0) {xchat_command(ph, randomLine(notRunTheme));return HEXCHAT_EAT_ALL;}
if (hwnd==0) {hexchat_command(ph, randomLine(notRunTheme));return HEXCHAT_EAT_ALL;}
tTitle=(char*)malloc(sizeof(char)*1024);
GetWindowText(hwnd, tTitle, 1024);
zero=strstr(tTitle," - Media Player Classic");
if (zero!=NULL) zero[0]=0;
else xchat_print(ph,"pattern not found");
else hexchat_print(ph,"pattern not found");
if ((tTitle[1]==':')&&(tTitle[2]=='\\')){
//xchat_print(ph,"seams to be full path");
//hexchat_print(ph,"seams to be full path");
if (endsWith(tTitle,".mp3")==1){
//xchat_print(ph,"seams to be a mp3 file");
//hexchat_print(ph,"seams to be a mp3 file");
info = readHeader(tTitle);
if ((info.artist!=NULL)&&(strcmp(info.artist,"")!=0)){
char *mode=MODES[info.mode];
//xchat_printf(ph,"mode: %s\n",mode);
//hexchat_printf(ph,"mode: %s\n",mode);
char *mp3Line=randomLine(mp3Theme);
mp3Line=replace(mp3Line,"%art",info.artist);
mp3Line=replace(mp3Line,"%tit",info.title);
@ -82,19 +82,19 @@ static int mpc_tell(char *word[], char *word_eol[], void *userdata){
//mp3Line=intReplace(mp3Line,"%perc",perc);
//mp3Line=replace(mp3Line,"%plTitle",title);
mp3Line=replace(mp3Line,"%file",tTitle);
xchat_command(ph, mp3Line);
hexchat_command(ph, mp3Line);
return HEXCHAT_EAT_ALL;
}
}
if (endsWith(tTitle,".ogg")==1){
xchat_printf(ph,"Ogg detected\n");
hexchat_printf(ph,"Ogg detected\n");
info = getOggHeader(tTitle);
if (info.artist!=NULL){
char *cbr;
if (info.cbr==1) cbr="CBR"; else cbr="VBR";
oggLine=randomLine(oggTheme);
//if (cue==1) oggLine=cueLine;
//xchat_printf(ph,"ogg-line: %s\n",oggLine);
//hexchat_printf(ph,"ogg-line: %s\n",oggLine);
oggLine=replace(oggLine,"%art",info.artist);
oggLine=replace(oggLine,"%tit",info.title);
oggLine=replace(oggLine,"%alb",info.album);
@ -111,39 +111,39 @@ static int mpc_tell(char *word[], char *word_eol[], void *userdata){
//oggLine=intReplace(oggLine,"%perc",perc);
//oggLine=replace(oggLine,"%plTitle",title);
oggLine=replace(oggLine,"%file",tTitle);
xchat_command(ph, oggLine);
hexchat_command(ph, oggLine);
return HEXCHAT_EAT_ALL;
}
}
}
line=randomLine(titleTheme);
line=replace(line,"%title", tTitle);
xchat_command(ph,line);
hexchat_command(ph,line);
return HEXCHAT_EAT_ALL;
}
int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg){
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg){
ph = plugin_handle;
*plugin_name = "mpcInfo";
*plugin_desc = "Information-Script for Media Player Classic";
*plugin_version=VERSION;
xchat_hook_command(ph, "mpc", HEXCHAT_PRI_NORM, mpc_tell,"no help text", 0);
xchat_hook_command(ph, "mpc_themes", HEXCHAT_PRI_NORM, print_themes,"no help text", 0);
xchat_hook_command(ph, "mpc_reloadthemes", HEXCHAT_PRI_NORM, mpc_themeReload,"no help text", 0);
xchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (MPC)\" \"MPC\"");
hexchat_hook_command(ph, "mpc", HEXCHAT_PRI_NORM, mpc_tell,"no help text", 0);
hexchat_hook_command(ph, "mpc_themes", HEXCHAT_PRI_NORM, print_themes,"no help text", 0);
hexchat_hook_command(ph, "mpc_reloadthemes", HEXCHAT_PRI_NORM, mpc_themeReload,"no help text", 0);
hexchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (MPC)\" \"MPC\"");
themeInit();
loadThemes();
xchat_printf(ph, "%s %s plugin loaded\n",*plugin_name, VERSION);
hexchat_printf(ph, "%s %s plugin loaded\n",*plugin_name, VERSION);
return 1;
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_command (ph, "MENU DEL \"Window/Display Current Song (MPC)\"");
xchat_print (ph, "mpcInfo plugin unloaded\n");
hexchat_command (ph, "MENU DEL \"Window/Display Current Song (MPC)\"");
hexchat_print (ph, "mpcInfo plugin unloaded\n");
return 1;
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -51,7 +51,7 @@ struct tagInfo getOggHeader(char *file){
info.artist=NULL;
f = fopen(file,"rb");
if (f==NULL){
xchat_print(ph,"file not found while trying to read ogg header");
hexchat_print(ph,"file not found while trying to read ogg header");
//if (DEBUG==1) putlog("file not found while trying to read ogg header");
return info;
}

View File

@ -39,14 +39,14 @@ void themeInit(){
void printTheme(struct theme data){
int i;
for (i=0;i<data.size;i++) xchat_printf(ph,"line[%i]=%s\n",i,data.line[i]);
for (i=0;i<data.size;i++) hexchat_printf(ph,"line[%i]=%s\n",i,data.line[i]);
}
void printThemes(){
xchat_printf(ph,"\nNotRun-Theme:\n");printTheme(notRunTheme);
xchat_printf(ph,"\nMP3-Theme:\n");printTheme(mp3Theme);
xchat_printf(ph,"\nOGG-Theme:\n");printTheme(oggTheme);
xchat_printf(ph,"\nTitle-Theme:\n");printTheme(titleTheme);
hexchat_printf(ph,"\nNotRun-Theme:\n");printTheme(notRunTheme);
hexchat_printf(ph,"\nMP3-Theme:\n");printTheme(mp3Theme);
hexchat_printf(ph,"\nOGG-Theme:\n");printTheme(oggTheme);
hexchat_printf(ph,"\nTitle-Theme:\n");printTheme(titleTheme);
}
void cbFix(char *line){
@ -85,18 +85,18 @@ struct theme themeAdd(struct theme data, char *info){
void loadThemes(){
char *hDir, *hFile, *line, *val;
FILE *f;
xchat_print(ph,"loading themes\n");
hexchat_print(ph,"loading themes\n");
hDir=(char*)calloc(1024,sizeof(char));
strcpy(hDir,xchat_get_info(ph,"xchatdirfs"));
strcpy(hDir,hexchat_get_info(ph,"xchatdirfs"));
hFile=str3cat(hDir,"\\","mpcInfo.theme.txt");
f = fopen(hFile,"r");
if(f==NULL)
{
xchat_print(ph,"no theme in homedir, checking global theme");
hexchat_print(ph,"no theme in homedir, checking global theme");
f=fopen("mpcInfo.theme.txt","r");
}
//xchat_printf(ph,"file_desc: %p\n",f);
if (f==NULL) xchat_print(ph, "no theme found, using hardcoded\n");
//hexchat_printf(ph,"file_desc: %p\n",f);
if (f==NULL) hexchat_print(ph, "no theme found, using hardcoded\n");
else {
if (f > 0)
{
@ -118,7 +118,7 @@ void loadThemes(){
if (strcmp(toUpper(line),"OGG_LINE")==0) mp3Theme=themeAdd(oggTheme,val);
}
fclose(f);
xchat_print(ph, "theme loaded successfull\n");
hexchat_print(ph, "theme loaded successfull\n");
}
if (notRunTheme.size==0) notRunTheme=themeAdd(notRunTheme,"say Media Player Classic not running");
if (titleTheme.size==0) titleTheme=themeAdd(titleTheme,"say Playing %title in Media Player Classic");

View File

@ -8,7 +8,7 @@ use warnings;
# filename
# The full path to the script.
# gui_entry
# This is xchat_plugin pointer that is used to remove the script from
# This is hexchat_plugin pointer that is used to remove the script from
# Plugins and Scripts window when a script is unloaded. This has also
# been converted with the PTR2IV() macro.
# hooks

View File

@ -39,7 +39,7 @@
#endif
#include "hexchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static int perl_load_file (char *script_name);
@ -144,9 +144,9 @@ perl_auto_load (void *unused)
#endif
/* get the dir in local filesystem encoding (what opendir() expects!) */
xdir = xchat_get_info (ph, "xchatdirfs");
xdir = hexchat_get_info (ph, "xchatdirfs");
if (!xdir) /* xchatdirfs is new for 2.0.9, will fail on older */
xdir = xchat_get_info (ph, "xchatdir");
xdir = hexchat_get_info (ph, "xchatdir");
/* don't pollute the filesystem with script files, this only causes misuse of the folders
* only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */
@ -187,8 +187,8 @@ typedef struct
{
SV *callback;
SV *userdata;
xchat_hook *hook; /* required for timers */
xchat_context *ctx; /* allow timers to remember their context */
hexchat_hook *hook; /* required for timers */
hexchat_context *ctx; /* allow timers to remember their context */
SV *package; /* need to track the package name when removing hooks
by returning REMOVE
*/
@ -218,10 +218,10 @@ execute_perl (SV * function, char *args)
count = call_sv (function, G_EVAL | G_SCALAR);
SPAGAIN;
if (SvTRUE (ERRSV)) {
xchat_printf(ph, "Perl error: %s\n", SvPV_nolen (ERRSV));
hexchat_printf(ph, "Perl error: %s\n", SvPV_nolen (ERRSV));
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
} else if (count != 1) {
xchat_printf (ph, "Perl error: expected 1 value from %s, "
hexchat_printf (ph, "Perl error: expected 1 value from %s, "
"got: %d\n", SvPV_nolen (function), count);
} else {
ret_value = POPi;
@ -263,7 +263,7 @@ get_filename (char *word[], char *word_eol[])
}
static SV *
list_item_to_sv ( xchat_list *list, const char *const *fields )
list_item_to_sv ( hexchat_list *list, const char *const *fields )
{
HV *hash = newHV();
SV *field_value;
@ -278,7 +278,7 @@ list_item_to_sv ( xchat_list *list, const char *const *fields )
switch (fields[field_index][0]) {
case 's':
field = xchat_list_str (ph, list, field_name);
field = hexchat_list_str (ph, list, field_name);
if (field != NULL) {
field_value = newSVpvn (field, strlen (field));
} else {
@ -286,14 +286,14 @@ list_item_to_sv ( xchat_list *list, const char *const *fields )
}
break;
case 'p':
field_value = newSViv (PTR2IV (xchat_list_str (ph, list,
field_value = newSViv (PTR2IV (hexchat_list_str (ph, list,
field_name)));
break;
case 'i':
field_value = newSVuv (xchat_list_int (ph, list, field_name));
field_value = newSVuv (hexchat_list_int (ph, list, field_name));
break;
case 't':
field_value = newSVnv (xchat_list_time (ph, list, field_name));
field_value = newSVnv (hexchat_list_time (ph, list, field_name));
break;
default:
field_value = &PL_sv_undef;
@ -354,12 +354,12 @@ fd_cb (int fd, int flags, void *userdata)
SPAGAIN;
if (SvTRUE (ERRSV)) {
xchat_printf (ph, "Error in fd callback %s", SvPV_nolen (ERRSV));
hexchat_printf (ph, "Error in fd callback %s", SvPV_nolen (ERRSV));
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
retVal = HEXCHAT_EAT_ALL;
} else {
if (count != 1) {
xchat_print (ph, "Fd handler should only return 1 value.");
hexchat_print (ph, "Fd handler should only return 1 value.");
retVal = HEXCHAT_EAT_NONE;
} else {
retVal = POPi;
@ -406,7 +406,7 @@ timer_cb (void *userdata)
PUTBACK;
if (data->ctx) {
xchat_set_context (ph, data->ctx);
hexchat_set_context (ph, data->ctx);
}
set_current_package (data->package);
@ -415,12 +415,12 @@ timer_cb (void *userdata)
SPAGAIN;
if (SvTRUE (ERRSV)) {
xchat_printf (ph, "Error in timer callback %s", SvPV_nolen (ERRSV));
hexchat_printf (ph, "Error in timer callback %s", SvPV_nolen (ERRSV));
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
retVal = HEXCHAT_EAT_ALL;
} else {
if (count != 1) {
xchat_print (ph, "Timer handler should only return 1 value.");
hexchat_print (ph, "Timer handler should only return 1 value.");
retVal = HEXCHAT_EAT_NONE;
} else {
retVal = POPi;
@ -459,7 +459,7 @@ server_cb (char *word[], char *word_eol[], void *userdata)
if (data->depth)
return HEXCHAT_EAT_NONE;
/* xchat_printf (ph, */
/* hexchat_printf (ph, */
/* "Recieved %d words in server callback", av_len (wd)); */
PUSHMARK (SP);
XPUSHs (newRV_noinc ((SV *) array2av (word)));
@ -474,12 +474,12 @@ server_cb (char *word[], char *word_eol[], void *userdata)
data->depth--;
SPAGAIN;
if (SvTRUE (ERRSV)) {
xchat_printf (ph, "Error in server callback %s", SvPV_nolen (ERRSV));
hexchat_printf (ph, "Error in server callback %s", SvPV_nolen (ERRSV));
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
retVal = HEXCHAT_EAT_NONE;
} else {
if (count != 1) {
xchat_print (ph, "Server handler should only return 1 value.");
hexchat_print (ph, "Server handler should only return 1 value.");
retVal = HEXCHAT_EAT_NONE;
} else {
retVal = POPi;
@ -508,7 +508,7 @@ command_cb (char *word[], char *word_eol[], void *userdata)
if (data->depth)
return HEXCHAT_EAT_NONE;
/* xchat_printf (ph, "Recieved %d words in command callback", */
/* hexchat_printf (ph, "Recieved %d words in command callback", */
/* av_len (wd)); */
PUSHMARK (SP);
XPUSHs (newRV_noinc ((SV *) array2av (word)));
@ -523,12 +523,12 @@ command_cb (char *word[], char *word_eol[], void *userdata)
data->depth--;
SPAGAIN;
if (SvTRUE (ERRSV)) {
xchat_printf (ph, "Error in command callback %s", SvPV_nolen (ERRSV));
hexchat_printf (ph, "Error in command callback %s", SvPV_nolen (ERRSV));
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
retVal = HEXCHAT_EAT_XCHAT;
} else {
if (count != 1) {
xchat_print (ph, "Command handler should only return 1 value.");
hexchat_print (ph, "Command handler should only return 1 value.");
retVal = HEXCHAT_EAT_NONE;
} else {
retVal = POPi;
@ -586,7 +586,7 @@ print_cb (char *word[], void *userdata)
}
}
/*xchat_printf (ph, "Recieved %d words in print callback", av_len (wd)+1); */
/*hexchat_printf (ph, "Recieved %d words in print callback", av_len (wd)+1); */
PUSHMARK (SP);
XPUSHs (newRV_noinc ((SV *) wd));
XPUSHs (data->userdata);
@ -599,12 +599,12 @@ print_cb (char *word[], void *userdata)
data->depth--;
SPAGAIN;
if (SvTRUE (ERRSV)) {
xchat_printf (ph, "Error in print callback %s", SvPV_nolen (ERRSV));
hexchat_printf (ph, "Error in print callback %s", SvPV_nolen (ERRSV));
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
retVal = HEXCHAT_EAT_NONE;
} else {
if (count != 1) {
xchat_print (ph, "Print handler should only return 1 value.");
hexchat_print (ph, "Print handler should only return 1 value.");
retVal = HEXCHAT_EAT_NONE;
} else {
retVal = POPi;
@ -632,7 +632,7 @@ XS (XS_Xchat_register)
void *gui_entry;
dXSARGS;
if (items != 4) {
xchat_printf (ph,
hexchat_printf (ph,
"Usage: Xchat::Internal::register(scriptname, version, desc, filename)");
} else {
name = SvPV_nolen (ST (0));
@ -640,7 +640,7 @@ XS (XS_Xchat_register)
desc = SvPV_nolen (ST (2));
filename = SvPV_nolen (ST (3));
gui_entry = xchat_plugingui_add (ph, filename, name,
gui_entry = hexchat_plugingui_add (ph, filename, name,
desc, version, NULL);
XSRETURN_IV (PTR2IV (gui_entry));
@ -658,10 +658,10 @@ XS (XS_Xchat_print)
dXSARGS;
if (items != 1) {
xchat_print (ph, "Usage: Xchat::Internal::print(text)");
hexchat_print (ph, "Usage: Xchat::Internal::print(text)");
} else {
text = SvPV_nolen (ST (0));
xchat_print (ph, text);
hexchat_print (ph, text);
}
XSRETURN_EMPTY;
}
@ -675,7 +675,7 @@ XS (XS_Xchat_emit_print)
dXSARGS;
if (items < 1) {
xchat_print (ph, "Usage: Xchat::emit_print(event_name, ...)");
hexchat_print (ph, "Usage: Xchat::emit_print(event_name, ...)");
} else {
event_name = (char *) SvPV_nolen (ST (0));
RETVAL = 0;
@ -689,25 +689,25 @@ XS (XS_Xchat_emit_print)
switch (count) {
case 1:
RETVAL = xchat_emit_print (ph, event_name, NULL);
RETVAL = hexchat_emit_print (ph, event_name, NULL);
break;
case 2:
RETVAL = xchat_emit_print (ph, event_name,
RETVAL = hexchat_emit_print (ph, event_name,
SvPV_nolen (ST (1)), NULL);
break;
case 3:
RETVAL = xchat_emit_print (ph, event_name,
RETVAL = hexchat_emit_print (ph, event_name,
SvPV_nolen (ST (1)),
SvPV_nolen (ST (2)), NULL);
break;
case 4:
RETVAL = xchat_emit_print (ph, event_name,
RETVAL = hexchat_emit_print (ph, event_name,
SvPV_nolen (ST (1)),
SvPV_nolen (ST (2)),
SvPV_nolen (ST (3)), NULL);
break;
case 5:
RETVAL = xchat_emit_print (ph, event_name,
RETVAL = hexchat_emit_print (ph, event_name,
SvPV_nolen (ST (1)),
SvPV_nolen (ST (2)),
SvPV_nolen (ST (3)),
@ -734,7 +734,7 @@ XS (XS_Xchat_send_modes)
dXSARGS;
if (items < 3 || items > 4) {
xchat_print (ph,
hexchat_print (ph,
"Usage: Xchat::send_modes( targets, sign, mode, modes_per_line)"
);
} else {
@ -768,7 +768,7 @@ XS (XS_Xchat_send_modes)
modes_per_line = (int) SvIV (ST (3));
}
xchat_send_modes (ph, targets, target_count, modes_per_line, sign, mode);
hexchat_send_modes (ph, targets, target_count, modes_per_line, sign, mode);
free (targets);
}
}
@ -778,12 +778,12 @@ XS (XS_Xchat_get_info)
SV *temp = NULL;
dXSARGS;
if (items != 1) {
xchat_print (ph, "Usage: Xchat::get_info(id)");
hexchat_print (ph, "Usage: Xchat::get_info(id)");
} else {
SV *id = ST (0);
const char *RETVAL;
RETVAL = xchat_get_info (ph, SvPV_nolen (id));
RETVAL = hexchat_get_info (ph, SvPV_nolen (id));
if (RETVAL == NULL) {
XSRETURN_UNDEF;
}
@ -817,9 +817,9 @@ XS (XS_Xchat_context_info)
dXSARGS;
if (items > 0 ) {
xchat_print (ph, "Usage: Xchat::Internal::context_info()");
hexchat_print (ph, "Usage: Xchat::Internal::context_info()");
}
fields = xchat_list_fields (ph, "channels" );
fields = hexchat_list_fields (ph, "channels" );
XPUSHs (list_item_to_sv (NULL, fields));
XSRETURN (1);
}
@ -832,7 +832,7 @@ XS (XS_Xchat_get_prefs)
SV *temp = NULL;
dXSARGS;
if (items != 1) {
xchat_print (ph, "Usage: Xchat::get_prefs(name)");
hexchat_print (ph, "Usage: Xchat::get_prefs(name)");
} else {
@ -871,13 +871,13 @@ XS (XS_Xchat_hook_server)
SV *callback;
SV *userdata;
SV *package;
xchat_hook *hook;
hexchat_hook *hook;
HookData *data;
dXSARGS;
if (items != 5) {
xchat_print (ph,
hexchat_print (ph,
"Usage: Xchat::Internal::hook_server(name, priority, callback, userdata, package)");
} else {
name = SvPV_nolen (ST (0));
@ -896,7 +896,7 @@ XS (XS_Xchat_hook_server)
data->depth = 0;
data->package = newSVsv (package);
hook = xchat_hook_server (ph, name, pri, server_cb, data);
hook = hexchat_hook_server (ph, name, pri, server_cb, data);
XSRETURN_IV (PTR2IV (hook));
}
@ -912,13 +912,13 @@ XS (XS_Xchat_hook_command)
char *help_text = NULL;
SV *userdata;
SV *package;
xchat_hook *hook;
hexchat_hook *hook;
HookData *data;
dXSARGS;
if (items != 6) {
xchat_print (ph,
hexchat_print (ph,
"Usage: Xchat::Internal::hook_command(name, priority, callback, help_text, userdata, package)");
} else {
name = SvPV_nolen (ST (0));
@ -944,7 +944,7 @@ XS (XS_Xchat_hook_command)
data->userdata = newSVsv (userdata);
data->depth = 0;
data->package = newSVsv (package);
hook = xchat_hook_command (ph, name, pri, command_cb, help_text, data);
hook = hexchat_hook_command (ph, name, pri, command_cb, help_text, data);
XSRETURN_IV (PTR2IV (hook));
}
@ -961,11 +961,11 @@ XS (XS_Xchat_hook_print)
SV *callback;
SV *userdata;
SV *package;
xchat_hook *hook;
hexchat_hook *hook;
HookData *data;
dXSARGS;
if (items != 5) {
xchat_print (ph,
hexchat_print (ph,
"Usage: Xchat::Internal::hook_print(name, priority, callback, userdata, package)");
} else {
name = SvPV_nolen (ST (0));
@ -984,7 +984,7 @@ XS (XS_Xchat_hook_print)
data->userdata = newSVsv (userdata);
data->depth = 0;
data->package = newSVsv (package);
hook = xchat_hook_print (ph, name, pri, print_cb, data);
hook = hexchat_hook_print (ph, name, pri, print_cb, data);
XSRETURN_IV (PTR2IV (hook));
}
@ -997,14 +997,14 @@ XS (XS_Xchat_hook_timer)
int timeout;
SV *callback;
SV *userdata;
xchat_hook *hook;
hexchat_hook *hook;
SV *package;
HookData *data;
dXSARGS;
if (items != 4) {
xchat_print (ph,
hexchat_print (ph,
"Usage: Xchat::Internal::hook_timer(timeout, callback, userdata, package)");
} else {
timeout = (int) SvIV (ST (0));
@ -1020,9 +1020,9 @@ XS (XS_Xchat_hook_timer)
data->callback = newSVsv (callback);
data->userdata = newSVsv (userdata);
data->ctx = xchat_get_context (ph);
data->ctx = hexchat_get_context (ph);
data->package = newSVsv (package);
hook = xchat_hook_timer (ph, timeout, timer_cb, data);
hook = hexchat_hook_timer (ph, timeout, timer_cb, data);
data->hook = hook;
XSRETURN_IV (PTR2IV (hook));
@ -1038,13 +1038,13 @@ XS (XS_Xchat_hook_fd)
int flags;
SV *userdata;
SV *package;
xchat_hook *hook;
hexchat_hook *hook;
HookData *data;
dXSARGS;
if (items != 4) {
xchat_print (ph,
hexchat_print (ph,
"Usage: Xchat::Internal::hook_fd(fd, callback, flags, userdata)");
} else {
fd = (int) SvIV (ST (0));
@ -1061,7 +1061,7 @@ XS (XS_Xchat_hook_fd)
*/
fd = _get_osfhandle(fd);
if (fd < 0) {
xchat_print(ph, "Invalid file descriptor");
hexchat_print(ph, "Invalid file descriptor");
XSRETURN_UNDEF;
}
}
@ -1076,7 +1076,7 @@ XS (XS_Xchat_hook_fd)
data->userdata = newSVsv (userdata);
data->depth = 0;
data->package = newSVsv (package);
hook = xchat_hook_fd (ph, fd, flags, fd_cb, data);
hook = hexchat_hook_fd (ph, fd, flags, fd_cb, data);
data->hook = hook;
XSRETURN_IV (PTR2IV (hook));
@ -1086,15 +1086,15 @@ XS (XS_Xchat_hook_fd)
static
XS (XS_Xchat_unhook)
{
xchat_hook *hook;
hexchat_hook *hook;
HookData *userdata;
int retCount = 0;
dXSARGS;
if (items != 1) {
xchat_print (ph, "Usage: Xchat::unhook(hook)");
hexchat_print (ph, "Usage: Xchat::unhook(hook)");
} else {
hook = INT2PTR (xchat_hook *, SvUV (ST (0)));
userdata = (HookData *) xchat_unhook (ph, hook);
hook = INT2PTR (hexchat_hook *, SvUV (ST (0)));
userdata = (HookData *) hexchat_unhook (ph, hook);
if (userdata != NULL) {
if (userdata->callback != NULL) {
@ -1126,10 +1126,10 @@ XS (XS_Xchat_command)
dXSARGS;
if (items != 1) {
xchat_print (ph, "Usage: Xchat::Internal::command(command)");
hexchat_print (ph, "Usage: Xchat::Internal::command(command)");
} else {
cmd = SvPV_nolen (ST (0));
xchat_command (ph, cmd);
hexchat_command (ph, cmd);
}
XSRETURN_EMPTY;
@ -1140,11 +1140,11 @@ XS (XS_Xchat_find_context)
{
char *server = NULL;
char *chan = NULL;
xchat_context *RETVAL;
hexchat_context *RETVAL;
dXSARGS;
if (items > 2)
xchat_print (ph, "Usage: Xchat::find_context ([channel, [server]])");
hexchat_print (ph, "Usage: Xchat::find_context ([channel, [server]])");
{
switch (items) {
@ -1156,9 +1156,9 @@ XS (XS_Xchat_find_context)
/* otherwise leave it as null */
if (SvTRUE (ST (0)) || SvNIOK (ST (0))) {
chan = SvPV_nolen (ST (0));
/* xchat_printf( ph, "XSUB - find_context( %s, NULL )", chan ); */
/* hexchat_printf( ph, "XSUB - find_context( %s, NULL )", chan ); */
}
/* else { xchat_print( ph, "XSUB - find_context( NULL, NULL )" ); } */
/* else { hexchat_print( ph, "XSUB - find_context( NULL, NULL )" ); } */
/* chan is already NULL */
break;
case 2: /* server and channel */
@ -1166,26 +1166,26 @@ XS (XS_Xchat_find_context)
/* otherwise leave it as NULL */
if (SvTRUE (ST (0)) || SvNIOK (ST (0))) {
chan = SvPV_nolen (ST (0));
/* xchat_printf( ph, "XSUB - find_context( %s, NULL )", SvPV_nolen(ST(0) )); */
/* hexchat_printf( ph, "XSUB - find_context( %s, NULL )", SvPV_nolen(ST(0) )); */
}
/* else { xchat_print( ph, "XSUB - 2 arg NULL chan" ); } */
/* else { hexchat_print( ph, "XSUB - 2 arg NULL chan" ); } */
/* change server value only if it is true or 0 */
/* otherwise leave it as NULL */
if (SvTRUE (ST (1)) || SvNIOK (ST (1))) {
server = SvPV_nolen (ST (1));
/* xchat_printf( ph, "XSUB - find_context( NULL, %s )", SvPV_nolen(ST(1) )); */
/* hexchat_printf( ph, "XSUB - find_context( NULL, %s )", SvPV_nolen(ST(1) )); */
}
/* else { xchat_print( ph, "XSUB - 2 arg NULL server" ); } */
/* else { hexchat_print( ph, "XSUB - 2 arg NULL server" ); } */
break;
}
RETVAL = xchat_find_context (ph, server, chan);
RETVAL = hexchat_find_context (ph, server, chan);
if (RETVAL != NULL) {
/* xchat_print (ph, "XSUB - context found"); */
/* hexchat_print (ph, "XSUB - context found"); */
XSRETURN_IV (PTR2IV (RETVAL));
} else {
/* xchat_print (ph, "XSUB - context not found"); */
/* hexchat_print (ph, "XSUB - context not found"); */
XSRETURN_UNDEF;
}
}
@ -1196,22 +1196,22 @@ XS (XS_Xchat_get_context)
{
dXSARGS;
if (items != 0) {
xchat_print (ph, "Usage: Xchat::get_context()");
hexchat_print (ph, "Usage: Xchat::get_context()");
} else {
XSRETURN_IV (PTR2IV (xchat_get_context (ph)));
XSRETURN_IV (PTR2IV (hexchat_get_context (ph)));
}
}
static
XS (XS_Xchat_set_context)
{
xchat_context *ctx;
hexchat_context *ctx;
dXSARGS;
if (items != 1) {
xchat_print (ph, "Usage: Xchat::set_context(ctx)");
hexchat_print (ph, "Usage: Xchat::set_context(ctx)");
} else {
ctx = INT2PTR (xchat_context *, SvUV (ST (0)));
XSRETURN_IV ((IV) xchat_set_context (ph, ctx));
ctx = INT2PTR (hexchat_context *, SvUV (ST (0)));
XSRETURN_IV ((IV) hexchat_set_context (ph, ctx));
}
}
@ -1220,9 +1220,9 @@ XS (XS_Xchat_nickcmp)
{
dXSARGS;
if (items != 2) {
xchat_print (ph, "Usage: Xchat::nickcmp(s1, s2)");
hexchat_print (ph, "Usage: Xchat::nickcmp(s1, s2)");
} else {
XSRETURN_IV ((IV) xchat_nickcmp (ph, SvPV_nolen (ST (0)),
XSRETURN_IV ((IV) hexchat_nickcmp (ph, SvPV_nolen (ST (0)),
SvPV_nolen (ST (1))));
}
}
@ -1231,37 +1231,37 @@ static
XS (XS_Xchat_get_list)
{
SV *name;
xchat_list *list;
hexchat_list *list;
const char *const *fields;
int count = 0; /* return value for scalar context */
dXSARGS;
if (items != 1) {
xchat_print (ph, "Usage: Xchat::get_list(name)");
hexchat_print (ph, "Usage: Xchat::get_list(name)");
} else {
SP -= items; /*remove the argument list from the stack */
name = ST (0);
list = xchat_list_get (ph, SvPV_nolen (name));
list = hexchat_list_get (ph, SvPV_nolen (name));
if (list == NULL) {
XSRETURN_EMPTY;
}
if (GIMME_V == G_SCALAR) {
while (xchat_list_next (ph, list)) {
while (hexchat_list_next (ph, list)) {
count++;
}
xchat_list_free (ph, list);
hexchat_list_free (ph, list);
XSRETURN_IV ((IV) count);
}
fields = xchat_list_fields (ph, SvPV_nolen (name));
while (xchat_list_next (ph, list)) {
fields = hexchat_list_fields (ph, SvPV_nolen (name));
while (hexchat_list_next (ph, list)) {
XPUSHs (list_item_to_sv (list, fields));
}
xchat_list_free (ph, list);
hexchat_list_free (ph, list);
PUTBACK;
return;
@ -1274,10 +1274,10 @@ XS (XS_Xchat_Embed_plugingui_remove)
void *gui_entry;
dXSARGS;
if (items != 1) {
xchat_print (ph, "Usage: Xchat::Embed::plugingui_remove(handle)");
hexchat_print (ph, "Usage: Xchat::Embed::plugingui_remove(handle)");
} else {
gui_entry = INT2PTR (void *, SvUV (ST (0)));
xchat_plugingui_remove (ph, gui_entry);
hexchat_plugingui_remove (ph, gui_entry);
}
XSRETURN_EMPTY;
}
@ -1535,7 +1535,7 @@ perl_command_reload (char *word[], char *word_eol[], void *userdata)
}
void
xchat_plugin_get_info (char **name, char **desc, char **version,
hexchat_plugin_get_info (char **name, char **desc, char **version,
void **reserved)
{
*name = "Perl";
@ -1551,11 +1551,11 @@ xchat_plugin_get_info (char **name, char **desc, char **version,
static int initialized = 0;
int
xchat_plugin_init (xchat_plugin * plugin_handle, char **plugin_name,
hexchat_plugin_init (hexchat_plugin * plugin_handle, char **plugin_name,
char **plugin_desc, char **plugin_version, char *arg)
{
if (initialized != 0) {
xchat_print (plugin_handle, "Perl interface already loaded\n");
hexchat_print (plugin_handle, "Perl interface already loaded\n");
return 0;
}
@ -1566,33 +1566,33 @@ xchat_plugin_init (xchat_plugin * plugin_handle, char **plugin_name,
*plugin_desc = "Perl scripting interface";
*plugin_version = PACKAGE_VERSION;
xchat_hook_command (ph, "load", HEXCHAT_PRI_NORM, perl_command_load, 0, 0);
xchat_hook_command (ph, "unload", HEXCHAT_PRI_NORM, perl_command_unload, 0,
hexchat_hook_command (ph, "load", HEXCHAT_PRI_NORM, perl_command_load, 0, 0);
hexchat_hook_command (ph, "unload", HEXCHAT_PRI_NORM, perl_command_unload, 0,
0);
xchat_hook_command (ph, "reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
hexchat_hook_command (ph, "reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
0);
xchat_hook_command (ph, "pl_reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
hexchat_hook_command (ph, "pl_reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
0);
xchat_hook_command (ph, "unloadall", HEXCHAT_PRI_NORM,
hexchat_hook_command (ph, "unloadall", HEXCHAT_PRI_NORM,
perl_command_unloadall, 0, 0);
xchat_hook_command (ph, "reloadall", HEXCHAT_PRI_NORM,
hexchat_hook_command (ph, "reloadall", HEXCHAT_PRI_NORM,
perl_command_reloadall, 0, 0);
/*perl_init (); */
xchat_hook_timer (ph, 0, perl_auto_load, NULL );
hexchat_hook_timer (ph, 0, perl_auto_load, NULL );
xchat_print (ph, "Perl interface loaded\n");
hexchat_print (ph, "Perl interface loaded\n");
return 1;
}
int
xchat_plugin_deinit (xchat_plugin * plugin_handle)
hexchat_plugin_deinit (hexchat_plugin * plugin_handle)
{
perl_end ();
initialized = 0;
xchat_print (plugin_handle, "Perl interface unloaded\n");
hexchat_print (plugin_handle, "Perl interface unloaded\n");
return 1;
}

View File

@ -1,4 +1,4 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
xchat_plugin_get_info
hexchat_plugin_init
hexchat_plugin_deinit
hexchat_plugin_get_info

View File

@ -99,7 +99,7 @@
calls_thread = NULL; \
} \
if (calls_plugin) \
xchat_set_context(ph, \
hexchat_set_context(ph, \
Plugin_GetContext(calls_plugin)); \
while (0)
#define END_XCHAT_CALLS() \
@ -118,7 +118,7 @@
#define BEGIN_PLUGIN(plg) \
do { \
xchat_context *begin_plugin_ctx = xchat_get_context(ph); \
hexchat_context *begin_plugin_ctx = hexchat_get_context(ph); \
RELEASE_XCHAT_LOCK(); \
Plugin_AcquireThread(plg); \
Plugin_SetContext(plg, begin_plugin_ctx); \
@ -135,7 +135,7 @@ static PyThreadState *pTempThread;
#define BEGIN_PLUGIN(plg) \
do { \
xchat_context *begin_plugin_ctx = xchat_get_context(ph); \
hexchat_context *begin_plugin_ctx = hexchat_get_context(ph); \
RELEASE_XCHAT_LOCK(); \
PyEval_AcquireLock(); \
pTempThread = PyThreadState_Swap(((PluginObject *)(plg))->tstate); \
@ -194,7 +194,7 @@ typedef struct {
typedef struct {
PyObject_HEAD
xchat_context *context;
hexchat_context *context;
} ContextObject;
typedef struct {
@ -211,7 +211,7 @@ typedef struct {
char *description;
GSList *hooks;
PyThreadState *tstate;
xchat_context *context;
hexchat_context *context;
void *gui;
} PluginObject;
@ -247,7 +247,7 @@ static PyObject *Context_prnt(ContextObject *self, PyObject *args);
static PyObject *Context_get_info(ContextObject *self, PyObject *args);
static PyObject *Context_get_list(ContextObject *self, PyObject *args);
static PyObject *Context_compare(ContextObject *a, ContextObject *b, int op);
static PyObject *Context_FromContext(xchat_context *context);
static PyObject *Context_FromContext(hexchat_context *context);
static PyObject *Context_FromServerAndChannel(char *server, char *channel);
static PyObject *Plugin_New(char *filename, PyMethodDef *xchat_methods,
@ -259,30 +259,30 @@ static Hook *Plugin_AddHook(int type, PyObject *plugin, PyObject *callback,
static void Plugin_RemoveHook(PyObject *plugin, Hook *hook);
static void Plugin_RemoveAllHooks(PyObject *plugin);
static PyObject *Module_xchat_command(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_command(PyObject *self, PyObject *args);
static PyObject *Module_xchat_prnt(PyObject *self, PyObject *args);
static PyObject *Module_xchat_get_context(PyObject *self, PyObject *args);
static PyObject *Module_xchat_find_context(PyObject *self, PyObject *args,
static PyObject *Module_hexchat_get_context(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_find_context(PyObject *self, PyObject *args,
PyObject *kwargs);
static PyObject *Module_xchat_get_info(PyObject *self, PyObject *args);
static PyObject *Module_xchat_hook_command(PyObject *self, PyObject *args,
static PyObject *Module_hexchat_get_info(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_hook_command(PyObject *self, PyObject *args,
PyObject *kwargs);
static PyObject *Module_xchat_hook_server(PyObject *self, PyObject *args,
static PyObject *Module_hexchat_hook_server(PyObject *self, PyObject *args,
PyObject *kwargs);
static PyObject *Module_xchat_hook_print(PyObject *self, PyObject *args,
static PyObject *Module_hexchat_hook_print(PyObject *self, PyObject *args,
PyObject *kwargs);
static PyObject *Module_xchat_hook_timer(PyObject *self, PyObject *args,
static PyObject *Module_hexchat_hook_timer(PyObject *self, PyObject *args,
PyObject *kwargs);
static PyObject *Module_xchat_unhook(PyObject *self, PyObject *args);
static PyObject *Module_xchat_get_info(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_unhook(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_get_info(PyObject *self, PyObject *args);
static PyObject *Module_xchat_get_list(PyObject *self, PyObject *args);
static PyObject *Module_xchat_get_lists(PyObject *self, PyObject *args);
static PyObject *Module_xchat_nickcmp(PyObject *self, PyObject *args);
static PyObject *Module_xchat_strip(PyObject *self, PyObject *args);
static PyObject *Module_xchat_pluginpref_set(PyObject *self, PyObject *args);
static PyObject *Module_xchat_pluginpref_get(PyObject *self, PyObject *args);
static PyObject *Module_xchat_pluginpref_delete(PyObject *self, PyObject *args);
static PyObject *Module_xchat_pluginpref_list(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_nickcmp(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_strip(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_pluginpref_set(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_pluginpref_get(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_pluginpref_delete(PyObject *self, PyObject *args);
static PyObject *Module_hexchat_pluginpref_list(PyObject *self, PyObject *args);
static void IInterp_Exec(char *command);
static int IInterp_Cmd(char *word[], char *word_eol[], void *userdata);
@ -305,7 +305,7 @@ staticforward PyTypeObject ListItem_Type;
static PyThreadState *main_tstate = NULL;
static void *thread_timer = NULL;
static xchat_plugin *ph;
static hexchat_plugin *ph;
static GSList *plugin_list = NULL;
static PyObject *interp_plugin = NULL;
@ -393,13 +393,13 @@ Util_Autoload()
char *sub_dir;
/* we need local filesystem encoding for chdir, opendir etc */
xdir = xchat_get_info(ph, "xchatdirfs");
xdir = hexchat_get_info(ph, "xchatdirfs");
/* don't pollute the filesystem with script files, this only causes misuse of the folders
* only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */
#if 0
/* auto-load from ~/.config/hexchat/ or %APPDATA%\HexChat\ */
Util_Autoload_from(xchat_get_info(ph, "xchatdirfs"));
Util_Autoload_from(hexchat_get_info(ph, "xchatdirfs"));
#endif
/* auto-load from subdirectory addons */
@ -449,7 +449,7 @@ Util_Expand(char *filename)
g_free(expanded);
/* Check if ~/.config/hexchat/addons/<filename> exists. */
expanded = g_build_filename(xchat_get_info(ph, "xchatdir"),
expanded = g_build_filename(hexchat_get_info(ph, "xchatdir"),
"addons", filename, NULL);
if (g_file_test(expanded, G_FILE_TEST_EXISTS))
return expanded;
@ -542,7 +542,7 @@ Callback_Print(char *word[], void *userdata)
listsize++;
word_eol = (char **) g_malloc(sizeof(char*)*(listsize+1));
if (word_eol == NULL) {
xchat_print(ph, "Not enough memory to alloc word_eol "
hexchat_print(ph, "Not enough memory to alloc word_eol "
"for python plugin callback.");
return 0;
}
@ -552,7 +552,7 @@ Callback_Print(char *word[], void *userdata)
/* Then join it. */
word_eol_raw = g_strjoinv(" ", word_eol);
if (word_eol_raw == NULL) {
xchat_print(ph, "Not enough memory to alloc word_eol_raw "
hexchat_print(ph, "Not enough memory to alloc word_eol_raw "
"for python plugin callback.");
return 0;
}
@ -700,7 +700,7 @@ XChatOut_write(PyObject *self, PyObject *args)
xchatout_buffer_size += data_size*2+16;
new_buffer = g_realloc(xchatout_buffer, xchatout_buffer_size);
if (new_buffer == NULL) {
xchat_print(ph, "Not enough memory to print");
hexchat_print(ph, "Not enough memory to print");
/* The system is out of resources. Let's help. */
g_free(xchatout_buffer);
xchatout_buffer = NULL;
@ -728,7 +728,7 @@ XChatOut_write(PyObject *self, PyObject *args)
if (*pos == '\n') {
/* Crop it, inserting the string limiter there. */
*pos = 0;
xchat_print(ph, xchatout_buffer);
hexchat_print(ph, xchatout_buffer);
if (print_limit < new_buffer_pos) {
/* There's still data to be printed. */
print_limit += 1; /* Include the limiter. */
@ -830,8 +830,8 @@ Context_command(ContextObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:command", &text))
return NULL;
BEGIN_XCHAT_CALLS(ALLOW_THREADS);
xchat_set_context(ph, self->context);
xchat_command(ph, text);
hexchat_set_context(ph, self->context);
hexchat_command(ph, text);
END_XCHAT_CALLS();
Py_INCREF(Py_None);
return Py_None;
@ -844,8 +844,8 @@ Context_prnt(ContextObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:prnt", &text))
return NULL;
BEGIN_XCHAT_CALLS(ALLOW_THREADS);
xchat_set_context(ph, self->context);
xchat_print(ph, text);
hexchat_set_context(ph, self->context);
hexchat_print(ph, text);
END_XCHAT_CALLS();
Py_INCREF(Py_None);
return Py_None;
@ -864,8 +864,8 @@ Context_emit_print(ContextObject *self, PyObject *args)
&argv[6], &argv[7], &argv[8]))
return NULL;
BEGIN_XCHAT_CALLS(ALLOW_THREADS);
xchat_set_context(ph, self->context);
res = xchat_emit_print(ph, name, argv[0], argv[1], argv[2],
hexchat_set_context(ph, self->context);
res = hexchat_emit_print(ph, name, argv[0], argv[1], argv[2],
argv[3], argv[4], argv[5],
argv[6], argv[7], argv[8]);
END_XCHAT_CALLS();
@ -880,8 +880,8 @@ Context_get_info(ContextObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:get_info", &name))
return NULL;
BEGIN_XCHAT_CALLS(NONE);
xchat_set_context(ph, self->context);
info = xchat_get_info(ph, name);
hexchat_set_context(ph, self->context);
info = hexchat_get_info(ph, name);
END_XCHAT_CALLS();
if (info == NULL) {
Py_INCREF(Py_None);
@ -894,7 +894,7 @@ static PyObject *
Context_get_list(ContextObject *self, PyObject *args)
{
PyObject *plugin = Plugin_GetCurrent();
xchat_context *saved_context = Plugin_GetContext(plugin);
hexchat_context *saved_context = Plugin_GetContext(plugin);
PyObject *ret;
Plugin_SetContext(plugin, self->context);
ret = Module_xchat_get_list((PyObject*)self, args);
@ -978,7 +978,7 @@ statichere PyTypeObject Context_Type = {
};
static PyObject *
Context_FromContext(xchat_context *context)
Context_FromContext(hexchat_context *context)
{
ContextObject *ctxobj = PyObject_New(ContextObject, &Context_Type);
if (ctxobj != NULL)
@ -990,9 +990,9 @@ static PyObject *
Context_FromServerAndChannel(char *server, char *channel)
{
ContextObject *ctxobj;
xchat_context *context;
hexchat_context *context;
BEGIN_XCHAT_CALLS(NONE);
context = xchat_find_context(ph, server, channel);
context = hexchat_find_context(ph, server, channel);
END_XCHAT_CALLS();
if (context == NULL)
return NULL;
@ -1098,20 +1098,20 @@ ListItem_New(const char *listname)
o = PyObject_GetAttrString(m, "__module_" #x "__"); \
if (o == NULL) { \
if (force) { \
xchat_print(ph, "Module has no __module_" #x "__ " \
hexchat_print(ph, "Module has no __module_" #x "__ " \
"defined"); \
goto error; \
} \
plugin->x = g_strdup(""); \
} else {\
if (!PyString_Check(o)) { \
xchat_print(ph, "Variable __module_" #x "__ " \
hexchat_print(ph, "Variable __module_" #x "__ " \
"must be a string"); \
goto error; \
} \
plugin->x = g_strdup(PyString_AsString(o)); \
if (plugin->x == NULL) { \
xchat_print(ph, "Not enough memory to allocate " #x); \
hexchat_print(ph, "Not enough memory to allocate " #x); \
goto error; \
} \
}
@ -1127,7 +1127,7 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
char *old_filename = filename;
filename = Util_Expand(filename);
if (filename == NULL) {
xchat_printf(ph, "File not found: %s", old_filename);
hexchat_printf(ph, "File not found: %s", old_filename);
return NULL;
}
}
@ -1135,7 +1135,7 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
/* Allocate plugin structure. */
plugin = PyObject_New(PluginObject, &Plugin_Type);
if (plugin == NULL) {
xchat_print(ph, "Can't create plugin object");
hexchat_print(ph, "Can't create plugin object");
goto error;
}
@ -1144,13 +1144,13 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
Plugin_SetFilename(plugin, NULL);
Plugin_SetDescription(plugin, NULL);
Plugin_SetHooks(plugin, NULL);
Plugin_SetContext(plugin, xchat_get_context(ph));
Plugin_SetContext(plugin, hexchat_get_context(ph));
/* Start a new interpreter environment for this plugin. */
PyEval_AcquireLock();
plugin->tstate = Py_NewInterpreter();
if (plugin->tstate == NULL) {
xchat_print(ph, "Can't create interpreter state");
hexchat_print(ph, "Can't create interpreter state");
goto error;
}
@ -1166,7 +1166,7 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
/* Add xchat module to the environment. */
m = Py_InitModule("xchat", xchat_methods);
if (m == NULL) {
xchat_print(ph, "Can't create xchat module");
hexchat_print(ph, "Can't create xchat module");
goto error;
}
@ -1182,7 +1182,7 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
o = Py_BuildValue("(ii)", VERSION_MAJOR, VERSION_MINOR);
if (o == NULL) {
xchat_print(ph, "Can't create version tuple");
hexchat_print(ph, "Can't create version tuple");
goto error;
}
PyObject_SetAttrString(m, "__version__", o);
@ -1191,13 +1191,13 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
#ifdef WIN32
PyObject* PyFileObject = PyFile_FromString(filename, "r");
if (PyFileObject == NULL) {
xchat_printf(ph, "Can't open file %s: %s\n",
hexchat_printf(ph, "Can't open file %s: %s\n",
filename, strerror(errno));
goto error;
}
if (PyRun_SimpleFile(PyFile_AsFile(PyFileObject), filename) != 0) {
xchat_printf(ph, "Error loading module %s\n",
hexchat_printf(ph, "Error loading module %s\n",
filename);
goto error;
}
@ -1215,14 +1215,14 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
/* Open the plugin file. */
fp = fopen(plugin->filename, "r");
if (fp == NULL) {
xchat_printf(ph, "Can't open file %s: %s\n",
hexchat_printf(ph, "Can't open file %s: %s\n",
plugin->filename, strerror(errno));
goto error;
}
/* Run the plugin. */
if (PyRun_SimpleFile(fp, plugin->filename) != 0) {
xchat_printf(ph, "Error loading module %s\n",
hexchat_printf(ph, "Error loading module %s\n",
plugin->filename);
fclose(fp);
goto error;
@ -1232,13 +1232,13 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
m = PyDict_GetItemString(PyImport_GetModuleDict(),
"__main__");
if (m == NULL) {
xchat_print(ph, "Can't get __main__ module");
hexchat_print(ph, "Can't get __main__ module");
goto error;
}
GET_MODULE_DATA(name, 1);
GET_MODULE_DATA(version, 0);
GET_MODULE_DATA(description, 0);
plugin->gui = xchat_plugingui_add(ph, plugin->filename,
plugin->gui = hexchat_plugingui_add(ph, plugin->filename,
plugin->name,
plugin->description,
plugin->version, NULL);
@ -1328,7 +1328,7 @@ Plugin_RemoveHook(PyObject *plugin, Hook *hook)
if (hook->type == HOOK_XCHAT) {
/* This is an xchat hook. Unregister it. */
BEGIN_XCHAT_CALLS(NONE);
xchat_unhook(ph, (xchat_hook*)hook->data);
hexchat_unhook(ph, (hexchat_hook*)hook->data);
END_XCHAT_CALLS();
}
Plugin_SetHooks(plugin,
@ -1349,7 +1349,7 @@ Plugin_RemoveAllHooks(PyObject *plugin)
if (hook->type == HOOK_XCHAT) {
/* This is an xchat hook. Unregister it. */
BEGIN_XCHAT_CALLS(NONE);
xchat_unhook(ph, (xchat_hook*)hook->data);
hexchat_unhook(ph, (hexchat_hook*)hook->data);
END_XCHAT_CALLS();
}
Py_DECREF(hook->callback);
@ -1381,7 +1381,7 @@ Plugin_Delete(PyObject *plugin)
list = list->next;
}
Plugin_RemoveAllHooks(plugin);
xchat_plugingui_remove(ph, ((PluginObject *)plugin)->gui);
hexchat_plugingui_remove(ph, ((PluginObject *)plugin)->gui);
Py_DECREF(plugin);
/*PyThreadState_Swap(tstate); needed? */
Py_EndInterpreter(tstate);
@ -1446,13 +1446,13 @@ statichere PyTypeObject Plugin_Type = {
/* XChat module */
static PyObject *
Module_xchat_command(PyObject *self, PyObject *args)
Module_hexchat_command(PyObject *self, PyObject *args)
{
char *text;
if (!PyArg_ParseTuple(args, "s:command", &text))
return NULL;
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT|ALLOW_THREADS);
xchat_command(ph, text);
hexchat_command(ph, text);
END_XCHAT_CALLS();
Py_INCREF(Py_None);
return Py_None;
@ -1465,14 +1465,14 @@ Module_xchat_prnt(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:prnt", &text))
return NULL;
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT|ALLOW_THREADS);
xchat_print(ph, text);
hexchat_print(ph, text);
END_XCHAT_CALLS();
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
Module_xchat_emit_print(PyObject *self, PyObject *args)
Module_hexchat_emit_print(PyObject *self, PyObject *args)
{
char *argv[10];
char *name;
@ -1484,7 +1484,7 @@ Module_xchat_emit_print(PyObject *self, PyObject *args)
&argv[6], &argv[7], &argv[8]))
return NULL;
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT|ALLOW_THREADS);
res = xchat_emit_print(ph, name, argv[0], argv[1], argv[2],
res = hexchat_emit_print(ph, name, argv[0], argv[1], argv[2],
argv[3], argv[4], argv[5],
argv[6], argv[7], argv[8]);
END_XCHAT_CALLS();
@ -1492,14 +1492,14 @@ Module_xchat_emit_print(PyObject *self, PyObject *args)
}
static PyObject *
Module_xchat_get_info(PyObject *self, PyObject *args)
Module_hexchat_get_info(PyObject *self, PyObject *args)
{
const char *info;
char *name;
if (!PyArg_ParseTuple(args, "s:get_info", &name))
return NULL;
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT);
info = xchat_get_info(ph, name);
info = hexchat_get_info(ph, name);
END_XCHAT_CALLS();
if (info == NULL) {
Py_INCREF(Py_None);
@ -1544,7 +1544,7 @@ Module_xchat_get_prefs(PyObject *self, PyObject *args)
}
static PyObject *
Module_xchat_get_context(PyObject *self, PyObject *args)
Module_hexchat_get_context(PyObject *self, PyObject *args)
{
PyObject *plugin;
PyObject *ctxobj;
@ -1560,7 +1560,7 @@ Module_xchat_get_context(PyObject *self, PyObject *args)
}
static PyObject *
Module_xchat_find_context(PyObject *self, PyObject *args, PyObject *kwargs)
Module_hexchat_find_context(PyObject *self, PyObject *args, PyObject *kwargs)
{
char *server = NULL;
char *channel = NULL;
@ -1578,7 +1578,7 @@ Module_xchat_find_context(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyObject *
Module_xchat_pluginpref_set(PyObject *self, PyObject *args)
Module_hexchat_pluginpref_set(PyObject *self, PyObject *args)
{
PyObject *result;
char *var;
@ -1587,11 +1587,11 @@ Module_xchat_pluginpref_set(PyObject *self, PyObject *args)
return NULL;
if (PyInt_Check(value)) {
int intvalue = PyInt_AsLong(value);
result = PyInt_FromLong(xchat_pluginpref_set_int(ph, var, intvalue));
result = PyInt_FromLong(hexchat_pluginpref_set_int(ph, var, intvalue));
}
else if (PyString_Check(value)) {
char *charvalue = PyString_AsString(value);
result = PyInt_FromLong(xchat_pluginpref_set_str(ph, var, charvalue));
result = PyInt_FromLong(hexchat_pluginpref_set_str(ph, var, charvalue));
}
else
result = PyInt_FromLong(0);
@ -1599,7 +1599,7 @@ Module_xchat_pluginpref_set(PyObject *self, PyObject *args)
}
static PyObject *
Module_xchat_pluginpref_get(PyObject *self, PyObject *args)
Module_hexchat_pluginpref_get(PyObject *self, PyObject *args)
{
PyObject *ret;
char *var;
@ -1608,8 +1608,8 @@ Module_xchat_pluginpref_get(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:get_pluginpref", &var))
return NULL;
// This will always return numbers as integers.
retint = xchat_pluginpref_get_int(ph, var);
if (xchat_pluginpref_get_str(ph, var, retstr)) {
retint = hexchat_pluginpref_get_int(ph, var);
if (hexchat_pluginpref_get_str(ph, var, retstr)) {
if ((retint == 0) && (strcmp(retstr, "0") != 0))
ret = PyString_FromString(retstr);
else
@ -1621,24 +1621,24 @@ Module_xchat_pluginpref_get(PyObject *self, PyObject *args)
}
static PyObject *
Module_xchat_pluginpref_delete(PyObject *self, PyObject *args)
Module_hexchat_pluginpref_delete(PyObject *self, PyObject *args)
{
char *var;
int result;
if (!PyArg_ParseTuple(args, "s:del_pluginpref", &var))
return NULL;
result = xchat_pluginpref_delete(ph, var);
result = hexchat_pluginpref_delete(ph, var);
return PyInt_FromLong(result);
}
static PyObject *
Module_xchat_pluginpref_list(PyObject *self, PyObject *args)
Module_hexchat_pluginpref_list(PyObject *self, PyObject *args)
{
char list[512];
char* token;
PyObject *pylist;
pylist = PyList_New(0);
if (xchat_pluginpref_list(ph, list)) {
if (hexchat_pluginpref_list(ph, list)) {
token = strtok(list, ",");
while (token != NULL) {
PyList_Append(pylist, PyString_FromString(token));
@ -1649,7 +1649,7 @@ Module_xchat_pluginpref_list(PyObject *self, PyObject *args)
}
static PyObject *
Module_xchat_hook_command(PyObject *self, PyObject *args, PyObject *kwargs)
Module_hexchat_hook_command(PyObject *self, PyObject *args, PyObject *kwargs)
{
char *name;
PyObject *callback;
@ -1679,7 +1679,7 @@ Module_xchat_hook_command(PyObject *self, PyObject *args, PyObject *kwargs)
return NULL;
BEGIN_XCHAT_CALLS(NONE);
hook->data = (void*)xchat_hook_command(ph, name, priority,
hook->data = (void*)hexchat_hook_command(ph, name, priority,
Callback_Command, help, hook);
END_XCHAT_CALLS();
@ -1687,7 +1687,7 @@ Module_xchat_hook_command(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyObject *
Module_xchat_hook_server(PyObject *self, PyObject *args, PyObject *kwargs)
Module_hexchat_hook_server(PyObject *self, PyObject *args, PyObject *kwargs)
{
char *name;
PyObject *callback;
@ -1715,7 +1715,7 @@ Module_xchat_hook_server(PyObject *self, PyObject *args, PyObject *kwargs)
return NULL;
BEGIN_XCHAT_CALLS(NONE);
hook->data = (void*)xchat_hook_server(ph, name, priority,
hook->data = (void*)hexchat_hook_server(ph, name, priority,
Callback_Command, hook);
END_XCHAT_CALLS();
@ -1723,7 +1723,7 @@ Module_xchat_hook_server(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyObject *
Module_xchat_hook_print(PyObject *self, PyObject *args, PyObject *kwargs)
Module_hexchat_hook_print(PyObject *self, PyObject *args, PyObject *kwargs)
{
char *name;
PyObject *callback;
@ -1751,7 +1751,7 @@ Module_xchat_hook_print(PyObject *self, PyObject *args, PyObject *kwargs)
return NULL;
BEGIN_XCHAT_CALLS(NONE);
hook->data = (void*)xchat_hook_print(ph, name, priority,
hook->data = (void*)hexchat_hook_print(ph, name, priority,
Callback_Print, hook);
END_XCHAT_CALLS();
@ -1760,7 +1760,7 @@ Module_xchat_hook_print(PyObject *self, PyObject *args, PyObject *kwargs)
static PyObject *
Module_xchat_hook_timer(PyObject *self, PyObject *args, PyObject *kwargs)
Module_hexchat_hook_timer(PyObject *self, PyObject *args, PyObject *kwargs)
{
int timeout;
PyObject *callback;
@ -1787,7 +1787,7 @@ Module_xchat_hook_timer(PyObject *self, PyObject *args, PyObject *kwargs)
return NULL;
BEGIN_XCHAT_CALLS(NONE);
hook->data = (void*)xchat_hook_timer(ph, timeout,
hook->data = (void*)hexchat_hook_timer(ph, timeout,
Callback_Timer, hook);
END_XCHAT_CALLS();
@ -1795,7 +1795,7 @@ Module_xchat_hook_timer(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyObject *
Module_xchat_hook_unload(PyObject *self, PyObject *args, PyObject *kwargs)
Module_hexchat_hook_unload(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *callback;
PyObject *userdata = Py_None;
@ -1823,7 +1823,7 @@ Module_xchat_hook_unload(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyObject *
Module_xchat_unhook(PyObject *self, PyObject *args)
Module_hexchat_unhook(PyObject *self, PyObject *args)
{
PyObject *plugin;
Hook *hook;
@ -1840,7 +1840,7 @@ Module_xchat_unhook(PyObject *self, PyObject *args)
static PyObject *
Module_xchat_get_list(PyObject *self, PyObject *args)
{
xchat_list *list;
hexchat_list *list;
PyObject *l;
const char *name;
const char *const *fields;
@ -1850,7 +1850,7 @@ Module_xchat_get_list(PyObject *self, PyObject *args)
return NULL;
/* This function is thread safe, and returns statically
* allocated data. */
fields = xchat_list_fields(ph, "lists");
fields = hexchat_list_fields(ph, "lists");
for (i = 0; fields[i]; i++) {
if (strcmp(fields[i], name) == 0) {
/* Use the static allocated one. */
@ -1866,11 +1866,11 @@ Module_xchat_get_list(PyObject *self, PyObject *args)
if (l == NULL)
return NULL;
BEGIN_XCHAT_CALLS(RESTORE_CONTEXT);
list = xchat_list_get(ph, (char*)name);
list = hexchat_list_get(ph, (char*)name);
if (list == NULL)
goto error;
fields = xchat_list_fields(ph, (char*)name);
while (xchat_list_next(ph, list)) {
fields = hexchat_list_fields(ph, (char*)name);
while (hexchat_list_next(ph, list)) {
PyObject *o = ListItem_New(name);
if (o == NULL || PyList_Append(l, o) == -1) {
Py_XDECREF(o);
@ -1884,18 +1884,18 @@ Module_xchat_get_list(PyObject *self, PyObject *args)
int iattr;
switch(fields[i][0]) {
case 's':
sattr = xchat_list_str(ph, list, (char*)fld);
sattr = hexchat_list_str(ph, list, (char*)fld);
attr = PyString_FromString(sattr?sattr:"");
break;
case 'i':
iattr = xchat_list_int(ph, list, (char*)fld);
iattr = hexchat_list_int(ph, list, (char*)fld);
attr = PyInt_FromLong((long)iattr);
break;
case 'p':
sattr = xchat_list_str(ph, list, (char*)fld);
sattr = hexchat_list_str(ph, list, (char*)fld);
if (strcmp(fld, "context") == 0) {
attr = Context_FromContext(
(xchat_context*)sattr);
(hexchat_context*)sattr);
break;
}
default: /* ignore unknown (newly added?) types */
@ -1907,11 +1907,11 @@ Module_xchat_get_list(PyObject *self, PyObject *args)
Py_DECREF(attr); /* make o own attr */
}
}
xchat_list_free(ph, list);
hexchat_list_free(ph, list);
goto exit;
error:
if (list)
xchat_list_free(ph, list);
hexchat_list_free(ph, list);
Py_DECREF(l);
l = NULL;
@ -1928,7 +1928,7 @@ Module_xchat_get_lists(PyObject *self, PyObject *args)
int i;
/* This function is thread safe, and returns statically
* allocated data. */
fields = xchat_list_fields(ph, "lists");
fields = hexchat_list_fields(ph, "lists");
l = PyList_New(0);
if (l == NULL)
return NULL;
@ -1945,70 +1945,70 @@ Module_xchat_get_lists(PyObject *self, PyObject *args)
}
static PyObject *
Module_xchat_nickcmp(PyObject *self, PyObject *args)
Module_hexchat_nickcmp(PyObject *self, PyObject *args)
{
char *s1, *s2;
if (!PyArg_ParseTuple(args, "ss:nickcmp", &s1, &s2))
return NULL;
return PyInt_FromLong((long) xchat_nickcmp(ph, s1, s2));
return PyInt_FromLong((long) hexchat_nickcmp(ph, s1, s2));
}
static PyObject *
Module_xchat_strip(PyObject *self, PyObject *args)
Module_hexchat_strip(PyObject *self, PyObject *args)
{
PyObject *result;
char *str, *str2;
int len = -1, flags = 1 | 2;
if (!PyArg_ParseTuple(args, "s|ii:strip", &str, &len, &flags))
return NULL;
str2 = xchat_strip(ph, str, len, flags);
str2 = hexchat_strip(ph, str, len, flags);
result = PyString_FromString(str2);
xchat_free(ph, str2);
hexchat_free(ph, str2);
return result;
}
static PyMethodDef Module_xchat_methods[] = {
{"command", Module_xchat_command,
{"command", Module_hexchat_command,
METH_VARARGS},
{"prnt", Module_xchat_prnt,
METH_VARARGS},
{"emit_print", Module_xchat_emit_print,
{"emit_print", Module_hexchat_emit_print,
METH_VARARGS},
{"get_info", Module_xchat_get_info,
{"get_info", Module_hexchat_get_info,
METH_VARARGS},
{"get_prefs", Module_xchat_get_prefs,
METH_VARARGS},
{"get_context", Module_xchat_get_context,
{"get_context", Module_hexchat_get_context,
METH_NOARGS},
{"find_context", (PyCFunction)Module_xchat_find_context,
{"find_context", (PyCFunction)Module_hexchat_find_context,
METH_VARARGS|METH_KEYWORDS},
{"set_pluginpref", Module_xchat_pluginpref_set,
{"set_pluginpref", Module_hexchat_pluginpref_set,
METH_VARARGS},
{"get_pluginpref", Module_xchat_pluginpref_get,
{"get_pluginpref", Module_hexchat_pluginpref_get,
METH_VARARGS},
{"del_pluginpref", Module_xchat_pluginpref_delete,
{"del_pluginpref", Module_hexchat_pluginpref_delete,
METH_VARARGS},
{"list_pluginpref", Module_xchat_pluginpref_list,
{"list_pluginpref", Module_hexchat_pluginpref_list,
METH_VARARGS},
{"hook_command", (PyCFunction)Module_xchat_hook_command,
{"hook_command", (PyCFunction)Module_hexchat_hook_command,
METH_VARARGS|METH_KEYWORDS},
{"hook_server", (PyCFunction)Module_xchat_hook_server,
{"hook_server", (PyCFunction)Module_hexchat_hook_server,
METH_VARARGS|METH_KEYWORDS},
{"hook_print", (PyCFunction)Module_xchat_hook_print,
{"hook_print", (PyCFunction)Module_hexchat_hook_print,
METH_VARARGS|METH_KEYWORDS},
{"hook_timer", (PyCFunction)Module_xchat_hook_timer,
{"hook_timer", (PyCFunction)Module_hexchat_hook_timer,
METH_VARARGS|METH_KEYWORDS},
{"hook_unload", (PyCFunction)Module_xchat_hook_unload,
{"hook_unload", (PyCFunction)Module_hexchat_hook_unload,
METH_VARARGS|METH_KEYWORDS},
{"unhook", Module_xchat_unhook,
{"unhook", Module_hexchat_unhook,
METH_VARARGS},
{"get_list", Module_xchat_get_list,
METH_VARARGS},
{"get_lists", Module_xchat_get_lists,
METH_NOARGS},
{"nickcmp", Module_xchat_nickcmp,
{"nickcmp", Module_hexchat_nickcmp,
METH_VARARGS},
{"strip", Module_xchat_strip,
{"strip", Module_hexchat_strip,
METH_VARARGS},
{NULL, NULL}
};
@ -2028,14 +2028,14 @@ IInterp_Exec(char *command)
m = PyImport_AddModule("__main__");
if (m == NULL) {
xchat_print(ph, "Can't get __main__ module");
hexchat_print(ph, "Can't get __main__ module");
goto fail;
}
d = PyModule_GetDict(m);
len = strlen(command);
buffer = (char *) g_malloc(len+2);
if (buffer == NULL) {
xchat_print(ph, "Not enough memory for command buffer");
hexchat_print(ph, "Not enough memory for command buffer");
goto fail;
}
memcpy(buffer, command, len);
@ -2060,9 +2060,9 @@ fail:
static int
IInterp_Cmd(char *word[], char *word_eol[], void *userdata)
{
char *channel = (char *) xchat_get_info(ph, "channel");
char *channel = (char *) hexchat_get_info(ph, "channel");
if (channel && channel[0] == '>' && strcmp(channel, ">>python<<") == 0) {
xchat_printf(ph, ">>> %s\n", word_eol[1]);
hexchat_printf(ph, ">>> %s\n", word_eol[1]);
IInterp_Exec(word_eol[1]);
return 1;
}
@ -2079,15 +2079,15 @@ Command_PyList()
GSList *list;
list = plugin_list;
if (list == NULL) {
xchat_print(ph, "No python modules loaded");
hexchat_print(ph, "No python modules loaded");
} else {
xchat_print(ph,
hexchat_print(ph,
"Name Version Filename Description\n"
"---- ------- -------- -----------\n");
while (list != NULL) {
PluginObject *plg = (PluginObject *) list->data;
char *basename = g_path_get_basename(plg->filename);
xchat_printf(ph, "%-12s %-8s %-20s %-10s\n",
hexchat_printf(ph, "%-12s %-8s %-20s %-10s\n",
plg->name,
*plg->version ? plg->version
: "<none>",
@ -2097,7 +2097,7 @@ Command_PyList()
g_free(basename);
list = list->next;
}
xchat_print(ph, "\n");
hexchat_print(ph, "\n");
}
}
@ -2117,7 +2117,7 @@ Command_PyUnload(char *name)
{
PluginObject *plugin = Plugin_ByString(name);
if (!plugin) {
xchat_print(ph, "Can't find a python plugin with that name");
hexchat_print(ph, "Can't find a python plugin with that name");
} else {
BEGIN_PLUGIN(plugin);
Plugin_Delete((PyObject*)plugin);
@ -2131,7 +2131,7 @@ Command_PyReload(char *name)
{
PluginObject *plugin = Plugin_ByString(name);
if (!plugin) {
xchat_print(ph, "Can't find a python plugin with that name");
hexchat_print(ph, "Can't find a python plugin with that name");
} else {
char *filename = strdup(plugin->filename);
Command_PyUnload(filename);
@ -2143,7 +2143,7 @@ Command_PyReload(char *name)
static void
Command_PyAbout()
{
xchat_print(ph, about);
hexchat_print(ph, about);
}
static int
@ -2176,13 +2176,13 @@ Command_Py(char *word[], char *word_eol[], void *userdata)
}
} else if (strcasecmp(cmd, "CONSOLE") == 0) {
ok = 1;
xchat_command(ph, "QUERY >>python<<");
hexchat_command(ph, "QUERY >>python<<");
} else if (strcasecmp(cmd, "ABOUT") == 0) {
ok = 1;
Command_PyAbout();
}
if (!ok)
xchat_print(ph, usage);
hexchat_print(ph, usage);
return HEXCHAT_EAT_ALL;
}
@ -2218,7 +2218,7 @@ static int initialized = 0;
static int reinit_tried = 0;
void
xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved)
hexchat_plugin_get_info(char **name, char **desc, char **version, void **reserved)
{
*name = "Python";
*version = VERSION;
@ -2228,7 +2228,7 @@ xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved)
}
int
xchat_plugin_init(xchat_plugin *plugin_handle,
hexchat_plugin_init(hexchat_plugin *plugin_handle,
char **plugin_name,
char **plugin_desc,
char **plugin_version,
@ -2240,7 +2240,7 @@ xchat_plugin_init(xchat_plugin *plugin_handle,
/* Block double initalization. */
if (initialized != 0) {
xchat_print(ph, "Python interface already loaded");
hexchat_print(ph, "Python interface already loaded");
/* deinit is called even when init fails, so keep track
* of a reinit failure. */
reinit_tried++;
@ -2263,7 +2263,7 @@ xchat_plugin_init(xchat_plugin *plugin_handle,
xchatout = XChatOut_New();
if (xchatout == NULL) {
xchat_print(ph, "Can't allocate xchatout object");
hexchat_print(ph, "Can't allocate xchatout object");
return 0;
}
@ -2271,7 +2271,7 @@ xchat_plugin_init(xchat_plugin *plugin_handle,
PyEval_InitThreads();
xchat_lock = PyThread_allocate_lock();
if (xchat_lock == NULL) {
xchat_print(ph, "Can't allocate xchat lock");
hexchat_print(ph, "Can't allocate xchat lock");
Py_DECREF(xchatout);
xchatout = NULL;
return 0;
@ -2282,7 +2282,7 @@ xchat_plugin_init(xchat_plugin *plugin_handle,
interp_plugin = Plugin_New(NULL, Module_xchat_methods, xchatout);
if (interp_plugin == NULL) {
xchat_print(ph, "Plugin_New() failed.\n");
hexchat_print(ph, "Plugin_New() failed.\n");
#ifdef WITH_THREAD
PyThread_free_lock(xchat_lock);
#endif
@ -2292,22 +2292,22 @@ xchat_plugin_init(xchat_plugin *plugin_handle,
}
xchat_hook_command(ph, "", HEXCHAT_PRI_NORM, IInterp_Cmd, 0, 0);
xchat_hook_command(ph, "PY", HEXCHAT_PRI_NORM, Command_Py, usage, 0);
xchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, Command_Load, 0, 0);
xchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, Command_Unload, 0, 0);
hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, IInterp_Cmd, 0, 0);
hexchat_hook_command(ph, "PY", HEXCHAT_PRI_NORM, Command_Py, usage, 0);
hexchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, Command_Load, 0, 0);
hexchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, Command_Unload, 0, 0);
#ifdef WITH_THREAD
thread_timer = xchat_hook_timer(ph, 300, Callback_ThreadTimer, NULL);
thread_timer = hexchat_hook_timer(ph, 300, Callback_ThreadTimer, NULL);
#endif
xchat_print(ph, "Python interface loaded\n");
hexchat_print(ph, "Python interface loaded\n");
Util_Autoload();
return 1;
}
int
xchat_plugin_deinit()
hexchat_plugin_deinit()
{
GSList *list;
@ -2349,13 +2349,13 @@ xchat_plugin_deinit()
#ifdef WITH_THREAD
if (thread_timer != NULL) {
xchat_unhook(ph, thread_timer);
hexchat_unhook(ph, thread_timer);
thread_timer = NULL;
}
PyThread_free_lock(xchat_lock);
#endif
xchat_print(ph, "Python interface unloaded\n");
hexchat_print(ph, "Python interface unloaded\n");
initialized = 0;
return 1;

View File

@ -1,4 +1,4 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
xchat_plugin_get_info
hexchat_plugin_init
hexchat_plugin_deinit
hexchat_plugin_get_info

View File

@ -40,7 +40,7 @@
#include "hexchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static char name[] = "SASL";
static char desc[] = "SASL authentication plugin for HexChat";
static char version[] = "1.2";
@ -61,13 +61,13 @@ add_info (char const* login, char const* password, char const* network)
char buffer[512];
sprintf (buffer, "%s:%s", login, password);
return xchat_pluginpref_set_str (ph, network, buffer);
return hexchat_pluginpref_set_str (ph, network, buffer);
}
static int
del_info (char const* network)
{
return xchat_pluginpref_delete (ph, network);
return hexchat_pluginpref_delete (ph, network);
}
static void
@ -76,20 +76,20 @@ print_info ()
char list[512];
char* token;
if (xchat_pluginpref_list (ph, list))
if (hexchat_pluginpref_list (ph, list))
{
xchat_printf (ph, "%s\tSASL-enabled networks:", name);
xchat_printf (ph, "%s\t----------------------", name);
hexchat_printf (ph, "%s\tSASL-enabled networks:", name);
hexchat_printf (ph, "%s\t----------------------", name);
token = strtok (list, ",");
while (token != NULL)
{
xchat_printf (ph, "%s\t%s", name, token);
hexchat_printf (ph, "%s\t%s", name, token);
token = strtok (NULL, ",");
}
}
else
{
xchat_printf (ph, "%s\tThere are no SASL-enabled networks currently", name);
hexchat_printf (ph, "%s\tThere are no SASL-enabled networks currently", name);
}
}
@ -100,7 +100,7 @@ find_info (char const* network)
char* token;
sasl_info* cur = (sasl_info*) malloc (sizeof (sasl_info));
if (xchat_pluginpref_get_str (ph, network, buffer))
if (hexchat_pluginpref_get_str (ph, network, buffer))
{
token = strtok (buffer, ":");
cur->login = g_strdup (token);
@ -118,7 +118,7 @@ static sasl_info*
get_info (void)
{
const char* name;
name = xchat_get_info (ph, "network");
name = hexchat_get_info (ph, "network");
if (name)
{
@ -136,8 +136,8 @@ authend_cb (char *word[], char *word_eol[], void *userdata)
if (get_info ())
{
/* omit cryptic server message parts */
xchat_printf (ph, "%s\t%s\n", name, ++word_eol[4]);
xchat_commandf (ph, "QUOTE CAP END");
hexchat_printf (ph, "%s\t%s\n", name, ++word_eol[4]);
hexchat_commandf (ph, "QUOTE CAP END");
}
return HEXCHAT_EAT_ALL;
@ -147,7 +147,7 @@ authend_cb (char *word[], char *word_eol[], void *userdata)
static int
disconnect_cb (char *word[], void *userdata)
{
xchat_printf (ph, "disconnected\n");
hexchat_printf (ph, "disconnected\n");
return HEXCHAT_EAT_NONE;
}
*/
@ -169,7 +169,7 @@ server_cb (char *word[], char *word_eol[], void *userdata)
return HEXCHAT_EAT_NONE;
}
xchat_printf (ph, "%s\tAuthenticating as %s\n", name, p->login);
hexchat_printf (ph, "%s\tAuthenticating as %s\n", name, p->login);
len = strlen (p->login) * 2 + 2 + strlen (p->password);
buf = (char*) malloc (len + 1);
@ -178,8 +178,8 @@ server_cb (char *word[], char *word_eol[], void *userdata)
strcpy (buf + strlen (p->login) * 2 + 2, p->password);
enc = g_base64_encode ((unsigned char*) buf, len);
/* xchat_printf (ph, "AUTHENTICATE %s\}", enc); */
xchat_commandf (ph, "QUOTE AUTHENTICATE %s", enc);
/* hexchat_printf (ph, "AUTHENTICATE %s\}", enc); */
hexchat_commandf (ph, "QUOTE AUTHENTICATE %s", enc);
free (enc);
free (buf);
@ -197,8 +197,8 @@ cap_cb (char *word[], char *word_eol[], void *userdata)
{
/* FIXME test sasl cap */
/* this is visible in the rawlog in case someone needs it, otherwise it's just noise */
/* xchat_printf (ph, "%s\t%s\n", name, word_eol[1]); */
xchat_commandf (ph, "QUOTE AUTHENTICATE PLAIN");
/* hexchat_printf (ph, "%s\t%s\n", name, word_eol[1]); */
hexchat_commandf (ph, "QUOTE AUTHENTICATE PLAIN");
}
return HEXCHAT_EAT_ALL;
@ -220,17 +220,17 @@ sasl_cmd_cb (char *word[], char *word_eol[], void *userdata)
if (!network || !*network) /* only check for the last word, if it's there, the previous ones will be there, too */
{
xchat_printf (ph, "%s", sasl_help);
hexchat_printf (ph, "%s", sasl_help);
return HEXCHAT_EAT_ALL;
}
if (add_info (login, password, network))
{
xchat_printf (ph, "%s\tEnabled SASL authentication for the \"%s\" network\n", name, network);
hexchat_printf (ph, "%s\tEnabled SASL authentication for the \"%s\" network\n", name, network);
}
else
{
xchat_printf (ph, "%s\tFailed to enable SASL authentication for the \"%s\" network\n", name, network);
hexchat_printf (ph, "%s\tFailed to enable SASL authentication for the \"%s\" network\n", name, network);
}
return HEXCHAT_EAT_ALL;
@ -241,17 +241,17 @@ sasl_cmd_cb (char *word[], char *word_eol[], void *userdata)
if (!network || !*network)
{
xchat_printf (ph, "%s", sasl_help);
hexchat_printf (ph, "%s", sasl_help);
return HEXCHAT_EAT_ALL;
}
if (del_info (network))
{
xchat_printf (ph, "%s\tDisabled SASL authentication for the \"%s\" network\n", name, network);
hexchat_printf (ph, "%s\tDisabled SASL authentication for the \"%s\" network\n", name, network);
}
else
{
xchat_printf (ph, "%s\tFailed to disable SASL authentication for the \"%s\" network\n", name, network);
hexchat_printf (ph, "%s\tFailed to disable SASL authentication for the \"%s\" network\n", name, network);
}
return HEXCHAT_EAT_ALL;
@ -263,7 +263,7 @@ sasl_cmd_cb (char *word[], char *word_eol[], void *userdata)
}
else
{
xchat_printf (ph, "%s", sasl_help);
hexchat_printf (ph, "%s", sasl_help);
return HEXCHAT_EAT_ALL;
}
}
@ -273,15 +273,15 @@ connect_cb (char *word[], void *userdata)
{
if (get_info ())
{
xchat_printf (ph, "%s\tSASL enabled\n", name);
xchat_commandf (ph, "QUOTE CAP REQ :sasl");
hexchat_printf (ph, "%s\tSASL enabled\n", name);
hexchat_commandf (ph, "QUOTE CAP REQ :sasl");
}
return HEXCHAT_EAT_NONE;
}
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_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;
@ -291,25 +291,25 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
*plugin_desc = desc;
*plugin_version = version;
xchat_hook_command (ph, "SASL", HEXCHAT_PRI_NORM, sasl_cmd_cb, sasl_help, 0);
xchat_hook_print (ph, "Connected", HEXCHAT_PRI_NORM, connect_cb, NULL);
/* xchat_hook_print (ph, "Disconnected", HEXCHAT_PRI_NORM, disconnect_cb, NULL); */
xchat_hook_server (ph, "CAP", HEXCHAT_PRI_NORM, cap_cb, NULL);
xchat_hook_server (ph, "RAW LINE", HEXCHAT_PRI_NORM, server_cb, NULL);
xchat_hook_server (ph, "903", HEXCHAT_PRI_NORM, authend_cb, NULL);
xchat_hook_server (ph, "904", HEXCHAT_PRI_NORM, authend_cb, NULL);
xchat_hook_server (ph, "905", HEXCHAT_PRI_NORM, authend_cb, NULL);
xchat_hook_server (ph, "906", HEXCHAT_PRI_NORM, authend_cb, NULL);
xchat_hook_server (ph, "907", HEXCHAT_PRI_NORM, authend_cb, NULL);
hexchat_hook_command (ph, "SASL", HEXCHAT_PRI_NORM, sasl_cmd_cb, sasl_help, 0);
hexchat_hook_print (ph, "Connected", HEXCHAT_PRI_NORM, connect_cb, NULL);
/* hexchat_hook_print (ph, "Disconnected", HEXCHAT_PRI_NORM, disconnect_cb, NULL); */
hexchat_hook_server (ph, "CAP", HEXCHAT_PRI_NORM, cap_cb, NULL);
hexchat_hook_server (ph, "RAW LINE", HEXCHAT_PRI_NORM, server_cb, NULL);
hexchat_hook_server (ph, "903", HEXCHAT_PRI_NORM, authend_cb, NULL);
hexchat_hook_server (ph, "904", HEXCHAT_PRI_NORM, authend_cb, NULL);
hexchat_hook_server (ph, "905", HEXCHAT_PRI_NORM, authend_cb, NULL);
hexchat_hook_server (ph, "906", HEXCHAT_PRI_NORM, authend_cb, NULL);
hexchat_hook_server (ph, "907", HEXCHAT_PRI_NORM, authend_cb, NULL);
xchat_printf (ph, "%s plugin loaded\n", name);
hexchat_printf (ph, "%s plugin loaded\n", name);
return 1;
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_printf (ph, "%s plugin unloaded\n", name);
hexchat_printf (ph, "%s plugin unloaded\n", name);
return 1;
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -27,7 +27,7 @@
#include "hexchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static char name[] = "SysInfo";
static char desc[] = "Display info about your hardware and OS";
static char version[] = "1.1";
@ -355,17 +355,17 @@ printInfo (char *word[], char *word_eol[], void *user_data)
/* query WMI info only at the first time SysInfo is called, then cache it to save time */
if (firstRun)
{
xchat_printf (ph, "%s first execution, querying and caching WMI info...\n", name);
hexchat_printf (ph, "%s first execution, querying and caching WMI info...\n", name);
wmiOs = getWmiInfo (0);
wmiCpu = getWmiInfo (1);
wmiVga = getWmiInfo (2);
firstRun = 0;
}
if (xchat_list_int (ph, NULL, "type") >= 2)
if (hexchat_list_int (ph, NULL, "type") >= 2)
{
/* uptime will work correctly for up to 50 days, should be enough */
xchat_commandf (ph, "ME ** SysInfo ** Client: HexChat %s (x%d) ** OS: %s ** CPU: %s (%s) ** RAM: %s ** VGA: %s ** Uptime: %.2f Hours **",
xchat_get_info (ph, "version"),
hexchat_commandf (ph, "ME ** SysInfo ** Client: HexChat %s (x%d) ** OS: %s ** CPU: %s (%s) ** RAM: %s ** VGA: %s ** Uptime: %.2f Hours **",
hexchat_get_info (ph, "version"),
getCpuArch (),
wmiOs,
wmiCpu,
@ -375,19 +375,19 @@ printInfo (char *word[], char *word_eol[], void *user_data)
}
else
{
xchat_printf (ph, " * Client: HexChat %s (x%d)\n", xchat_get_info (ph, "version"), getCpuArch ());
xchat_printf (ph, " * OS: %s\n", wmiOs);
xchat_printf (ph, " * CPU: %s (%s)\n", wmiCpu, getCpuMhz ());
xchat_printf (ph, " * RAM: %s\n", getMemoryInfo ());
xchat_printf (ph, " * VGA: %s\n", wmiVga);
xchat_printf (ph, " * Uptime: %.2f Hours\n", (float) GetTickCount() / 1000 / 60 / 60);
hexchat_printf (ph, " * Client: HexChat %s (x%d)\n", hexchat_get_info (ph, "version"), getCpuArch ());
hexchat_printf (ph, " * OS: %s\n", wmiOs);
hexchat_printf (ph, " * CPU: %s (%s)\n", wmiCpu, getCpuMhz ());
hexchat_printf (ph, " * RAM: %s\n", getMemoryInfo ());
hexchat_printf (ph, " * VGA: %s\n", wmiVga);
hexchat_printf (ph, " * Uptime: %.2f Hours\n", (float) GetTickCount() / 1000 / 60 / 60);
}
return HEXCHAT_EAT_XCHAT;
}
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
@ -397,19 +397,19 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
firstRun = 1;
xchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, printInfo, NULL, NULL);
xchat_command (ph, "MENU -ietc\\system.png ADD \"Window/Display System Info\" \"SYSINFO\"");
hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, printInfo, NULL, NULL);
hexchat_command (ph, "MENU -ietc\\system.png ADD \"Window/Display System Info\" \"SYSINFO\"");
xchat_printf (ph, "%s plugin loaded\n", name);
hexchat_printf (ph, "%s plugin loaded\n", name);
return 1; /* return 1 for success */
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_command (ph, "MENU DEL \"Window/Display System Info\"");
xchat_printf (ph, "%s plugin unloaded\n", name);
hexchat_command (ph, "MENU DEL \"Window/Display System Info\"");
hexchat_printf (ph, "%s plugin unloaded\n", name);
return 1;
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -37,7 +37,7 @@
#define DEFAULT_PERCENT 1
#define DEFAULT_PCIIDS "/usr/share/hwdata/pci.ids"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static int error_printed = 0; /* semaphore, make sure not to print the same error more than once during one execution */
static char name[] = "SysInfo";
@ -48,13 +48,13 @@ static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [OS|DISTRO|CPU|RAM|DISK
void
sysinfo_get_pciids (char* dest)
{
xchat_pluginpref_get_str (ph, "pciids", dest);
hexchat_pluginpref_get_str (ph, "pciids", dest);
}
int
sysinfo_get_percent ()
{
return xchat_pluginpref_get_int (ph, "percent");
return hexchat_pluginpref_get_int (ph, "percent");
}
void
@ -62,7 +62,7 @@ sysinfo_print_error (const char* msg)
{
if (!error_printed)
{
xchat_printf (ph, "%s\t%s", name, msg);
hexchat_printf (ph, "%s\t%s", name, msg);
}
error_printed++;
@ -91,7 +91,7 @@ print_summary (int announce, char* format)
int seconds;
sysinfo[0] = '\0';
snprintf (buffer, bsize, "%s", xchat_get_info (ph, "version"));
snprintf (buffer, bsize, "%s", hexchat_get_info (ph, "version"));
format_output ("HexChat", buffer, format);
strcat (sysinfo, "\017 ");
strncat (sysinfo, buffer, bsize - strlen (sysinfo));
@ -99,7 +99,7 @@ print_summary (int announce, char* format)
/* BEGIN OS PARSING */
if (xs_parse_os (os_user, os_host, os_kernel) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_os()", name);
hexchat_printf (ph, "%s\tERROR in parse_os()", name);
return HEXCHAT_EAT_ALL;
}
@ -121,7 +121,7 @@ print_summary (int announce, char* format)
/* BEGIN CPU PARSING */
if (xs_parse_cpu (cpu_model, cpu_vendor, &cpu_freq, cpu_cache, &count) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_cpu()", name);
hexchat_printf (ph, "%s\tERROR in parse_cpu()", name);
return HEXCHAT_EAT_ALL;
}
@ -147,7 +147,7 @@ print_summary (int announce, char* format)
/* BEGIN MEMORY PARSING */
if (xs_parse_meminfo (&mem_total, &mem_free, 0) == 1)
{
xchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
hexchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
return HEXCHAT_EAT_ALL;
}
@ -159,7 +159,7 @@ print_summary (int announce, char* format)
/* BEGIN DISK PARSING */
if (xs_parse_df (NULL, buffer))
{
xchat_printf (ph, "%s\tERROR in parse_df", name);
hexchat_printf (ph, "%s\tERROR in parse_df", name);
return HEXCHAT_EAT_ALL;
}
@ -170,7 +170,7 @@ print_summary (int announce, char* format)
/* BEGIN VIDEO PARSING */
if (xs_parse_video (buffer))
{
xchat_printf (ph, "%s\tERROR in parse_video", name);
hexchat_printf (ph, "%s\tERROR in parse_video", name);
return HEXCHAT_EAT_ALL;
}
@ -201,7 +201,7 @@ print_summary (int announce, char* format)
/* BEGIN UPTIME PARSING */
if (xs_parse_uptime (&weeks, &days, &hours, &minutes, &seconds))
{
xchat_printf (ph, "%s\tERROR in parse_uptime()", name);
hexchat_printf (ph, "%s\tERROR in parse_uptime()", name);
return HEXCHAT_EAT_ALL;
}
@ -237,11 +237,11 @@ print_summary (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", sysinfo);
hexchat_commandf (ph, "SAY %s", sysinfo);
}
else
{
xchat_printf (ph, "%s", sysinfo);
hexchat_printf (ph, "%s", sysinfo);
}
return HEXCHAT_EAT_ALL;
@ -257,7 +257,7 @@ print_os (int announce, char* format)
if (xs_parse_os (user, host, kernel) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_os()", name);
hexchat_printf (ph, "%s\tERROR in parse_os()", name);
return HEXCHAT_EAT_ALL;
}
@ -266,11 +266,11 @@ print_os (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", buffer);
hexchat_commandf (ph, "SAY %s", buffer);
}
else
{
xchat_printf (ph, "%s", buffer);
hexchat_printf (ph, "%s", buffer);
}
return HEXCHAT_EAT_ALL;
@ -283,7 +283,7 @@ print_distro (int announce, char* format)
if (xs_parse_distro (name) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_distro()!", name);
hexchat_printf (ph, "%s\tERROR in parse_distro()!", name);
return HEXCHAT_EAT_ALL;
}
@ -291,11 +291,11 @@ print_distro (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", name);
hexchat_commandf (ph, "SAY %s", name);
}
else
{
xchat_printf (ph, "%s", name);
hexchat_printf (ph, "%s", name);
}
return HEXCHAT_EAT_ALL;
}
@ -313,7 +313,7 @@ print_cpu (int announce, char* format)
if (xs_parse_cpu (model, vendor, &freq, cache, &count) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_cpu()", name);
hexchat_printf (ph, "%s\tERROR in parse_cpu()", name);
return HEXCHAT_EAT_ALL;
}
@ -336,11 +336,11 @@ print_cpu (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", buffer);
hexchat_commandf (ph, "SAY %s", buffer);
}
else
{
xchat_printf (ph, "%s", buffer);
hexchat_printf (ph, "%s", buffer);
}
return HEXCHAT_EAT_ALL;
@ -357,12 +357,12 @@ print_ram (int announce, char* format)
if (xs_parse_meminfo (&mem_total, &mem_free, 0) == 1)
{
xchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
hexchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
return HEXCHAT_EAT_ALL;
}
if (xs_parse_meminfo (&swap_total, &swap_free, 1) == 1)
{
xchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
hexchat_printf (ph, "%s\tERROR in parse_meminfo!", name);
return HEXCHAT_EAT_ALL;
}
@ -371,11 +371,11 @@ print_ram (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", string);
hexchat_commandf (ph, "SAY %s", string);
}
else
{
xchat_printf (ph, "%s", string);
hexchat_printf (ph, "%s", string);
}
return HEXCHAT_EAT_ALL;
@ -391,7 +391,7 @@ print_disk (int announce, char* format)
{
if (xs_parse_df (NULL, string))
{
xchat_printf (ph, "ERROR in parse_df");
hexchat_printf (ph, "ERROR in parse_df");
return HEXCHAT_EAT_ALL;
}
}
@ -399,7 +399,7 @@ print_disk (int announce, char* format)
{
if (xs_parse_df (*word, string))
{
xchat_printf (ph, "ERROR in parse_df");
hexchat_printf (ph, "ERROR in parse_df");
return HEXCHAT_EAT_ALL;
}
}
@ -407,7 +407,7 @@ print_disk (int announce, char* format)
if (xs_parse_df (NULL, string))
{
xchat_printf (ph, "%s\tERROR in parse_df", name);
hexchat_printf (ph, "%s\tERROR in parse_df", name);
return HEXCHAT_EAT_ALL;
}
@ -415,11 +415,11 @@ print_disk (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", string);
hexchat_commandf (ph, "SAY %s", string);
}
else
{
xchat_printf (ph, "%s", string);
hexchat_printf (ph, "%s", string);
}
return HEXCHAT_EAT_ALL;
@ -435,7 +435,7 @@ print_vga (int announce, char* format)
if ((ret = xs_parse_video (vid_card)) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_video! %d", name, ret);
hexchat_printf (ph, "%s\tERROR in parse_video! %d", name, ret);
return HEXCHAT_EAT_ALL;
}
@ -452,11 +452,11 @@ print_vga (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", buffer);
hexchat_commandf (ph, "SAY %s", buffer);
}
else
{
xchat_printf (ph, "%s", buffer);
hexchat_printf (ph, "%s", buffer);
}
return HEXCHAT_EAT_ALL;
@ -469,7 +469,7 @@ print_sound (int announce, char* format)
if (xs_parse_sound (sound) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_asound()!", name);
hexchat_printf (ph, "%s\tERROR in parse_asound()!", name);
return HEXCHAT_EAT_ALL;
}
@ -477,11 +477,11 @@ print_sound (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", sound);
hexchat_commandf (ph, "SAY %s", sound);
}
else
{
xchat_printf (ph, "%s", sound);
hexchat_printf (ph, "%s", sound);
}
return HEXCHAT_EAT_ALL;
@ -502,11 +502,11 @@ print_ethernet (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", ethernet_card);
hexchat_commandf (ph, "SAY %s", ethernet_card);
}
else
{
xchat_printf (ph, "%s", ethernet_card);
hexchat_printf (ph, "%s", ethernet_card);
}
return HEXCHAT_EAT_ALL;
@ -524,7 +524,7 @@ print_uptime (int announce, char* format)
if (xs_parse_uptime (&weeks, &days, &hours, &minutes, &seconds))
{
xchat_printf (ph, "%s\tERROR in parse_uptime()", name);
hexchat_printf (ph, "%s\tERROR in parse_uptime()", name);
return HEXCHAT_EAT_ALL;
}
@ -558,11 +558,11 @@ print_uptime (int announce, char* format)
if (announce)
{
xchat_commandf (ph, "SAY %s", buffer);
hexchat_commandf (ph, "SAY %s", buffer);
}
else
{
xchat_printf (ph, "%s", buffer);
hexchat_printf (ph, "%s", buffer);
}
return HEXCHAT_EAT_ALL;
@ -578,13 +578,13 @@ netdata_cb (char *word[], char *word_eol[], void *userdata)
if (*word[2] == '\0')
{
xchat_printf (ph, "%s\tYou must specify a network device (e.g. /NETDATA eth0)!", name);
hexchat_printf (ph, "%s\tYou must specify a network device (e.g. /NETDATA eth0)!", name);
return HEXCHAT_EAT_ALL;
}
if (xs_parse_netdev (word[2], &bytes_recv, &bytes_sent) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_netdev", name);
hexchat_printf (ph, "%s\tERROR in parse_netdev", name);
return HEXCHAT_EAT_ALL;
}
@ -592,16 +592,16 @@ netdata_cb (char *word[], char *word_eol[], void *userdata)
bytes_sent /= 1024;
snprintf (netdata, bsize, "%s: %.1f MB Recieved, %.1f MB Sent", word[2], (double)bytes_recv/1024.0, (double)bytes_sent/1024.0);
xchat_pluginpref_get_str (ph, "format", format);
hexchat_pluginpref_get_str (ph, "format", format);
format_output ("Netdata", netdata, format);
if (xchat_list_int (ph, NULL, "type") >= 2)
if (hexchat_list_int (ph, NULL, "type") >= 2)
{
xchat_commandf (ph, "SAY %s", netdata);
hexchat_commandf (ph, "SAY %s", netdata);
}
else
{
xchat_printf (ph, "%s", netdata);
hexchat_printf (ph, "%s", netdata);
}
return HEXCHAT_EAT_ALL;
@ -623,13 +623,13 @@ netstream_cb (char *word[], char *word_eol[], void *userdata)
if (*word[2] == '\0')
{
xchat_printf (ph, "%s\tYou must specify a network device (e.g. /NETSTREAM eth0)!", name);
hexchat_printf (ph, "%s\tYou must specify a network device (e.g. /NETSTREAM eth0)!", name);
return HEXCHAT_EAT_ALL;
}
if (xs_parse_netdev(word[2], &bytes_recv, &bytes_sent) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_netdev", name);
hexchat_printf (ph, "%s\tERROR in parse_netdev", name);
return HEXCHAT_EAT_ALL;
}
@ -637,7 +637,7 @@ netstream_cb (char *word[], char *word_eol[], void *userdata)
if (xs_parse_netdev(word[2], &bytes_recv_p, &bytes_sent_p) != 0)
{
xchat_printf (ph, "%s\tERROR in parse_netdev", name);
hexchat_printf (ph, "%s\tERROR in parse_netdev", name);
return HEXCHAT_EAT_ALL;
}
@ -665,16 +665,16 @@ netstream_cb (char *word[], char *word_eol[], void *userdata)
}
snprintf (netstream, bsize, "%s: Receiving %llu %s, Sending %llu %s", word[2], bytes_recv, mag_r, bytes_sent, mag_s);
xchat_pluginpref_get_str (ph, "format", format);
hexchat_pluginpref_get_str (ph, "format", format);
format_output ("Netstream", netstream, format);
if (xchat_list_int (ph, NULL, "type") >= 2)
if (hexchat_list_int (ph, NULL, "type") >= 2)
{
xchat_commandf (ph, "SAY %s", netstream);
hexchat_commandf (ph, "SAY %s", netstream);
}
else
{
xchat_printf (ph, "%s", netstream);
hexchat_printf (ph, "%s", netstream);
}
return HEXCHAT_EAT_ALL;
@ -687,14 +687,14 @@ list_settings ()
char buffer[512];
char* token;
xchat_pluginpref_list (ph, list);
xchat_printf (ph, "%s\tCurrent Settings:", name);
hexchat_pluginpref_list (ph, list);
hexchat_printf (ph, "%s\tCurrent Settings:", name);
token = strtok (list, ",");
while (token != NULL)
{
xchat_pluginpref_get_str (ph, token, buffer);
xchat_printf (ph, "%s\t%s: %s\n", name, token, buffer);
hexchat_pluginpref_get_str (ph, token, buffer);
hexchat_printf (ph, "%s\t%s: %s\n", name, token, buffer);
token = strtok (NULL, ",");
}
}
@ -702,9 +702,9 @@ list_settings ()
static void
reset_settings ()
{
xchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS);
xchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT);
xchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
hexchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS);
hexchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT);
hexchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
}
static int
@ -715,20 +715,20 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
int buffer;
char format[bsize];
if (!xchat_pluginpref_get_str (ph, "format", format))
if (!hexchat_pluginpref_get_str (ph, "format", format))
{
xchat_printf (ph, "%s\tError reading config file!", name);
hexchat_printf (ph, "%s\tError reading config file!", name);
return HEXCHAT_EAT_ALL;
}
if (xchat_list_int (ph, NULL, "type") >= 2)
if (hexchat_list_int (ph, NULL, "type") >= 2)
{
announce = 1;
}
if (!g_ascii_strcasecmp ("HELP", word[2]))
{
xchat_printf (ph, sysinfo_help);
hexchat_printf (ph, sysinfo_help);
return HEXCHAT_EAT_ALL;
}
else if (!g_ascii_strcasecmp ("LIST", word[2]))
@ -740,13 +740,13 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
{
if (!g_ascii_strcasecmp ("", word_eol[4]))
{
xchat_printf (ph, "%s\tEnter a value!\n", name);
hexchat_printf (ph, "%s\tEnter a value!\n", name);
return HEXCHAT_EAT_ALL;
}
if (!g_ascii_strcasecmp ("format", word[3]))
{
xchat_pluginpref_set_str (ph, "format", word_eol[4]);
xchat_printf (ph, "%s\tformat is set to: %s\n", name, word_eol[4]);
hexchat_pluginpref_set_str (ph, "format", word_eol[4]);
hexchat_printf (ph, "%s\tformat is set to: %s\n", name, word_eol[4]);
}
else if (!g_ascii_strcasecmp ("percent", word[3]))
{
@ -754,22 +754,22 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
if (buffer > 0 && buffer < INT_MAX)
{
xchat_pluginpref_set_int (ph, "percent", buffer);
xchat_printf (ph, "%s\tpercent is set to: %d\n", name, buffer);
hexchat_pluginpref_set_int (ph, "percent", buffer);
hexchat_printf (ph, "%s\tpercent is set to: %d\n", name, buffer);
}
else
{
xchat_printf (ph, "%s\tInvalid input!\n", name);
hexchat_printf (ph, "%s\tInvalid input!\n", name);
}
}
else if (!g_ascii_strcasecmp ("pciids", word[3]))
{
xchat_pluginpref_set_str (ph, "pciids", word_eol[4]);
xchat_printf (ph, "%s\tpciids is set to: %s\n", name, word_eol[4]);
hexchat_pluginpref_set_str (ph, "pciids", word_eol[4]);
hexchat_printf (ph, "%s\tpciids is set to: %s\n", name, word_eol[4]);
}
else
{
xchat_printf (ph, "%s\tInvalid variable name! Use 'pciids', 'format' or 'percent'!\n", name);
hexchat_printf (ph, "%s\tInvalid variable name! Use 'pciids', 'format' or 'percent'!\n", name);
return HEXCHAT_EAT_ALL;
}
@ -778,7 +778,7 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
else if (!g_ascii_strcasecmp ("RESET", word[2]))
{
reset_settings ();
xchat_printf (ph, "%s\tSettings have been restored to defaults.\n", name);
hexchat_printf (ph, "%s\tSettings have been restored to defaults.\n", name);
return HEXCHAT_EAT_ALL;
}
else if (!g_ascii_strcasecmp ("OS", word[2]))
@ -833,13 +833,13 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
}
else
{
xchat_printf (ph, sysinfo_help);
hexchat_printf (ph, sysinfo_help);
return HEXCHAT_EAT_ALL;
}
}
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
*plugin_name = name;
@ -847,35 +847,35 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
*plugin_version = version;
char buffer[bsize];
xchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
xchat_hook_command (ph, "NETDATA", HEXCHAT_PRI_NORM, netdata_cb, NULL, NULL);
xchat_hook_command (ph, "NETSTREAM", HEXCHAT_PRI_NORM, netstream_cb, NULL, NULL);
hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
hexchat_hook_command (ph, "NETDATA", HEXCHAT_PRI_NORM, netdata_cb, NULL, NULL);
hexchat_hook_command (ph, "NETSTREAM", HEXCHAT_PRI_NORM, netstream_cb, NULL, NULL);
/* this is required for the very first run */
if (xchat_pluginpref_get_str (ph, "pciids", buffer) == 0)
if (hexchat_pluginpref_get_str (ph, "pciids", buffer) == 0)
{
xchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS);
hexchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS);
}
if (xchat_pluginpref_get_str (ph, "format", buffer) == 0)
if (hexchat_pluginpref_get_str (ph, "format", buffer) == 0)
{
xchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT);
hexchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT);
}
if (xchat_pluginpref_get_int (ph, "percent") == -1)
if (hexchat_pluginpref_get_int (ph, "percent") == -1)
{
xchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
hexchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT);
}
xchat_command (ph, "MENU ADD \"Window/Display System Info\" \"SYSINFO\"");
xchat_printf (ph, "%s plugin loaded\n", name);
hexchat_command (ph, "MENU ADD \"Window/Display System Info\" \"SYSINFO\"");
hexchat_printf (ph, "%s plugin loaded\n", name);
return 1;
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_command (ph, "MENU DEL \"Window/Display System Info\"");
xchat_printf (ph, "%s plugin unloaded\n", name);
hexchat_command (ph, "MENU DEL \"Window/Display System Info\"");
hexchat_printf (ph, "%s plugin unloaded\n", name);
return 1;
}

View File

@ -20,7 +20,7 @@ typedef struct {
char *event;
char *emit;
int argc;
xchat_hook *hook;
hexchat_hook *hook;
} print_event;
enum

View File

@ -1,4 +1,4 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
xchat_plugin_get_info
hexchat_plugin_init
hexchat_plugin_deinit
hexchat_plugin_get_info

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
typedef struct {
char *procPtr;
xchat_hook *hook;
hexchat_hook *hook;
} alias;
typedef struct {
@ -53,7 +53,7 @@ typedef struct {
static char *StrDup(const char *string, int *length);
static char *myitoa(long value);
static xchat_context *xchat_smart_context(const char *arg1, const char *arg2);
static hexchat_context *xchat_smart_context(const char *arg1, const char *arg2);
static void queue_nexttimer();
static int insert_timer(int seconds, int count, const char *script);
static void do_timer();
@ -79,7 +79,7 @@ static int tcl_chats(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
static int tcl_ignores(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]);
static int tcl_dcclist(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]);
static int tcl_me(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]);
static int tcl_xchat_nickcmp(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]);
static int tcl_hexchat_nickcmp(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]);
static int tcl_strip(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]);
static int tcl_topic(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]);
static int tcl_word(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]);
@ -94,5 +94,5 @@ static int TCL_Event_Handler(void *userdata);
static void Tcl_Plugin_Init();
static void Tcl_Plugin_DeInit();
static void banner();
int xchat_plugin_init(xchat_plugin * plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg);
int xchat_plugin_deinit();
int hexchat_plugin_init(hexchat_plugin * plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg);
int hexchat_plugin_deinit();

View File

@ -28,7 +28,7 @@
#define DEFAULT_DELAY 10 /* 10 seconds */
#define DEFAULT_FREQ 360 /* 6 hours */
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static char name[] = "Update Checker";
static char desc[] = "Check for HexChat updates automatically";
static char version[] = "4.0";
@ -162,14 +162,14 @@ print_version (char *word[], char *word_eol[], void *userdata)
if (!g_ascii_strcasecmp ("HELP", word[2]))
{
xchat_printf (ph, upd_help);
hexchat_printf (ph, upd_help);
return HEXCHAT_EAT_XCHAT;
}
else if (!g_ascii_strcasecmp ("SET", word[2]))
{
if (!g_ascii_strcasecmp ("", word_eol[4]))
{
xchat_printf (ph, "%s\tEnter a value!\n", name);
hexchat_printf (ph, "%s\tEnter a value!\n", name);
return HEXCHAT_EAT_XCHAT;
}
if (!g_ascii_strcasecmp ("delay", word[3]))
@ -178,13 +178,13 @@ print_version (char *word[], char *word_eol[], void *userdata)
if (convbuf > 0 && convbuf < INT_MAX)
{
prevbuf = xchat_pluginpref_get_int (ph, "delay");
xchat_pluginpref_set_int (ph, "delay", convbuf);
xchat_printf (ph, "%s\tUpdate check startup delay is set to %d seconds (from %d).\n", name, convbuf, prevbuf);
prevbuf = hexchat_pluginpref_get_int (ph, "delay");
hexchat_pluginpref_set_int (ph, "delay", convbuf);
hexchat_printf (ph, "%s\tUpdate check startup delay is set to %d seconds (from %d).\n", name, convbuf, prevbuf);
}
else
{
xchat_printf (ph, "%s\tInvalid input!\n", name);
hexchat_printf (ph, "%s\tInvalid input!\n", name);
}
}
else if (!g_ascii_strcasecmp ("freq", word[3]))
@ -193,18 +193,18 @@ print_version (char *word[], char *word_eol[], void *userdata)
if (convbuf > 0 && convbuf < INT_MAX)
{
prevbuf = xchat_pluginpref_get_int (ph, "freq");
xchat_pluginpref_set_int (ph, "freq", convbuf);
xchat_printf (ph, "%s\tUpdate check frequency is set to %d minutes (from %d).\n", name, convbuf, prevbuf);
prevbuf = hexchat_pluginpref_get_int (ph, "freq");
hexchat_pluginpref_set_int (ph, "freq", convbuf);
hexchat_printf (ph, "%s\tUpdate check frequency is set to %d minutes (from %d).\n", name, convbuf, prevbuf);
}
else
{
xchat_printf (ph, "%s\tInvalid input!\n", name);
hexchat_printf (ph, "%s\tInvalid input!\n", name);
}
}
else
{
xchat_printf (ph, "%s\tInvalid variable name! Use 'delay' or 'freq'!\n", name);
hexchat_printf (ph, "%s\tInvalid variable name! Use 'delay' or 'freq'!\n", name);
return HEXCHAT_EAT_XCHAT;
}
@ -214,27 +214,27 @@ print_version (char *word[], char *word_eol[], void *userdata)
{
version = check_version ();
if (strcmp (version, xchat_get_info (ph, "version")) == 0)
if (strcmp (version, hexchat_get_info (ph, "version")) == 0)
{
xchat_printf (ph, "%s\tYou have the latest version of HexChat installed!\n", name);
hexchat_printf (ph, "%s\tYou have the latest version of HexChat installed!\n", name);
}
else if (strcmp (version, "Unknown") == 0)
{
xchat_printf (ph, "%s\tUnable to check for HexChat updates!\n", name);
hexchat_printf (ph, "%s\tUnable to check for HexChat updates!\n", name);
}
else
{
#ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for some reason */
xchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x64.exe\n", name, version);
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x64.exe\n", name, version);
#else
xchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x86.exe\n", name, version);
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x86.exe\n", name, version);
#endif
}
return HEXCHAT_EAT_XCHAT;
}
else
{
xchat_printf (ph, upd_help);
hexchat_printf (ph, upd_help);
return HEXCHAT_EAT_XCHAT;
}
}
@ -245,12 +245,12 @@ print_version_quiet (void *userdata)
char *version = check_version ();
/* if it's not the current version AND not network error */
if (!(strcmp (version, xchat_get_info (ph, "version")) == 0) && !(strcmp (version, "Unknown") == 0))
if (!(strcmp (version, hexchat_get_info (ph, "version")) == 0) && !(strcmp (version, "Unknown") == 0))
{
#ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for plugins for some reason */
xchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x64.exe\n", name, version);
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x64.exe\n", name, version);
#else
xchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x86.exe\n", name, version);
hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x86.exe\n", name, version);
#endif
/* print update url once, then stop the timer */
return 0;
@ -262,20 +262,20 @@ print_version_quiet (void *userdata)
static int
delayed_check (void *userdata)
{
int freq = xchat_pluginpref_get_int (ph, "freq");
int freq = hexchat_pluginpref_get_int (ph, "freq");
/* only start the timer if there's no update available during startup */
if (print_version_quiet (NULL))
{
/* check for updates, every 6 hours by default */
xchat_hook_timer (ph, freq * 1000 * 60, print_version_quiet, NULL);
hexchat_hook_timer (ph, freq * 1000 * 60, print_version_quiet, NULL);
}
return 0; /* run delayed_check() only once */
}
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
int delay;
ph = plugin_handle;
@ -285,30 +285,30 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
*plugin_version = version;
/* these are required for the very first run */
delay = xchat_pluginpref_get_int (ph, "delay");
delay = hexchat_pluginpref_get_int (ph, "delay");
if (delay == -1)
{
delay = DEFAULT_DELAY;
xchat_pluginpref_set_int (ph, "delay", DEFAULT_DELAY);
hexchat_pluginpref_set_int (ph, "delay", DEFAULT_DELAY);
}
if (xchat_pluginpref_get_int (ph, "freq") == -1)
if (hexchat_pluginpref_get_int (ph, "freq") == -1)
{
xchat_pluginpref_set_int (ph, "freq", DEFAULT_FREQ);
hexchat_pluginpref_set_int (ph, "freq", DEFAULT_FREQ);
}
xchat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, print_version, upd_help, NULL);
xchat_hook_timer (ph, delay * 1000, delayed_check, NULL);
xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\"");
xchat_printf (ph, "%s plugin loaded\n", name);
hexchat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, print_version, upd_help, NULL);
hexchat_hook_timer (ph, delay * 1000, delayed_check, NULL);
hexchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\"");
hexchat_printf (ph, "%s plugin loaded\n", name);
return 1; /* return 1 for success */
}
int
xchat_plugin_deinit (void)
hexchat_plugin_deinit (void)
{
xchat_command (ph, "MENU DEL \"Help/Check for updates\"");
xchat_printf (ph, "%s plugin unloaded\n", name);
hexchat_command (ph, "MENU DEL \"Help/Check for updates\"");
hexchat_printf (ph, "%s plugin unloaded\n", name);
return 1;
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -19,7 +19,7 @@
#define PLAYING 1
#define PAUSED 3
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
BOOL winamp_found = FALSE;
@ -66,43 +66,43 @@ HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);
SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);
if (SendMessage(hwndWinamp, WM_USER, 0, 104) == PLAYING)
xchat_printf(ph, "Winamp: playing");
hexchat_printf(ph, "Winamp: playing");
else
xchat_printf(ph, "Winamp: paused");
hexchat_printf(ph, "Winamp: paused");
}
}
else
if (!stricmp("STOP", word[2]))
{
SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
xchat_printf(ph, "Winamp: stopped");
hexchat_printf(ph, "Winamp: stopped");
}
else
if (!stricmp("PLAY", word[2]))
{
SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
xchat_printf(ph, "Winamp: playing");
hexchat_printf(ph, "Winamp: playing");
}
else
if (!stricmp("NEXT", word[2]))
{
SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
xchat_printf(ph, "Winamp: next playlist entry");
hexchat_printf(ph, "Winamp: next playlist entry");
}
else
if (!stricmp("PREV", word[2]))
{
SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
xchat_printf(ph, "Winamp: previous playlist entry");
hexchat_printf(ph, "Winamp: previous playlist entry");
}
else
if (!stricmp("START", word[2]))
{
SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);
xchat_printf(ph, "Winamp: playlist start");
hexchat_printf(ph, "Winamp: playlist start");
}
else
@ -141,25 +141,25 @@ HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);
sprintf(truc, "me is now playing:%s", cur_esc);
}
xchat_commandf(ph, truc);
hexchat_commandf(ph, truc);
}
else xchat_print(ph, "Winamp: Nothing being played.");
else hexchat_print(ph, "Winamp: Nothing being played.");
}
else
xchat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
hexchat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
}
}
else
{
xchat_print(ph, "Winamp not found.\n");
hexchat_print(ph, "Winamp not found.\n");
}
return HEXCHAT_EAT_ALL;
}
int
xchat_plugin_init(xchat_plugin *plugin_handle,
hexchat_plugin_init(hexchat_plugin *plugin_handle,
char **plugin_name,
char **plugin_desc,
char **plugin_version,
@ -172,18 +172,18 @@ xchat_plugin_init(xchat_plugin *plugin_handle,
*plugin_desc = "Winamp plugin for HexChat";
*plugin_version = "0.5";
xchat_hook_command (ph, "WINAMP", HEXCHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
xchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
hexchat_hook_command (ph, "WINAMP", HEXCHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
hexchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
xchat_print (ph, "Winamp plugin loaded\n");
hexchat_print (ph, "Winamp plugin loaded\n");
return 1; /* return 1 for success */
}
int
xchat_plugin_deinit(void)
hexchat_plugin_deinit(void)
{
xchat_command (ph, "MENU DEL \"Window/Display Current Song (Winamp)\"");
xchat_print (ph, "Winamp plugin unloaded\n");
hexchat_command (ph, "MENU DEL \"Window/Display Current Song (Winamp)\"");
hexchat_print (ph, "Winamp plugin unloaded\n");
return 1;
}

View File

@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@ -18,14 +18,14 @@
/******************************************************************
* Globalss
******************************************************************/
xchat_plugin *ph = NULL;
hexchat_plugin *ph = NULL;
CWMPPlayer4 *wmp;
static const char subKey[] = "Software\\FlowerSoft\\WMPA";
/******************************************************************
* xchat_plugin_init
* hexchat_plugin_init
******************************************************************/
int xchat_plugin_init(xchat_plugin *plugin_handle,
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
char **plugin_name,
char **plugin_desc,
char **plugin_version,
@ -42,75 +42,75 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
// Show the song browser
success = StartWindowsMediaPlayer();
if (!success) {
xchat_printf(ph, "WMPA: Failed to show the song browser.");
xchat_printf(ph, "WMPA: Could not load plug-in version %s.", VER_STRING);
hexchat_printf(ph, "WMPA: Failed to show the song browser.");
hexchat_printf(ph, "WMPA: Could not load plug-in version %s.", VER_STRING);
return(E_FAIL);
}
// Get a pointer to the Windows Media Player control
wmp = GetWindowsMediaPlayer();
if (wmp == NULL) {
xchat_printf(ph, "WMPA: Failed to get a pointer to the Windows Media Player interface.");
xchat_printf(ph, "WMPA: Could not load plug-in version %s.", VER_STRING);
hexchat_printf(ph, "WMPA: Failed to get a pointer to the Windows Media Player interface.");
hexchat_printf(ph, "WMPA: Could not load plug-in version %s.", VER_STRING);
return(E_POINTER);
}
// Restore the settings (need wmp first)
success = wmpaRestoreSettings();
if (!success) {
xchat_printf(ph, "WMPA: Failed to restore the settings.");
hexchat_printf(ph, "WMPA: Failed to restore the settings.");
}
xchat_hook_command(ph, "auto", HEXCHAT_PRI_NORM, wmpaAuto, 0, 0);
xchat_hook_command(ph, "curr", HEXCHAT_PRI_NORM, wmpaCurr, 0, 0);
xchat_hook_command(ph, "find", HEXCHAT_PRI_NORM, wmpaFind, 0, 0);
xchat_hook_command(ph, "slist", HEXCHAT_PRI_NORM, wmpaList, 0, 0);
xchat_hook_command(ph, "next", HEXCHAT_PRI_NORM, wmpaNext, 0, 0);
xchat_hook_command(ph, "play", HEXCHAT_PRI_NORM, wmpaPlay, 0, 0);
xchat_hook_command(ph, "pause", HEXCHAT_PRI_NORM, wmpaPause, 0, 0);
xchat_hook_command(ph, "prev", HEXCHAT_PRI_NORM, wmpaPrev, 0, 0);
xchat_hook_command(ph, "song", HEXCHAT_PRI_NORM, wmpaSong, 0, 0);
xchat_hook_command(ph, "stop", HEXCHAT_PRI_NORM, wmpaStop, 0, 0);
xchat_hook_command(ph, "volume", HEXCHAT_PRI_NORM, wmpaVolume, 0, 0);
xchat_hook_command(ph, "wmpahelp", HEXCHAT_PRI_NORM, wmpaHelp, 0, 0);
hexchat_hook_command(ph, "auto", HEXCHAT_PRI_NORM, wmpaAuto, 0, 0);
hexchat_hook_command(ph, "curr", HEXCHAT_PRI_NORM, wmpaCurr, 0, 0);
hexchat_hook_command(ph, "find", HEXCHAT_PRI_NORM, wmpaFind, 0, 0);
hexchat_hook_command(ph, "slist", HEXCHAT_PRI_NORM, wmpaList, 0, 0);
hexchat_hook_command(ph, "next", HEXCHAT_PRI_NORM, wmpaNext, 0, 0);
hexchat_hook_command(ph, "play", HEXCHAT_PRI_NORM, wmpaPlay, 0, 0);
hexchat_hook_command(ph, "pause", HEXCHAT_PRI_NORM, wmpaPause, 0, 0);
hexchat_hook_command(ph, "prev", HEXCHAT_PRI_NORM, wmpaPrev, 0, 0);
hexchat_hook_command(ph, "song", HEXCHAT_PRI_NORM, wmpaSong, 0, 0);
hexchat_hook_command(ph, "stop", HEXCHAT_PRI_NORM, wmpaStop, 0, 0);
hexchat_hook_command(ph, "volume", HEXCHAT_PRI_NORM, wmpaVolume, 0, 0);
hexchat_hook_command(ph, "wmpahelp", HEXCHAT_PRI_NORM, wmpaHelp, 0, 0);
xchat_printf(ph, "WMPA %s successfully loaded.", VER_STRING);
hexchat_printf(ph, "WMPA %s successfully loaded.", VER_STRING);
wmpaCommands();
xchat_printf(ph, "WMPA: e-mail me if you find any bugs: dcullen@intergate.com");
hexchat_printf(ph, "WMPA: e-mail me if you find any bugs: dcullen@intergate.com");
return 1;
}
/******************************************************************
* xchat_plugin_deinit
* hexchat_plugin_deinit
******************************************************************/
int xchat_plugin_deinit(void)
int hexchat_plugin_deinit(void)
{
BOOL success;
xchat_printf(ph, "WMPA %s is unloading.", VER_STRING);
hexchat_printf(ph, "WMPA %s is unloading.", VER_STRING);
// Save the settings
success = wmpaSaveSettings();
if (!success) {
xchat_printf(ph, "WMPA: Failed to save the settings.");
hexchat_printf(ph, "WMPA: Failed to save the settings.");
}
wmp = NULL;
BOOL result = StopWindowsMediaPlayer();
if (!result) {
xchat_printf(ph, "WMPA could not shut down Windows Media Player.");
hexchat_printf(ph, "WMPA could not shut down Windows Media Player.");
}
xchat_printf(ph, "WMPA %s has unloaded.", VER_STRING);
hexchat_printf(ph, "WMPA %s has unloaded.", VER_STRING);
return 1;
}
/******************************************************************
* xchat_plugin_get_info
* hexchat_plugin_get_info
******************************************************************/
void xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved)
void hexchat_plugin_get_info(char **name, char **desc, char **version, void **reserved)
{
*name = "WMPA";
*desc = "Announce the current song from Windows Media Player.";
@ -123,18 +123,18 @@ void xchat_plugin_get_info(char **name, char **desc, char **version, void **rese
******************************************************************/
void wmpaCommands(void)
{
xchat_printf(ph, "WMPA: /auto [on/off] : Turn on/off auto announce of the current song or display the current setting");
xchat_printf(ph, "WMPA: /curr : Tell what song is currently playing");
xchat_printf(ph, "WMPA: /find [word] : Find songs with \"word\" in their title, create a new playlist, and play it");
xchat_printf(ph, "WMPA: /slist [word] : List songs with \"word\" in their title");
xchat_printf(ph, "WMPA: /next : Play the next song");
xchat_printf(ph, "WMPA: /play : Play the current song");
xchat_printf(ph, "WMPA: /pause : Pause the current song");
xchat_printf(ph, "WMPA: /prev : Play the previous song");
xchat_printf(ph, "WMPA: /song : Announce the current song from Windows Media Player in HexChat");
xchat_printf(ph, "WMPA: /stop : Stop the current song");
xchat_printf(ph, "WMPA: /volume [volume] : Set the volume (0 to 100) or display the current volume");
xchat_printf(ph, "WMPA: /wmpahelp : Display this help.");
hexchat_printf(ph, "WMPA: /auto [on/off] : Turn on/off auto announce of the current song or display the current setting");
hexchat_printf(ph, "WMPA: /curr : Tell what song is currently playing");
hexchat_printf(ph, "WMPA: /find [word] : Find songs with \"word\" in their title, create a new playlist, and play it");
hexchat_printf(ph, "WMPA: /slist [word] : List songs with \"word\" in their title");
hexchat_printf(ph, "WMPA: /next : Play the next song");
hexchat_printf(ph, "WMPA: /play : Play the current song");
hexchat_printf(ph, "WMPA: /pause : Pause the current song");
hexchat_printf(ph, "WMPA: /prev : Play the previous song");
hexchat_printf(ph, "WMPA: /song : Announce the current song from Windows Media Player in HexChat");
hexchat_printf(ph, "WMPA: /stop : Stop the current song");
hexchat_printf(ph, "WMPA: /volume [volume] : Set the volume (0 to 100) or display the current volume");
hexchat_printf(ph, "WMPA: /wmpahelp : Display this help.");
}
/******************************************************************
@ -167,7 +167,7 @@ int wmpaAuto(char *word[], char *word_eol[], void *user_data)
wmpaSaveSettings();
}
xchat_printf(ph, "WMPA: auto is %s", state);
hexchat_printf(ph, "WMPA: auto is %s", state);
return(HEXCHAT_EAT_ALL);
}
@ -177,7 +177,7 @@ int wmpaAuto(char *word[], char *word_eol[], void *user_data)
******************************************************************/
int wmpaCurr(char *word[], char *word_eol[], void *user_data)
{
xchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
return(HEXCHAT_EAT_ALL);
}
@ -224,10 +224,10 @@ int wmpaFind(char *word[], char *word_eol[], void *user_data)
}
if (found > 0) {
xchat_printf(ph, "WMPA: Found %d songs with \"%s\" in them", found, word_eol[2]);
hexchat_printf(ph, "WMPA: Found %d songs with \"%s\" in them", found, word_eol[2]);
wmp->SetCurrentPlaylist(playlist);
wmp->GetControls().play();
xchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
CWMPADialog *dialog = GetWMPADialog();
if (dialog != NULL) {
@ -238,7 +238,7 @@ int wmpaFind(char *word[], char *word_eol[], void *user_data)
}
else {
xchat_printf(ph, "WMPA: Could not find %s", word_eol[2]);
hexchat_printf(ph, "WMPA: Could not find %s", word_eol[2]);
}
}
@ -256,7 +256,7 @@ int wmpaList(char *word[], char *word_eol[], void *user_data)
long found;
if (wmp != NULL) {
xchat_printf(ph, "WMPA: Listing songs with \"%s\" in them", word_eol[2]);
hexchat_printf(ph, "WMPA: Listing songs with \"%s\" in them", word_eol[2]);
CWMPMediaCollection mc = wmp->GetMediaCollection();
CWMPPlaylist all = mc.getAll();
@ -272,19 +272,19 @@ int wmpaList(char *word[], char *word_eol[], void *user_data)
if ( (artist.Find(word_eol[2]) != -1) ||
(title.Find(word_eol[2]) != -1) ||
(album.Find(word_eol[2]) != -1) ) {
xchat_printf(ph, "WMPA: Found \"%s - %s (%s)\"", artist, title, album);
hexchat_printf(ph, "WMPA: Found \"%s - %s (%s)\"", artist, title, album);
found++;
}
}
if (found > 0) {
if (found == 1)
xchat_printf(ph, "WMPA: Found %d song with \"%s\" in it", found, word_eol[2]);
hexchat_printf(ph, "WMPA: Found %d song with \"%s\" in it", found, word_eol[2]);
else
xchat_printf(ph, "WMPA: Found %d songs with \"%s\" in them", found, word_eol[2]);
hexchat_printf(ph, "WMPA: Found %d songs with \"%s\" in them", found, word_eol[2]);
}
else {
xchat_printf(ph, "WMPA: Could not find any songs with \"%s\" in them", word_eol[2]);
hexchat_printf(ph, "WMPA: Could not find any songs with \"%s\" in them", word_eol[2]);
}
}
@ -299,7 +299,7 @@ int wmpaNext(char *word[], char *word_eol[], void *user_data)
{
if (wmp != NULL) {
wmp->GetControls().next();
xchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
}
return(HEXCHAT_EAT_ALL);
}
@ -311,7 +311,7 @@ int wmpaPlay(char *word[], char *word_eol[], void *user_data)
{
if (wmp != NULL) {
wmp->GetControls().play();
xchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
}
return(HEXCHAT_EAT_ALL);
}
@ -323,7 +323,7 @@ int wmpaPause(char *word[], char *word_eol[], void *user_data)
{
if (wmp != NULL) {
wmp->GetControls().pause();
xchat_printf(ph, "WMPA: Pausing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Pausing %s", (LPCTSTR) wmpaGetSongTitle());
}
return(HEXCHAT_EAT_ALL);
}
@ -335,7 +335,7 @@ int wmpaPrev(char *word[], char *word_eol[], void *user_data)
{
if (wmp != NULL) {
wmp->GetControls().previous();
xchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
}
return(HEXCHAT_EAT_ALL);
}
@ -347,7 +347,7 @@ int wmpaSong(char *word[], char *word_eol[], void *user_data)
{
CString songTitle = wmpaGetSongTitle();
xchat_commandf(ph, "me is playing %s", (LPCTSTR) songTitle);
hexchat_commandf(ph, "me is playing %s", (LPCTSTR) songTitle);
return(HEXCHAT_EAT_ALL);
}
@ -359,7 +359,7 @@ int wmpaStop(char *word[], char *word_eol[], void *user_data)
{
if (wmp != NULL) {
wmp->GetControls().stop();
xchat_printf(ph, "WMPA: Stopping %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Stopping %s", (LPCTSTR) wmpaGetSongTitle());
}
return(HEXCHAT_EAT_ALL);
}
@ -369,10 +369,10 @@ int wmpaStop(char *word[], char *word_eol[], void *user_data)
******************************************************************/
int wmpaHelp(char *word[], char *word_eol[], void *user_data)
{
xchat_printf(ph, "\n");
xchat_printf(ph, "WMPA %s Help", VER_STRING);
hexchat_printf(ph, "\n");
hexchat_printf(ph, "WMPA %s Help", VER_STRING);
wmpaCommands();
xchat_printf(ph, "\n");
hexchat_printf(ph, "\n");
return(HEXCHAT_EAT_ALL);
}
@ -397,7 +397,7 @@ int wmpaVolume(char *word[], char *word_eol[], void *user_data)
}
}
xchat_printf(ph, "WMPA: volume is %d", volume);
hexchat_printf(ph, "WMPA: volume is %d", volume);
return(HEXCHAT_EAT_ALL);
}
@ -471,7 +471,7 @@ CString wmpaGetSongTitle(void)
CWMPMedia media = wmp->GetCurrentMedia();
if (media == NULL) {
xchat_printf(ph, "WMPA: Could not get current media");
hexchat_printf(ph, "WMPA: Could not get current media");
return(HEXCHAT_EAT_ALL);
}

View File

@ -30,230 +30,230 @@ extern "C" {
#endif
typedef struct _xchat_plugin xchat_plugin;
typedef struct _xchat_list xchat_list;
typedef struct _xchat_hook xchat_hook;
typedef struct _hexchat_plugin hexchat_plugin;
typedef struct _hexchat_list hexchat_list;
typedef struct _hexchat_hook hexchat_hook;
#ifndef PLUGIN_C
typedef struct _xchat_context xchat_context;
typedef struct _hexchat_context hexchat_context;
#endif
#ifndef PLUGIN_C
struct _xchat_plugin {
struct _hexchat_plugin {
/* these are only used on win32 */
xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_command) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
const char *help_text,
void *userdata);
xchat_hook *(*xchat_hook_server) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_server) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_print) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_print) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_timer) (hexchat_plugin *ph,
int timeout,
int (*callback) (void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_fd) (hexchat_plugin *ph,
int fd,
int flags,
int (*callback) (int fd, int flags, void *user_data),
void *userdata);
void *(*xchat_unhook) (xchat_plugin *ph,
xchat_hook *hook);
void (*xchat_print) (xchat_plugin *ph,
void *(*hexchat_unhook) (hexchat_plugin *ph,
hexchat_hook *hook);
void (*hexchat_print) (hexchat_plugin *ph,
const char *text);
void (*xchat_printf) (xchat_plugin *ph,
void (*hexchat_printf) (hexchat_plugin *ph,
const char *format, ...);
void (*xchat_command) (xchat_plugin *ph,
void (*hexchat_command) (hexchat_plugin *ph,
const char *command);
void (*xchat_commandf) (xchat_plugin *ph,
void (*hexchat_commandf) (hexchat_plugin *ph,
const char *format, ...);
int (*xchat_nickcmp) (xchat_plugin *ph,
int (*hexchat_nickcmp) (hexchat_plugin *ph,
const char *s1,
const char *s2);
int (*xchat_set_context) (xchat_plugin *ph,
xchat_context *ctx);
xchat_context *(*xchat_find_context) (xchat_plugin *ph,
int (*hexchat_set_context) (hexchat_plugin *ph,
hexchat_context *ctx);
hexchat_context *(*hexchat_find_context) (hexchat_plugin *ph,
const char *servname,
const char *channel);
xchat_context *(*xchat_get_context) (xchat_plugin *ph);
const char *(*xchat_get_info) (xchat_plugin *ph,
hexchat_context *(*hexchat_get_context) (hexchat_plugin *ph);
const char *(*hexchat_get_info) (hexchat_plugin *ph,
const char *id);
int (*xchat_get_prefs) (xchat_plugin *ph,
int (*xchat_get_prefs) (hexchat_plugin *ph,
const char *name,
const char **string,
int *integer);
xchat_list * (*xchat_list_get) (xchat_plugin *ph,
hexchat_list * (*hexchat_list_get) (hexchat_plugin *ph,
const char *name);
void (*xchat_list_free) (xchat_plugin *ph,
xchat_list *xlist);
const char * const * (*xchat_list_fields) (xchat_plugin *ph,
void (*hexchat_list_free) (hexchat_plugin *ph,
hexchat_list *xlist);
const char * const * (*hexchat_list_fields) (hexchat_plugin *ph,
const char *name);
int (*xchat_list_next) (xchat_plugin *ph,
xchat_list *xlist);
const char * (*xchat_list_str) (xchat_plugin *ph,
xchat_list *xlist,
int (*hexchat_list_next) (hexchat_plugin *ph,
hexchat_list *xlist);
const char * (*hexchat_list_str) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
int (*xchat_list_int) (xchat_plugin *ph,
xchat_list *xlist,
int (*hexchat_list_int) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
void * (*xchat_plugingui_add) (xchat_plugin *ph,
void * (*hexchat_plugingui_add) (hexchat_plugin *ph,
const char *filename,
const char *name,
const char *desc,
const char *version,
char *reserved);
void (*xchat_plugingui_remove) (xchat_plugin *ph,
void (*hexchat_plugingui_remove) (hexchat_plugin *ph,
void *handle);
int (*xchat_emit_print) (xchat_plugin *ph,
int (*hexchat_emit_print) (hexchat_plugin *ph,
const char *event_name, ...);
int (*xchat_read_fd) (xchat_plugin *ph,
int (*xchat_read_fd) (hexchat_plugin *ph,
void *src,
char *buf,
int *len);
time_t (*xchat_list_time) (xchat_plugin *ph,
xchat_list *xlist,
time_t (*hexchat_list_time) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
char *(*xchat_gettext) (xchat_plugin *ph,
char *(*hexchat_gettext) (hexchat_plugin *ph,
const char *msgid);
void (*xchat_send_modes) (xchat_plugin *ph,
void (*hexchat_send_modes) (hexchat_plugin *ph,
const char **targets,
int ntargets,
int modes_per_line,
char sign,
char mode);
char *(*xchat_strip) (xchat_plugin *ph,
char *(*hexchat_strip) (hexchat_plugin *ph,
const char *str,
int len,
int flags);
void (*xchat_free) (xchat_plugin *ph,
void (*hexchat_free) (hexchat_plugin *ph,
void *ptr);
};
#endif
xchat_hook *
xchat_hook_command (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_command (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
const char *help_text,
void *userdata);
xchat_hook *
xchat_hook_server (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_server (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
xchat_hook *
xchat_hook_print (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_print (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], void *user_data),
void *userdata);
xchat_hook *
xchat_hook_timer (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_timer (hexchat_plugin *ph,
int timeout,
int (*callback) (void *user_data),
void *userdata);
xchat_hook *
xchat_hook_fd (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_fd (hexchat_plugin *ph,
int fd,
int flags,
int (*callback) (int fd, int flags, void *user_data),
void *userdata);
void *
xchat_unhook (xchat_plugin *ph,
xchat_hook *hook);
hexchat_unhook (hexchat_plugin *ph,
hexchat_hook *hook);
void
xchat_print (xchat_plugin *ph,
hexchat_print (hexchat_plugin *ph,
const char *text);
void
xchat_printf (xchat_plugin *ph,
hexchat_printf (hexchat_plugin *ph,
const char *format, ...);
void
xchat_command (xchat_plugin *ph,
hexchat_command (hexchat_plugin *ph,
const char *command);
void
xchat_commandf (xchat_plugin *ph,
hexchat_commandf (hexchat_plugin *ph,
const char *format, ...);
int
xchat_nickcmp (xchat_plugin *ph,
hexchat_nickcmp (hexchat_plugin *ph,
const char *s1,
const char *s2);
int
xchat_set_context (xchat_plugin *ph,
xchat_context *ctx);
hexchat_set_context (hexchat_plugin *ph,
hexchat_context *ctx);
xchat_context *
xchat_find_context (xchat_plugin *ph,
hexchat_context *
hexchat_find_context (hexchat_plugin *ph,
const char *servname,
const char *channel);
xchat_context *
xchat_get_context (xchat_plugin *ph);
hexchat_context *
hexchat_get_context (hexchat_plugin *ph);
const char *
xchat_get_info (xchat_plugin *ph,
hexchat_get_info (hexchat_plugin *ph,
const char *id);
int
xchat_get_prefs (xchat_plugin *ph,
xchat_get_prefs (hexchat_plugin *ph,
const char *name,
const char **string,
int *integer);
xchat_list *
xchat_list_get (xchat_plugin *ph,
hexchat_list *
hexchat_list_get (hexchat_plugin *ph,
const char *name);
void
xchat_list_free (xchat_plugin *ph,
xchat_list *xlist);
hexchat_list_free (hexchat_plugin *ph,
hexchat_list *xlist);
const char * const *
xchat_list_fields (xchat_plugin *ph,
hexchat_list_fields (hexchat_plugin *ph,
const char *name);
int
xchat_list_next (xchat_plugin *ph,
xchat_list *xlist);
hexchat_list_next (hexchat_plugin *ph,
hexchat_list *xlist);
const char *
xchat_list_str (xchat_plugin *ph,
xchat_list *xlist,
hexchat_list_str (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
int
xchat_list_int (xchat_plugin *ph,
xchat_list *xlist,
hexchat_list_int (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
time_t
xchat_list_time (xchat_plugin *ph,
xchat_list *xlist,
hexchat_list_time (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
void *
xchat_plugingui_add (xchat_plugin *ph,
hexchat_plugingui_add (hexchat_plugin *ph,
const char *filename,
const char *name,
const char *desc,
@ -261,19 +261,19 @@ extern "C" {
char *reserved);
void
xchat_plugingui_remove (xchat_plugin *ph,
hexchat_plugingui_remove (hexchat_plugin *ph,
void *handle);
int
xchat_emit_print (xchat_plugin *ph,
hexchat_emit_print (hexchat_plugin *ph,
const char *event_name, ...);
char *
xchat_gettext (xchat_plugin *ph,
hexchat_gettext (hexchat_plugin *ph,
const char *msgid);
void
xchat_send_modes (xchat_plugin *ph,
hexchat_send_modes (hexchat_plugin *ph,
const char **targets,
int ntargets,
int modes_per_line,
@ -281,49 +281,49 @@ extern "C" {
char mode);
char *
xchat_strip (xchat_plugin *ph,
hexchat_strip (hexchat_plugin *ph,
const char *str,
int len,
int flags);
void
xchat_free (xchat_plugin *ph,
hexchat_free (hexchat_plugin *ph,
void *ptr);
#if !defined(PLUGIN_C) && defined(WIN32)
#ifndef HEXCHAT_PLUGIN_HANDLE
#define HEXCHAT_PLUGIN_HANDLE (ph)
#endif
#define xchat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_command)
#define xchat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_server)
#define xchat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_print)
#define xchat_hook_timer ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_timer)
#define xchat_hook_fd ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_fd)
#define xchat_unhook ((HEXCHAT_PLUGIN_HANDLE)->xchat_unhook)
#define xchat_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_print)
#define xchat_printf ((HEXCHAT_PLUGIN_HANDLE)->xchat_printf)
#define xchat_command ((HEXCHAT_PLUGIN_HANDLE)->xchat_command)
#define xchat_commandf ((HEXCHAT_PLUGIN_HANDLE)->xchat_commandf)
#define xchat_nickcmp ((HEXCHAT_PLUGIN_HANDLE)->xchat_nickcmp)
#define xchat_set_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_set_context)
#define xchat_find_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_find_context)
#define xchat_get_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_context)
#define xchat_get_info ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_info)
#define hexchat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_command)
#define hexchat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_server)
#define hexchat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_print)
#define hexchat_hook_timer ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_timer)
#define hexchat_hook_fd ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_fd)
#define hexchat_unhook ((HEXCHAT_PLUGIN_HANDLE)->hexchat_unhook)
#define hexchat_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_print)
#define hexchat_printf ((HEXCHAT_PLUGIN_HANDLE)->hexchat_printf)
#define hexchat_command ((HEXCHAT_PLUGIN_HANDLE)->hexchat_command)
#define hexchat_commandf ((HEXCHAT_PLUGIN_HANDLE)->hexchat_commandf)
#define hexchat_nickcmp ((HEXCHAT_PLUGIN_HANDLE)->hexchat_nickcmp)
#define hexchat_set_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_set_context)
#define hexchat_find_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_find_context)
#define hexchat_get_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_get_context)
#define hexchat_get_info ((HEXCHAT_PLUGIN_HANDLE)->hexchat_get_info)
#define xchat_get_prefs ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_prefs)
#define xchat_list_get ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_get)
#define xchat_list_free ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_free)
#define xchat_list_fields ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_fields)
#define xchat_list_str ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_str)
#define xchat_list_int ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_int)
#define xchat_list_time ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_time)
#define xchat_list_next ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_next)
#define xchat_plugingui_add ((HEXCHAT_PLUGIN_HANDLE)->xchat_plugingui_add)
#define xchat_plugingui_remove ((HEXCHAT_PLUGIN_HANDLE)->xchat_plugingui_remove)
#define xchat_emit_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_emit_print)
#define xchat_gettext ((HEXCHAT_PLUGIN_HANDLE)->xchat_gettext)
#define xchat_send_modes ((HEXCHAT_PLUGIN_HANDLE)->xchat_send_modes)
#define xchat_strip ((HEXCHAT_PLUGIN_HANDLE)->xchat_strip)
#define xchat_free ((HEXCHAT_PLUGIN_HANDLE)->xchat_free)
#define hexchat_list_get ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_get)
#define hexchat_list_free ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_free)
#define hexchat_list_fields ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_fields)
#define hexchat_list_str ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_str)
#define hexchat_list_int ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_int)
#define hexchat_list_time ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_time)
#define hexchat_list_next ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_next)
#define hexchat_plugingui_add ((HEXCHAT_PLUGIN_HANDLE)->hexchat_plugingui_add)
#define hexchat_plugingui_remove ((HEXCHAT_PLUGIN_HANDLE)->hexchat_plugingui_remove)
#define hexchat_emit_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_emit_print)
#define hexchat_gettext ((HEXCHAT_PLUGIN_HANDLE)->hexchat_gettext)
#define hexchat_send_modes ((HEXCHAT_PLUGIN_HANDLE)->hexchat_send_modes)
#define hexchat_strip ((HEXCHAT_PLUGIN_HANDLE)->hexchat_strip)
#define hexchat_free ((HEXCHAT_PLUGIN_HANDLE)->hexchat_free)
#endif
#ifdef __cplusplus
@ -333,7 +333,7 @@ extern "C" {
/******************************************************************
* Globals
******************************************************************/
extern xchat_plugin *ph;
extern hexchat_plugin *ph;
/******************************************************************
* Prototypes

View File

@ -7,9 +7,9 @@ EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
xchat_plugin_init
xchat_plugin_deinit
xchat_plugin_get_info
hexchat_plugin_init
hexchat_plugin_deinit
hexchat_plugin_get_info
StartWindowsMediaPlayer
GetWindowsMediaPlayer
GetWMPADialog

View File

@ -108,10 +108,10 @@ void CWMPADialog::OnDblclkPlaylist()
m_WMP.GetControls().play();
if (autoAnnounce) {
xchat_commandf(ph, "me is playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_commandf(ph, "me is playing %s", (LPCTSTR) wmpaGetSongTitle());
}
else {
xchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
}
}
@ -195,10 +195,10 @@ void CWMPADialog::OnDblclkSonglist()
int index = m_SongListBox.GetCurSel();
m_WMP.GetControls().playItem(m_WMP.GetCurrentPlaylist().GetItem(index));
if (autoAnnounce) {
xchat_commandf(ph, "me is playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_commandf(ph, "me is playing %s", (LPCTSTR) wmpaGetSongTitle());
}
else {
xchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
}
}
@ -216,10 +216,10 @@ void CWMPADialog::OnCurrentItemChangeWmp(LPDISPATCH pdispMedia)
int state = m_WMP.GetPlayState();
if (state == 3) { // Playing
if (autoAnnounce) {
xchat_commandf(ph, "me is playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_commandf(ph, "me is playing %s", (LPCTSTR) wmpaGetSongTitle());
}
else {
xchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle());
}
}

View File

@ -5,8 +5,8 @@ all: xdcc.obj xdcc.def
xdcc.def:
echo EXPORTS > xdcc.def
echo xchat_plugin_init >> xdcc.def
echo xchat_plugin_deinit >> xdcc.def
echo hexchat_plugin_init >> xdcc.def
echo hexchat_plugin_deinit >> xdcc.def
xdcc.obj: xdcc.c makefile.mak
cl $(CFLAGS) $(GLIB) /I.. xdcc.c

View File

@ -12,7 +12,7 @@
#include "hexchat-plugin.h"
#include "../../src/common/hexchat.h"
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static int xdcc_on = 1;
static int xdcc_slots = 3;
@ -31,25 +31,25 @@ typedef struct fileoffer
static int num_open_dccs(void)
{
xchat_list *list;
hexchat_list *list;
int num = 0;
list = xchat_list_get(ph, "dcc");
list = hexchat_list_get(ph, "dcc");
if(!list)
return 0;
while(xchat_list_next(ph, list))
while(hexchat_list_next(ph, list))
{
/* check only ACTIVE dccs */
if(xchat_list_int(ph, list, "status") == 1)
if(hexchat_list_int(ph, list, "status") == 1)
{
/* check only SEND dccs */
if(xchat_list_int(ph, list, "type") == 0)
if(hexchat_list_int(ph, list, "type") == 0)
num++;
}
}
xchat_list_free(ph, list);
hexchat_list_free(ph, list);
return num;
}
@ -67,20 +67,20 @@ static void xdcc_get(char *nick, char *host, char *arg)
list = g_slist_nth(file_list, num - 1);
if(!list)
{
xchat_commandf(ph, "quote NOTICE %s :No such file number #%d!", nick, num);
hexchat_commandf(ph, "quote NOTICE %s :No such file number #%d!", nick, num);
return;
}
if(num_open_dccs() >= xdcc_slots)
{
xchat_commandf(ph, "quote NOTICE %s :All slots full. Try again later.", nick);
hexchat_commandf(ph, "quote NOTICE %s :All slots full. Try again later.", nick);
return;
}
offer = (fileoffer *) list->data;
offer->downloads++;
xchat_commandf(ph, "quote NOTICE %s :Sending offer #%d %s", nick, num, offer->file);
xchat_commandf(ph, "dcc send %s %s", nick, offer->fullpath);
hexchat_commandf(ph, "quote NOTICE %s :Sending offer #%d %s", nick, num, offer->file);
hexchat_commandf(ph, "dcc send %s %s", nick, offer->fullpath);
}
static void xdcc_del(char *name)
@ -95,7 +95,7 @@ static void xdcc_del(char *name)
if(strcasecmp(name, offer->file) == 0)
{
file_list = g_slist_remove(file_list, offer);
xchat_printf(ph, "%s [%s] removed.\n", offer->file, offer->fullpath);
hexchat_printf(ph, "%s [%s] removed.\n", offer->file, offer->fullpath);
free(offer->file);
free(offer->desc);
free(offer->fullpath);
@ -125,21 +125,21 @@ static void xdcc_list(char *nick, char *host, char *arg, char *cmd)
int i = 0;
fileoffer *offer;
xchat_commandf(ph, "%s %s :XDCC List:", cmd, nick);
hexchat_commandf(ph, "%s %s :XDCC List:", cmd, nick);
list = file_list;
while(list)
{
i++;
offer = (fileoffer *) list->data;
xchat_commandf(ph, "%s %s :[#%d] %s - %s [%d dl]", cmd,
hexchat_commandf(ph, "%s %s :[#%d] %s - %s [%d dl]", cmd,
nick, i, offer->file, offer->desc, offer->downloads);
list = list->next;
}
if(i == 0)
xchat_commandf(ph, "%s %s :- list empty.", cmd, nick);
hexchat_commandf(ph, "%s %s :- list empty.", cmd, nick);
else
xchat_commandf(ph, "%s %s :%d files listed.", cmd, nick, i);
hexchat_commandf(ph, "%s %s :%d files listed.", cmd, nick, i);
}
static int xdcc_command(char *word[], char *word_eol[], void *userdata)
@ -147,16 +147,16 @@ static int xdcc_command(char *word[], char *word_eol[], void *userdata)
if(strcasecmp(word[2], "ADD") == 0)
{
if(!word_eol[5][0])
xchat_print(ph, "Syntax: /XDCC ADD <name> <path> <description>\n");
hexchat_print(ph, "Syntax: /XDCC ADD <name> <path> <description>\n");
else
{
if(access(word[4], R_OK) == 0)
{
xdcc_add(word[3], word[4], word_eol[5], 0);
xchat_printf(ph, "%s [%s] added.\n", word[3], word[4]);
hexchat_printf(ph, "%s [%s] added.\n", word[3], word[4]);
}
else
xchat_printf(ph, "Cannot read %s\n", word[4]);
hexchat_printf(ph, "Cannot read %s\n", word[4]);
}
return HEXCHAT_EAT_XCHAT;
}
@ -172,10 +172,10 @@ static int xdcc_command(char *word[], char *word_eol[], void *userdata)
if(word[3][0])
{
xdcc_slots = atoi(word[3]);
xchat_printf(ph, "XDCC slots set to %d\n", xdcc_slots);
hexchat_printf(ph, "XDCC slots set to %d\n", xdcc_slots);
} else
{
xchat_printf(ph, "XDCC slots: %d\n", xdcc_slots);
hexchat_printf(ph, "XDCC slots: %d\n", xdcc_slots);
}
return HEXCHAT_EAT_XCHAT;
}
@ -183,7 +183,7 @@ static int xdcc_command(char *word[], char *word_eol[], void *userdata)
if(strcasecmp(word[2], "ON") == 0)
{
xdcc_on = TRUE;
xchat_print(ph, "XDCC now ON\n");
hexchat_print(ph, "XDCC now ON\n");
return HEXCHAT_EAT_XCHAT;
}
@ -196,11 +196,11 @@ static int xdcc_command(char *word[], char *word_eol[], void *userdata)
if(strcasecmp(word[2], "OFF") == 0)
{
xdcc_on = FALSE;
xchat_print(ph, "XDCC now OFF\n");
hexchat_print(ph, "XDCC now OFF\n");
return HEXCHAT_EAT_XCHAT;
}
xchat_print(ph, "Syntax: XDCC ADD <name> <fullpath> <description>\n"
hexchat_print(ph, "Syntax: XDCC ADD <name> <fullpath> <description>\n"
" XDCC DEL <name>\n"
" XDCC SLOTS <number>\n"
" XDCC LIST\n"
@ -223,7 +223,7 @@ static void xdcc_remote(char *from, char *msg)
if(xdcc_on == 0)
{
xchat_commandf(ph, "notice %s XDCC is turned OFF!", from);
hexchat_commandf(ph, "notice %s XDCC is turned OFF!", from);
return;
}
@ -232,7 +232,7 @@ static void xdcc_remote(char *from, char *msg)
else if(strncasecmp(msg, "GET ", 4) == 0)
xdcc_get(nick, host, msg + 4);
else
xchat_commandf(ph, "notice %s Unknown XDCC command!", from);
hexchat_commandf(ph, "notice %s Unknown XDCC command!", from);
}
static int ctcp_cb(char *word[], void *userdata)
@ -253,7 +253,7 @@ static void xdcc_save(void)
GSList *list;
fileoffer *offer;
snprintf(buf, sizeof(buf), "%s/xdcclist.conf", xchat_get_info(ph, "xchatdir"));
snprintf(buf, sizeof(buf), "%s/xdcclist.conf", hexchat_get_info(ph, "xchatdir"));
fp = fopen(buf, "w");
if(!fp)
@ -280,7 +280,7 @@ static void xdcc_load(void)
char dl[128];
FILE *fp;
snprintf(buf, sizeof(buf), "%s/xdcclist.conf", xchat_get_info(ph, "xchatdir"));
snprintf(buf, sizeof(buf), "%s/xdcclist.conf", hexchat_get_info(ph, "xchatdir"));
fp = fopen(buf, "r");
if(!fp)
@ -303,14 +303,14 @@ static void xdcc_load(void)
fclose(fp);
}
int xchat_plugin_deinit(void)
int hexchat_plugin_deinit(void)
{
xdcc_save();
xchat_print(ph, "XDCC List saved\n");
hexchat_print(ph, "XDCC List saved\n");
return 1;
}
int xchat_plugin_init(xchat_plugin *plugin_handle,
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
char **plugin_name, char **plugin_desc, char **plugin_version,
char *arg)
{
@ -320,12 +320,12 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,
*plugin_desc = "Very simple XDCC server";
*plugin_version = "0.1";
xchat_hook_command(ph, "XDCC", HEXCHAT_PRI_NORM, xdcc_command, 0, 0);
xchat_hook_print(ph, "CTCP Generic", HEXCHAT_PRI_NORM, ctcp_cb, 0);
xchat_hook_print(ph, "CTCP Generic to Channel", HEXCHAT_PRI_NORM, ctcp_cb, 0);
hexchat_hook_command(ph, "XDCC", HEXCHAT_PRI_NORM, xdcc_command, 0, 0);
hexchat_hook_print(ph, "CTCP Generic", HEXCHAT_PRI_NORM, ctcp_cb, 0);
hexchat_hook_print(ph, "CTCP Generic to Channel", HEXCHAT_PRI_NORM, ctcp_cb, 0);
xdcc_load();
xchat_print(ph, "XDCC loaded. Type /XDCC for help.\n");
hexchat_print(ph, "XDCC loaded. Type /XDCC for help.\n");
return 1;
}

View File

@ -47,7 +47,7 @@ join_cb (char *word[], void *userdata)
if (enable)
{
/* Op ANYONE who joins */
xchat_commandf (ph, "OP %s", word[1]);
hexchat_commandf (ph, "OP %s", word[1]);
}
/* word[1] is the nickname, as in the Settings->Advanced->TextEvents window in xchat */
@ -60,19 +60,19 @@ autooptoggle_cb (char *word[], char *word_eol[], void *userdata)
if (!enable)
{
enable = 1;
xchat_print (ph, "AutoOping now enabled!\n");
hexchat_print (ph, "AutoOping now enabled!\n");
}
else
{
enable = 0;
xchat_print (ph, "AutoOping now disabled!\n");
hexchat_print (ph, "AutoOping now disabled!\n");
}
return HEXCHAT_EAT_ALL; /* eat this command so HexChat and other plugins can't process it */
}
void
xchat_plugin_get_info (char **name, char **desc, char **version, void **reserved)
hexchat_plugin_get_info (char **name, char **desc, char **version, void **reserved)
{
*name = PNAME;
*desc = PDESC;
@ -80,7 +80,7 @@ xchat_plugin_get_info (char **name, char **desc, char **version, void **reserved
}
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_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;
@ -90,10 +90,10 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
*plugin_desc = PDESC;
*plugin_version = PVERSION;
xchat_hook_command (ph, "AutoOpToggle", HEXCHAT_PRI_NORM, autooptoggle_cb, "Usage: AUTOOPTOGGLE, Turns OFF/ON Auto Oping", 0);
xchat_hook_print (ph, "Join", HEXCHAT_PRI_NORM, join_cb, 0);
hexchat_hook_command (ph, "AutoOpToggle", HEXCHAT_PRI_NORM, autooptoggle_cb, "Usage: AUTOOPTOGGLE, Turns OFF/ON Auto Oping", 0);
hexchat_hook_print (ph, "Join", HEXCHAT_PRI_NORM, join_cb, 0);
xchat_print (ph, "AutoOpPlugin loaded successfully!\n");
hexchat_print (ph, "AutoOpPlugin loaded successfully!\n");
return 1; /* return 1 for success */
}
@ -135,7 +135,7 @@ needed for a long time after calling _xchat\_list\_str_. The types of lists and
<tr bgcolor="#dddddd"><td>Name</td><td>Description</td><td>Type</td></tr>
<tr><td>channel</td><td>Channel or query name</td><td>string</td></tr>
<tr><td>chantypes</td><td>Channel types e.g. "#!&amp;"<br><small>(Added in version 2.0.9. Older versions will return NULL)</small></td><td>string</td>
<tr><td>context</td><td>(xchat_context *) pointer. Can be used with xchat_set_context</td><td>string</td></tr>
<tr><td>context</td><td>(hexchat_context *) pointer. Can be used with hexchat_set_context</td><td>string</td></tr>
<tr><td>flags</td><td>Server/Channel Bits:<br>
<table>
<tr><td>Bit #</td><td>Value</td><td>Description</td></tr>
@ -206,7 +206,7 @@ needed for a long time after calling _xchat\_list\_str_. The types of lists and
<tr><td>seen</td><td>Time when user the user was last verified still online.</td><td>time_t</td></tr>
</table>
<small>The entire "notify" list was added in xchat 2.0.8. Fields are
only valid for the context when xchat_list_get() was called
only valid for the context when hexchat_list_get() was called
(i.e. you get information about the user ON THAT ONE SERVER ONLY). You
may cycle through the "channels" list to find notify information for every
server.</small>
@ -230,22 +230,22 @@ server.</small>
Example:
<pre>
list = xchat_list_get (ph, "dcc");
list = hexchat_list_get (ph, "dcc");
if (list)
{
xchat_print (ph, "--- DCC LIST ------------------\nFile To/From KB/s Position\n");
hexchat_print (ph, "--- DCC LIST ------------------\nFile To/From KB/s Position\n");
while (xchat_list_next (ph, list))
while (hexchat_list_next (ph, list))
{
xchat_printf (ph, "%6s %10s %.2f %d\n",
xchat_list_str (ph, list, "file"),
xchat_list_str (ph, list, "nick"),
xchat_list_int (ph, list, "cps") / 1024,
xchat_list_int (ph, list, "pos"));
hexchat_printf (ph, "%6s %10s %.2f %d\n",
hexchat_list_str (ph, list, "file"),
hexchat_list_str (ph, list, "nick"),
hexchat_list_int (ph, list, "cps") / 1024,
hexchat_list_int (ph, list, "pos"));
}
xchat_list_free (ph, list);
hexchat_list_free (ph, list);
}
</pre>
@ -260,9 +260,9 @@ Yes, it can be done. All you need is Visual Studio setup as explained in [Buildi
<pre>
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
xchat_plugin_get_info
hexchat_plugin_init
hexchat_plugin_deinit
hexchat_plugin_get_info
</pre>
Leave out _xchat\_plugin\_deinit_ if you don't intend to define that
@ -316,7 +316,7 @@ Parameters and flags:
<tr><td>-eX</td><td>Set enable flag to X. -e0 for disable, -e1 for enable. This lets you create a disabled (shaded) item.</td></tr>
<tr><td>-iFILE</td><td>Use an icon filename FILE (new for 2.8.0). Not supported for toggles or radio items.</td></tr>
<tr><td>-k&lt;mod>,&lt;key></td><td>Specify a keyboard shortcut. "mod" is the modifier which is a bitwise OR of: 1-SHIFT 4-CTRL 8-ALT in decimal. "key" is the key value in decimal, e.g. -k5,101 would specify SHIFT-CTRL-E.</td></tr>
<tr><td>-m</td><td>Specify that this label should be treated as <a href="http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html">Pango Markup</a> language. Since forward slash ("/") is already used in menu paths, you should replace closing tags with an ASCII 003 instead e.g.: xchat_command(ph, "MENU -m ADD \"&lt;b>Bold Menu&lt;\003b>\""); (new for 2.6.6).</td></tr>
<tr><td>-m</td><td>Specify that this label should be treated as <a href="http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html">Pango Markup</a> language. Since forward slash ("/") is already used in menu paths, you should replace closing tags with an ASCII 003 instead e.g.: hexchat_command(ph, "MENU -m ADD \"&lt;b>Bold Menu&lt;\003b>\""); (new for 2.6.6).</td></tr>
<tr><td>-pX</td><td>Specify a menu item's position number. e.g. -p5 will cause the item to be inserted in the 5th place. New for 2.8.0: If the position is a negative number, it will be used as an offset from the bottom/right-most item.</td></tr>
<tr><td>-rX,group</td><td>Specify a radio menu item, with initial state X and a group name (new for 2.8.0). The group name should be the exact label of another menu item (without the path) that this item will be grouped with. For radio items, only a select command will be executed (no unselect command).</td></tr>
<tr><td>-tX</td><td>Specify a toggle menu item with an initial state. -t0 for an "unticked" item and -t1 for a "ticked" item.</td></tr>
@ -454,7 +454,7 @@ get_file_name (char *nick, char *fname)
while (fgets (buf, sizeof (buf), fp))
{
/* send every line to the user that requested it */
xchat_commandf (ph, "QUOTE NOTICE %s :%s", nick, buf);
hexchat_commandf (ph, "QUOTE NOTICE %s :%s", nick, buf);
}
fclose (fp);
}
@ -494,15 +494,15 @@ onotice_cb (char *word[], char *word_eol[], void *userdata)
{
if (word_eol[2][0] == 0)
{
xchat_printf (ph, "Second arg must be the message!\n");
hexchat_printf (ph, "Second arg must be the message!\n");
return HEXCHAT_EAT_ALL;
}
xchat_commandf (ph, "NOTICE @%s :%s", xchat_get_info (ph, "channel"), word_eol[2]);
hexchat_commandf (ph, "NOTICE @%s :%s", hexchat_get_info (ph, "channel"), word_eol[2]);
return HEXCHAT_EAT_ALL;
}
xchat_hook_command (ph, "ONOTICE", HEXCHAT_PRI_NORM, onotice_cb, "Usage: ONOTICE &lt;message> Sends a notice to all ops", NULL);
hexchat_hook_command (ph, "ONOTICE", HEXCHAT_PRI_NORM, onotice_cb, "Usage: ONOTICE &lt;message> Sends a notice to all ops", NULL);
</pre>
***
@ -568,11 +568,11 @@ Currently they are:
static int
youpart_cb (char *word[], void *userdata)
{
xchat_printf (ph, "You have left channel %s\n", word[3]);
hexchat_printf (ph, "You have left channel %s\n", word[3]);
return HEXCHAT_EAT_XCHAT; /* dont let HexChat do its normal printing */
}
xchat_hook_print (ph, "You Part", HEXCHAT_PRI_NORM, youpart_cb, NULL);
hexchat_hook_print (ph, "You Part", HEXCHAT_PRI_NORM, youpart_cb, NULL);
</pre>
***
@ -600,11 +600,11 @@ hook every line that comes from the IRC server, you may use the special name of
static int
kick_cb (char *word[], char *word_eol[], void *userdata)
{
xchat_printf (ph, "%s was kicked from %s (reason=%s)\n", word[4], word[3], word_eol[5]);
hexchat_printf (ph, "%s was kicked from %s (reason=%s)\n", word[4], word[3], word_eol[5]);
return HEXCHAT_EAT_NONE; /* don't eat this event, let other plugins and HexChat see it too */
}
xchat_hook_server (ph, "KICK", HEXCHAT_PRI_NORM, kick_cb, NULL);
hexchat_hook_server (ph, "KICK", HEXCHAT_PRI_NORM, kick_cb, NULL);
</pre>
***
@ -622,21 +622,21 @@ xchat_hook_server (ph, "KICK", HEXCHAT_PRI_NORM, kick_cb, NULL);
* **callb:** Callback function. This will be called every "timeout" milliseconds.
* **userdata:** Pointer passed to the callback function.
**Returns:** Pointer to the hook. Can be passed to xchat_unhook.
**Returns:** Pointer to the hook. Can be passed to hexchat_unhook.
**Example:**
<pre>
static xchat_hook *myhook;
static hexchat_hook *myhook;
static int
stop_cb (char *word[], char *word_eol[], void *userdata)
{
if (myhook != NULL)
{
xchat_unhook (ph, myhook);
hexchat_unhook (ph, myhook);
myhook = NULL;
xchat_print (ph, "Timeout removed!\n");
hexchat_print (ph, "Timeout removed!\n");
}
return HEXCHAT_EAT_ALL;
@ -645,12 +645,12 @@ stop_cb (char *word[], char *word_eol[], void *userdata)
static int
timeout_cb (void *userdata)
{
xchat_print (ph, "Annoying message every 5 seconds! Type /STOP to stop it.\n");
hexchat_print (ph, "Annoying message every 5 seconds! Type /STOP to stop it.\n");
return 1; /* return 1 to keep the timeout going */
}
myhook = xchat_hook_timer (ph, 5000, timeout_cb, NULL);
xchat_hook_command (ph, "STOP", HEXCHAT_PRI_NORM, stop_cb, NULL, NULL);
myhook = hexchat_hook_timer (ph, 5000, timeout_cb, NULL);
hexchat_hook_command (ph, "STOP", HEXCHAT_PRI_NORM, stop_cb, NULL, NULL);
</pre>
***
@ -740,7 +740,7 @@ xchat_hook_command (ph, "STOP", HEXCHAT_PRI_NORM, stop_cb, NULL, NULL);
**Example:**
<pre>
xchat_emit_print (ph, "Channel Message", "John", "Hi there", "@", NULL);
hexchat_emit_print (ph, "Channel Message", "John", "Hi there", "@", NULL);
</pre>
***
@ -767,7 +767,7 @@ in a channel context.
<pre>
const char *names_to_Op[] = {"John", "Jack", "Jill"};
xchat_send_modes (ph, names_to_Op, 3, 0, '+', 'o');
hexchat_send_modes (ph, names_to_Op, 3, 0, '+', 'o');
</pre>
***
@ -877,7 +877,7 @@ A few extra bits of information are available that don't appear in the _/SET_ li
if (xchat_get_prefs (ph, "irc_nick1", &amp;str, &amp;i) == 1)
{
xchat_printf (ph, "Current nickname setting: %s\n", str);
hexchat_printf (ph, "Current nickname setting: %s\n", str);
}
}
</pre>
@ -948,13 +948,13 @@ equivalence of two nicknames.
char *new_text;
/* strip both colors and attributes by using the 0 and 1 bits (1 BITWISE-OR 2) */
new_text = xchat_strip (ph, "\00312Blue\003 \002Bold!\002", -1, 1 | 2);
new_text = hexchat_strip (ph, "\00312Blue\003 \002Bold!\002", -1, 1 | 2);
if (new_text)
{
/* new_text should now contain only "Blue Bold!" */
xchat_printf (ph, "%s\n", new_text);
xchat_free (ph, new_text);
hexchat_printf (ph, "%s\n", new_text);
hexchat_free (ph, new_text);
}
}
</pre>
@ -995,15 +995,15 @@ equivalence of two nicknames.
<pre>
int
xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
*plugin_name = "Tester Thingie";
*plugin_desc = "Testing stuff";
*plugin_version = "1.0";
xchat_pluginpref_set_str (ph, "myvar1", "I want to save this string!");
xchat_pluginpref_set_str (ph, "myvar2", "This is important, too.");
hexchat_pluginpref_set_str (ph, "myvar1", "I want to save this string!");
hexchat_pluginpref_set_str (ph, "myvar2", "This is important, too.");
return 1; /* return 1 for success */
}
@ -1018,7 +1018,7 @@ You should never need to edit this file manually.
***
### xchat\_pluginpref\_get\_str ()
**Prototype:** int xchat_pluginpref_get_str (xchat\_plugin \*ph, const char \*var, char \*dest);
**Prototype:** int hexchat_pluginpref_get_str (xchat\_plugin \*ph, const char \*var, char \*dest);
**Description:** Loads a plugin-specific setting with string value from a plugin-specific config file.
@ -1062,18 +1062,18 @@ saveint_cb (char *word[], char *word_eol[], void *user_data)
if (buffer > 0 && buffer &lt; INT_MAX)
{
if (xchat_pluginpref_set_int (ph, "myint1", buffer))
if (hexchat_pluginpref_set_int (ph, "myint1", buffer))
{
xchat_printf (ph, "Setting successfully saved!\n");
hexchat_printf (ph, "Setting successfully saved!\n");
}
else
{
xchat_printf (ph, "Error while saving!\n");
hexchat_printf (ph, "Error while saving!\n");
}
}
else
{
xchat_printf (ph, "Invalid input!\n");
hexchat_printf (ph, "Invalid input!\n");
}
return HEXCHAT_EAT_XCHAT;
@ -1144,14 +1144,14 @@ list_settings ()
char buffer[512];
char *token;
xchat_pluginpref_list (ph, list);
xchat_printf (ph, "Current Settings:\n");
hexchat_pluginpref_list (ph, list);
hexchat_printf (ph, "Current Settings:\n");
token = strtok (list, ",");
while (token != NULL)
{
xchat_pluginpref_get_str (ph, token, buffer);
xchat_printf (ph, "%s: %s\n", token, buffer);
hexchat_pluginpref_get_str (ph, token, buffer);
hexchat_printf (ph, "%s: %s\n", token, buffer);
token = strtok (NULL, ",");
}
}

View File

@ -34,7 +34,7 @@
#define DBUS_SERVICE "org.hexchat.service"
#define DBUS_OBJECT_PATH "/org/hexchat"
static xchat_plugin *ph;
static hexchat_plugin *ph;
static guint last_context_id = 0;
static GList *contexts = NULL;
static GHashTable *clients = NULL;
@ -51,7 +51,7 @@ struct RemoteObject
guint last_hook_id;
guint last_list_id;
xchat_context *context;
hexchat_context *context;
char *dbus_path;
char *filename;
GHashTable *hooks;
@ -68,14 +68,14 @@ typedef struct
{
guint id;
int return_value;
xchat_hook *hook;
hexchat_hook *hook;
RemoteObject *obj;
} HookInfo;
typedef struct
{
guint id;
xchat_context *context;
hexchat_context *context;
} ContextInfo;
enum
@ -246,8 +246,8 @@ static gboolean remote_object_send_modes (RemoteObject *obj,
/* Useful functions */
static char** build_list (char *word[]);
static guint context_list_find_id (xchat_context *context);
static xchat_context* context_list_find_context (guint id);
static guint context_list_find_id (hexchat_context *context);
static hexchat_context* context_list_find_context (guint id);
/* Remote Object */
@ -259,14 +259,14 @@ hook_info_destroy (gpointer data)
if (info == NULL) {
return;
}
xchat_unhook (ph, info->hook);
hexchat_unhook (ph, info->hook);
g_free (info);
}
static void
list_info_destroy (gpointer data)
{
xchat_list_free (ph, (xchat_list*)data);
hexchat_list_free (ph, (hexchat_list*)data);
}
static void
@ -278,7 +278,7 @@ remote_object_finalize (GObject *obj)
g_hash_table_destroy (self->hooks);
g_free (self->dbus_path);
g_free (self->filename);
xchat_plugingui_remove (ph, self->handle);
hexchat_plugingui_remove (ph, self->handle);
G_OBJECT_CLASS (remote_object_parent_class)->finalize (obj);
}
@ -301,7 +301,7 @@ remote_object_init (RemoteObject *obj)
obj->filename = NULL;
obj->last_hook_id = 0;
obj->last_list_id = 0;
obj->context = xchat_get_context (ph);
obj->context = hexchat_get_context (ph);
}
static void
@ -377,7 +377,7 @@ remote_object_connect (RemoteObject *obj,
remote_object = g_object_new (REMOTE_TYPE_OBJECT, NULL);
remote_object->dbus_path = path;
remote_object->filename = g_path_get_basename (filename);
remote_object->handle = xchat_plugingui_add (ph,
remote_object->handle = hexchat_plugingui_add (ph,
remote_object->filename,
name,
desc,
@ -413,8 +413,8 @@ remote_object_command (RemoteObject *obj,
const char *command,
GError **error)
{
if (xchat_set_context (ph, obj->context)) {
xchat_command (ph, command);
if (hexchat_set_context (ph, obj->context)) {
hexchat_command (ph, command);
}
return TRUE;
}
@ -424,8 +424,8 @@ remote_object_print (RemoteObject *obj,
const char *text,
GError **error)
{
if (xchat_set_context (ph, obj->context)) {
xchat_print (ph, text);
if (hexchat_set_context (ph, obj->context)) {
hexchat_print (ph, text);
}
return TRUE;
}
@ -437,7 +437,7 @@ remote_object_find_context (RemoteObject *obj,
guint *ret_id,
GError **error)
{
xchat_context *context;
hexchat_context *context;
if (*server == '\0') {
server = NULL;
@ -445,7 +445,7 @@ remote_object_find_context (RemoteObject *obj,
if (*channel == '\0') {
channel = NULL;
}
context = xchat_find_context (ph, server, channel);
context = hexchat_find_context (ph, server, channel);
*ret_id = context_list_find_id (context);
return TRUE;
@ -466,7 +466,7 @@ remote_object_set_context (RemoteObject *obj,
gboolean *ret,
GError **error)
{
xchat_context *context;
hexchat_context *context;
context = context_list_find_context (id);
if (context == NULL) {
@ -487,12 +487,12 @@ remote_object_get_info (RemoteObject *obj,
{
/* win_ptr is a GtkWindow* casted to char* and will crash
* D-Bus if we send it as a string */
if (!xchat_set_context (ph, obj->context) ||
if (!hexchat_set_context (ph, obj->context) ||
g_str_equal (id, "win_ptr")) {
*ret_info = NULL;
return TRUE;
}
*ret_info = g_strdup (xchat_get_info (ph, id));
*ret_info = g_strdup (hexchat_get_info (ph, id));
return TRUE;
}
@ -506,7 +506,7 @@ remote_object_get_prefs (RemoteObject *obj,
{
const char *str;
if (!xchat_set_context (ph, obj->context)) {
if (!hexchat_set_context (ph, obj->context)) {
*ret_type = 0;
return TRUE;
}
@ -527,7 +527,7 @@ server_hook_cb (char *word[],
arg1 = build_list (word + 1);
arg2 = build_list (word_eol + 1);
info->obj->context = xchat_get_context (ph);
info->obj->context = hexchat_get_context (ph);
g_signal_emit (info->obj,
signals[SERVER_SIGNAL],
0,
@ -550,7 +550,7 @@ command_hook_cb (char *word[],
arg1 = build_list (word + 1);
arg2 = build_list (word_eol + 1);
info->obj->context = xchat_get_context (ph);
info->obj->context = hexchat_get_context (ph);
g_signal_emit (info->obj,
signals[COMMAND_SIGNAL],
0,
@ -570,7 +570,7 @@ print_hook_cb (char *word[],
char **arg1;
arg1 = build_list (word + 1);
info->obj->context = xchat_get_context (ph);
info->obj->context = hexchat_get_context (ph);
g_signal_emit (info->obj,
signals[PRINT_SIGNAL],
0,
@ -596,7 +596,7 @@ remote_object_hook_command (RemoteObject *obj,
info->obj = obj;
info->return_value = return_value;
info->id = ++obj->last_hook_id;
info->hook = xchat_hook_command (ph,
info->hook = hexchat_hook_command (ph,
name,
priority,
command_hook_cb,
@ -622,7 +622,7 @@ remote_object_hook_server (RemoteObject *obj,
info->obj = obj;
info->return_value = return_value;
info->id = ++obj->last_hook_id;
info->hook = xchat_hook_server (ph,
info->hook = hexchat_hook_server (ph,
name,
priority,
server_hook_cb,
@ -647,7 +647,7 @@ remote_object_hook_print (RemoteObject *obj,
info->obj = obj;
info->return_value = return_value;
info->id = ++obj->last_hook_id;
info->hook = xchat_hook_print (ph,
info->hook = hexchat_hook_print (ph,
name,
priority,
print_hook_cb,
@ -673,14 +673,14 @@ remote_object_list_get (RemoteObject *obj,
guint *ret_id,
GError **error)
{
xchat_list *xlist;
hexchat_list *xlist;
guint *id;
if (!xchat_set_context (ph, obj->context)) {
if (!hexchat_set_context (ph, obj->context)) {
*ret_id = 0;
return TRUE;
}
xlist = xchat_list_get (ph, name);
xlist = hexchat_list_get (ph, name);
if (xlist == NULL) {
*ret_id = 0;
return TRUE;
@ -701,14 +701,14 @@ remote_object_list_next (RemoteObject *obj,
gboolean *ret,
GError **error)
{
xchat_list *xlist;
hexchat_list *xlist;
xlist = g_hash_table_lookup (obj->lists, &id);
if (xlist == NULL) {
*ret = FALSE;
return TRUE;
}
*ret = xchat_list_next (ph, xlist);
*ret = hexchat_list_next (ph, xlist);
return TRUE;
}
@ -720,10 +720,10 @@ remote_object_list_str (RemoteObject *obj,
char **ret_str,
GError **error)
{
xchat_list *xlist;
hexchat_list *xlist;
xlist = g_hash_table_lookup (obj->lists, &id);
if (xlist == NULL && !xchat_set_context (ph, obj->context)) {
if (xlist == NULL && !hexchat_set_context (ph, obj->context)) {
*ret_str = NULL;
return TRUE;
}
@ -731,7 +731,7 @@ remote_object_list_str (RemoteObject *obj,
*ret_str = NULL;
return TRUE;
}
*ret_str = g_strdup (xchat_list_str (ph, xlist, name));
*ret_str = g_strdup (hexchat_list_str (ph, xlist, name));
return TRUE;
}
@ -743,19 +743,19 @@ remote_object_list_int (RemoteObject *obj,
int *ret_int,
GError **error)
{
xchat_list *xlist;
hexchat_list *xlist;
xlist = g_hash_table_lookup (obj->lists, &id);
if (xlist == NULL && !xchat_set_context (ph, obj->context)) {
if (xlist == NULL && !hexchat_set_context (ph, obj->context)) {
*ret_int = -1;
return TRUE;
}
if (g_str_equal (name, "context")) {
xchat_context *context;
context = (xchat_context*)xchat_list_str (ph, xlist, name);
hexchat_context *context;
context = (hexchat_context*)hexchat_list_str (ph, xlist, name);
*ret_int = context_list_find_id (context);
} else {
*ret_int = xchat_list_int (ph, xlist, name);
*ret_int = hexchat_list_int (ph, xlist, name);
}
return TRUE;
@ -768,14 +768,14 @@ remote_object_list_time (RemoteObject *obj,
guint64 *ret_time,
GError **error)
{
xchat_list *xlist;
hexchat_list *xlist;
xlist = g_hash_table_lookup (obj->lists, &id);
if (xlist == NULL) {
*ret_time = (guint64) -1;
return TRUE;
}
*ret_time = xchat_list_time (ph, xlist, name);
*ret_time = hexchat_list_time (ph, xlist, name);
return TRUE;
}
@ -786,7 +786,7 @@ remote_object_list_fields (RemoteObject *obj,
char ***ret,
GError **error)
{
*ret = g_strdupv ((char**)xchat_list_fields (ph, name));
*ret = g_strdupv ((char**)hexchat_list_fields (ph, name));
if (*ret == NULL) {
*ret = g_new0 (char*, 1);
}
@ -816,9 +816,9 @@ remote_object_emit_print (RemoteObject *obj,
argv[i] = args[i];
}
*ret = xchat_set_context (ph, obj->context);
*ret = hexchat_set_context (ph, obj->context);
if (*ret) {
*ret = xchat_emit_print (ph, event_name, argv[0], argv[1],
*ret = hexchat_emit_print (ph, event_name, argv[0], argv[1],
argv[2], argv[3]);
}
@ -832,8 +832,8 @@ remote_object_nickcmp (RemoteObject *obj,
int *ret,
GError **error)
{
xchat_set_context (ph, obj->context);
*ret = xchat_nickcmp (ph, nick1, nick2);
hexchat_set_context (ph, obj->context);
*ret = hexchat_nickcmp (ph, nick1, nick2);
return TRUE;
}
@ -845,7 +845,7 @@ remote_object_strip (RemoteObject *obj,
char **ret_str,
GError **error)
{
*ret_str = xchat_strip (ph, str, len, flag);
*ret_str = hexchat_strip (ph, str, len, flag);
return TRUE;
}
@ -857,8 +857,8 @@ remote_object_send_modes (RemoteObject *obj,
char mode,
GError **error)
{
if (xchat_set_context (ph, obj->context)) {
xchat_send_modes (ph, targets,
if (hexchat_set_context (ph, obj->context)) {
hexchat_send_modes (ph, targets,
g_strv_length ((char**)targets),
modes_per_line,
sign, mode);
@ -894,7 +894,7 @@ init_dbus (void)
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (connection == NULL) {
xchat_printf (ph, _("Couldn't connect to session bus: %s\n"),
hexchat_printf (ph, _("Couldn't connect to session bus: %s\n"),
error->message);
g_error_free (error);
return FALSE;
@ -911,7 +911,7 @@ init_dbus (void)
G_TYPE_INVALID,
G_TYPE_UINT, &request_name_result,
G_TYPE_INVALID)) {
xchat_printf (ph, _("Failed to acquire %s: %s\n"),
hexchat_printf (ph, _("Failed to acquire %s: %s\n"),
DBUS_SERVICE,
error->message);
g_error_free (error);
@ -936,7 +936,7 @@ init_dbus (void)
return TRUE;
}
/* xchat_plugin stuffs */
/* hexchat_plugin stuffs */
static char**
build_list (char *word[])
@ -962,7 +962,7 @@ build_list (char *word[])
}
static guint
context_list_find_id (xchat_context *context)
context_list_find_id (hexchat_context *context)
{
GList *l = NULL;
@ -975,7 +975,7 @@ context_list_find_id (xchat_context *context)
return 0;
}
static xchat_context*
static hexchat_context*
context_list_find_context (guint id)
{
GList *l = NULL;
@ -997,7 +997,7 @@ open_context_cb (char *word[],
info = g_new0 (ContextInfo, 1);
info->id = ++last_context_id;
info->context = xchat_get_context (ph);
info->context = hexchat_get_context (ph);
contexts = g_list_prepend (contexts, info);
return HEXCHAT_EAT_NONE;
@ -1008,7 +1008,7 @@ close_context_cb (char *word[],
void *userdata)
{
GList *l;
xchat_context *context = xchat_get_context (ph);
hexchat_context *context = hexchat_get_context (ph);
for (l = contexts; l != NULL; l = l->next) {
if (((ContextInfo*)l->data)->context == context) {
@ -1049,7 +1049,7 @@ unload_plugin_cb (char *word[], char *word_eol[], void *userdata)
}
int
dbus_plugin_init (xchat_plugin *plugin_handle,
dbus_plugin_init (hexchat_plugin *plugin_handle,
char **plugin_name,
char **plugin_desc,
char **plugin_version,
@ -1061,24 +1061,24 @@ dbus_plugin_init (xchat_plugin *plugin_handle,
*plugin_version = PVERSION;
if (init_dbus()) {
/*xchat_printf (ph, _("%s loaded successfully!\n"), PNAME);*/
/*hexchat_printf (ph, _("%s loaded successfully!\n"), PNAME);*/
clients = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
xchat_hook_print (ph, "Open Context",
hexchat_hook_print (ph, "Open Context",
HEXCHAT_PRI_NORM,
open_context_cb,
NULL);
xchat_hook_print (ph, "Close Context",
hexchat_hook_print (ph, "Close Context",
HEXCHAT_PRI_NORM,
close_context_cb,
NULL);
xchat_hook_command (ph, "unload",
hexchat_hook_command (ph, "unload",
HEXCHAT_PRI_HIGHEST,
unload_plugin_cb, NULL, NULL);
}

View File

@ -24,246 +24,246 @@
extern "C" {
#endif
typedef struct _xchat_plugin xchat_plugin;
typedef struct _xchat_list xchat_list;
typedef struct _xchat_hook xchat_hook;
typedef struct _hexchat_plugin hexchat_plugin;
typedef struct _hexchat_list hexchat_list;
typedef struct _hexchat_hook hexchat_hook;
#ifndef PLUGIN_C
typedef struct _xchat_context xchat_context;
typedef struct _hexchat_context hexchat_context;
#endif
#ifndef PLUGIN_C
struct _xchat_plugin
struct _hexchat_plugin
{
/* these are only used on win32 */
xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_command) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
const char *help_text,
void *userdata);
xchat_hook *(*xchat_hook_server) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_server) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_print) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_print) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_timer) (hexchat_plugin *ph,
int timeout,
int (*callback) (void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_fd) (hexchat_plugin *ph,
int fd,
int flags,
int (*callback) (int fd, int flags, void *user_data),
void *userdata);
void *(*xchat_unhook) (xchat_plugin *ph,
xchat_hook *hook);
void (*xchat_print) (xchat_plugin *ph,
void *(*hexchat_unhook) (hexchat_plugin *ph,
hexchat_hook *hook);
void (*hexchat_print) (hexchat_plugin *ph,
const char *text);
void (*xchat_printf) (xchat_plugin *ph,
void (*hexchat_printf) (hexchat_plugin *ph,
const char *format, ...);
void (*xchat_command) (xchat_plugin *ph,
void (*hexchat_command) (hexchat_plugin *ph,
const char *command);
void (*xchat_commandf) (xchat_plugin *ph,
void (*hexchat_commandf) (hexchat_plugin *ph,
const char *format, ...);
int (*xchat_nickcmp) (xchat_plugin *ph,
int (*hexchat_nickcmp) (hexchat_plugin *ph,
const char *s1,
const char *s2);
int (*xchat_set_context) (xchat_plugin *ph,
xchat_context *ctx);
xchat_context *(*xchat_find_context) (xchat_plugin *ph,
int (*hexchat_set_context) (hexchat_plugin *ph,
hexchat_context *ctx);
hexchat_context *(*hexchat_find_context) (hexchat_plugin *ph,
const char *servname,
const char *channel);
xchat_context *(*xchat_get_context) (xchat_plugin *ph);
const char *(*xchat_get_info) (xchat_plugin *ph,
hexchat_context *(*hexchat_get_context) (hexchat_plugin *ph);
const char *(*hexchat_get_info) (hexchat_plugin *ph,
const char *id);
int (*xchat_get_prefs) (xchat_plugin *ph,
int (*xchat_get_prefs) (hexchat_plugin *ph,
const char *name,
const char **string,
int *integer);
xchat_list * (*xchat_list_get) (xchat_plugin *ph,
hexchat_list * (*hexchat_list_get) (hexchat_plugin *ph,
const char *name);
void (*xchat_list_free) (xchat_plugin *ph,
xchat_list *xlist);
const char * const * (*xchat_list_fields) (xchat_plugin *ph,
void (*hexchat_list_free) (hexchat_plugin *ph,
hexchat_list *xlist);
const char * const * (*hexchat_list_fields) (hexchat_plugin *ph,
const char *name);
int (*xchat_list_next) (xchat_plugin *ph,
xchat_list *xlist);
const char * (*xchat_list_str) (xchat_plugin *ph,
xchat_list *xlist,
int (*hexchat_list_next) (hexchat_plugin *ph,
hexchat_list *xlist);
const char * (*hexchat_list_str) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
int (*xchat_list_int) (xchat_plugin *ph,
xchat_list *xlist,
int (*hexchat_list_int) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
void * (*xchat_plugingui_add) (xchat_plugin *ph,
void * (*hexchat_plugingui_add) (hexchat_plugin *ph,
const char *filename,
const char *name,
const char *desc,
const char *version,
char *reserved);
void (*xchat_plugingui_remove) (xchat_plugin *ph,
void (*hexchat_plugingui_remove) (hexchat_plugin *ph,
void *handle);
int (*xchat_emit_print) (xchat_plugin *ph,
int (*hexchat_emit_print) (hexchat_plugin *ph,
const char *event_name, ...);
int (*xchat_read_fd) (xchat_plugin *ph,
int (*xchat_read_fd) (hexchat_plugin *ph,
void *src,
char *buf,
int *len);
time_t (*xchat_list_time) (xchat_plugin *ph,
xchat_list *xlist,
time_t (*hexchat_list_time) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
char *(*xchat_gettext) (xchat_plugin *ph,
char *(*hexchat_gettext) (hexchat_plugin *ph,
const char *msgid);
void (*xchat_send_modes) (xchat_plugin *ph,
void (*hexchat_send_modes) (hexchat_plugin *ph,
const char **targets,
int ntargets,
int modes_per_line,
char sign,
char mode);
char *(*xchat_strip) (xchat_plugin *ph,
char *(*hexchat_strip) (hexchat_plugin *ph,
const char *str,
int len,
int flags);
void (*xchat_free) (xchat_plugin *ph,
void (*hexchat_free) (hexchat_plugin *ph,
void *ptr);
int (*xchat_pluginpref_set_str) (xchat_plugin *ph,
int (*hexchat_pluginpref_set_str) (hexchat_plugin *ph,
const char *var,
const char *value);
int (*xchat_pluginpref_get_str) (xchat_plugin *ph,
int (*hexchat_pluginpref_get_str) (hexchat_plugin *ph,
const char *var,
char *dest);
int (*xchat_pluginpref_set_int) (xchat_plugin *ph,
int (*hexchat_pluginpref_set_int) (hexchat_plugin *ph,
const char *var,
int value);
int (*xchat_pluginpref_get_int) (xchat_plugin *ph,
int (*hexchat_pluginpref_get_int) (hexchat_plugin *ph,
const char *var);
int (*xchat_pluginpref_delete) (xchat_plugin *ph,
int (*hexchat_pluginpref_delete) (hexchat_plugin *ph,
const char *var);
int (*xchat_pluginpref_list) (xchat_plugin *ph,
int (*hexchat_pluginpref_list) (hexchat_plugin *ph,
char *dest);
};
#endif
xchat_hook *
xchat_hook_command (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_command (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
const char *help_text,
void *userdata);
xchat_hook *
xchat_hook_server (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_server (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
xchat_hook *
xchat_hook_print (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_print (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], void *user_data),
void *userdata);
xchat_hook *
xchat_hook_timer (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_timer (hexchat_plugin *ph,
int timeout,
int (*callback) (void *user_data),
void *userdata);
xchat_hook *
xchat_hook_fd (xchat_plugin *ph,
hexchat_hook *
hexchat_hook_fd (hexchat_plugin *ph,
int fd,
int flags,
int (*callback) (int fd, int flags, void *user_data),
void *userdata);
void *
xchat_unhook (xchat_plugin *ph,
xchat_hook *hook);
hexchat_unhook (hexchat_plugin *ph,
hexchat_hook *hook);
void
xchat_print (xchat_plugin *ph,
hexchat_print (hexchat_plugin *ph,
const char *text);
void
xchat_printf (xchat_plugin *ph,
hexchat_printf (hexchat_plugin *ph,
const char *format, ...);
void
xchat_command (xchat_plugin *ph,
hexchat_command (hexchat_plugin *ph,
const char *command);
void
xchat_commandf (xchat_plugin *ph,
hexchat_commandf (hexchat_plugin *ph,
const char *format, ...);
int
xchat_nickcmp (xchat_plugin *ph,
hexchat_nickcmp (hexchat_plugin *ph,
const char *s1,
const char *s2);
int
xchat_set_context (xchat_plugin *ph,
xchat_context *ctx);
hexchat_set_context (hexchat_plugin *ph,
hexchat_context *ctx);
xchat_context *
xchat_find_context (xchat_plugin *ph,
hexchat_context *
hexchat_find_context (hexchat_plugin *ph,
const char *servname,
const char *channel);
xchat_context *
xchat_get_context (xchat_plugin *ph);
hexchat_context *
hexchat_get_context (hexchat_plugin *ph);
const char *
xchat_get_info (xchat_plugin *ph,
hexchat_get_info (hexchat_plugin *ph,
const char *id);
int
xchat_get_prefs (xchat_plugin *ph,
xchat_get_prefs (hexchat_plugin *ph,
const char *name,
const char **string,
int *integer);
xchat_list *
xchat_list_get (xchat_plugin *ph,
hexchat_list *
hexchat_list_get (hexchat_plugin *ph,
const char *name);
void
xchat_list_free (xchat_plugin *ph,
xchat_list *xlist);
hexchat_list_free (hexchat_plugin *ph,
hexchat_list *xlist);
const char * const *
xchat_list_fields (xchat_plugin *ph,
hexchat_list_fields (hexchat_plugin *ph,
const char *name);
int
xchat_list_next (xchat_plugin *ph,
xchat_list *xlist);
hexchat_list_next (hexchat_plugin *ph,
hexchat_list *xlist);
const char *
xchat_list_str (xchat_plugin *ph,
xchat_list *xlist,
hexchat_list_str (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
int
xchat_list_int (xchat_plugin *ph,
xchat_list *xlist,
hexchat_list_int (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
time_t
xchat_list_time (xchat_plugin *ph,
xchat_list *xlist,
hexchat_list_time (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
void *
xchat_plugingui_add (xchat_plugin *ph,
hexchat_plugingui_add (hexchat_plugin *ph,
const char *filename,
const char *name,
const char *desc,
@ -271,19 +271,19 @@ xchat_plugingui_add (xchat_plugin *ph,
char *reserved);
void
xchat_plugingui_remove (xchat_plugin *ph,
hexchat_plugingui_remove (hexchat_plugin *ph,
void *handle);
int
xchat_emit_print (xchat_plugin *ph,
hexchat_emit_print (hexchat_plugin *ph,
const char *event_name, ...);
char *
xchat_gettext (xchat_plugin *ph,
hexchat_gettext (hexchat_plugin *ph,
const char *msgid);
void
xchat_send_modes (xchat_plugin *ph,
hexchat_send_modes (hexchat_plugin *ph,
const char **targets,
int ntargets,
int modes_per_line,
@ -291,81 +291,81 @@ xchat_send_modes (xchat_plugin *ph,
char mode);
char *
xchat_strip (xchat_plugin *ph,
hexchat_strip (hexchat_plugin *ph,
const char *str,
int len,
int flags);
void
xchat_free (xchat_plugin *ph,
hexchat_free (hexchat_plugin *ph,
void *ptr);
int
xchat_pluginpref_set_str (xchat_plugin *ph,
hexchat_pluginpref_set_str (hexchat_plugin *ph,
const char *var,
const char *value);
int
xchat_pluginpref_get_str (xchat_plugin *ph,
hexchat_pluginpref_get_str (hexchat_plugin *ph,
const char *var,
char *dest);
int
xchat_pluginpref_set_int (xchat_plugin *ph,
hexchat_pluginpref_set_int (hexchat_plugin *ph,
const char *var,
int value);
int
xchat_pluginpref_get_int (xchat_plugin *ph,
hexchat_pluginpref_get_int (hexchat_plugin *ph,
const char *var);
int
xchat_pluginpref_delete (xchat_plugin *ph,
hexchat_pluginpref_delete (hexchat_plugin *ph,
const char *var);
int
xchat_pluginpref_list (xchat_plugin *ph,
hexchat_pluginpref_list (hexchat_plugin *ph,
char *dest);
#if !defined(PLUGIN_C) && defined(WIN32)
#ifndef HEXCHAT_PLUGIN_HANDLE
#define HEXCHAT_PLUGIN_HANDLE (ph)
#endif
#define xchat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_command)
#define xchat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_server)
#define xchat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_print)
#define xchat_hook_timer ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_timer)
#define xchat_hook_fd ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_fd)
#define xchat_unhook ((HEXCHAT_PLUGIN_HANDLE)->xchat_unhook)
#define xchat_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_print)
#define xchat_printf ((HEXCHAT_PLUGIN_HANDLE)->xchat_printf)
#define xchat_command ((HEXCHAT_PLUGIN_HANDLE)->xchat_command)
#define xchat_commandf ((HEXCHAT_PLUGIN_HANDLE)->xchat_commandf)
#define xchat_nickcmp ((HEXCHAT_PLUGIN_HANDLE)->xchat_nickcmp)
#define xchat_set_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_set_context)
#define xchat_find_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_find_context)
#define xchat_get_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_context)
#define xchat_get_info ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_info)
#define hexchat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_command)
#define hexchat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_server)
#define hexchat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_print)
#define hexchat_hook_timer ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_timer)
#define hexchat_hook_fd ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_fd)
#define hexchat_unhook ((HEXCHAT_PLUGIN_HANDLE)->hexchat_unhook)
#define hexchat_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_print)
#define hexchat_printf ((HEXCHAT_PLUGIN_HANDLE)->hexchat_printf)
#define hexchat_command ((HEXCHAT_PLUGIN_HANDLE)->hexchat_command)
#define hexchat_commandf ((HEXCHAT_PLUGIN_HANDLE)->hexchat_commandf)
#define hexchat_nickcmp ((HEXCHAT_PLUGIN_HANDLE)->hexchat_nickcmp)
#define hexchat_set_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_set_context)
#define hexchat_find_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_find_context)
#define hexchat_get_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_get_context)
#define hexchat_get_info ((HEXCHAT_PLUGIN_HANDLE)->hexchat_get_info)
#define xchat_get_prefs ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_prefs)
#define xchat_list_get ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_get)
#define xchat_list_free ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_free)
#define xchat_list_fields ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_fields)
#define xchat_list_next ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_next)
#define xchat_list_str ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_str)
#define xchat_list_int ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_int)
#define xchat_plugingui_add ((HEXCHAT_PLUGIN_HANDLE)->xchat_plugingui_add)
#define xchat_plugingui_remove ((HEXCHAT_PLUGIN_HANDLE)->xchat_plugingui_remove)
#define xchat_emit_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_emit_print)
#define xchat_list_time ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_time)
#define xchat_gettext ((HEXCHAT_PLUGIN_HANDLE)->xchat_gettext)
#define xchat_send_modes ((HEXCHAT_PLUGIN_HANDLE)->xchat_send_modes)
#define xchat_strip ((HEXCHAT_PLUGIN_HANDLE)->xchat_strip)
#define xchat_free ((HEXCHAT_PLUGIN_HANDLE)->xchat_free)
#define xchat_pluginpref_set_str ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_set_str)
#define xchat_pluginpref_get_str ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_get_str)
#define xchat_pluginpref_set_int ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_set_int)
#define xchat_pluginpref_get_int ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_get_int)
#define xchat_pluginpref_delete ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_delete)
#define xchat_pluginpref_list ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_list)
#define hexchat_list_get ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_get)
#define hexchat_list_free ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_free)
#define hexchat_list_fields ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_fields)
#define hexchat_list_next ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_next)
#define hexchat_list_str ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_str)
#define hexchat_list_int ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_int)
#define hexchat_plugingui_add ((HEXCHAT_PLUGIN_HANDLE)->hexchat_plugingui_add)
#define hexchat_plugingui_remove ((HEXCHAT_PLUGIN_HANDLE)->hexchat_plugingui_remove)
#define hexchat_emit_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_emit_print)
#define hexchat_list_time ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_time)
#define hexchat_gettext ((HEXCHAT_PLUGIN_HANDLE)->hexchat_gettext)
#define hexchat_send_modes ((HEXCHAT_PLUGIN_HANDLE)->hexchat_send_modes)
#define hexchat_strip ((HEXCHAT_PLUGIN_HANDLE)->hexchat_strip)
#define hexchat_free ((HEXCHAT_PLUGIN_HANDLE)->hexchat_free)
#define hexchat_pluginpref_set_str ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_set_str)
#define hexchat_pluginpref_get_str ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_get_str)
#define hexchat_pluginpref_set_int ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_set_int)
#define hexchat_pluginpref_get_int ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_get_int)
#define hexchat_pluginpref_delete ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_delete)
#define hexchat_pluginpref_list ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_list)
#endif
#ifdef __cplusplus

View File

@ -7,7 +7,7 @@
#define g_ascii_strcasecmp stricmp
#endif
static xchat_plugin *ph; /* plugin handle */
static hexchat_plugin *ph; /* plugin handle */
static GSList *timer_list = NULL;
#define STATIC
@ -17,8 +17,8 @@ static GSList *timer_list = NULL;
typedef struct
{
xchat_hook *hook;
xchat_context *context;
hexchat_hook *hook;
hexchat_context *context;
char *command;
int ref;
int repeat;
@ -31,7 +31,7 @@ timer_del (timer *tim)
{
timer_list = g_slist_remove (timer_list, tim);
free (tim->command);
xchat_unhook (ph, tim->hook);
hexchat_unhook (ph, tim->hook);
free (tim);
}
@ -49,21 +49,21 @@ timer_del_ref (int ref, int quiet)
{
timer_del (tim);
if (!quiet)
xchat_printf (ph, "Timer %d deleted.\n", ref);
hexchat_printf (ph, "Timer %d deleted.\n", ref);
return;
}
list = list->next;
}
if (!quiet)
xchat_print (ph, "No such ref number found.\n");
hexchat_print (ph, "No such ref number found.\n");
}
static int
timeout_cb (timer *tim)
{
if (xchat_set_context (ph, tim->context))
if (hexchat_set_context (ph, tim->context))
{
xchat_command (ph, tim->command);
hexchat_command (ph, tim->command);
if (tim->forever)
return 1;
@ -101,13 +101,13 @@ timer_add (int ref, float timeout, int repeat, char *command)
tim->repeat = repeat;
tim->timeout = timeout;
tim->command = strdup (command);
tim->context = xchat_get_context (ph);
tim->context = hexchat_get_context (ph);
tim->forever = FALSE;
if (repeat == 0)
tim->forever = TRUE;
tim->hook = xchat_hook_timer (ph, timeout * 1000.0, (void *)timeout_cb, tim);
tim->hook = hexchat_hook_timer (ph, timeout * 1000.0, (void *)timeout_cb, tim);
timer_list = g_slist_append (timer_list, tim);
}
@ -119,17 +119,17 @@ timer_showlist (void)
if (timer_list == NULL)
{
xchat_print (ph, "No timers installed.\n");
xchat_print (ph, HELP);
hexchat_print (ph, "No timers installed.\n");
hexchat_print (ph, HELP);
return;
}
/* 00000 00000000 0000000 abc */
xchat_print (ph, "\026 Ref# Seconds Repeat Command \026\n");
hexchat_print (ph, "\026 Ref# Seconds Repeat Command \026\n");
list = timer_list;
while (list)
{
tim = list->data;
xchat_printf (ph, "%5d %8.1f %7d %s\n", tim->ref, tim->timeout,
hexchat_printf (ph, "%5d %8.1f %7d %s\n", tim->ref, tim->timeout,
tim->repeat, tim->command);
list = list->next;
}
@ -179,7 +179,7 @@ timer_cb (char *word[], char *word_eol[], void *userdata)
command = word_eol[3 + offset];
if (timeout < 0.1 || !command[0])
xchat_print (ph, HELP);
hexchat_print (ph, HELP);
else
timer_add (ref, timeout, repeat, command);
@ -190,9 +190,9 @@ int
#ifdef STATIC
timer_plugin_init
#else
xchat_plugin_init
hexchat_plugin_init
#endif
(xchat_plugin *plugin_handle, char **plugin_name,
(hexchat_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 */
@ -202,7 +202,7 @@ xchat_plugin_init
*plugin_desc = "IrcII style /TIMER command";
*plugin_version = "";
xchat_hook_command (ph, "TIMER", HEXCHAT_PRI_NORM, timer_cb, HELP, 0);
hexchat_hook_command (ph, "TIMER", HEXCHAT_PRI_NORM, timer_cb, HELP, 0);
return 1; /* return 1 for success */
}

View File

@ -1,7 +1,7 @@
#ifndef HEXCHAT_PLUGIN_TIMER_H
#define HEXCHAT_PLUGIN_TIMER_H
int timer_plugin_init (xchat_plugin *plugin_handle, char **plugin_name,
int timer_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
char **plugin_desc, char **plugin_version, char *arg);
#endif

View File

@ -41,7 +41,7 @@
#include "notify.h"
#include "text.h"
#define PLUGIN_C
typedef struct session xchat_context;
typedef struct session hexchat_context;
#include "hexchat-plugin.h"
#include "plugin.h"
@ -61,9 +61,9 @@ typedef struct session xchat_context;
#define DEBUG(x) {x;}
/* crafted to be an even 32 bytes */
struct _xchat_hook
struct _hexchat_hook
{
xchat_plugin *pl; /* the plugin to which it belongs */
hexchat_plugin *pl; /* the plugin to which it belongs */
char *name; /* "xdcc" */
void *callback; /* pointer to xdcc_callback */
char *help_text; /* help_text for commands only */
@ -73,7 +73,7 @@ struct _xchat_hook
int pri; /* fd */ /* priority / fd for HOOK_FD only */
};
struct _xchat_list
struct _hexchat_list
{
int type; /* LIST_* */
GSList *pos; /* current pos */
@ -84,11 +84,11 @@ struct _xchat_list
typedef int (xchat_cmd_cb) (char *word[], char *word_eol[], void *user_data);
typedef int (xchat_serv_cb) (char *word[], char *word_eol[], void *user_data);
typedef int (xchat_print_cb) (char *word[], void *user_data);
typedef int (hexchat_print_cb) (char *word[], void *user_data);
typedef int (xchat_fd_cb) (int fd, int flags, void *user_data);
typedef int (xchat_timer_cb) (void *user_data);
typedef int (xchat_init_func) (xchat_plugin *, char **, char **, char **, char *);
typedef int (xchat_deinit_func) (xchat_plugin *);
typedef int (xchat_init_func) (hexchat_plugin *, char **, char **, char **, char *);
typedef int (xchat_deinit_func) (hexchat_plugin *);
enum
{
@ -118,13 +118,13 @@ extern const struct prefs vars[]; /* cfgfiles.c */
/* unload a plugin and remove it from our linked list */
static int
plugin_free (xchat_plugin *pl, int do_deinit, int allow_refuse)
plugin_free (hexchat_plugin *pl, int do_deinit, int allow_refuse)
{
GSList *list, *next;
xchat_hook *hook;
hexchat_hook *hook;
xchat_deinit_func *deinit_func;
/* fake plugin added by xchat_plugingui_add() */
/* fake plugin added by hexchat_plugingui_add() */
if (pl->fake)
goto xit;
@ -143,7 +143,7 @@ plugin_free (xchat_plugin *pl, int do_deinit, int allow_refuse)
hook = list->data;
next = list->next;
if (hook->pl == pl)
xchat_unhook (NULL, hook);
hexchat_unhook (NULL, hook);
list = next;
}
@ -179,14 +179,14 @@ xit:
return TRUE;
}
static xchat_plugin *
plugin_list_add (xchat_context *ctx, char *filename, const char *name,
static hexchat_plugin *
plugin_list_add (hexchat_context *ctx, char *filename, const char *name,
const char *desc, const char *version, void *handle,
void *deinit_func, int fake, int free_strings)
{
xchat_plugin *pl;
hexchat_plugin *pl;
pl = malloc (sizeof (xchat_plugin));
pl = malloc (sizeof (hexchat_plugin));
pl->handle = handle;
pl->filename = filename;
pl->context = ctx;
@ -203,14 +203,14 @@ plugin_list_add (xchat_context *ctx, char *filename, const char *name,
}
static void *
xchat_dummy (xchat_plugin *ph)
xchat_dummy (hexchat_plugin *ph)
{
return NULL;
}
#ifdef WIN32
static int
xchat_read_fd (xchat_plugin *ph, GIOChannel *source, char *buf, int *len)
xchat_read_fd (hexchat_plugin *ph, GIOChannel *source, char *buf, int *len)
{
GError *error = NULL;
@ -234,7 +234,7 @@ void
plugin_add (session *sess, char *filename, void *handle, void *init_func,
void *deinit_func, char *arg, int fake)
{
xchat_plugin *pl;
hexchat_plugin *pl;
char *file;
file = NULL;
@ -247,47 +247,47 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
if (!fake)
{
/* win32 uses these because it doesn't have --export-dynamic! */
pl->xchat_hook_command = xchat_hook_command;
pl->xchat_hook_server = xchat_hook_server;
pl->xchat_hook_print = xchat_hook_print;
pl->xchat_hook_timer = xchat_hook_timer;
pl->xchat_hook_fd = xchat_hook_fd;
pl->xchat_unhook = xchat_unhook;
pl->xchat_print = xchat_print;
pl->xchat_printf = xchat_printf;
pl->xchat_command = xchat_command;
pl->xchat_commandf = xchat_commandf;
pl->xchat_nickcmp = xchat_nickcmp;
pl->xchat_set_context = xchat_set_context;
pl->xchat_find_context = xchat_find_context;
pl->xchat_get_context = xchat_get_context;
pl->xchat_get_info = xchat_get_info;
pl->hexchat_hook_command = hexchat_hook_command;
pl->hexchat_hook_server = hexchat_hook_server;
pl->hexchat_hook_print = hexchat_hook_print;
pl->hexchat_hook_timer = hexchat_hook_timer;
pl->hexchat_hook_fd = hexchat_hook_fd;
pl->hexchat_unhook = hexchat_unhook;
pl->hexchat_print = hexchat_print;
pl->hexchat_printf = hexchat_printf;
pl->hexchat_command = hexchat_command;
pl->hexchat_commandf = hexchat_commandf;
pl->hexchat_nickcmp = hexchat_nickcmp;
pl->hexchat_set_context = hexchat_set_context;
pl->hexchat_find_context = hexchat_find_context;
pl->hexchat_get_context = hexchat_get_context;
pl->hexchat_get_info = hexchat_get_info;
pl->xchat_get_prefs = xchat_get_prefs;
pl->xchat_list_get = xchat_list_get;
pl->xchat_list_free = xchat_list_free;
pl->xchat_list_fields = xchat_list_fields;
pl->xchat_list_str = xchat_list_str;
pl->xchat_list_next = xchat_list_next;
pl->xchat_list_int = xchat_list_int;
pl->xchat_plugingui_add = xchat_plugingui_add;
pl->xchat_plugingui_remove = xchat_plugingui_remove;
pl->xchat_emit_print = xchat_emit_print;
pl->hexchat_list_get = hexchat_list_get;
pl->hexchat_list_free = hexchat_list_free;
pl->hexchat_list_fields = hexchat_list_fields;
pl->hexchat_list_str = hexchat_list_str;
pl->hexchat_list_next = hexchat_list_next;
pl->hexchat_list_int = hexchat_list_int;
pl->hexchat_plugingui_add = hexchat_plugingui_add;
pl->hexchat_plugingui_remove = hexchat_plugingui_remove;
pl->hexchat_emit_print = hexchat_emit_print;
#ifdef WIN32
pl->xchat_read_fd = (void *) xchat_read_fd;
#else
pl->xchat_read_fd = xchat_dummy;
#endif
pl->xchat_list_time = xchat_list_time;
pl->xchat_gettext = xchat_gettext;
pl->xchat_send_modes = xchat_send_modes;
pl->xchat_strip = xchat_strip;
pl->xchat_free = xchat_free;
pl->xchat_pluginpref_set_str = xchat_pluginpref_set_str;
pl->xchat_pluginpref_get_str = xchat_pluginpref_get_str;
pl->xchat_pluginpref_set_int = xchat_pluginpref_set_int;
pl->xchat_pluginpref_get_int = xchat_pluginpref_get_int;
pl->xchat_pluginpref_delete = xchat_pluginpref_delete;
pl->xchat_pluginpref_list = xchat_pluginpref_list;
pl->hexchat_list_time = hexchat_list_time;
pl->hexchat_gettext = hexchat_gettext;
pl->hexchat_send_modes = hexchat_send_modes;
pl->hexchat_strip = hexchat_strip;
pl->hexchat_free = hexchat_free;
pl->hexchat_pluginpref_set_str = hexchat_pluginpref_set_str;
pl->hexchat_pluginpref_get_str = hexchat_pluginpref_get_str;
pl->hexchat_pluginpref_set_int = hexchat_pluginpref_set_int;
pl->hexchat_pluginpref_get_int = hexchat_pluginpref_get_int;
pl->hexchat_pluginpref_delete = hexchat_pluginpref_delete;
pl->hexchat_pluginpref_list = hexchat_pluginpref_list;
/* incase new plugins are loaded on older xchat */
pl->xchat_dummy4 = xchat_dummy;
@ -295,7 +295,7 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
pl->xchat_dummy2 = xchat_dummy;
pl->xchat_dummy1 = xchat_dummy;
/* run xchat_plugin_init, if it returns 0, close the plugin */
/* run hexchat_plugin_init, if it returns 0, close the plugin */
if (((xchat_init_func *)init_func) (pl, &pl->name, &pl->desc, &pl->version, arg) == 0)
{
plugin_free (pl, FALSE, FALSE);
@ -314,7 +314,7 @@ int
plugin_kill (char *name, int by_filename)
{
GSList *list;
xchat_plugin *pl;
hexchat_plugin *pl;
list = plugin_list;
while (list)
@ -345,7 +345,7 @@ void
plugin_kill_all (void)
{
GSList *list, *next;
xchat_plugin *pl;
hexchat_plugin *pl;
list = plugin_list;
while (list)
@ -375,15 +375,15 @@ plugin_load (session *sess, char *filename, char *arg)
if (handle == NULL)
return (char *)g_module_error ();
/* find the init routine xchat_plugin_init */
if (!g_module_symbol (handle, "xchat_plugin_init", (gpointer *)&init_func))
/* find the init routine hexchat_plugin_init */
if (!g_module_symbol (handle, "hexchat_plugin_init", (gpointer *)&init_func))
{
g_module_close (handle);
return _("No xchat_plugin_init symbol; is this really an xchat plugin?");
return _("No hexchat_plugin_init symbol; is this really an xchat plugin?");
}
/* find the plugin's deinit routine, if any */
if (!g_module_symbol (handle, "xchat_plugin_deinit", (gpointer *)&deinit_func))
if (!g_module_symbol (handle, "hexchat_plugin_deinit", (gpointer *)&deinit_func))
deinit_func = NULL;
#else
@ -414,17 +414,17 @@ plugin_load (session *sess, char *filename, char *arg)
return (char *)dlerror ();
dlerror (); /* Clear any existing error */
/* find the init routine xchat_plugin_init */
init_func = dlsym (handle, "xchat_plugin_init");
/* find the init routine hexchat_plugin_init */
init_func = dlsym (handle, "hexchat_plugin_init");
error = (char *)dlerror ();
if (error != NULL)
{
dlclose (handle);
return _("No xchat_plugin_init symbol; is this really an xchat plugin?");
return _("No hexchat_plugin_init symbol; is this really an xchat plugin?");
}
/* find the plugin's deinit routine, if any */
deinit_func = dlsym (handle, "xchat_plugin_deinit");
deinit_func = dlsym (handle, "hexchat_plugin_deinit");
error = (char *)dlerror ();
#endif
@ -506,7 +506,7 @@ plugin_auto_load (session *sess)
static GSList *
plugin_hook_find (GSList *list, int type, char *name)
{
xchat_hook *hook;
hexchat_hook *hook;
while (list)
{
@ -534,7 +534,7 @@ static int
plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[], int type)
{
GSList *list, *next;
xchat_hook *hook;
hexchat_hook *hook;
int ret, eat = 0;
list = hook_list;
@ -558,7 +558,7 @@ plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[], int
ret = ((xchat_serv_cb *)hook->callback) (word, word_eol, hook->userdata);
break;
default: /*case HOOK_PRINT:*/
ret = ((xchat_print_cb *)hook->callback) (word, hook->userdata);
ret = ((hexchat_print_cb *)hook->callback) (word, hook->userdata);
break;
}
@ -659,7 +659,7 @@ plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval,
}
static int
plugin_timeout_cb (xchat_hook *hook)
plugin_timeout_cb (hexchat_hook *hook)
{
int ret;
@ -676,7 +676,7 @@ plugin_timeout_cb (xchat_hook *hook)
if (ret == 0)
{
hook->tag = 0; /* avoid fe_timeout_remove, returning 0 is enough! */
xchat_unhook (hook->pl, hook);
hexchat_unhook (hook->pl, hook);
}
return ret;
@ -685,10 +685,10 @@ plugin_timeout_cb (xchat_hook *hook)
/* insert a hook into hook_list according to its priority */
static void
plugin_insert_hook (xchat_hook *new_hook)
plugin_insert_hook (hexchat_hook *new_hook)
{
GSList *list;
xchat_hook *hook;
hexchat_hook *hook;
list = hook_list;
while (list)
@ -706,7 +706,7 @@ plugin_insert_hook (xchat_hook *new_hook)
}
static gboolean
plugin_fd_cb (GIOChannel *source, GIOCondition condition, xchat_hook *hook)
plugin_fd_cb (GIOChannel *source, GIOCondition condition, hexchat_hook *hook)
{
int flags = 0, ret;
typedef int (xchat_fd_cb2) (int fd, int flags, void *user_data, GIOChannel *);
@ -727,7 +727,7 @@ plugin_fd_cb (GIOChannel *source, GIOCondition condition, xchat_hook *hook)
if (ret == 0)
{
hook->tag = 0; /* avoid fe_input_remove, returning 0 is enough! */
xchat_unhook (hook->pl, hook);
hexchat_unhook (hook->pl, hook);
}
return ret;
@ -735,14 +735,14 @@ plugin_fd_cb (GIOChannel *source, GIOCondition condition, xchat_hook *hook)
/* allocate and add a hook to our list. Used for all 4 types */
static xchat_hook *
plugin_add_hook (xchat_plugin *pl, int type, int pri, const char *name,
static hexchat_hook *
plugin_add_hook (hexchat_plugin *pl, int type, int pri, const char *name,
const char *help_text, void *callb, int timeout, void *userdata)
{
xchat_hook *hook;
hexchat_hook *hook;
hook = malloc (sizeof (xchat_hook));
memset (hook, 0, sizeof (xchat_hook));
hook = malloc (sizeof (hexchat_hook));
memset (hook, 0, sizeof (hexchat_hook));
hook->type = type;
hook->pri = pri;
@ -766,7 +766,7 @@ plugin_add_hook (xchat_plugin *pl, int type, int pri, const char *name,
GList *
plugin_command_list(GList *tmp_list)
{
xchat_hook *hook;
hexchat_hook *hook;
GSList *list = hook_list;
while (list)
@ -784,7 +784,7 @@ plugin_command_foreach (session *sess, void *userdata,
void (*cb) (session *sess, void *userdata, char *name, char *help))
{
GSList *list;
xchat_hook *hook;
hexchat_hook *hook;
list = hook_list;
while (list)
@ -802,7 +802,7 @@ int
plugin_show_help (session *sess, char *cmd)
{
GSList *list;
xchat_hook *hook;
hexchat_hook *hook;
list = plugin_hook_find (hook_list, HOOK_COMMAND, cmd);
if (list)
@ -823,7 +823,7 @@ plugin_show_help (session *sess, char *cmd)
/* ========================================================= */
void *
xchat_unhook (xchat_plugin *ph, xchat_hook *hook)
hexchat_unhook (hexchat_plugin *ph, hexchat_hook *hook)
{
/* perl.c trips this */
if (!g_slist_find (hook_list, hook) || hook->type == HOOK_DELETED)
@ -845,40 +845,40 @@ xchat_unhook (xchat_plugin *ph, xchat_hook *hook)
return hook->userdata;
}
xchat_hook *
xchat_hook_command (xchat_plugin *ph, const char *name, int pri,
hexchat_hook *
hexchat_hook_command (hexchat_plugin *ph, const char *name, int pri,
xchat_cmd_cb *callb, const char *help_text, void *userdata)
{
return plugin_add_hook (ph, HOOK_COMMAND, pri, name, help_text, callb, 0,
userdata);
}
xchat_hook *
xchat_hook_server (xchat_plugin *ph, const char *name, int pri,
hexchat_hook *
hexchat_hook_server (hexchat_plugin *ph, const char *name, int pri,
xchat_serv_cb *callb, void *userdata)
{
return plugin_add_hook (ph, HOOK_SERVER, pri, name, 0, callb, 0, userdata);
}
xchat_hook *
xchat_hook_print (xchat_plugin *ph, const char *name, int pri,
xchat_print_cb *callb, void *userdata)
hexchat_hook *
hexchat_hook_print (hexchat_plugin *ph, const char *name, int pri,
hexchat_print_cb *callb, void *userdata)
{
return plugin_add_hook (ph, HOOK_PRINT, pri, name, 0, callb, 0, userdata);
}
xchat_hook *
xchat_hook_timer (xchat_plugin *ph, int timeout, xchat_timer_cb *callb,
hexchat_hook *
hexchat_hook_timer (hexchat_plugin *ph, int timeout, xchat_timer_cb *callb,
void *userdata)
{
return plugin_add_hook (ph, HOOK_TIMER, 0, 0, 0, callb, timeout, userdata);
}
xchat_hook *
xchat_hook_fd (xchat_plugin *ph, int fd, int flags,
hexchat_hook *
hexchat_hook_fd (hexchat_plugin *ph, int fd, int flags,
xchat_fd_cb *callb, void *userdata)
{
xchat_hook *hook;
hexchat_hook *hook;
hook = plugin_add_hook (ph, HOOK_FD, 0, 0, 0, callb, 0, userdata);
hook->pri = fd;
@ -889,11 +889,11 @@ xchat_hook_fd (xchat_plugin *ph, int fd, int flags,
}
void
xchat_print (xchat_plugin *ph, const char *text)
hexchat_print (hexchat_plugin *ph, const char *text)
{
if (!is_session (ph->context))
{
DEBUG(PrintTextf(0, "%s\txchat_print called without a valid context.\n", ph->name));
DEBUG(PrintTextf(0, "%s\thexchat_print called without a valid context.\n", ph->name));
return;
}
@ -901,7 +901,7 @@ xchat_print (xchat_plugin *ph, const char *text)
}
void
xchat_printf (xchat_plugin *ph, const char *format, ...)
hexchat_printf (hexchat_plugin *ph, const char *format, ...)
{
va_list args;
char *buf;
@ -910,19 +910,19 @@ xchat_printf (xchat_plugin *ph, const char *format, ...)
buf = g_strdup_vprintf (format, args);
va_end (args);
xchat_print (ph, buf);
hexchat_print (ph, buf);
g_free (buf);
}
void
xchat_command (xchat_plugin *ph, const char *command)
hexchat_command (hexchat_plugin *ph, const char *command)
{
char *conv;
int len = -1;
if (!is_session (ph->context))
{
DEBUG(PrintTextf(0, "%s\txchat_command called without a valid context.\n", ph->name));
DEBUG(PrintTextf(0, "%s\thexchat_command called without a valid context.\n", ph->name));
return;
}
@ -933,7 +933,7 @@ xchat_command (xchat_plugin *ph, const char *command)
}
void
xchat_commandf (xchat_plugin *ph, const char *format, ...)
hexchat_commandf (hexchat_plugin *ph, const char *format, ...)
{
va_list args;
char *buf;
@ -942,24 +942,24 @@ xchat_commandf (xchat_plugin *ph, const char *format, ...)
buf = g_strdup_vprintf (format, args);
va_end (args);
xchat_command (ph, buf);
hexchat_command (ph, buf);
g_free (buf);
}
int
xchat_nickcmp (xchat_plugin *ph, const char *s1, const char *s2)
hexchat_nickcmp (hexchat_plugin *ph, const char *s1, const char *s2)
{
return ((session *)ph->context)->server->p_cmp (s1, s2);
}
xchat_context *
xchat_get_context (xchat_plugin *ph)
hexchat_context *
hexchat_get_context (hexchat_plugin *ph)
{
return ph->context;
}
int
xchat_set_context (xchat_plugin *ph, xchat_context *context)
hexchat_set_context (hexchat_plugin *ph, hexchat_context *context)
{
if (is_session (context))
{
@ -969,8 +969,8 @@ xchat_set_context (xchat_plugin *ph, xchat_context *context)
return 0;
}
xchat_context *
xchat_find_context (xchat_plugin *ph, const char *servname, const char *channel)
hexchat_context *
hexchat_find_context (hexchat_plugin *ph, const char *servname, const char *channel)
{
GSList *slist, *clist, *sessions = NULL;
server *serv;
@ -1030,7 +1030,7 @@ xchat_find_context (xchat_plugin *ph, const char *servname, const char *channel)
}
const char *
xchat_get_info (xchat_plugin *ph, const char *id)
hexchat_get_info (hexchat_plugin *ph, const char *id)
{
session *sess;
guint32 hash;
@ -1063,7 +1063,7 @@ xchat_get_info (xchat_plugin *ph, const char *id)
sess = ph->context;
if (!is_session (sess))
{
DEBUG(PrintTextf(0, "%s\txchat_get_info called without a valid context.\n", ph->name));
DEBUG(PrintTextf(0, "%s\thexchat_get_info called without a valid context.\n", ph->name));
return NULL;
}
@ -1137,7 +1137,7 @@ xchat_get_info (xchat_plugin *ph, const char *id)
}
int
xchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int *integer)
xchat_get_prefs (hexchat_plugin *ph, const char *name, const char **string, int *integer)
{
int i = 0;
@ -1183,12 +1183,12 @@ xchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int *i
return 0;
}
xchat_list *
xchat_list_get (xchat_plugin *ph, const char *name)
hexchat_list *
hexchat_list_get (hexchat_plugin *ph, const char *name)
{
xchat_list *list;
hexchat_list *list;
list = malloc (sizeof (xchat_list));
list = malloc (sizeof (hexchat_list));
list->pos = NULL;
switch (str_hash (name))
@ -1232,7 +1232,7 @@ xchat_list_get (xchat_plugin *ph, const char *name)
}
void
xchat_list_free (xchat_plugin *ph, xchat_list *xlist)
hexchat_list_free (hexchat_plugin *ph, hexchat_list *xlist)
{
if (xlist->type == LIST_USERS)
g_slist_free (xlist->head);
@ -1240,7 +1240,7 @@ xchat_list_free (xchat_plugin *ph, xchat_list *xlist)
}
int
xchat_list_next (xchat_plugin *ph, xchat_list *xlist)
hexchat_list_next (hexchat_plugin *ph, hexchat_list *xlist)
{
if (xlist->next == NULL)
return 0;
@ -1262,7 +1262,7 @@ xchat_list_next (xchat_plugin *ph, xchat_list *xlist)
}
const char * const *
xchat_list_fields (xchat_plugin *ph, const char *name)
hexchat_list_fields (hexchat_plugin *ph, const char *name)
{
static const char * const dcc_fields[] =
{
@ -1312,7 +1312,7 @@ xchat_list_fields (xchat_plugin *ph, const char *name)
}
time_t
xchat_list_time (xchat_plugin *ph, xchat_list *xlist, const char *name)
hexchat_list_time (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data;
@ -1346,7 +1346,7 @@ xchat_list_time (xchat_plugin *ph, xchat_list *xlist, const char *name)
}
const char *
xchat_list_str (xchat_plugin *ph, xchat_list *xlist, const char *name)
hexchat_list_str (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data = ph->context;
@ -1430,7 +1430,7 @@ xchat_list_str (xchat_plugin *ph, xchat_list *xlist, const char *name)
}
int
xchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
hexchat_list_int (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
{
guint32 hash = str_hash (name);
gpointer data = ph->context;
@ -1547,7 +1547,7 @@ xchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
}
void *
xchat_plugingui_add (xchat_plugin *ph, const char *filename,
hexchat_plugingui_add (hexchat_plugin *ph, const char *filename,
const char *name, const char *desc,
const char *version, char *reserved)
{
@ -1561,7 +1561,7 @@ xchat_plugingui_add (xchat_plugin *ph, const char *filename,
}
void
xchat_plugingui_remove (xchat_plugin *ph, void *handle)
hexchat_plugingui_remove (hexchat_plugin *ph, void *handle)
{
#ifdef USE_PLUGIN
plugin_free (handle, FALSE, FALSE);
@ -1569,7 +1569,7 @@ xchat_plugingui_remove (xchat_plugin *ph, void *handle)
}
int
xchat_emit_print (xchat_plugin *ph, const char *event_name, ...)
hexchat_emit_print (hexchat_plugin *ph, const char *event_name, ...)
{
va_list args;
/* currently only 4 because no events use more than 4.
@ -1596,7 +1596,7 @@ xchat_emit_print (xchat_plugin *ph, const char *event_name, ...)
}
char *
xchat_gettext (xchat_plugin *ph, const char *msgid)
hexchat_gettext (hexchat_plugin *ph, const char *msgid)
{
/* so that plugins can use xchat's internal gettext strings. */
/* e.g. The EXEC plugin uses this on Windows. */
@ -1604,7 +1604,7 @@ xchat_gettext (xchat_plugin *ph, const char *msgid)
}
void
xchat_send_modes (xchat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
hexchat_send_modes (hexchat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
{
char tbuf[514]; /* modes.c needs 512 + null */
@ -1612,19 +1612,19 @@ xchat_send_modes (xchat_plugin *ph, const char **targets, int ntargets, int mode
}
char *
xchat_strip (xchat_plugin *ph, const char *str, int len, int flags)
hexchat_strip (hexchat_plugin *ph, const char *str, int len, int flags)
{
return strip_color ((char *)str, len, flags);
}
void
xchat_free (xchat_plugin *ph, void *ptr)
hexchat_free (hexchat_plugin *ph, void *ptr)
{
g_free (ptr);
}
static int
xchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
{
FILE *fpIn;
int fhOut;
@ -1737,13 +1737,13 @@ xchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *va
}
int
xchat_pluginpref_set_str (xchat_plugin *pl, const char *var, const char *value)
hexchat_pluginpref_set_str (hexchat_plugin *pl, const char *var, const char *value)
{
return xchat_pluginpref_set_str_real (pl, var, value, 1);
return hexchat_pluginpref_set_str_real (pl, var, value, 1);
}
int
xchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest)
hexchat_pluginpref_get_str (hexchat_plugin *pl, const char *var, char *dest)
{
int fh;
int l;
@ -1795,20 +1795,20 @@ xchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest)
}
int
xchat_pluginpref_set_int (xchat_plugin *pl, const char *var, int value)
hexchat_pluginpref_set_int (hexchat_plugin *pl, const char *var, int value)
{
char buffer[12];
sprintf (buffer, "%d", value);
return xchat_pluginpref_set_str_real (pl, var, buffer, 1);
return hexchat_pluginpref_set_str_real (pl, var, buffer, 1);
}
int
xchat_pluginpref_get_int (xchat_plugin *pl, const char *var)
hexchat_pluginpref_get_int (hexchat_plugin *pl, const char *var)
{
char buffer[12];
if (xchat_pluginpref_get_str (pl, var, buffer))
if (hexchat_pluginpref_get_str (pl, var, buffer))
{
return atoi (buffer);
}
@ -1819,13 +1819,13 @@ xchat_pluginpref_get_int (xchat_plugin *pl, const char *var)
}
int
xchat_pluginpref_delete (xchat_plugin *pl, const char *var)
hexchat_pluginpref_delete (hexchat_plugin *pl, const char *var)
{
return xchat_pluginpref_set_str_real (pl, var, 0, 0);
return hexchat_pluginpref_set_str_real (pl, var, 0, 0);
}
int
xchat_pluginpref_list (xchat_plugin *pl, char* dest)
hexchat_pluginpref_list (hexchat_plugin *pl, char* dest)
{
FILE *fpIn;
char confname[64];

View File

@ -2,121 +2,121 @@
#define HEXCHAT_COMMONPLUGIN_H
#ifdef PLUGIN_C
struct _xchat_plugin
struct _hexchat_plugin
{
/* Keep these in sync with hexchat-plugin.h */
/* !!don't change the order, to keep binary compat!! */
xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_command) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
const char *help_text,
void *userdata);
xchat_hook *(*xchat_hook_server) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_server) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_print) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_print) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_timer) (hexchat_plugin *ph,
int timeout,
int (*callback) (void *user_data),
void *userdata);
xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph,
hexchat_hook *(*hexchat_hook_fd) (hexchat_plugin *ph,
int fd,
int flags,
int (*callback) (int fd, int flags, void *user_data),
void *userdata);
void *(*xchat_unhook) (xchat_plugin *ph,
xchat_hook *hook);
void (*xchat_print) (xchat_plugin *ph,
void *(*hexchat_unhook) (hexchat_plugin *ph,
hexchat_hook *hook);
void (*hexchat_print) (hexchat_plugin *ph,
const char *text);
void (*xchat_printf) (xchat_plugin *ph,
void (*hexchat_printf) (hexchat_plugin *ph,
const char *format, ...);
void (*xchat_command) (xchat_plugin *ph,
void (*hexchat_command) (hexchat_plugin *ph,
const char *command);
void (*xchat_commandf) (xchat_plugin *ph,
void (*hexchat_commandf) (hexchat_plugin *ph,
const char *format, ...);
int (*xchat_nickcmp) (xchat_plugin *ph,
int (*hexchat_nickcmp) (hexchat_plugin *ph,
const char *s1,
const char *s2);
int (*xchat_set_context) (xchat_plugin *ph,
xchat_context *ctx);
xchat_context *(*xchat_find_context) (xchat_plugin *ph,
int (*hexchat_set_context) (hexchat_plugin *ph,
hexchat_context *ctx);
hexchat_context *(*hexchat_find_context) (hexchat_plugin *ph,
const char *servname,
const char *channel);
xchat_context *(*xchat_get_context) (xchat_plugin *ph);
const char *(*xchat_get_info) (xchat_plugin *ph,
hexchat_context *(*hexchat_get_context) (hexchat_plugin *ph);
const char *(*hexchat_get_info) (hexchat_plugin *ph,
const char *id);
int (*xchat_get_prefs) (xchat_plugin *ph,
int (*xchat_get_prefs) (hexchat_plugin *ph,
const char *name,
const char **string,
int *integer);
xchat_list * (*xchat_list_get) (xchat_plugin *ph,
hexchat_list * (*hexchat_list_get) (hexchat_plugin *ph,
const char *name);
void (*xchat_list_free) (xchat_plugin *ph,
xchat_list *xlist);
const char * const * (*xchat_list_fields) (xchat_plugin *ph,
void (*hexchat_list_free) (hexchat_plugin *ph,
hexchat_list *xlist);
const char * const * (*hexchat_list_fields) (hexchat_plugin *ph,
const char *name);
int (*xchat_list_next) (xchat_plugin *ph,
xchat_list *xlist);
const char * (*xchat_list_str) (xchat_plugin *ph,
xchat_list *xlist,
int (*hexchat_list_next) (hexchat_plugin *ph,
hexchat_list *xlist);
const char * (*hexchat_list_str) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
int (*xchat_list_int) (xchat_plugin *ph,
xchat_list *xlist,
int (*hexchat_list_int) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
void * (*xchat_plugingui_add) (xchat_plugin *ph,
void * (*hexchat_plugingui_add) (hexchat_plugin *ph,
const char *filename,
const char *name,
const char *desc,
const char *version,
char *reserved);
void (*xchat_plugingui_remove) (xchat_plugin *ph,
void (*hexchat_plugingui_remove) (hexchat_plugin *ph,
void *handle);
int (*xchat_emit_print) (xchat_plugin *ph,
int (*hexchat_emit_print) (hexchat_plugin *ph,
const char *event_name, ...);
void *(*xchat_read_fd) (xchat_plugin *ph);
time_t (*xchat_list_time) (xchat_plugin *ph,
xchat_list *xlist,
void *(*xchat_read_fd) (hexchat_plugin *ph);
time_t (*hexchat_list_time) (hexchat_plugin *ph,
hexchat_list *xlist,
const char *name);
char *(*xchat_gettext) (xchat_plugin *ph,
char *(*hexchat_gettext) (hexchat_plugin *ph,
const char *msgid);
void (*xchat_send_modes) (xchat_plugin *ph,
void (*hexchat_send_modes) (hexchat_plugin *ph,
const char **targets,
int ntargets,
int modes_per_line,
char sign,
char mode);
char *(*xchat_strip) (xchat_plugin *ph,
char *(*hexchat_strip) (hexchat_plugin *ph,
const char *str,
int len,
int flags);
void (*xchat_free) (xchat_plugin *ph,
void (*hexchat_free) (hexchat_plugin *ph,
void *ptr);
int (*xchat_pluginpref_set_str) (xchat_plugin *ph,
int (*hexchat_pluginpref_set_str) (hexchat_plugin *ph,
const char *var,
const char *value);
int (*xchat_pluginpref_get_str) (xchat_plugin *ph,
int (*hexchat_pluginpref_get_str) (hexchat_plugin *ph,
const char *var,
char *dest);
int (*xchat_pluginpref_set_int) (xchat_plugin *ph,
int (*hexchat_pluginpref_set_int) (hexchat_plugin *ph,
const char *var,
int value);
int (*xchat_pluginpref_get_int) (xchat_plugin *ph,
int (*hexchat_pluginpref_get_int) (hexchat_plugin *ph,
const char *var);
int (*xchat_pluginpref_delete) (xchat_plugin *ph,
int (*hexchat_pluginpref_delete) (hexchat_plugin *ph,
const char *var);
int (*xchat_pluginpref_list) (xchat_plugin *ph,
int (*hexchat_pluginpref_list) (hexchat_plugin *ph,
char *dest);
void *(*xchat_dummy4) (xchat_plugin *ph);
void *(*xchat_dummy3) (xchat_plugin *ph);
void *(*xchat_dummy2) (xchat_plugin *ph);
void *(*xchat_dummy1) (xchat_plugin *ph);
void *(*xchat_dummy4) (hexchat_plugin *ph);
void *(*xchat_dummy3) (hexchat_plugin *ph);
void *(*xchat_dummy2) (hexchat_plugin *ph);
void *(*xchat_dummy1) (hexchat_plugin *ph);
/* PRIVATE FIELDS! */
void *handle; /* from dlopen */
char *filename; /* loaded from */
@ -124,8 +124,8 @@ struct _xchat_plugin
char *desc;
char *version;
session *context;
void *deinit_callback; /* pointer to xchat_plugin_deinit */
unsigned int fake:1; /* fake plugin. Added by xchat_plugingui_add() */
void *deinit_callback; /* pointer to hexchat_plugin_deinit */
unsigned int fake:1; /* fake plugin. Added by hexchat_plugingui_add() */
unsigned int free_strings:1; /* free name,desc,version? */
};
#endif

View File

@ -60,7 +60,7 @@ typedef GdkPixbuf* TrayIcon;
static GtkStatusIcon *sticon;
static gint flash_tag;
static TrayStatus tray_status;
static xchat_plugin *ph;
static hexchat_plugin *ph;
static TrayIcon custom_icon1;
static TrayIcon custom_icon2;
@ -79,7 +79,7 @@ tray_get_window_status (void)
{
const char *st;
st = xchat_get_info (ph, "win_status");
st = hexchat_get_info (ph, "win_status");
if (!st)
return WS_HIDDEN;
@ -374,9 +374,9 @@ tray_toggle_visibility (gboolean force_hide)
return FALSE;
/* ph may have an invalid context now */
xchat_set_context (ph, xchat_find_context (ph, NULL, NULL));
hexchat_set_context (ph, hexchat_find_context (ph, NULL, NULL));
win = xchat_get_info (ph, "gtkwin_ptr");
win = hexchat_get_info (ph, "gtkwin_ptr");
tray_stop_flash ();
tray_reset_counts ();
@ -507,7 +507,7 @@ tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata)
#endif
/* ph may have an invalid context now */
xchat_set_context (ph, xchat_find_context (ph, NULL, NULL));
hexchat_set_context (ph, hexchat_find_context (ph, NULL, NULL));
menu = gtk_menu_new ();
/*gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));*/
@ -586,15 +586,15 @@ tray_hilight_cb (char *word[], void *userdata)
tray_hilight_count++;
if (tray_hilight_count == 1)
tray_set_tipf (_(DISPLAY_NAME": Highlighted message from: %s (%s)"),
word[1], xchat_get_info (ph, "channel"));
word[1], hexchat_get_info (ph, "channel"));
else
tray_set_tipf (_(DISPLAY_NAME": %u highlighted messages, latest from: %s (%s)"),
tray_hilight_count, word[1], xchat_get_info (ph, "channel"));
tray_hilight_count, word[1], hexchat_get_info (ph, "channel"));
}
if (prefs.hex_input_balloon_hilight && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
tray_set_balloonf (word[2], _(DISPLAY_NAME": Highlighted message from: %s (%s)"),
word[1], xchat_get_info (ph, "channel"));
word[1], hexchat_get_info (ph, "channel"));
return HEXCHAT_EAT_NONE;
}
@ -612,14 +612,14 @@ tray_message_cb (char *word[], void *userdata)
tray_pub_count++;
if (tray_pub_count == 1)
tray_set_tipf (_(DISPLAY_NAME": New public message from: %s (%s)"),
word[1], xchat_get_info (ph, "channel"));
word[1], hexchat_get_info (ph, "channel"));
else
tray_set_tipf (_(DISPLAY_NAME": %u new public messages."), tray_pub_count);
}
if (prefs.hex_input_balloon_chans && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
tray_set_balloonf (word[2], _(DISPLAY_NAME": New public message from: %s (%s)"),
word[1], xchat_get_info (ph, "channel"));
word[1], hexchat_get_info (ph, "channel"));
return HEXCHAT_EAT_NONE;
}
@ -634,9 +634,9 @@ tray_priv (char *from, char *text)
tray_set_flash (ICON_MSG);
network = xchat_get_info (ph, "network");
network = hexchat_get_info (ph, "network");
if (!network)
network = xchat_get_info (ph, "server");
network = hexchat_get_info (ph, "server");
tray_priv_count++;
if (tray_priv_count == 1)
@ -683,9 +683,9 @@ tray_dcc_cb (char *word[], void *userdata)
/* if (tray_status == TS_FILEOFFER)
return HEXCHAT_EAT_NONE;*/
network = xchat_get_info (ph, "network");
network = hexchat_get_info (ph, "network");
if (!network)
network = xchat_get_info (ph, "server");
network = hexchat_get_info (ph, "server");
if (prefs.hex_input_tray_priv && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
{
@ -743,7 +743,7 @@ tray_apply_setup (void)
}
int
tray_plugin_init (xchat_plugin *plugin_handle, char **plugin_name,
tray_plugin_init (hexchat_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 */
@ -753,21 +753,21 @@ tray_plugin_init (xchat_plugin *plugin_handle, char **plugin_name,
*plugin_desc = "";
*plugin_version = "";
xchat_hook_print (ph, "Channel Msg Hilight", -1, tray_hilight_cb, NULL);
xchat_hook_print (ph, "Channel Action Hilight", -1, tray_hilight_cb, NULL);
hexchat_hook_print (ph, "Channel Msg Hilight", -1, tray_hilight_cb, NULL);
hexchat_hook_print (ph, "Channel Action Hilight", -1, tray_hilight_cb, NULL);
xchat_hook_print (ph, "Channel Message", -1, tray_message_cb, NULL);
xchat_hook_print (ph, "Channel Action", -1, tray_message_cb, NULL);
xchat_hook_print (ph, "Channel Notice", -1, tray_message_cb, NULL);
hexchat_hook_print (ph, "Channel Message", -1, tray_message_cb, NULL);
hexchat_hook_print (ph, "Channel Action", -1, tray_message_cb, NULL);
hexchat_hook_print (ph, "Channel Notice", -1, tray_message_cb, NULL);
xchat_hook_print (ph, "Private Message", -1, tray_priv_cb, NULL);
xchat_hook_print (ph, "Private Message to Dialog", -1, tray_priv_cb, NULL);
xchat_hook_print (ph, "Notice", -1, tray_priv_cb, NULL);
xchat_hook_print (ph, "Invited", -1, tray_invited_cb, NULL);
hexchat_hook_print (ph, "Private Message", -1, tray_priv_cb, NULL);
hexchat_hook_print (ph, "Private Message to Dialog", -1, tray_priv_cb, NULL);
hexchat_hook_print (ph, "Notice", -1, tray_priv_cb, NULL);
hexchat_hook_print (ph, "Invited", -1, tray_invited_cb, NULL);
xchat_hook_print (ph, "DCC Offer", -1, tray_dcc_cb, NULL);
hexchat_hook_print (ph, "DCC Offer", -1, tray_dcc_cb, NULL);
xchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
hexchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
if (prefs.hex_gui_tray && !hextray_mode ())
tray_init ();
@ -776,7 +776,7 @@ tray_plugin_init (xchat_plugin *plugin_handle, char **plugin_name,
}
int
tray_plugin_deinit (xchat_plugin *plugin_handle)
tray_plugin_deinit (hexchat_plugin *plugin_handle)
{
#ifdef WIN32
tray_cleanup ();

View File

@ -34,7 +34,7 @@
#include "../common/hexchat.h"
#define PLUGIN_C
typedef struct session xchat_context;
typedef struct session hexchat_context;
#include "../common/hexchat-plugin.h"
#include "../common/plugin.h"
#include "../common/util.h"
@ -99,7 +99,7 @@ extern GSList *plugin_list;
void
fe_pluginlist_update (void)
{
xchat_plugin *pl;
hexchat_plugin *pl;
GSList *list;
GtkTreeView *view;
GtkListStore *store;

View File

@ -1,40 +1,40 @@
EXPORTED {
global:
xchat_hook_command;
xchat_hook_server;
xchat_hook_print;
xchat_hook_timer;
xchat_hook_fd;
xchat_unhook;
xchat_print;
xchat_printf;
xchat_command;
xchat_commandf;
xchat_nickcmp;
xchat_set_context;
xchat_find_context;
xchat_get_context;
xchat_get_info;
xchat_get_prefs;
xchat_list_get;
xchat_list_free;
xchat_list_fields;
xchat_list_next;
xchat_list_str;
xchat_list_int;
xchat_plugingui_add;
xchat_plugingui_remove;
xchat_emit_print;
xchat_list_time;
xchat_gettext;
xchat_send_modes;
xchat_strip;
xchat_free;
xchat_pluginpref_set_str;
xchat_pluginpref_get_str;
xchat_pluginpref_set_int;
xchat_pluginpref_get_int;
xchat_pluginpref_delete;
xchat_pluginpref_list;
hexchat_hook_command;
hexchat_hook_server;
hexchat_hook_print;
hexchat_hook_timer;
hexchat_hook_fd;
hexchat_unhook;
hexchat_print;
hexchat_printf;
hexchat_command;
hexchat_commandf;
hexchat_nickcmp;
hexchat_set_context;
hexchat_find_context;
hexchat_get_context;
hexchat_get_info;
hexchat_get_prefs;
hexchat_list_get;
hexchat_list_free;
hexchat_list_fields;
hexchat_list_next;
hexchat_list_str;
hexchat_list_int;
hexchat_plugingui_add;
hexchat_plugingui_remove;
hexchat_emit_print;
hexchat_list_time;
hexchat_gettext;
hexchat_send_modes;
hexchat_strip;
hexchat_free;
hexchat_pluginpref_set_str;
hexchat_pluginpref_get_str;
hexchat_pluginpref_set_int;
hexchat_pluginpref_get_int;
hexchat_pluginpref_delete;
hexchat_pluginpref_list;
local: *;
};