summary refs log tree commit diff stats
path: root/plugins
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-10-30 08:42:48 +0100
committerBerke Viktor <bviktor@hexchat.org>2012-10-30 08:42:48 +0100
commite681eafa78262d0c177832d67900687f2c938081 (patch)
tree5668476e046c505b9f3fcc8c53b6e0971c146978 /plugins
parent97dc13fde70810abf07985f45ac459560eae6e96 (diff)
Rebranding for the rest of plugin*
Diffstat (limited to 'plugins')
-rw-r--r--plugins/checksum/checksum.c56
-rw-r--r--plugins/checksum/checksum.def4
-rw-r--r--plugins/dns/dns.c42
-rw-r--r--plugins/dns/dns.def4
-rw-r--r--plugins/doat/doat.c20
-rw-r--r--plugins/doat/doat.def4
-rw-r--r--plugins/ewc/ewc.c42
-rw-r--r--plugins/ewc/makefile.mak4
-rw-r--r--plugins/exec/exec.c20
-rw-r--r--plugins/exec/exec.def4
-rw-r--r--plugins/fishlim/fishlim.def6
-rw-r--r--plugins/fishlim/plugin_hexchat.c62
-rw-r--r--plugins/gtkpref/gtkpref.c14
-rw-r--r--plugins/gtkpref/makefile.mak4
-rw-r--r--plugins/hextray/callbacks.cpp30
-rw-r--r--plugins/hextray/hexchat.cpp86
-rw-r--r--plugins/hextray/hexchat.h16
-rw-r--r--plugins/hextray/hextray.cpp64
-rw-r--r--plugins/hextray/hextray.def4
-rw-r--r--plugins/hextray/hextray.h2
-rw-r--r--plugins/hextray/utility.cpp20
-rw-r--r--plugins/lua/lua.c166
-rw-r--r--plugins/lua/lua.def4
-rw-r--r--plugins/mailcheck/mailcheck.c8
-rw-r--r--plugins/mpcinfo/functions.c2
-rw-r--r--plugins/mpcinfo/mp3Info.c46
-rw-r--r--plugins/mpcinfo/mpcInfo.c40
-rw-r--r--plugins/mpcinfo/mpcinfo.def4
-rw-r--r--plugins/mpcinfo/oggInfo.c2
-rw-r--r--plugins/mpcinfo/theme.c22
-rw-r--r--plugins/perl/lib/Xchat/Embed.pm2
-rw-r--r--plugins/perl/perl.c216
-rw-r--r--plugins/perl/perl.def6
-rw-r--r--plugins/python/python.c302
-rw-r--r--plugins/python/python.def6
-rw-r--r--plugins/sasl/sasl.c82
-rw-r--r--plugins/sasl/sasl.def4
-rw-r--r--plugins/sysinfo/sysinfo.cpp36
-rw-r--r--plugins/sysinfo/sysinfo.def4
-rw-r--r--plugins/sysinfo/xsys.c184
-rw-r--r--plugins/tcl/printevents.h2
-rw-r--r--plugins/tcl/tcl.def6
-rw-r--r--plugins/tcl/tclplugin.c464
-rw-r--r--plugins/tcl/tclplugin.h10
-rw-r--r--plugins/upd/upd.c70
-rw-r--r--plugins/upd/upd.def4
-rw-r--r--plugins/winamp/winamp.c38
-rw-r--r--plugins/winamp/winamp.def4
-rw-r--r--plugins/wmpa/hexchat-plugin.cpp128
-rw-r--r--plugins/wmpa/hexchat-plugin.h236
-rw-r--r--plugins/wmpa/wmpa.def6
-rw-r--r--plugins/wmpa/wmpadialog.cpp12
-rw-r--r--plugins/xdcc/makefile.mak4
-rw-r--r--plugins/xdcc/xdcc.c70
54 files changed, 1349 insertions, 1349 deletions
diff --git a/plugins/checksum/checksum.c b/plugins/checksum/checksum.c
index 19130ed2..d190bd03 100644
--- a/plugins/checksum/checksum.c
+++ b/plugins/checksum/checksum.c
@@ -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;
 }
diff --git a/plugins/checksum/checksum.def b/plugins/checksum/checksum.def
index 77670bf2..e560f50f 100644
--- a/plugins/checksum/checksum.def
+++ b/plugins/checksum/checksum.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/dns/dns.c b/plugins/dns/dns.c
index 211c760e..2f56e006 100644
--- a/plugins/dns/dns.c
+++ b/plugins/dns/dns.c
@@ -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 */
 }
diff --git a/plugins/dns/dns.def b/plugins/dns/dns.def
index 77670bf2..e560f50f 100644
--- a/plugins/dns/dns.def
+++ b/plugins/dns/dns.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/doat/doat.c b/plugins/doat/doat.c
index c8fbd278..e62f7d75 100644
--- a/plugins/doat/doat.c
+++ b/plugins/doat/doat.c
@@ -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;
 }
diff --git a/plugins/doat/doat.def b/plugins/doat/doat.def
index 77670bf2..e560f50f 100644
--- a/plugins/doat/doat.def
+++ b/plugins/doat/doat.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/ewc/ewc.c b/plugins/ewc/ewc.c
index 0b4c2af1..9fb5a135 100644
--- a/plugins/ewc/ewc.c
+++ b/plugins/ewc/ewc.c
@@ -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;

 }

diff --git a/plugins/ewc/makefile.mak b/plugins/ewc/makefile.mak
index 9b9f21c1..a54708de 100644
--- a/plugins/ewc/makefile.mak
+++ b/plugins/ewc/makefile.mak
@@ -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

diff --git a/plugins/exec/exec.c b/plugins/exec/exec.c
index c9c64074..31dd9350 100644
--- a/plugins/exec/exec.c
+++ b/plugins/exec/exec.c
@@ -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;
 }
diff --git a/plugins/exec/exec.def b/plugins/exec/exec.def
index 77670bf2..e560f50f 100644
--- a/plugins/exec/exec.def
+++ b/plugins/exec/exec.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/fishlim/fishlim.def b/plugins/fishlim/fishlim.def
index 5797636b..6ce04e98 100644
--- a/plugins/fishlim/fishlim.def
+++ b/plugins/fishlim/fishlim.def
@@ -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 

diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c
index 82611850..3be13efb 100644
--- a/plugins/fishlim/plugin_hexchat.c
+++ b/plugins/fishlim/plugin_hexchat.c
@@ -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;
 }
 
diff --git a/plugins/gtkpref/gtkpref.c b/plugins/gtkpref/gtkpref.c
index 8fdb4714..337f14d2 100644
--- a/plugins/gtkpref/gtkpref.c
+++ b/plugins/gtkpref/gtkpref.c
@@ -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;
 }
diff --git a/plugins/gtkpref/makefile.mak b/plugins/gtkpref/makefile.mak
index e2292365..a5578483 100644
--- a/plugins/gtkpref/makefile.mak
+++ b/plugins/gtkpref/makefile.mak
@@ -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

diff --git a/plugins/hextray/callbacks.cpp b/plugins/hextray/callbacks.cpp
index 53a706b2..3882c137 100644
--- a/plugins/hextray/callbacks.cpp
+++ b/plugins/hextray/callbacks.cpp
@@ -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();

 				}

 			}

 		}

diff --git a/plugins/hextray/hexchat.cpp b/plugins/hextray/hexchat.cpp
index b1defc1f..6376b2d9 100644
--- a/plugins/hextray/hexchat.cpp
+++ b/plugins/hextray/hexchat.cpp
@@ -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);

 }
\ No newline at end of file
diff --git a/plugins/hextray/hexchat.h b/plugins/hextray/hexchat.h
index 76452aeb..847f3547 100644
--- a/plugins/hextray/hexchat.h
+++ b/plugins/hextray/hexchat.h
@@ -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
\ No newline at end of file
diff --git a/plugins/hextray/hextray.cpp b/plugins/hextray/hextray.cpp
index 5b5f56af..56d79ba5 100644
--- a/plugins/hextray/hextray.cpp
+++ b/plugins/hextray/hextray.cpp
@@ -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();

 	}

diff --git a/plugins/hextray/hextray.def b/plugins/hextray/hextray.def
index 77670bf2..e560f50f 100644
--- a/plugins/hextray/hextray.def
+++ b/plugins/hextray/hextray.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/hextray/hextray.h b/plugins/hextray/hextray.h
index 2c244d8f..30a564bc 100644
--- a/plugins/hextray/hextray.h
+++ b/plugins/hextray/hextray.h
@@ -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 ************************/

diff --git a/plugins/hextray/utility.cpp b/plugins/hextray/utility.cpp
index f2ad2e60..44eaf7b7 100644
--- a/plugins/hextray/utility.cpp
+++ b/plugins/hextray/utility.cpp
@@ -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 ********************************/

diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c
index 2ec21c22..98778e64 100644
--- a/plugins/lua/lua.c
+++ b/plugins/lua/lua.c
@@ -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);
diff --git a/plugins/lua/lua.def b/plugins/lua/lua.def
index 77670bf2..e560f50f 100644
--- a/plugins/lua/lua.def
+++ b/plugins/lua/lua.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/mailcheck/mailcheck.c b/plugins/mailcheck/mailcheck.c
index fb507539..fcd3a7c9 100644
--- a/plugins/mailcheck/mailcheck.c
+++ b/plugins/mailcheck/mailcheck.c
@@ -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;
 }
diff --git a/plugins/mpcinfo/functions.c b/plugins/mpcinfo/functions.c
index ed0632d4..ba6ba519 100644
--- a/plugins/mpcinfo/functions.c
+++ b/plugins/mpcinfo/functions.c
@@ -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;
 }
 
diff --git a/plugins/mpcinfo/mp3Info.c b/plugins/mpcinfo/mp3Info.c
index f75ba9c4..c08e9663 100644
--- a/plugins/mpcinfo/mp3Info.c
+++ b/plugins/mpcinfo/mp3Info.c
@@ -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;
     }
diff --git a/plugins/mpcinfo/mpcInfo.c b/plugins/mpcinfo/mpcInfo.c
index f0909766..be2fe74f 100644
--- a/plugins/mpcinfo/mpcInfo.c
+++ b/plugins/mpcinfo/mpcInfo.c
@@ -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;
 }
diff --git a/plugins/mpcinfo/mpcinfo.def b/plugins/mpcinfo/mpcinfo.def
index 77670bf2..e560f50f 100644
--- a/plugins/mpcinfo/mpcinfo.def
+++ b/plugins/mpcinfo/mpcinfo.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/mpcinfo/oggInfo.c b/plugins/mpcinfo/oggInfo.c
index 83c2beb5..64c9c512 100644
--- a/plugins/mpcinfo/oggInfo.c
+++ b/plugins/mpcinfo/oggInfo.c
@@ -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;
     }
diff --git a/plugins/mpcinfo/theme.c b/plugins/mpcinfo/theme.c
index 000c00b1..fc218267 100644
--- a/plugins/mpcinfo/theme.c
+++ b/plugins/mpcinfo/theme.c
@@ -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");
diff --git a/plugins/perl/lib/Xchat/Embed.pm b/plugins/perl/lib/Xchat/Embed.pm
index c5857eb0..f7dd70f1 100644
--- a/plugins/perl/lib/Xchat/Embed.pm
+++ b/plugins/perl/lib/Xchat/Embed.pm
@@ -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
diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c
index 7d6912d6..3b2bbba1 100644
--- a/plugins/perl/perl.c
+++ b/plugins/perl/perl.c
@@ -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;
 }
diff --git a/plugins/perl/perl.def b/plugins/perl/perl.def
index a2ec6566..8589b9cb 100644
--- a/plugins/perl/perl.def
+++ b/plugins/perl/perl.def
@@ -1,4 +1,4 @@
 EXPORTS

-  xchat_plugin_init

-  xchat_plugin_deinit

-  xchat_plugin_get_info
\ No newline at end of file
+  hexchat_plugin_init

+  hexchat_plugin_deinit

+  hexchat_plugin_get_info
\ No newline at end of file
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 8b8b47c4..9c797ef0 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -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;
diff --git a/plugins/python/python.def b/plugins/python/python.def
index 5797636b..6ce04e98 100644
--- a/plugins/python/python.def
+++ b/plugins/python/python.def
@@ -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 

diff --git a/plugins/sasl/sasl.c b/plugins/sasl/sasl.c
index 8460f072..3a15e0f4 100644
--- a/plugins/sasl/sasl.c
+++ b/plugins/sasl/sasl.c
@@ -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;
 }
diff --git a/plugins/sasl/sasl.def b/plugins/sasl/sasl.def
index 77670bf2..e560f50f 100644
--- a/plugins/sasl/sasl.def
+++ b/plugins/sasl/sasl.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/sysinfo/sysinfo.cpp b/plugins/sysinfo/sysinfo.cpp
index b11ee9ff..4057eac8 100644
--- a/plugins/sysinfo/sysinfo.cpp
+++ b/plugins/sysinfo/sysinfo.cpp
@@ -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;
 }
diff --git a/plugins/sysinfo/sysinfo.def b/plugins/sysinfo/sysinfo.def
index 77670bf2..e560f50f 100644
--- a/plugins/sysinfo/sysinfo.def
+++ b/plugins/sysinfo/sysinfo.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/sysinfo/xsys.c b/plugins/sysinfo/xsys.c
index 322173ca..cf807343 100644
--- a/plugins/sysinfo/xsys.c
+++ b/plugins/sysinfo/xsys.c
@@ -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;
 }
diff --git a/plugins/tcl/printevents.h b/plugins/tcl/printevents.h
index d4ad5d0d..09937b2b 100644
--- a/plugins/tcl/printevents.h
+++ b/plugins/tcl/printevents.h
@@ -20,7 +20,7 @@ typedef struct {
     char *event;
     char *emit;
     int argc;
-    xchat_hook *hook;
+    hexchat_hook *hook;
 } print_event;
 
 enum
diff --git a/plugins/tcl/tcl.def b/plugins/tcl/tcl.def
index 5797636b..6ce04e98 100644
--- a/plugins/tcl/tcl.def
+++ b/plugins/tcl/tcl.def
@@ -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 

diff --git a/plugins/tcl/tclplugin.c b/plugins/tcl/tclplugin.c
index 0e8973f9..ec17aef5 100644
--- a/plugins/tcl/tclplugin.c
+++ b/plugins/tcl/tclplugin.c
@@ -49,14 +49,14 @@ static char VERSION[16];
 static int initialized = 0;
 static int reinit_tried = 0;
 static Tcl_Interp *interp = NULL;
-static xchat_plugin *ph;
-static xchat_hook *raw_line_hook;
-static xchat_hook *Command_TCL_hook;
-static xchat_hook *Command_Source_hook;
-static xchat_hook *Command_Reload_hook;
-static xchat_hook *Command_Load_hook;
-static xchat_hook *Event_Handler_hook;
-static xchat_hook *Null_Command_hook;
+static hexchat_plugin *ph;
+static hexchat_hook *raw_line_hook;
+static hexchat_hook *Command_TCL_hook;
+static hexchat_hook *Command_Source_hook;
+static hexchat_hook *Command_Reload_hook;
+static hexchat_hook *Command_Load_hook;
+static hexchat_hook *Event_Handler_hook;
+static hexchat_hook *Null_Command_hook;
 
 static int complete_level = 0;
 static t_complete complete[MAX_COMPLETES + 1];
@@ -243,7 +243,7 @@ static char *myitoa(long value)
     return result;
 }
 
-static xchat_context *atoctx(const char *nptr)
+static hexchat_context *atoctx(const char *nptr)
 {
     int isnum = 1;
     int x = 0;
@@ -257,40 +257,40 @@ static xchat_context *atoctx(const char *nptr)
     }
 
     if (isnum && x)
-        return (xchat_context *) atol(nptr);
+        return (hexchat_context *) atol(nptr);
     else
         return NULL;
 }
 
-static xchat_context *xchat_smart_context(const char *arg1, const char *arg2)
+static hexchat_context *xchat_smart_context(const char *arg1, const char *arg2)
 {
     const char *server, *s, *n;
-    xchat_context *result = NULL;
-    xchat_context *ctx = NULL;
-    xchat_context *actx = NULL;
-    xchat_list *list;
+    hexchat_context *result = NULL;
+    hexchat_context *ctx = NULL;
+    hexchat_context *actx = NULL;
+    hexchat_list *list;
 
     if (arg1 == NULL)
-        return xchat_get_context(ph);;
+        return hexchat_get_context(ph);;
 
     if (arg1 && arg2) {
-        result = xchat_find_context(ph, arg1, arg2);
+        result = hexchat_find_context(ph, arg1, arg2);
         if (result == NULL)
-            result = xchat_find_context(ph, arg2, arg1);
+            result = hexchat_find_context(ph, arg2, arg1);
         return result;
     } else {
 
         actx = atoctx(arg1);
 
-        server = xchat_get_info(ph, "server");
+        server = hexchat_get_info(ph, "server");
 
-        list = xchat_list_get(ph, "channels");
+        list = hexchat_list_get(ph, "channels");
 
         if (list != NULL) {
 
-            while (xchat_list_next(ph, list)) {
+            while (hexchat_list_next(ph, list)) {
 
-                ctx = (xchat_context *)xchat_list_str(ph, list, "context");
+                ctx = (hexchat_context *)hexchat_list_str(ph, list, "context");
 
                 if (actx) {
                     if (ctx == actx) {
@@ -299,14 +299,14 @@ static xchat_context *xchat_smart_context(const char *arg1, const char *arg2)
                     }
                 } else {
 
-                    s = xchat_list_str(ph, list, "server");
+                    s = hexchat_list_str(ph, list, "server");
 
-                    if (xchat_list_int(ph, list, "type") == 1) {
+                    if (hexchat_list_int(ph, list, "type") == 1) {
                         if (strcasecmp(arg1, s) == 0) {
                             result = ctx;
                             break;
                         }
-                        n = xchat_list_str(ph, list, "network");
+                        n = hexchat_list_str(ph, list, "network");
                         if (n) {
                             if (strcasecmp(arg1, n) == 0) {
                                 result = ctx;
@@ -314,7 +314,7 @@ static xchat_context *xchat_smart_context(const char *arg1, const char *arg2)
                             }
                         }
                     } else {
-                        if ((strcasecmp(server, s) == 0) && (strcasecmp(arg1, xchat_list_str(ph, list, "channel")) == 0)) {
+                        if ((strcasecmp(server, s) == 0) && (strcasecmp(arg1, hexchat_list_str(ph, list, "channel")) == 0)) {
                             result = ctx;
                             break;
                         }
@@ -322,7 +322,7 @@ static xchat_context *xchat_smart_context(const char *arg1, const char *arg2)
                 }
             }
 
-            xchat_list_free(ph, list);
+            hexchat_list_free(ph, list);
         }
 
     }
@@ -365,7 +365,7 @@ static int insert_timer(int seconds, int count, const char *script)
     for (x = 1; x < MAX_TIMERS; x++) {
         if (timers[x].timerid == 0) {
             if (SourceInternalProc(id, "", script) == TCL_ERROR) {
-                xchat_printf(ph, "\0039TCL plugin\003\tERROR (timer %d) ", timers[x].timerid);
+                hexchat_printf(ph, "\0039TCL plugin\003\tERROR (timer %d) ", timers[x].timerid);
                 NiceErrorInfo ();
                 return (-1);
             }
@@ -384,7 +384,7 @@ static int insert_timer(int seconds, int count, const char *script)
 
 static void do_timer()
 {
-    xchat_context *origctx;
+    hexchat_context *origctx;
     time_t now;
     int index;
 
@@ -397,12 +397,12 @@ static void do_timer()
         return;
 
     index = nexttimerindex;
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
     if (EvalInternalProc(timers[index].procPtr, 0) == TCL_ERROR) {
-        xchat_printf(ph, "\0039TCL plugin\003\tERROR (timer %d) ", timers[index].timerid);
+        hexchat_printf(ph, "\0039TCL plugin\003\tERROR (timer %d) ", timers[index].timerid);
         NiceErrorInfo ();
     }
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, origctx);
 
     if (timers[index].count != -1)
       timers[index].count--;
@@ -430,7 +430,7 @@ static int Server_raw_line(char *word[], char *word_eol[], void *userdata)
     char *chancmd = NULL;
     char *procList;
     Tcl_HashEntry *entry = NULL;
-    xchat_context *origctx;
+    hexchat_context *origctx;
     int len;
     int dummy;
     char *string = NULL;
@@ -532,12 +532,12 @@ static int Server_raw_line(char *word[], char *word_eol[], void *userdata)
                 if (Tcl_SplitList(interp, list_argv[count], &proc_argc, &proc_argv) != TCL_OK)
                     continue;
 
-                origctx = xchat_get_context(ph);
+                origctx = hexchat_get_context(ph);
                 if (EvalInternalProc(proc_argv[1], 7, src, dest, cmd, rest, word_eol[1], proc_argv[0], myitoa(private)) == TCL_ERROR) {
-                    xchat_printf(ph, "\0039TCL plugin\003\tERROR (on %s %s) ", cmd, proc_argv[0]);
+                    hexchat_printf(ph, "\0039TCL plugin\003\tERROR (on %s %s) ", cmd, proc_argv[0]);
                     NiceErrorInfo ();
                 }
-                xchat_set_context(ph, origctx);
+                hexchat_set_context(ph, origctx);
 
                 Tcl_Free((char *) proc_argv);
 
@@ -565,7 +565,7 @@ static int Print_Hook(char *word[], void *userdata)
 {
     char *procList;
     Tcl_HashEntry *entry;
-    xchat_context *origctx;
+    hexchat_context *origctx;
     int count;
     int list_argc, proc_argc;
     const char **list_argv, **proc_argv;
@@ -592,7 +592,7 @@ static int Print_Hook(char *word[], void *userdata)
                 if (Tcl_SplitList(interp, list_argv[count], &proc_argc, &proc_argv) != TCL_OK)
                     continue;
 
-                origctx = xchat_get_context(ph);
+                origctx = hexchat_get_context(ph);
 
                 Tcl_DStringInit(&ds);
 
@@ -601,7 +601,7 @@ static int Print_Hook(char *word[], void *userdata)
                     Tcl_DStringAppend(&ds, "!*@", 3);
                     Tcl_DStringAppend(&ds, word[1], strlen(word[1]));
                     if (EvalInternalProc(proc_argv[1], 7, ds.string, word[2], xc[(int) userdata].event, word[4], "", proc_argv[0], "0") == TCL_ERROR) {
-                        xchat_printf(ph, "\0039TCL plugin\003\tERROR (on %s %s) ", xc[(int) userdata].event, proc_argv[0]);
+                        hexchat_printf(ph, "\0039TCL plugin\003\tERROR (on %s %s) ", xc[(int) userdata].event, proc_argv[0]);
                         NiceErrorInfo ();
                     }
                 } else {
@@ -610,14 +610,14 @@ static int Print_Hook(char *word[], void *userdata)
                             Tcl_DStringAppendElement(&ds, word[x]);
                     }
                     if (EvalInternalProc(proc_argv[1], 7, "", "", xc[(int) userdata].event, "", ds.string, proc_argv[0], "0") == TCL_ERROR) {
-                        xchat_printf(ph, "\0039Tcl plugin\003\tERROR (on %s %s) ", xc[(int) userdata].event, proc_argv[0]);
+                        hexchat_printf(ph, "\0039Tcl plugin\003\tERROR (on %s %s) ", xc[(int) userdata].event, proc_argv[0]);
                         NiceErrorInfo ();
                     }
                 }
 
                 Tcl_DStringFree(&ds);
 
-                xchat_set_context(ph, origctx);
+                hexchat_set_context(ph, origctx);
 
                 Tcl_Free((char *) proc_argv);
 
@@ -787,7 +787,7 @@ static int tcl_on(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
     id = (nextprocid++ % INT_MAX) + 1;
 
     if (SourceInternalProc(id, "_src _dest _cmd _rest _raw _label _private", argv[3]) == TCL_ERROR) {
-        xchat_printf(ph, "\0039Tcl plugin\003\tERROR (on %s:%s) ", argv[1], argv[2]);
+        hexchat_printf(ph, "\0039Tcl plugin\003\tERROR (on %s:%s) ", argv[1], argv[2]);
         NiceErrorInfo ();
         return TCL_OK;
     }
@@ -832,7 +832,7 @@ static int tcl_on(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
         for (index = 0; index < XC_SIZE; index++) {
             if (strcmp(xc[index].event, token) == 0) {
                 if (xc[index].hook == NULL) {
-                    xc[index].hook = xchat_hook_print(ph, xc[index].emit, HEXCHAT_PRI_NORM, Print_Hook, (void *) index);
+                    xc[index].hook = hexchat_hook_print(ph, xc[index].emit, HEXCHAT_PRI_NORM, Print_Hook, (void *) index);
                     break;
                 }
             }
@@ -900,7 +900,7 @@ static int tcl_off(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]
                 for (index = 0; index < XC_SIZE; index++) {
                     if (strcmp(xc[index].event, token) == 0) {
                         if (xc[index].hook != NULL) {
-                            xchat_unhook(ph, xc[index].hook);
+                            hexchat_unhook(ph, xc[index].hook);
                             xc[index].hook = NULL;
                             break;
                         }
@@ -939,7 +939,7 @@ static int tcl_alias(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
         id = (nextprocid++ % INT_MAX) + 1;
 
         if (SourceInternalProc(id, "_cmd _rest", argv[argc - 1]) == TCL_ERROR) {
-            xchat_printf(ph, "\0039Tcl plugin\003\tERROR (alias %s) ", argv[1]);
+            hexchat_printf(ph, "\0039Tcl plugin\003\tERROR (alias %s) ", argv[1]);
             NiceErrorInfo ();
             return TCL_OK;
         }
@@ -950,7 +950,7 @@ static int tcl_alias(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
             if (string[0] == '@')
                 aliasPtr->hook = NULL;
             else
-                aliasPtr->hook = xchat_hook_command(ph, string, HEXCHAT_PRI_NORM, Command_Alias, help, 0);
+                aliasPtr->hook = hexchat_hook_command(ph, string, HEXCHAT_PRI_NORM, Command_Alias, help, 0);
         } else {
             aliasPtr = Tcl_GetHashValue(entry);
             DeleteInternalProc(aliasPtr->procPtr);
@@ -968,7 +968,7 @@ static int tcl_alias(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
             DeleteInternalProc(aliasPtr->procPtr);
             Tcl_Free(aliasPtr->procPtr);
             if (aliasPtr->hook)
-                xchat_unhook(ph, aliasPtr->hook);
+                hexchat_unhook(ph, aliasPtr->hook);
             Tcl_Free((char *) aliasPtr);
             Tcl_DeleteHashEntry(entry);
         }
@@ -1004,13 +1004,13 @@ static int tcl_complete(ClientData cd, Tcl_Interp * irp, int argc, const char *a
 
 static int tcl_command(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_context *origctx;
-    xchat_context *ctx = NULL;
+    hexchat_context *origctx;
+    hexchat_context *ctx = NULL;
     const char *string = NULL;
 
     BADARGS(2, 4, " ?server|network|context? ?#channel|nick? text");
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     switch (argc) {
     case 2:
@@ -1032,22 +1032,22 @@ static int tcl_command(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
     if (string[0] == '/')
         string++;
 
-    xchat_set_context(ph, ctx);
-    xchat_command(ph, string);
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, ctx);
+    hexchat_command(ph, string);
+    hexchat_set_context(ph, origctx);
 
     return TCL_OK;
 }
 
 static int tcl_raw(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_context *origctx;
-    xchat_context *ctx = NULL;
+    hexchat_context *origctx;
+    hexchat_context *ctx = NULL;
     const char *string = NULL;
 
     BADARGS(2, 4, " ?server|network|context? ?#channel|nick? text");
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     switch (argc) {
     case 2:
@@ -1066,9 +1066,9 @@ static int tcl_raw(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[]
 
     string = argv[argc - 1];
 
-    xchat_set_context(ph, ctx);
-    xchat_commandf(ph, "RAW %s", string);
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, ctx);
+    hexchat_commandf(ph, "RAW %s", string);
+    hexchat_set_context(ph, origctx);
 
     return TCL_OK;
 }
@@ -1100,7 +1100,7 @@ static int tcl_info(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[
 {
     char *result;
     int max_argc;
-    xchat_context *origctx, *ctx;
+    hexchat_context *origctx, *ctx;
 
     if (id == NULL) {
         BADARGS(2, 3, " ?server|network|context? id");
@@ -1110,23 +1110,23 @@ static int tcl_info(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[
         max_argc = 2;
     }
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     if (argc == max_argc) {
         ctx = xchat_smart_context(argv[1], NULL);
         CHECKCTX(ctx);
-        xchat_set_context(ph, ctx);
+        hexchat_set_context(ph, ctx);
     }
 
     if (id == NULL)
       id = argv[argc-1];
 
-    if ((result = xchat_get_info(ph, id)) == NULL)
+    if ((result = hexchat_get_info(ph, id)) == NULL)
         result = "";
 
     Tcl_AppendResult(irp, result, NULL);
 
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, origctx);
 
     return TCL_OK;
 }
@@ -1143,7 +1143,7 @@ static int tcl_getinfo(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
 
 static int tcl_getlist(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_list *list = NULL;
+    hexchat_list *list = NULL;
     const char *name = NULL;
     const char * const *fields;
     const char *field;
@@ -1152,16 +1152,16 @@ static int tcl_getlist(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
     int i;
     time_t t;
     Tcl_DString ds;
-    xchat_context *origctx;
-    xchat_context *ctx = NULL;
+    hexchat_context *origctx;
+    hexchat_context *ctx = NULL;
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     BADARGS(1, 2, " list");
 
     Tcl_DStringInit(&ds);
 
-    fields = xchat_list_fields(ph, "lists");
+    fields = hexchat_list_fields(ph, "lists");
 
     if (argc == 1) {
         for (i = 0; fields[i] != NULL; i++) {
@@ -1180,11 +1180,11 @@ static int tcl_getlist(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
     if (name == NULL)
         goto done;
 
-    list = xchat_list_get(ph, name);
+    list = hexchat_list_get(ph, name);
     if (list == NULL)
         goto done;
 
-    fields = xchat_list_fields(ph, name);
+    fields = hexchat_list_fields(ph, name);
 
     Tcl_DStringStartSublist(&ds);
     for (i = 0; fields[i] != NULL; i++) {
@@ -1193,7 +1193,7 @@ static int tcl_getlist(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
     }
     Tcl_DStringEndSublist(&ds);
 
-    while (xchat_list_next(ph, list)) {
+    while (hexchat_list_next(ph, list)) {
 
         Tcl_DStringStartSublist(&ds);
 
@@ -1203,21 +1203,21 @@ static int tcl_getlist(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
 
             switch (fields[i][0]) {
             case 's':
-                sattr = xchat_list_str(ph, list, (char *) field);
+                sattr = hexchat_list_str(ph, list, (char *) field);
                 Tcl_DStringAppendElement(&ds, sattr);
                 break;
             case 'i':
-                iattr = xchat_list_int(ph, list, (char *) field);
+                iattr = hexchat_list_int(ph, list, (char *) field);
                 Tcl_DStringAppendElement(&ds, myitoa((long)iattr));
                 break;
             case 't':
-                t = xchat_list_time(ph, list, (char *) field);
+                t = hexchat_list_time(ph, list, (char *) field);
                 Tcl_DStringAppendElement(&ds, myitoa((long)t));
                 break;
             case 'p':
-                sattr = xchat_list_str(ph, list, (char *) field);
+                sattr = hexchat_list_str(ph, list, (char *) field);
                 if (strcmp(field, "context") == 0) {
-                    ctx = (xchat_context *) sattr;
+                    ctx = (hexchat_context *) sattr;
                     Tcl_DStringAppendElement(&ds, myitoa((long)ctx));
                 } else
                     Tcl_DStringAppendElement(&ds, "*");
@@ -1232,11 +1232,11 @@ static int tcl_getlist(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
 
     }
 
-    xchat_list_free(ph, list);
+    hexchat_list_free(ph, list);
 
   done:
 
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, origctx);
 
     Tcl_AppendResult(irp, ds.string, NULL);
 
@@ -1305,9 +1305,9 @@ static int tcl_xchat_puts(ClientData cd, Tcl_Interp * irp, int argc, const char
 
     if (trap_stdout) {
         if (newline)
-            xchat_printf(ph, "%s\n", string);
+            hexchat_printf(ph, "%s\n", string);
         else
-            xchat_print(ph, string);
+            hexchat_print(ph, string);
         return TCL_OK;
     }
 
@@ -1340,13 +1340,13 @@ static int tcl_xchat_puts(ClientData cd, Tcl_Interp * irp, int argc, const char
 
 static int tcl_print(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_context *origctx;
-    xchat_context *ctx = NULL;
+    hexchat_context *origctx;
+    hexchat_context *ctx = NULL;
     const char *string = NULL;
 
     BADARGS(2, 4, " ?server|network|context? ?#channel|nick? text");
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     switch (argc) {
     case 2:
@@ -1365,16 +1365,16 @@ static int tcl_print(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
 
     string = argv[argc - 1];
 
-    xchat_set_context(ph, ctx);
-    xchat_print(ph, string);
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, ctx);
+    hexchat_print(ph, string);
+    hexchat_set_context(ph, origctx);
 
     return TCL_OK;
 }
 
 static int tcl_setcontext(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_context *ctx = NULL;
+    hexchat_context *ctx = NULL;
 
     BADARGS(2, 2, " context");
 
@@ -1382,20 +1382,20 @@ static int tcl_setcontext(ClientData cd, Tcl_Interp * irp, int argc, const char
 
     CHECKCTX(ctx);
 
-    xchat_set_context(ph, ctx);
+    hexchat_set_context(ph, ctx);
 
     return TCL_OK;
 }
 
 static int tcl_findcontext(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_context *ctx = NULL;
+    hexchat_context *ctx = NULL;
 
     BADARGS(1, 3, " ?server|network|context? ?channel?");
 
     switch (argc) {
     case 1:
-        ctx = xchat_find_context(ph, NULL, NULL);
+        ctx = hexchat_find_context(ph, NULL, NULL);
         break;
     case 2:
         ctx = xchat_smart_context(argv[1], NULL);
@@ -1415,11 +1415,11 @@ static int tcl_findcontext(ClientData cd, Tcl_Interp * irp, int argc, const char
 
 static int tcl_getcontext(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_context *ctx = NULL;
+    hexchat_context *ctx = NULL;
 
     BADARGS(1, 1, "");
 
-    ctx = xchat_get_context(ph);
+    ctx = hexchat_get_context(ph);
 
     Tcl_AppendResult(irp, myitoa((long)ctx), NULL);
 
@@ -1429,44 +1429,44 @@ static int tcl_getcontext(ClientData cd, Tcl_Interp * irp, int argc, const char
 static int tcl_channels(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
     const char *server, *channel;
-    xchat_list *list;
+    hexchat_list *list;
     Tcl_DString ds;
-    xchat_context *origctx;
-    xchat_context *ctx;
+    hexchat_context *origctx;
+    hexchat_context *ctx;
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     BADARGS(1, 2, " ?server|network|context?");
 
     if (argc == 2) {
         ctx = xchat_smart_context(argv[1], NULL);
         CHECKCTX(ctx);
-        xchat_set_context(ph, ctx);
+        hexchat_set_context(ph, ctx);
     }
 
-    server = (char *) xchat_get_info(ph, "server");
+    server = (char *) hexchat_get_info(ph, "server");
 
     Tcl_DStringInit(&ds);
 
-    list = xchat_list_get(ph, "channels");
+    list = hexchat_list_get(ph, "channels");
 
     if (list != NULL) {
-        while (xchat_list_next(ph, list)) {
-            if (xchat_list_int(ph, list, "type") != 2)
+        while (hexchat_list_next(ph, list)) {
+            if (hexchat_list_int(ph, list, "type") != 2)
                 continue;
-            if (strcasecmp(server, xchat_list_str(ph, list, "server")) != 0)
+            if (strcasecmp(server, hexchat_list_str(ph, list, "server")) != 0)
                 continue;
-            channel = xchat_list_str(ph, list, "channel");
+            channel = hexchat_list_str(ph, list, "channel");
             Tcl_DStringAppendElement(&ds, channel);
         }
-        xchat_list_free(ph, list);
+        hexchat_list_free(ph, list);
     }
 
     Tcl_AppendResult(irp, ds.string, NULL);
 
     Tcl_DStringFree(&ds);
 
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, origctx);
 
     return TCL_OK;
 }
@@ -1474,23 +1474,23 @@ static int tcl_channels(ClientData cd, Tcl_Interp * irp, int argc, const char *a
 static int tcl_servers(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
     const char *server;
-    xchat_list *list;
+    hexchat_list *list;
     Tcl_DString ds;
 
     BADARGS(1, 1, "");
 
     Tcl_DStringInit(&ds);
 
-    list = xchat_list_get(ph, "channels");
+    list = hexchat_list_get(ph, "channels");
 
     if (list != NULL) {
-        while (xchat_list_next(ph, list)) {
-            if (xchat_list_int(ph, list, "type") == 1) {
-                server = xchat_list_str(ph, list, "server");
+        while (hexchat_list_next(ph, list)) {
+            if (hexchat_list_int(ph, list, "type") == 1) {
+                server = hexchat_list_str(ph, list, "server");
                 Tcl_DStringAppendElement(&ds, server);
             }
         }
-        xchat_list_free(ph, list);
+        hexchat_list_free(ph, list);
     }
 
     Tcl_AppendResult(irp, ds.string, NULL);
@@ -1503,57 +1503,57 @@ static int tcl_servers(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
 static int tcl_queries(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
     const char *server, *channel;
-    xchat_list *list;
+    hexchat_list *list;
     Tcl_DString ds;
-    xchat_context *origctx;
-    xchat_context *ctx;
+    hexchat_context *origctx;
+    hexchat_context *ctx;
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     BADARGS(1, 2, " ?server|network|context?");
 
     if (argc == 2) {
         ctx = xchat_smart_context(argv[1], NULL);
         CHECKCTX(ctx);
-        xchat_set_context(ph, ctx);
+        hexchat_set_context(ph, ctx);
     }
 
-    server = (char *) xchat_get_info(ph, "server");
+    server = (char *) hexchat_get_info(ph, "server");
 
     Tcl_DStringInit(&ds);
 
-    list = xchat_list_get(ph, "channels");
+    list = hexchat_list_get(ph, "channels");
 
     if (list != NULL) {
-        while (xchat_list_next(ph, list)) {
-            if (xchat_list_int(ph, list, "type") != 3)
+        while (hexchat_list_next(ph, list)) {
+            if (hexchat_list_int(ph, list, "type") != 3)
                 continue;
-            if (strcasecmp(server, xchat_list_str(ph, list, "server")) != 0)
+            if (strcasecmp(server, hexchat_list_str(ph, list, "server")) != 0)
                 continue;
-            channel = xchat_list_str(ph, list, "channel");
+            channel = hexchat_list_str(ph, list, "channel");
             Tcl_DStringAppendElement(&ds, channel);
         }
-        xchat_list_free(ph, list);
+        hexchat_list_free(ph, list);
     }
 
     Tcl_AppendResult(irp, ds.string, NULL);
 
     Tcl_DStringFree(&ds);
 
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, origctx);
 
     return TCL_OK;
 }
 
 static int tcl_users(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_context *origctx, *ctx = NULL;
-    xchat_list *list;
+    hexchat_context *origctx, *ctx = NULL;
+    hexchat_list *list;
     Tcl_DString ds;
 
     BADARGS(1, 3, " ?server|network|context? ?channel?");
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     switch (argc) {
     case 1:
@@ -1570,11 +1570,11 @@ static int tcl_users(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
 
     CHECKCTX(ctx);
 
-    xchat_set_context(ph, ctx);
+    hexchat_set_context(ph, ctx);
 
     Tcl_DStringInit(&ds);
 
-    list = xchat_list_get(ph, "users");
+    list = hexchat_list_get(ph, "users");
 
     if (list != NULL) {
 
@@ -1587,39 +1587,39 @@ static int tcl_users(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
         Tcl_DStringAppendElement(&ds, "selected");
         Tcl_DStringEndSublist(&ds);
 
-        while (xchat_list_next(ph, list)) {
+        while (hexchat_list_next(ph, list)) {
             Tcl_DStringStartSublist(&ds);
-            Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "nick"));
-            Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "host"));
-            Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "prefix"));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_int(ph, list, "away")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_time(ph, list, "lasttalk")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_int(ph, list, "selected")));
+            Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "nick"));
+            Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "host"));
+            Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "prefix"));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_int(ph, list, "away")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_time(ph, list, "lasttalk")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_int(ph, list, "selected")));
             Tcl_DStringEndSublist(&ds);
         }
 
-        xchat_list_free(ph, list);
+        hexchat_list_free(ph, list);
     }
 
     Tcl_AppendResult(irp, ds.string, NULL);
 
     Tcl_DStringFree(&ds);
 
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, origctx);
 
     return TCL_OK;
 }
 
 static int tcl_notifylist(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_list *list;
+    hexchat_list *list;
     Tcl_DString ds;
 
     BADARGS(1, 1, "");
 
     Tcl_DStringInit(&ds);
 
-    list = xchat_list_get(ph, "notify");
+    list = hexchat_list_get(ph, "notify");
 
     if (list != NULL) {
 
@@ -1632,18 +1632,18 @@ static int tcl_notifylist(ClientData cd, Tcl_Interp * irp, int argc, const char
         Tcl_DStringAppendElement(&ds, "networks");
         Tcl_DStringEndSublist(&ds);
 
-        while (xchat_list_next(ph, list)) {
+        while (hexchat_list_next(ph, list)) {
             Tcl_DStringStartSublist(&ds);
-            Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "nick"));
-            Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "flags"));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_time(ph, list, "on")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_time(ph, list, "off")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_time(ph, list, "seen")));
-            Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "networks"));
+            Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "nick"));
+            Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "flags"));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_time(ph, list, "on")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_time(ph, list, "off")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_time(ph, list, "seen")));
+            Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "networks"));
             Tcl_DStringEndSublist(&ds);
         }
 
-        xchat_list_free(ph, list);
+        hexchat_list_free(ph, list);
 
     }
 
@@ -1656,26 +1656,26 @@ static int tcl_notifylist(ClientData cd, Tcl_Interp * irp, int argc, const char
 
 static int tcl_chats(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_list *list;
+    hexchat_list *list;
     Tcl_DString ds;
 
     BADARGS(1, 1, "");
 
     Tcl_DStringInit(&ds);
 
-    list = xchat_list_get(ph, "dcc");
+    list = hexchat_list_get(ph, "dcc");
 
     if (list != NULL) {
-        while (xchat_list_next(ph, list)) {
-            switch (xchat_list_int(ph, list, "type")) {
+        while (hexchat_list_next(ph, list)) {
+            switch (hexchat_list_int(ph, list, "type")) {
             case 2:
             case 3:
-                if (xchat_list_int(ph, list, "status") == 1)
-                    Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "nick"));
+                if (hexchat_list_int(ph, list, "status") == 1)
+                    Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "nick"));
                 break;
             }
         }
-        xchat_list_free(ph, list);
+        hexchat_list_free(ph, list);
     }
 
     Tcl_AppendResult(irp, ds.string, NULL);
@@ -1687,7 +1687,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[])
 {
-    xchat_list *list;
+    hexchat_list *list;
     Tcl_DString ds;
     int flags;
 
@@ -1695,15 +1695,15 @@ static int tcl_ignores(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
 
     Tcl_DStringInit(&ds);
 
-    list = xchat_list_get(ph, "ignore");
+    list = hexchat_list_get(ph, "ignore");
 
     if (list != NULL) {
 
-        while (xchat_list_next(ph, list)) {
+        while (hexchat_list_next(ph, list)) {
             Tcl_DStringStartSublist(&ds);
-            Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "mask"));
+            Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "mask"));
             Tcl_DStringStartSublist(&ds);
-            flags = xchat_list_int(ph, list, "flags");
+            flags = hexchat_list_int(ph, list, "flags");
             if (flags & 1)
                 Tcl_DStringAppendElement(&ds, "PRIVMSG");
             if (flags & 2)
@@ -1721,7 +1721,7 @@ static int tcl_ignores(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
             Tcl_DStringEndSublist(&ds);
             Tcl_DStringEndSublist(&ds);
         }
-        xchat_list_free(ph, list);
+        hexchat_list_free(ph, list);
     }
 
     Tcl_AppendResult(irp, ds.string, NULL);
@@ -1733,7 +1733,7 @@ static int tcl_ignores(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
 
 static int tcl_dcclist(ClientData cd, Tcl_Interp * irp, int argc, const char *argv[])
 {
-    xchat_list *list;
+    hexchat_list *list;
     Tcl_DString ds;
     int dcctype;
 
@@ -1741,13 +1741,13 @@ static int tcl_dcclist(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
 
     Tcl_DStringInit(&ds);
 
-    list = xchat_list_get(ph, "dcc");
+    list = hexchat_list_get(ph, "dcc");
 
     if (list != NULL) {
 
-        while (xchat_list_next(ph, list)) {
+        while (hexchat_list_next(ph, list)) {
             Tcl_DStringStartSublist(&ds);
-            dcctype = xchat_list_int(ph, list, "type");
+            dcctype = hexchat_list_int(ph, list, "type");
             switch (dcctype) {
             case 0:
                 Tcl_DStringAppendElement(&ds, "filesend");
@@ -1762,7 +1762,7 @@ static int tcl_dcclist(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
                 Tcl_DStringAppendElement(&ds, "chatsend");
                 break;
             }
-            switch (xchat_list_int(ph, list, "status")) {
+            switch (hexchat_list_int(ph, list, "status")) {
             case 0:
                 Tcl_DStringAppendElement(&ds, "queued");
                 break;
@@ -1783,26 +1783,26 @@ static int tcl_dcclist(ClientData cd, Tcl_Interp * irp, int argc, const char *ar
                 break;
             }
 
-            Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "nick"));
+            Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "nick"));
 
             switch (dcctype) {
             case 0:
-                Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "file"));
+                Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "file"));
                 break;
             case 1:
-                Tcl_DStringAppendElement(&ds, (const char *) xchat_list_str(ph, list, "destfile"));
+                Tcl_DStringAppendElement(&ds, (const char *) hexchat_list_str(ph, list, "destfile"));
                 break;
             }
 
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_int(ph, list, "size")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_int(ph, list, "resume")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_int(ph, list, "pos")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_int(ph, list, "cps")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_int(ph, list, "address32")));
-            Tcl_DStringAppendElement(&ds, myitoa((long)xchat_list_int(ph, list, "port")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_int(ph, list, "size")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_int(ph, list, "resume")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_int(ph, list, "pos")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_int(ph, list, "cps")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_int(ph, list, "address32")));
+            Tcl_DStringAppendElement(&ds, myitoa((long)hexchat_list_int(ph, list, "port")));
             Tcl_DStringEndSublist(&ds);
         }
-        xchat_list_free(ph, list);
+        hexchat_list_free(ph, list);
     }
 
     Tcl_AppendResult(irp, ds.string, NULL);
@@ -1825,11 +1825,11 @@ static int tcl_strip(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
             return TCL_ERROR;
     }
 
-    new_text = xchat_strip(ph, argv[1], -1, flags);
+    new_text = hexchat_strip(ph, argv[1], -1, flags);
 
     if(new_text) {
         Tcl_AppendResult(irp, new_text, NULL);
-        xchat_free(ph, new_text);
+        hexchat_free(ph, new_text);
     }
 
     return TCL_OK;
@@ -1837,10 +1837,10 @@ 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[])
 {
-    xchat_context *origctx, *ctx = NULL;
+    hexchat_context *origctx, *ctx = NULL;
     BADARGS(1, 3, " ?server|network|context? ?channel?");
 
-    origctx = xchat_get_context(ph);
+    origctx = hexchat_get_context(ph);
 
     switch (argc) {
     case 1:
@@ -1857,17 +1857,17 @@ static int tcl_topic(ClientData cd, Tcl_Interp * irp, int argc, const char *argv
 
     CHECKCTX(ctx);
 
-    xchat_set_context(ph, ctx);
-    Tcl_AppendResult(irp, xchat_get_info(ph, "topic"), NULL);
-    xchat_set_context(ph, origctx);
+    hexchat_set_context(ph, ctx);
+    Tcl_AppendResult(irp, hexchat_get_info(ph, "topic"), NULL);
+    hexchat_set_context(ph, origctx);
 
     return TCL_OK;
 }
 
-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[])
 {
     BADARGS(3, 3, " string1 string2");
-    Tcl_AppendResult(irp, myitoa((long)xchat_nickcmp(ph, argv[1], argv[2])), NULL);
+    Tcl_AppendResult(irp, myitoa((long)hexchat_nickcmp(ph, argv[1], argv[2])), NULL);
     return TCL_OK;
 }
 
@@ -1909,7 +1909,7 @@ static int Command_Alias(char *word[], char *word_eol[], void *userdata)
 {
     alias *aliasPtr;
     Tcl_HashEntry *entry;
-    xchat_context *origctx;
+    hexchat_context *origctx;
     int dummy;
     char *string;
 
@@ -1928,12 +1928,12 @@ static int Command_Alias(char *word[], char *word_eol[], void *userdata)
 
     if ((entry = Tcl_FindHashEntry(&aliasTablePtr, string)) != NULL) {
         aliasPtr = Tcl_GetHashValue(entry);
-        origctx = xchat_get_context(ph);
+        origctx = hexchat_get_context(ph);
         if (EvalInternalProc(aliasPtr->procPtr, 2, string, word_eol[2]) == TCL_ERROR) {
-            xchat_printf(ph, "\0039Tcl plugin\003\tERROR (alias %s) ", string);
+            hexchat_printf(ph, "\0039Tcl plugin\003\tERROR (alias %s) ", string);
             NiceErrorInfo ();
         }
-        xchat_set_context(ph, origctx);
+        hexchat_set_context(ph, origctx);
     }
 
     Tcl_Free(string);
@@ -1945,7 +1945,7 @@ static int Null_Command_Alias(char *word[], char *word_eol[], void *userdata)
 {
     alias *aliasPtr;
     Tcl_HashEntry *entry;
-    xchat_context *origctx;
+    hexchat_context *origctx;
     int dummy;
     const char *channel;
     char *string;
@@ -1966,7 +1966,7 @@ static int Null_Command_Alias(char *word[], char *word_eol[], void *userdata)
 
     recurse++;
 
-    channel = xchat_get_info(ph, "channel");
+    channel = hexchat_get_info(ph, "channel");
     Tcl_DStringInit(&ds);
     Tcl_DStringAppend(&ds, "@", 1);
     Tcl_DStringAppend(&ds, channel, strlen(channel));
@@ -1977,12 +1977,12 @@ static int Null_Command_Alias(char *word[], char *word_eol[], void *userdata)
 
     if ((entry = Tcl_FindHashEntry(&aliasTablePtr, string)) != NULL) {
         aliasPtr = Tcl_GetHashValue(entry);
-        origctx = xchat_get_context(ph);
+        origctx = hexchat_get_context(ph);
         if (EvalInternalProc(aliasPtr->procPtr, 2, string, word_eol[1]) == TCL_ERROR) {
-            xchat_printf(ph, "\0039Tcl plugin\003\tERROR (alias %s) ", string);
+            hexchat_printf(ph, "\0039Tcl plugin\003\tERROR (alias %s) ", string);
             NiceErrorInfo ();
         }
-        xchat_set_context(ph, origctx);
+        hexchat_set_context(ph, origctx);
     }
 
     Tcl_Free(string);
@@ -2002,9 +2002,9 @@ static int Command_TCL(char *word[], char *word_eol[], void *userdata)
 
     if (Tcl_Eval(interp, word_eol[2]) == TCL_ERROR) {
         errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
-        xchat_printf(ph, "\0039Tcl plugin\003\tERROR: %s ", errorInfo);
+        hexchat_printf(ph, "\0039Tcl plugin\003\tERROR: %s ", errorInfo);
     } else
-        xchat_printf(ph, "\0039Tcl plugin\003\tRESULT: %s ", Tcl_GetStringResult(interp));
+        hexchat_printf(ph, "\0039Tcl plugin\003\tRESULT: %s ", Tcl_GetStringResult(interp));
 
     complete_level--;
 
@@ -2030,7 +2030,7 @@ static int Command_Source(char *word[], char *word_eol[], void *userdata)
 
     if (len > 4 && strcasecmp(".tcl", word[2] + len - 4) == 0) {
 
-        xchatdir = xchat_get_info(ph, "xchatdir");
+        xchatdir = hexchat_get_info(ph, "xchatdir");
 
         Tcl_DStringInit(&ds);
 
@@ -2046,9 +2046,9 @@ static int Command_Source(char *word[], char *word_eol[], void *userdata)
 
         if (Tcl_EvalFile(interp, ds.string) == TCL_ERROR) {
             errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
-            xchat_printf(ph, "\0039Tcl plugin\003\tERROR: %s ", errorInfo);
+            hexchat_printf(ph, "\0039Tcl plugin\003\tERROR: %s ", errorInfo);
         } else
-            xchat_printf(ph, "\0039Tcl plugin\003\tSourced %s\n", ds.string);
+            hexchat_printf(ph, "\0039Tcl plugin\003\tSourced %s\n", ds.string);
 
         Tcl_DStringFree(&ds);
 
@@ -2068,7 +2068,7 @@ static int Command_Reloadall(char *word[], char *word_eol[], void *userdata)
     Tcl_Plugin_DeInit();
     Tcl_Plugin_Init();
 
-    xchat_print(ph, "\0039Tcl plugin\003\tRehashed\n");
+    hexchat_print(ph, "\0039Tcl plugin\003\tRehashed\n");
 
     return HEXCHAT_EAT_ALL;
 }
@@ -2109,7 +2109,7 @@ static void Tcl_Plugin_Init()
     Tcl_CreateCommand(interp, "me", tcl_me, NULL, NULL);
     Tcl_CreateCommand(interp, "on", tcl_on, NULL, NULL);
     Tcl_CreateCommand(interp, "off", tcl_off, NULL, NULL);
-    Tcl_CreateCommand(interp, "nickcmp", tcl_xchat_nickcmp, NULL, NULL);
+    Tcl_CreateCommand(interp, "nickcmp", tcl_hexchat_nickcmp, NULL, NULL);
     Tcl_CreateCommand(interp, "print", tcl_print, NULL, NULL);
     Tcl_CreateCommand(interp, "prefs", tcl_prefs, NULL, NULL);
     Tcl_CreateCommand(interp, "::puts", tcl_xchat_puts, NULL, NULL);
@@ -2136,18 +2136,18 @@ static void Tcl_Plugin_Init()
     for (x = 0; x < XC_SIZE; x++)
         xc[x].hook = NULL;
 
-    xchatdir = xchat_get_info(ph, "xchatdir");
+    xchatdir = hexchat_get_info(ph, "xchatdir");
 
     if (Tcl_Eval(interp, unknown) == TCL_ERROR) {
-        xchat_printf(ph, "Error sourcing internal 'unknown' (%s)\n", Tcl_GetStringResult(interp));
+        hexchat_printf(ph, "Error sourcing internal 'unknown' (%s)\n", Tcl_GetStringResult(interp));
     }
 
     if (Tcl_Eval(interp, inlinetcl) == TCL_ERROR) {
-        xchat_printf(ph, "Error sourcing internal 'inlinetcl' (%s)\n", Tcl_GetStringResult(interp));
+        hexchat_printf(ph, "Error sourcing internal 'inlinetcl' (%s)\n", Tcl_GetStringResult(interp));
     }
 
     if (Tcl_Eval(interp, sourcedirs) == TCL_ERROR) {
-        xchat_printf(ph, "Error sourcing internal 'sourcedirs' (%s)\n", Tcl_GetStringResult(interp));
+        hexchat_printf(ph, "Error sourcing internal 'sourcedirs' (%s)\n", Tcl_GetStringResult(interp));
     }
 
 }
@@ -2176,7 +2176,7 @@ static void Tcl_Plugin_DeInit()
         aliasPtr = Tcl_GetHashValue(entry);
         Tcl_Free(aliasPtr->procPtr);
         if (aliasPtr->hook)
-            xchat_unhook(ph, aliasPtr->hook);
+            hexchat_unhook(ph, aliasPtr->hook);
         Tcl_Free((char *) aliasPtr);
         entry = Tcl_NextHashEntry(&search);
     }
@@ -2195,7 +2195,7 @@ static void Tcl_Plugin_DeInit()
 
     for (x = 0; x < XC_SIZE; x++) {
         if (xc[x].hook != NULL) {
-            xchat_unhook(ph, xc[x].hook);
+            hexchat_unhook(ph, xc[x].hook);
             xc[x].hook = NULL;
         }
     }
@@ -2206,13 +2206,13 @@ static void Tcl_Plugin_DeInit()
 static void banner()
 {
 #if 0
-    xchat_printf(ph, "Tcl plugin for HexChat - Version %s\n", VERSION);
-    xchat_print(ph, "Copyright 2002-2012 Daniel P. Stasinski\n");
-    xchat_print(ph, "http://www.scriptkitties.com/tclplugin/\n");
+    hexchat_printf(ph, "Tcl plugin for HexChat - Version %s\n", VERSION);
+    hexchat_print(ph, "Copyright 2002-2012 Daniel P. Stasinski\n");
+    hexchat_print(ph, "http://www.scriptkitties.com/tclplugin/\n");
 #endif
 }
 
-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)
 {
 #ifdef WIN32
     HINSTANCE lib;
@@ -2225,7 +2225,7 @@ int xchat_plugin_init(xchat_plugin * plugin_handle, char **plugin_name, char **p
 #ifdef WIN32
     lib = LoadLibraryA(TCL_DLL);
     if (!lib) {
-        xchat_print(ph, "You must have ActiveTCL 8.5 installed in order to run Tcl scripts.\n" "http://www.activestate.com/activetcl/downloads\n" "Make sure Tcl's bin directory is in your PATH.\n");
+        hexchat_print(ph, "You must have ActiveTCL 8.5 installed in order to run Tcl scripts.\n" "http://www.activestate.com/activetcl/downloads\n" "Make sure Tcl's bin directory is in your PATH.\n");
         return 0;
     }
     FreeLibrary(lib);
@@ -2233,7 +2233,7 @@ int xchat_plugin_init(xchat_plugin * plugin_handle, char **plugin_name, char **p
 
     if (initialized != 0) {
         banner();
-        xchat_print(ph, "Tcl interface already loaded");
+        hexchat_print(ph, "Tcl interface already loaded");
         reinit_tried++;
         return 0;
     }
@@ -2245,44 +2245,44 @@ int xchat_plugin_init(xchat_plugin * plugin_handle, char **plugin_name, char **p
 
     Tcl_Plugin_Init();
 
-    raw_line_hook = xchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, Server_raw_line, NULL);
-    Command_TCL_hook = xchat_hook_command(ph, "tcl", HEXCHAT_PRI_NORM, Command_TCL, 0, 0);
-    Command_Source_hook = xchat_hook_command(ph, "source", HEXCHAT_PRI_NORM, Command_Source, 0, 0);
-    Command_Reload_hook = xchat_hook_command(ph, "reloadall", HEXCHAT_PRI_NORM, Command_Reloadall, 0, 0);
-    Command_Load_hook = xchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, Command_Source, 0, 0);
-    Event_Handler_hook = xchat_hook_timer(ph, 100, TCL_Event_Handler, 0);
-    Null_Command_hook = xchat_hook_command(ph, "", HEXCHAT_PRI_NORM, Null_Command_Alias, "", 0);
+    raw_line_hook = hexchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, Server_raw_line, NULL);
+    Command_TCL_hook = hexchat_hook_command(ph, "tcl", HEXCHAT_PRI_NORM, Command_TCL, 0, 0);
+    Command_Source_hook = hexchat_hook_command(ph, "source", HEXCHAT_PRI_NORM, Command_Source, 0, 0);
+    Command_Reload_hook = hexchat_hook_command(ph, "reloadall", HEXCHAT_PRI_NORM, Command_Reloadall, 0, 0);
+    Command_Load_hook = hexchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, Command_Source, 0, 0);
+    Event_Handler_hook = hexchat_hook_timer(ph, 100, TCL_Event_Handler, 0);
+    Null_Command_hook = hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, Null_Command_Alias, "", 0);
 
     banner();
-    xchat_print(ph, "Tcl interface loaded\n");
+    hexchat_print(ph, "Tcl interface loaded\n");
 
     return 1;                   /* return 1 for success */
 }
 
-int xchat_plugin_deinit()
+int hexchat_plugin_deinit()
 {
     if (reinit_tried) {
         reinit_tried--;
         return 1;
     }
 
-    xchat_unhook(ph, raw_line_hook);
-    xchat_unhook(ph, Command_TCL_hook);
-    xchat_unhook(ph, Command_Source_hook);
-    xchat_unhook(ph, Command_Reload_hook);
-    xchat_unhook(ph, Command_Load_hook);
-    xchat_unhook(ph, Event_Handler_hook);
-    xchat_unhook(ph, Null_Command_hook);
+    hexchat_unhook(ph, raw_line_hook);
+    hexchat_unhook(ph, Command_TCL_hook);
+    hexchat_unhook(ph, Command_Source_hook);
+    hexchat_unhook(ph, Command_Reload_hook);
+    hexchat_unhook(ph, Command_Load_hook);
+    hexchat_unhook(ph, Event_Handler_hook);
+    hexchat_unhook(ph, Null_Command_hook);
 
     Tcl_Plugin_DeInit();
 
-    xchat_print(ph, "Tcl interface unloaded\n");
+    hexchat_print(ph, "Tcl interface unloaded\n");
     initialized = 0;
 
     return 1;
 }
 
-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)
 {
    strncpy(VERSION, &RCSID[19], 5);
    *name = "tclplugin";
diff --git a/plugins/tcl/tclplugin.h b/plugins/tcl/tclplugin.h
index fb89e1fa..a5425edf 100644
--- a/plugins/tcl/tclplugin.h
+++ b/plugins/tcl/tclplugin.h
@@ -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();
diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c
index e0782ec0..e3d6d714 100644
--- a/plugins/upd/upd.c
+++ b/plugins/upd/upd.c
@@ -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;
 }
diff --git a/plugins/upd/upd.def b/plugins/upd/upd.def
index 77670bf2..e560f50f 100644
--- a/plugins/upd/upd.def
+++ b/plugins/upd/upd.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/winamp/winamp.c b/plugins/winamp/winamp.c
index 1357ac83..2db892a4 100644
--- a/plugins/winamp/winamp.c
+++ b/plugins/winamp/winamp.c
@@ -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;
 }
diff --git a/plugins/winamp/winamp.def b/plugins/winamp/winamp.def
index 77670bf2..e560f50f 100644
--- a/plugins/winamp/winamp.def
+++ b/plugins/winamp/winamp.def
@@ -1,3 +1,3 @@
 EXPORTS 

-xchat_plugin_init 

-xchat_plugin_deinit 

+hexchat_plugin_init 

+hexchat_plugin_deinit 

diff --git a/plugins/wmpa/hexchat-plugin.cpp b/plugins/wmpa/hexchat-plugin.cpp
index 38f6456c..956218d2 100644
--- a/plugins/wmpa/hexchat-plugin.cpp
+++ b/plugins/wmpa/hexchat-plugin.cpp
@@ -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);
-
-   xchat_printf(ph, "WMPA %s successfully loaded.", VER_STRING);
+   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);
+
+   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);
    }
 
diff --git a/plugins/wmpa/hexchat-plugin.h b/plugins/wmpa/hexchat-plugin.h
index 2046a379..934c070e 100644
--- a/plugins/wmpa/hexchat-plugin.h
+++ b/plugins/wmpa/hexchat-plugin.h
@@ -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
diff --git a/plugins/wmpa/wmpa.def b/plugins/wmpa/wmpa.def
index d0a3b042..97f5e475 100644
--- a/plugins/wmpa/wmpa.def
+++ b/plugins/wmpa/wmpa.def
@@ -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

diff --git a/plugins/wmpa/wmpadialog.cpp b/plugins/wmpa/wmpadialog.cpp
index 90bae309..28d33c93 100644
--- a/plugins/wmpa/wmpadialog.cpp
+++ b/plugins/wmpa/wmpadialog.cpp
@@ -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());

       }

    }

 

diff --git a/plugins/xdcc/makefile.mak b/plugins/xdcc/makefile.mak
index 0a12347e..5caeca34 100644
--- a/plugins/xdcc/makefile.mak
+++ b/plugins/xdcc/makefile.mak
@@ -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

diff --git a/plugins/xdcc/xdcc.c b/plugins/xdcc/xdcc.c
index 9ccfebfe..ffe7dfd3 100644
--- a/plugins/xdcc/xdcc.c
+++ b/plugins/xdcc/xdcc.c
@@ -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;
 }