summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/dbus/dbus-plugin.c124
-rw-r--r--src/common/hexchat-plugin.h270
-rw-r--r--src/common/plugin-timer.c36
-rw-r--r--src/common/plugin-timer.h2
-rw-r--r--src/common/plugin.c278
-rw-r--r--src/common/plugin.h102
6 files changed, 406 insertions, 406 deletions
diff --git a/src/common/dbus/dbus-plugin.c b/src/common/dbus/dbus-plugin.c
index c1cca2fc..cba106a9 100644
--- a/src/common/dbus/dbus-plugin.c
+++ b/src/common/dbus/dbus-plugin.c
@@ -34,7 +34,7 @@
 #define DBUS_SERVICE "org.hexchat.service"
 #define DBUS_OBJECT_PATH "/org/hexchat"
 
-static xchat_plugin *ph;
+static hexchat_plugin *ph;
 static guint last_context_id = 0;
 static GList *contexts = NULL;
 static GHashTable *clients = NULL;
@@ -51,7 +51,7 @@ struct RemoteObject
 
 	guint last_hook_id;
 	guint last_list_id;
-	xchat_context *context;
+	hexchat_context *context;
 	char *dbus_path;
 	char *filename;
 	GHashTable *hooks;
@@ -68,14 +68,14 @@ typedef struct
 {
 	guint id;
 	int return_value;
-	xchat_hook *hook;
+	hexchat_hook *hook;
 	RemoteObject *obj;
 } HookInfo;
 
 typedef struct
 {
 	guint id;
-	xchat_context *context;
+	hexchat_context *context;
 } ContextInfo;
 
 enum
@@ -246,8 +246,8 @@ static gboolean		remote_object_send_modes	(RemoteObject *obj,
 /* Useful functions */
 
 static char**		build_list			(char *word[]);
-static guint		context_list_find_id		(xchat_context *context);
-static xchat_context*	context_list_find_context	(guint id);
+static guint		context_list_find_id		(hexchat_context *context);
+static hexchat_context*	context_list_find_context	(guint id);
 
 /* Remote Object */
 
@@ -259,14 +259,14 @@ hook_info_destroy (gpointer data)
 	if (info == NULL) {
 		return;
 	}
-	xchat_unhook (ph, info->hook);
+	hexchat_unhook (ph, info->hook);
 	g_free (info);
 }
 
 static void
 list_info_destroy (gpointer data)
 {
-	xchat_list_free (ph, (xchat_list*)data);
+	hexchat_list_free (ph, (hexchat_list*)data);
 }
 
 static void
@@ -278,7 +278,7 @@ remote_object_finalize (GObject *obj)
 	g_hash_table_destroy (self->hooks);
 	g_free (self->dbus_path);
 	g_free (self->filename);
-	xchat_plugingui_remove (ph, self->handle);
+	hexchat_plugingui_remove (ph, self->handle);
 
 	G_OBJECT_CLASS (remote_object_parent_class)->finalize (obj);
 }
@@ -301,7 +301,7 @@ remote_object_init (RemoteObject *obj)
 	obj->filename = NULL;
 	obj->last_hook_id = 0;
 	obj->last_list_id = 0;
-	obj->context = xchat_get_context (ph);
+	obj->context = hexchat_get_context (ph);
 }
 
 static void
@@ -377,7 +377,7 @@ remote_object_connect (RemoteObject *obj,
 	remote_object = g_object_new (REMOTE_TYPE_OBJECT, NULL);
 	remote_object->dbus_path = path;
 	remote_object->filename = g_path_get_basename (filename);
-	remote_object->handle = xchat_plugingui_add (ph,
+	remote_object->handle = hexchat_plugingui_add (ph,
 						     remote_object->filename,
 						     name,
 						     desc,
@@ -413,8 +413,8 @@ remote_object_command (RemoteObject *obj,
 		       const char *command,
 		       GError **error)
 {
-	if (xchat_set_context (ph, obj->context)) {
-		xchat_command (ph, command);
+	if (hexchat_set_context (ph, obj->context)) {
+		hexchat_command (ph, command);
 	}
 	return TRUE;
 }
@@ -424,8 +424,8 @@ remote_object_print (RemoteObject *obj,
 		     const char *text,
 		     GError **error)
 {
-	if (xchat_set_context (ph, obj->context)) {
-		xchat_print (ph, text);
+	if (hexchat_set_context (ph, obj->context)) {
+		hexchat_print (ph, text);
 	}
 	return TRUE;
 }
@@ -437,7 +437,7 @@ remote_object_find_context (RemoteObject *obj,
 			    guint *ret_id,
 			    GError **error)
 {
-	xchat_context *context;
+	hexchat_context *context;
 
 	if (*server == '\0') {
 		server = NULL;
@@ -445,7 +445,7 @@ remote_object_find_context (RemoteObject *obj,
 	if (*channel == '\0') {
 		channel = NULL;
 	}
-	context = xchat_find_context (ph, server, channel);
+	context = hexchat_find_context (ph, server, channel);
 	*ret_id = context_list_find_id (context);
 
 	return TRUE;
@@ -466,7 +466,7 @@ remote_object_set_context (RemoteObject *obj,
 			   gboolean *ret,
 			   GError **error)
 {
-	xchat_context *context;
+	hexchat_context *context;
 	
 	context = context_list_find_context (id);
 	if (context == NULL) {
@@ -487,12 +487,12 @@ remote_object_get_info (RemoteObject *obj,
 {
 	/* win_ptr is a GtkWindow* casted to char* and will crash
 	 * D-Bus if we send it as a string */
-	if (!xchat_set_context (ph, obj->context) ||
+	if (!hexchat_set_context (ph, obj->context) ||
 	    g_str_equal (id, "win_ptr")) {
 		*ret_info = NULL;
 		return TRUE;
 	}
-	*ret_info = g_strdup (xchat_get_info (ph, id));
+	*ret_info = g_strdup (hexchat_get_info (ph, id));
 	return TRUE;
 }
 
@@ -506,7 +506,7 @@ remote_object_get_prefs (RemoteObject *obj,
 {
 	const char *str;
 
-	if (!xchat_set_context (ph, obj->context)) {
+	if (!hexchat_set_context (ph, obj->context)) {
 		*ret_type = 0;
 		return TRUE;
 	}
@@ -527,7 +527,7 @@ server_hook_cb (char *word[],
 
 	arg1 = build_list (word + 1);
 	arg2 = build_list (word_eol + 1);
-	info->obj->context = xchat_get_context (ph);
+	info->obj->context = hexchat_get_context (ph);
 	g_signal_emit (info->obj,
 		       signals[SERVER_SIGNAL],
 		       0,
@@ -550,7 +550,7 @@ command_hook_cb (char *word[],
 
 	arg1 = build_list (word + 1);
 	arg2 = build_list (word_eol + 1);
-	info->obj->context = xchat_get_context (ph);
+	info->obj->context = hexchat_get_context (ph);
 	g_signal_emit (info->obj,
 		       signals[COMMAND_SIGNAL],
 		       0,
@@ -570,7 +570,7 @@ print_hook_cb (char *word[],
 	char **arg1;
 
 	arg1 = build_list (word + 1);
-	info->obj->context = xchat_get_context (ph);
+	info->obj->context = hexchat_get_context (ph);
 	g_signal_emit (info->obj,
 		       signals[PRINT_SIGNAL],
 		       0,
@@ -596,7 +596,7 @@ remote_object_hook_command (RemoteObject *obj,
 	info->obj = obj;
 	info->return_value = return_value;
 	info->id = ++obj->last_hook_id;
-	info->hook = xchat_hook_command (ph,
+	info->hook = hexchat_hook_command (ph,
 					 name,
 					 priority,
 					 command_hook_cb,
@@ -622,7 +622,7 @@ remote_object_hook_server (RemoteObject *obj,
 	info->obj = obj;
 	info->return_value = return_value;
 	info->id = ++obj->last_hook_id;
-	info->hook = xchat_hook_server (ph,
+	info->hook = hexchat_hook_server (ph,
 					name,
 					priority,
 					server_hook_cb,
@@ -647,7 +647,7 @@ remote_object_hook_print (RemoteObject *obj,
 	info->obj = obj;
 	info->return_value = return_value;
 	info->id = ++obj->last_hook_id;
-	info->hook = xchat_hook_print (ph,
+	info->hook = hexchat_hook_print (ph,
 				       name,
 				       priority,
 				       print_hook_cb,
@@ -673,14 +673,14 @@ remote_object_list_get (RemoteObject *obj,
 			guint *ret_id,
 			GError **error)
 {
-	xchat_list *xlist;
+	hexchat_list *xlist;
 	guint *id;
 
-	if (!xchat_set_context (ph, obj->context)) {
+	if (!hexchat_set_context (ph, obj->context)) {
 		*ret_id = 0;
 		return TRUE;
 	}
-	xlist = xchat_list_get (ph, name);
+	xlist = hexchat_list_get (ph, name);
 	if (xlist == NULL) {
 		*ret_id = 0;
 		return TRUE;
@@ -701,14 +701,14 @@ remote_object_list_next	(RemoteObject *obj,
 			 gboolean *ret,
 			 GError **error)
 {
-	xchat_list *xlist;
+	hexchat_list *xlist;
 	
 	xlist = g_hash_table_lookup (obj->lists, &id);
 	if (xlist == NULL) {
 		*ret = FALSE;
 		return TRUE;
 	}
-	*ret = xchat_list_next (ph, xlist);
+	*ret = hexchat_list_next (ph, xlist);
 
 	return TRUE;
 }			 
@@ -720,10 +720,10 @@ remote_object_list_str (RemoteObject *obj,
 			char **ret_str,
 			GError **error)
 {
-	xchat_list *xlist;
+	hexchat_list *xlist;
 	
 	xlist = g_hash_table_lookup (obj->lists, &id);
-	if (xlist == NULL && !xchat_set_context (ph, obj->context)) {
+	if (xlist == NULL && !hexchat_set_context (ph, obj->context)) {
 		*ret_str = NULL;
 		return TRUE;
 	}
@@ -731,7 +731,7 @@ remote_object_list_str (RemoteObject *obj,
 		*ret_str = NULL;
 		return TRUE;
 	}
-	*ret_str = g_strdup (xchat_list_str (ph, xlist, name));
+	*ret_str = g_strdup (hexchat_list_str (ph, xlist, name));
 
 	return TRUE;
 }
@@ -743,19 +743,19 @@ remote_object_list_int (RemoteObject *obj,
 			int *ret_int,
 			GError **error)
 {
-	xchat_list *xlist;
+	hexchat_list *xlist;
 	
 	xlist = g_hash_table_lookup (obj->lists, &id);
-	if (xlist == NULL && !xchat_set_context (ph, obj->context)) {
+	if (xlist == NULL && !hexchat_set_context (ph, obj->context)) {
 		*ret_int = -1;
 		return TRUE;
 	}
 	if (g_str_equal (name, "context")) {
-		xchat_context *context;
-		context = (xchat_context*)xchat_list_str (ph, xlist, name);
+		hexchat_context *context;
+		context = (hexchat_context*)hexchat_list_str (ph, xlist, name);
 		*ret_int = context_list_find_id (context);
 	} else {
-		*ret_int = xchat_list_int (ph, xlist, name);
+		*ret_int = hexchat_list_int (ph, xlist, name);
 	}
 
 	return TRUE;
@@ -768,14 +768,14 @@ remote_object_list_time (RemoteObject *obj,
 			 guint64 *ret_time,
 			 GError **error)
 {
-	xchat_list *xlist;
+	hexchat_list *xlist;
 	
 	xlist = g_hash_table_lookup (obj->lists, &id);
 	if (xlist == NULL) {
 		*ret_time = (guint64) -1;
 		return TRUE;
 	}
-	*ret_time = xchat_list_time (ph, xlist, name);
+	*ret_time = hexchat_list_time (ph, xlist, name);
 	
 	return TRUE;
 }
@@ -786,7 +786,7 @@ remote_object_list_fields (RemoteObject *obj,
 			   char ***ret,
 			   GError **error)
 {
-	*ret = g_strdupv ((char**)xchat_list_fields (ph, name));
+	*ret = g_strdupv ((char**)hexchat_list_fields (ph, name));
 	if (*ret == NULL) {
 		*ret = g_new0 (char*, 1);
 	}
@@ -816,9 +816,9 @@ remote_object_emit_print (RemoteObject *obj,
 		argv[i] = args[i];
 	}
 
-	*ret = xchat_set_context (ph, obj->context);
+	*ret = hexchat_set_context (ph, obj->context);
 	if (*ret) {
-		*ret = xchat_emit_print (ph, event_name, argv[0], argv[1],
+		*ret = hexchat_emit_print (ph, event_name, argv[0], argv[1],
 							 argv[2], argv[3]);
 	}
 
@@ -832,8 +832,8 @@ remote_object_nickcmp (RemoteObject *obj,
 		       int *ret,
 		       GError **error)
 {
-	xchat_set_context (ph, obj->context);
-	*ret = xchat_nickcmp (ph, nick1, nick2);
+	hexchat_set_context (ph, obj->context);
+	*ret = hexchat_nickcmp (ph, nick1, nick2);
 	return TRUE;
 }
 
@@ -845,7 +845,7 @@ remote_object_strip (RemoteObject *obj,
 		     char **ret_str,
 		     GError **error)
 {
-	*ret_str = xchat_strip (ph, str, len, flag);
+	*ret_str = hexchat_strip (ph, str, len, flag);
 	return TRUE;
 }
 
@@ -857,8 +857,8 @@ remote_object_send_modes (RemoteObject *obj,
 			  char mode,
 			  GError **error)
 {
-	if (xchat_set_context (ph, obj->context)) {
-		xchat_send_modes (ph, targets,
+	if (hexchat_set_context (ph, obj->context)) {
+		hexchat_send_modes (ph, targets,
 				  g_strv_length ((char**)targets),
 				  modes_per_line,
 				  sign, mode);
@@ -894,7 +894,7 @@ init_dbus (void)
 
 	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
 	if (connection == NULL) {
-		xchat_printf (ph, _("Couldn't connect to session bus: %s\n"),
+		hexchat_printf (ph, _("Couldn't connect to session bus: %s\n"),
 			      error->message);
 		g_error_free (error);
 		return FALSE;
@@ -911,7 +911,7 @@ init_dbus (void)
 				G_TYPE_INVALID,
 				G_TYPE_UINT, &request_name_result,
 				G_TYPE_INVALID)) {
-		xchat_printf (ph, _("Failed to acquire %s: %s\n"),
+		hexchat_printf (ph, _("Failed to acquire %s: %s\n"),
 			      DBUS_SERVICE,
 			      error->message);
 		g_error_free (error);
@@ -936,7 +936,7 @@ init_dbus (void)
 	return TRUE;
 }
 
-/* xchat_plugin stuffs */
+/* hexchat_plugin stuffs */
 
 static char**
 build_list (char *word[])
@@ -962,7 +962,7 @@ build_list (char *word[])
 }
 
 static guint
-context_list_find_id (xchat_context *context)
+context_list_find_id (hexchat_context *context)
 {
 	GList *l = NULL;
 
@@ -975,7 +975,7 @@ context_list_find_id (xchat_context *context)
 	return 0;
 }
 
-static xchat_context*
+static hexchat_context*
 context_list_find_context (guint id)
 {
 	GList *l = NULL;
@@ -997,7 +997,7 @@ open_context_cb (char *word[],
 	
 	info = g_new0 (ContextInfo, 1);
 	info->id = ++last_context_id;
-	info->context = xchat_get_context (ph);
+	info->context = hexchat_get_context (ph);
 	contexts = g_list_prepend (contexts, info);
 
 	return HEXCHAT_EAT_NONE;
@@ -1008,7 +1008,7 @@ close_context_cb (char *word[],
 		  void *userdata)
 {
 	GList *l;
-	xchat_context *context = xchat_get_context (ph);
+	hexchat_context *context = hexchat_get_context (ph);
 
 	for (l = contexts; l != NULL; l = l->next) {
 		if (((ContextInfo*)l->data)->context == context) {
@@ -1049,7 +1049,7 @@ unload_plugin_cb (char *word[], char *word_eol[], void *userdata)
 }
 
 int
-dbus_plugin_init (xchat_plugin *plugin_handle,
+dbus_plugin_init (hexchat_plugin *plugin_handle,
 		  char **plugin_name,
 		  char **plugin_desc,
 		  char **plugin_version,
@@ -1061,24 +1061,24 @@ dbus_plugin_init (xchat_plugin *plugin_handle,
 	*plugin_version = PVERSION;
 
 	if (init_dbus()) {
-		/*xchat_printf (ph, _("%s loaded successfully!\n"), PNAME);*/
+		/*hexchat_printf (ph, _("%s loaded successfully!\n"), PNAME);*/
 
 		clients = g_hash_table_new_full (g_str_hash,
 						 g_str_equal,
 						 g_free,
 						 g_object_unref);
 
-		xchat_hook_print (ph, "Open Context",
+		hexchat_hook_print (ph, "Open Context",
 				  HEXCHAT_PRI_NORM,
 				  open_context_cb,
 				  NULL);
 
-		xchat_hook_print (ph, "Close Context",
+		hexchat_hook_print (ph, "Close Context",
 				  HEXCHAT_PRI_NORM,
 				  close_context_cb,
 				  NULL);
 
-		xchat_hook_command (ph, "unload",
+		hexchat_hook_command (ph, "unload",
 				    HEXCHAT_PRI_HIGHEST,
 				    unload_plugin_cb, NULL, NULL);
 	}
diff --git a/src/common/hexchat-plugin.h b/src/common/hexchat-plugin.h
index b1dc64b8..f0b76ad6 100644
--- a/src/common/hexchat-plugin.h
+++ b/src/common/hexchat-plugin.h
@@ -24,246 +24,246 @@
 extern "C" {
 #endif
 
-typedef struct _xchat_plugin xchat_plugin;
-typedef struct _xchat_list xchat_list;
-typedef struct _xchat_hook xchat_hook;
+typedef struct _hexchat_plugin hexchat_plugin;
+typedef struct _hexchat_list hexchat_list;
+typedef struct _hexchat_hook hexchat_hook;
 #ifndef PLUGIN_C
-typedef struct _xchat_context xchat_context;
+typedef struct _hexchat_context hexchat_context;
 #endif
 
 #ifndef PLUGIN_C
-struct _xchat_plugin
+struct _hexchat_plugin
 {
 	/* these are only used on win32 */
-	xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_command) (hexchat_plugin *ph,
 		    const char *name,
 		    int pri,
 		    int (*callback) (char *word[], char *word_eol[], void *user_data),
 		    const char *help_text,
 		    void *userdata);
-	xchat_hook *(*xchat_hook_server) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_server) (hexchat_plugin *ph,
 		   const char *name,
 		   int pri,
 		   int (*callback) (char *word[], char *word_eol[], void *user_data),
 		   void *userdata);
-	xchat_hook *(*xchat_hook_print) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_print) (hexchat_plugin *ph,
 		  const char *name,
 		  int pri,
 		  int (*callback) (char *word[], void *user_data),
 		  void *userdata);
-	xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_timer) (hexchat_plugin *ph,
 		  int timeout,
 		  int (*callback) (void *user_data),
 		  void *userdata);
-	xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_fd) (hexchat_plugin *ph,
 		   int fd,
 		   int flags,
 		   int (*callback) (int fd, int flags, void *user_data),
 		   void *userdata);
-	void *(*xchat_unhook) (xchat_plugin *ph,
-	      xchat_hook *hook);
-	void (*xchat_print) (xchat_plugin *ph,
+	void *(*hexchat_unhook) (hexchat_plugin *ph,
+	      hexchat_hook *hook);
+	void (*hexchat_print) (hexchat_plugin *ph,
 	     const char *text);
-	void (*xchat_printf) (xchat_plugin *ph,
+	void (*hexchat_printf) (hexchat_plugin *ph,
 	      const char *format, ...);
-	void (*xchat_command) (xchat_plugin *ph,
+	void (*hexchat_command) (hexchat_plugin *ph,
 	       const char *command);
-	void (*xchat_commandf) (xchat_plugin *ph,
+	void (*hexchat_commandf) (hexchat_plugin *ph,
 		const char *format, ...);
-	int (*xchat_nickcmp) (xchat_plugin *ph,
+	int (*hexchat_nickcmp) (hexchat_plugin *ph,
 	       const char *s1,
 	       const char *s2);
-	int (*xchat_set_context) (xchat_plugin *ph,
-		   xchat_context *ctx);
-	xchat_context *(*xchat_find_context) (xchat_plugin *ph,
+	int (*hexchat_set_context) (hexchat_plugin *ph,
+		   hexchat_context *ctx);
+	hexchat_context *(*hexchat_find_context) (hexchat_plugin *ph,
 		    const char *servname,
 		    const char *channel);
-	xchat_context *(*xchat_get_context) (xchat_plugin *ph);
-	const char *(*xchat_get_info) (xchat_plugin *ph,
+	hexchat_context *(*hexchat_get_context) (hexchat_plugin *ph);
+	const char *(*hexchat_get_info) (hexchat_plugin *ph,
 		const char *id);
-	int (*xchat_get_prefs) (xchat_plugin *ph,
+	int (*xchat_get_prefs) (hexchat_plugin *ph,
 		 const char *name,
 		 const char **string,
 		 int *integer);
-	xchat_list * (*xchat_list_get) (xchat_plugin *ph,
+	hexchat_list * (*hexchat_list_get) (hexchat_plugin *ph,
 		const char *name);
-	void (*xchat_list_free) (xchat_plugin *ph,
-		 xchat_list *xlist);
-	const char * const * (*xchat_list_fields) (xchat_plugin *ph,
+	void (*hexchat_list_free) (hexchat_plugin *ph,
+		 hexchat_list *xlist);
+	const char * const * (*hexchat_list_fields) (hexchat_plugin *ph,
 		   const char *name);
-	int (*xchat_list_next) (xchat_plugin *ph,
-		 xchat_list *xlist);
-	const char * (*xchat_list_str) (xchat_plugin *ph,
-		xchat_list *xlist,
+	int (*hexchat_list_next) (hexchat_plugin *ph,
+		 hexchat_list *xlist);
+	const char * (*hexchat_list_str) (hexchat_plugin *ph,
+		hexchat_list *xlist,
 		const char *name);
-	int (*xchat_list_int) (xchat_plugin *ph,
-		xchat_list *xlist,
+	int (*hexchat_list_int) (hexchat_plugin *ph,
+		hexchat_list *xlist,
 		const char *name);
-	void * (*xchat_plugingui_add) (xchat_plugin *ph,
+	void * (*hexchat_plugingui_add) (hexchat_plugin *ph,
 		     const char *filename,
 		     const char *name,
 		     const char *desc,
 		     const char *version,
 		     char *reserved);
-	void (*xchat_plugingui_remove) (xchat_plugin *ph,
+	void (*hexchat_plugingui_remove) (hexchat_plugin *ph,
 			void *handle);
-	int (*xchat_emit_print) (xchat_plugin *ph,
+	int (*hexchat_emit_print) (hexchat_plugin *ph,
 			const char *event_name, ...);
-	int (*xchat_read_fd) (xchat_plugin *ph,
+	int (*xchat_read_fd) (hexchat_plugin *ph,
 			void *src,
 			char *buf,
 			int *len);
-	time_t (*xchat_list_time) (xchat_plugin *ph,
-		xchat_list *xlist,
+	time_t (*hexchat_list_time) (hexchat_plugin *ph,
+		hexchat_list *xlist,
 		const char *name);
-	char *(*xchat_gettext) (xchat_plugin *ph,
+	char *(*hexchat_gettext) (hexchat_plugin *ph,
 		const char *msgid);
-	void (*xchat_send_modes) (xchat_plugin *ph,
+	void (*hexchat_send_modes) (hexchat_plugin *ph,
 		  const char **targets,
 		  int ntargets,
 		  int modes_per_line,
 		  char sign,
 		  char mode);
-	char *(*xchat_strip) (xchat_plugin *ph,
+	char *(*hexchat_strip) (hexchat_plugin *ph,
 	     const char *str,
 	     int len,
 	     int flags);
-	void (*xchat_free) (xchat_plugin *ph,
+	void (*hexchat_free) (hexchat_plugin *ph,
 	    void *ptr);
-	int (*xchat_pluginpref_set_str) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_set_str) (hexchat_plugin *ph,
 		const char *var,
 		const char *value);
-	int (*xchat_pluginpref_get_str) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_get_str) (hexchat_plugin *ph,
 		const char *var,
 		char *dest);
-	int (*xchat_pluginpref_set_int) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_set_int) (hexchat_plugin *ph,
 		const char *var,
 		int value);
-	int (*xchat_pluginpref_get_int) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_get_int) (hexchat_plugin *ph,
 		const char *var);
-	int (*xchat_pluginpref_delete) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_delete) (hexchat_plugin *ph,
 		const char *var);
-	int (*xchat_pluginpref_list) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_list) (hexchat_plugin *ph,
 		char *dest);
 };
 #endif
 
 
-xchat_hook *
-xchat_hook_command (xchat_plugin *ph,
+hexchat_hook *
+hexchat_hook_command (hexchat_plugin *ph,
 		    const char *name,
 		    int pri,
 		    int (*callback) (char *word[], char *word_eol[], void *user_data),
 		    const char *help_text,
 		    void *userdata);
 
-xchat_hook *
-xchat_hook_server (xchat_plugin *ph,
+hexchat_hook *
+hexchat_hook_server (hexchat_plugin *ph,
 		   const char *name,
 		   int pri,
 		   int (*callback) (char *word[], char *word_eol[], void *user_data),
 		   void *userdata);
 
-xchat_hook *
-xchat_hook_print (xchat_plugin *ph,
+hexchat_hook *
+hexchat_hook_print (hexchat_plugin *ph,
 		  const char *name,
 		  int pri,
 		  int (*callback) (char *word[], void *user_data),
 		  void *userdata);
 
-xchat_hook *
-xchat_hook_timer (xchat_plugin *ph,
+hexchat_hook *
+hexchat_hook_timer (hexchat_plugin *ph,
 		  int timeout,
 		  int (*callback) (void *user_data),
 		  void *userdata);
 
-xchat_hook *
-xchat_hook_fd (xchat_plugin *ph,
+hexchat_hook *
+hexchat_hook_fd (hexchat_plugin *ph,
 		int fd,
 		int flags,
 		int (*callback) (int fd, int flags, void *user_data),
 		void *userdata);
 
 void *
-xchat_unhook (xchat_plugin *ph,
-	      xchat_hook *hook);
+hexchat_unhook (hexchat_plugin *ph,
+	      hexchat_hook *hook);
 
 void
-xchat_print (xchat_plugin *ph,
+hexchat_print (hexchat_plugin *ph,
 	     const char *text);
 
 void
-xchat_printf (xchat_plugin *ph,
+hexchat_printf (hexchat_plugin *ph,
 	      const char *format, ...);
 
 void
-xchat_command (xchat_plugin *ph,
+hexchat_command (hexchat_plugin *ph,
 	       const char *command);
 
 void
-xchat_commandf (xchat_plugin *ph,
+hexchat_commandf (hexchat_plugin *ph,
 		const char *format, ...);
 
 int
-xchat_nickcmp (xchat_plugin *ph,
+hexchat_nickcmp (hexchat_plugin *ph,
 	       const char *s1,
 	       const char *s2);
 
 int
-xchat_set_context (xchat_plugin *ph,
-		   xchat_context *ctx);
+hexchat_set_context (hexchat_plugin *ph,
+		   hexchat_context *ctx);
 
-xchat_context *
-xchat_find_context (xchat_plugin *ph,
+hexchat_context *
+hexchat_find_context (hexchat_plugin *ph,
 		    const char *servname,
 		    const char *channel);
 
-xchat_context *
-xchat_get_context (xchat_plugin *ph);
+hexchat_context *
+hexchat_get_context (hexchat_plugin *ph);
 
 const char *
-xchat_get_info (xchat_plugin *ph,
+hexchat_get_info (hexchat_plugin *ph,
 		const char *id);
 
 int
-xchat_get_prefs (xchat_plugin *ph,
+xchat_get_prefs (hexchat_plugin *ph,
 		 const char *name,
 		 const char **string,
 		 int *integer);
 
-xchat_list *
-xchat_list_get (xchat_plugin *ph,
+hexchat_list *
+hexchat_list_get (hexchat_plugin *ph,
 		const char *name);
 
 void
-xchat_list_free (xchat_plugin *ph,
-		 xchat_list *xlist);
+hexchat_list_free (hexchat_plugin *ph,
+		 hexchat_list *xlist);
 
 const char * const *
-xchat_list_fields (xchat_plugin *ph,
+hexchat_list_fields (hexchat_plugin *ph,
 		   const char *name);
 
 int
-xchat_list_next (xchat_plugin *ph,
-		 xchat_list *xlist);
+hexchat_list_next (hexchat_plugin *ph,
+		 hexchat_list *xlist);
 
 const char *
-xchat_list_str (xchat_plugin *ph,
-		xchat_list *xlist,
+hexchat_list_str (hexchat_plugin *ph,
+		hexchat_list *xlist,
 		const char *name);
 
 int
-xchat_list_int (xchat_plugin *ph,
-		xchat_list *xlist,
+hexchat_list_int (hexchat_plugin *ph,
+		hexchat_list *xlist,
 		const char *name);
 
 time_t
-xchat_list_time (xchat_plugin *ph,
-		 xchat_list *xlist,
+hexchat_list_time (hexchat_plugin *ph,
+		 hexchat_list *xlist,
 		 const char *name);
 
 void *
-xchat_plugingui_add (xchat_plugin *ph,
+hexchat_plugingui_add (hexchat_plugin *ph,
 		     const char *filename,
 		     const char *name,
 		     const char *desc,
@@ -271,19 +271,19 @@ xchat_plugingui_add (xchat_plugin *ph,
 		     char *reserved);
 
 void
-xchat_plugingui_remove (xchat_plugin *ph,
+hexchat_plugingui_remove (hexchat_plugin *ph,
 			void *handle);
 
 int 
-xchat_emit_print (xchat_plugin *ph,
+hexchat_emit_print (hexchat_plugin *ph,
 		  const char *event_name, ...);
 
 char *
-xchat_gettext (xchat_plugin *ph,
+hexchat_gettext (hexchat_plugin *ph,
 	       const char *msgid);
 
 void
-xchat_send_modes (xchat_plugin *ph,
+hexchat_send_modes (hexchat_plugin *ph,
 		  const char **targets,
 		  int ntargets,
 		  int modes_per_line,
@@ -291,81 +291,81 @@ xchat_send_modes (xchat_plugin *ph,
 		  char mode);
 
 char *
-xchat_strip (xchat_plugin *ph,
+hexchat_strip (hexchat_plugin *ph,
 	     const char *str,
 	     int len,
 	     int flags);
 
 void
-xchat_free (xchat_plugin *ph,
+hexchat_free (hexchat_plugin *ph,
 	    void *ptr);
 
 int
-xchat_pluginpref_set_str (xchat_plugin *ph,
+hexchat_pluginpref_set_str (hexchat_plugin *ph,
 		const char *var,
 		const char *value);
 
 int
-xchat_pluginpref_get_str (xchat_plugin *ph,
+hexchat_pluginpref_get_str (hexchat_plugin *ph,
 		const char *var,
 		char *dest);
 
 int
-xchat_pluginpref_set_int (xchat_plugin *ph,
+hexchat_pluginpref_set_int (hexchat_plugin *ph,
 		const char *var,
 		int value);
 int
-xchat_pluginpref_get_int (xchat_plugin *ph,
+hexchat_pluginpref_get_int (hexchat_plugin *ph,
 		const char *var);
 
 int
-xchat_pluginpref_delete (xchat_plugin *ph,
+hexchat_pluginpref_delete (hexchat_plugin *ph,
 		const char *var);
 
 int
-xchat_pluginpref_list (xchat_plugin *ph,
+hexchat_pluginpref_list (hexchat_plugin *ph,
 		char *dest);
 
 #if !defined(PLUGIN_C) && defined(WIN32)
 #ifndef HEXCHAT_PLUGIN_HANDLE
 #define HEXCHAT_PLUGIN_HANDLE (ph)
 #endif
-#define xchat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_command)
-#define xchat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_server)
-#define xchat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_print)
-#define xchat_hook_timer ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_timer)
-#define xchat_hook_fd ((HEXCHAT_PLUGIN_HANDLE)->xchat_hook_fd)
-#define xchat_unhook ((HEXCHAT_PLUGIN_HANDLE)->xchat_unhook)
-#define xchat_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_print)
-#define xchat_printf ((HEXCHAT_PLUGIN_HANDLE)->xchat_printf)
-#define xchat_command ((HEXCHAT_PLUGIN_HANDLE)->xchat_command)
-#define xchat_commandf ((HEXCHAT_PLUGIN_HANDLE)->xchat_commandf)
-#define xchat_nickcmp ((HEXCHAT_PLUGIN_HANDLE)->xchat_nickcmp)
-#define xchat_set_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_set_context)
-#define xchat_find_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_find_context)
-#define xchat_get_context ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_context)
-#define xchat_get_info ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_info)
+#define hexchat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_command)
+#define hexchat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_server)
+#define hexchat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_print)
+#define hexchat_hook_timer ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_timer)
+#define hexchat_hook_fd ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_fd)
+#define hexchat_unhook ((HEXCHAT_PLUGIN_HANDLE)->hexchat_unhook)
+#define hexchat_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_print)
+#define hexchat_printf ((HEXCHAT_PLUGIN_HANDLE)->hexchat_printf)
+#define hexchat_command ((HEXCHAT_PLUGIN_HANDLE)->hexchat_command)
+#define hexchat_commandf ((HEXCHAT_PLUGIN_HANDLE)->hexchat_commandf)
+#define hexchat_nickcmp ((HEXCHAT_PLUGIN_HANDLE)->hexchat_nickcmp)
+#define hexchat_set_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_set_context)
+#define hexchat_find_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_find_context)
+#define hexchat_get_context ((HEXCHAT_PLUGIN_HANDLE)->hexchat_get_context)
+#define hexchat_get_info ((HEXCHAT_PLUGIN_HANDLE)->hexchat_get_info)
 #define xchat_get_prefs ((HEXCHAT_PLUGIN_HANDLE)->xchat_get_prefs)
-#define xchat_list_get ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_get)
-#define xchat_list_free ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_free)
-#define xchat_list_fields ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_fields)
-#define xchat_list_next ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_next)
-#define xchat_list_str ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_str)
-#define xchat_list_int ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_int)
-#define xchat_plugingui_add ((HEXCHAT_PLUGIN_HANDLE)->xchat_plugingui_add)
-#define xchat_plugingui_remove ((HEXCHAT_PLUGIN_HANDLE)->xchat_plugingui_remove)
-#define xchat_emit_print ((HEXCHAT_PLUGIN_HANDLE)->xchat_emit_print)
-#define xchat_list_time ((HEXCHAT_PLUGIN_HANDLE)->xchat_list_time)
-#define xchat_gettext ((HEXCHAT_PLUGIN_HANDLE)->xchat_gettext)
-#define xchat_send_modes ((HEXCHAT_PLUGIN_HANDLE)->xchat_send_modes)
-#define xchat_strip ((HEXCHAT_PLUGIN_HANDLE)->xchat_strip)
-#define xchat_free ((HEXCHAT_PLUGIN_HANDLE)->xchat_free)
-#define xchat_pluginpref_set_str ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_set_str)
-#define xchat_pluginpref_get_str ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_get_str)
-#define xchat_pluginpref_set_int ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_set_int)
-#define xchat_pluginpref_get_int ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_get_int)
-#define xchat_pluginpref_delete ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_delete)
-#define xchat_pluginpref_list ((HEXCHAT_PLUGIN_HANDLE)->xchat_pluginpref_list)
+#define hexchat_list_get ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_get)
+#define hexchat_list_free ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_free)
+#define hexchat_list_fields ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_fields)
+#define hexchat_list_next ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_next)
+#define hexchat_list_str ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_str)
+#define hexchat_list_int ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_int)
+#define hexchat_plugingui_add ((HEXCHAT_PLUGIN_HANDLE)->hexchat_plugingui_add)
+#define hexchat_plugingui_remove ((HEXCHAT_PLUGIN_HANDLE)->hexchat_plugingui_remove)
+#define hexchat_emit_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_emit_print)
+#define hexchat_list_time ((HEXCHAT_PLUGIN_HANDLE)->hexchat_list_time)
+#define hexchat_gettext ((HEXCHAT_PLUGIN_HANDLE)->hexchat_gettext)
+#define hexchat_send_modes ((HEXCHAT_PLUGIN_HANDLE)->hexchat_send_modes)
+#define hexchat_strip ((HEXCHAT_PLUGIN_HANDLE)->hexchat_strip)
+#define hexchat_free ((HEXCHAT_PLUGIN_HANDLE)->hexchat_free)
+#define hexchat_pluginpref_set_str ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_set_str)
+#define hexchat_pluginpref_get_str ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_get_str)
+#define hexchat_pluginpref_set_int ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_set_int)
+#define hexchat_pluginpref_get_int ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_get_int)
+#define hexchat_pluginpref_delete ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_delete)
+#define hexchat_pluginpref_list ((HEXCHAT_PLUGIN_HANDLE)->hexchat_pluginpref_list)
 #endif
 
 #ifdef __cplusplus
diff --git a/src/common/plugin-timer.c b/src/common/plugin-timer.c
index b294c005..5540b364 100644
--- a/src/common/plugin-timer.c
+++ b/src/common/plugin-timer.c
@@ -7,7 +7,7 @@
 #define g_ascii_strcasecmp stricmp
 #endif
 
-static xchat_plugin *ph;	/* plugin handle */
+static hexchat_plugin *ph;	/* plugin handle */
 static GSList *timer_list = NULL;
 
 #define STATIC
@@ -17,8 +17,8 @@ static GSList *timer_list = NULL;
 
 typedef struct
 {
-	xchat_hook *hook;
-	xchat_context *context;
+	hexchat_hook *hook;
+	hexchat_context *context;
 	char *command;
 	int ref;
 	int repeat;
@@ -31,7 +31,7 @@ timer_del (timer *tim)
 {
 	timer_list = g_slist_remove (timer_list, tim);
 	free (tim->command);
-	xchat_unhook (ph, tim->hook);
+	hexchat_unhook (ph, tim->hook);
 	free (tim);
 }
 
@@ -49,21 +49,21 @@ timer_del_ref (int ref, int quiet)
 		{
 			timer_del (tim);
 			if (!quiet)
-				xchat_printf (ph, "Timer %d deleted.\n", ref);
+				hexchat_printf (ph, "Timer %d deleted.\n", ref);
 			return;
 		}
 		list = list->next;
 	}
 	if (!quiet)
-		xchat_print (ph, "No such ref number found.\n");
+		hexchat_print (ph, "No such ref number found.\n");
 }
 
 static int
 timeout_cb (timer *tim)
 {
-	if (xchat_set_context (ph, tim->context))
+	if (hexchat_set_context (ph, tim->context))
 	{
-		xchat_command (ph, tim->command);
+		hexchat_command (ph, tim->command);
 
 		if (tim->forever)
 			return 1;
@@ -101,13 +101,13 @@ timer_add (int ref, float timeout, int repeat, char *command)
 	tim->repeat = repeat;
 	tim->timeout = timeout;
 	tim->command = strdup (command);
-	tim->context = xchat_get_context (ph);
+	tim->context = hexchat_get_context (ph);
 	tim->forever = FALSE;
 
 	if (repeat == 0)
 		tim->forever = TRUE;
 
-	tim->hook = xchat_hook_timer (ph, timeout * 1000.0, (void *)timeout_cb, tim);
+	tim->hook = hexchat_hook_timer (ph, timeout * 1000.0, (void *)timeout_cb, tim);
 	timer_list = g_slist_append (timer_list, tim);
 }
 
@@ -119,17 +119,17 @@ timer_showlist (void)
 
 	if (timer_list == NULL)
 	{
-		xchat_print (ph, "No timers installed.\n");
-		xchat_print (ph, HELP);
+		hexchat_print (ph, "No timers installed.\n");
+		hexchat_print (ph, HELP);
 		return;
 	}
 							 /*  00000 00000000 0000000 abc */
-	xchat_print (ph, "\026 Ref#  Seconds  Repeat  Command \026\n");
+	hexchat_print (ph, "\026 Ref#  Seconds  Repeat  Command \026\n");
 	list = timer_list;
 	while (list)
 	{
 		tim = list->data;
-		xchat_printf (ph, "%5d %8.1f %7d  %s\n", tim->ref, tim->timeout,
+		hexchat_printf (ph, "%5d %8.1f %7d  %s\n", tim->ref, tim->timeout,
 						  tim->repeat, tim->command);
 		list = list->next;
 	}
@@ -179,7 +179,7 @@ timer_cb (char *word[], char *word_eol[], void *userdata)
 	command = word_eol[3 + offset];
 
 	if (timeout < 0.1 || !command[0])
-		xchat_print (ph, HELP);
+		hexchat_print (ph, HELP);
 	else
 		timer_add (ref, timeout, repeat, command);
 
@@ -190,9 +190,9 @@ int
 #ifdef STATIC
 timer_plugin_init
 #else
-xchat_plugin_init
+hexchat_plugin_init
 #endif
-				(xchat_plugin *plugin_handle, char **plugin_name,
+				(hexchat_plugin *plugin_handle, char **plugin_name,
 				char **plugin_desc, char **plugin_version, char *arg)
 {
 	/* we need to save this for use with any xchat_* functions */
@@ -202,7 +202,7 @@ xchat_plugin_init
 	*plugin_desc = "IrcII style /TIMER command";
 	*plugin_version = "";
 
-	xchat_hook_command (ph, "TIMER", HEXCHAT_PRI_NORM, timer_cb, HELP, 0);
+	hexchat_hook_command (ph, "TIMER", HEXCHAT_PRI_NORM, timer_cb, HELP, 0);
 
 	return 1;       /* return 1 for success */
 }
diff --git a/src/common/plugin-timer.h b/src/common/plugin-timer.h
index 4b4f0d8d..6be73760 100644
--- a/src/common/plugin-timer.h
+++ b/src/common/plugin-timer.h
@@ -1,7 +1,7 @@
 #ifndef HEXCHAT_PLUGIN_TIMER_H
 #define HEXCHAT_PLUGIN_TIMER_H
 
-int timer_plugin_init (xchat_plugin *plugin_handle, char **plugin_name,
+int timer_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
 				char **plugin_desc, char **plugin_version, char *arg);
 
 #endif
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 8961f0d2..a3bf8dc2 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -41,7 +41,7 @@
 #include "notify.h"
 #include "text.h"
 #define PLUGIN_C
-typedef struct session xchat_context;
+typedef struct session hexchat_context;
 #include "hexchat-plugin.h"
 #include "plugin.h"
 
@@ -61,9 +61,9 @@ typedef struct session xchat_context;
 #define DEBUG(x) {x;}
 
 /* crafted to be an even 32 bytes */
-struct _xchat_hook
+struct _hexchat_hook
 {
-	xchat_plugin *pl;	/* the plugin to which it belongs */
+	hexchat_plugin *pl;	/* the plugin to which it belongs */
 	char *name;			/* "xdcc" */
 	void *callback;	/* pointer to xdcc_callback */
 	char *help_text;	/* help_text for commands only */
@@ -73,7 +73,7 @@ struct _xchat_hook
 	int pri;	/* fd */	/* priority / fd for HOOK_FD only */
 };
 
-struct _xchat_list
+struct _hexchat_list
 {
 	int type;			/* LIST_* */
 	GSList *pos;		/* current pos */
@@ -84,11 +84,11 @@ struct _xchat_list
 
 typedef int (xchat_cmd_cb) (char *word[], char *word_eol[], void *user_data);
 typedef int (xchat_serv_cb) (char *word[], char *word_eol[], void *user_data);
-typedef int (xchat_print_cb) (char *word[], void *user_data);
+typedef int (hexchat_print_cb) (char *word[], void *user_data);
 typedef int (xchat_fd_cb) (int fd, int flags, void *user_data);
 typedef int (xchat_timer_cb) (void *user_data);
-typedef int (xchat_init_func) (xchat_plugin *, char **, char **, char **, char *);
-typedef int (xchat_deinit_func) (xchat_plugin *);
+typedef int (xchat_init_func) (hexchat_plugin *, char **, char **, char **, char *);
+typedef int (xchat_deinit_func) (hexchat_plugin *);
 
 enum
 {
@@ -118,13 +118,13 @@ extern const struct prefs vars[];	/* cfgfiles.c */
 /* unload a plugin and remove it from our linked list */
 
 static int
-plugin_free (xchat_plugin *pl, int do_deinit, int allow_refuse)
+plugin_free (hexchat_plugin *pl, int do_deinit, int allow_refuse)
 {
 	GSList *list, *next;
-	xchat_hook *hook;
+	hexchat_hook *hook;
 	xchat_deinit_func *deinit_func;
 
-	/* fake plugin added by xchat_plugingui_add() */
+	/* fake plugin added by hexchat_plugingui_add() */
 	if (pl->fake)
 		goto xit;
 
@@ -143,7 +143,7 @@ plugin_free (xchat_plugin *pl, int do_deinit, int allow_refuse)
 		hook = list->data;
 		next = list->next;
 		if (hook->pl == pl)
-			xchat_unhook (NULL, hook);
+			hexchat_unhook (NULL, hook);
 		list = next;
 	}
 
@@ -179,14 +179,14 @@ xit:
 	return TRUE;
 }
 
-static xchat_plugin *
-plugin_list_add (xchat_context *ctx, char *filename, const char *name,
+static hexchat_plugin *
+plugin_list_add (hexchat_context *ctx, char *filename, const char *name,
 					  const char *desc, const char *version, void *handle,
 					  void *deinit_func, int fake, int free_strings)
 {
-	xchat_plugin *pl;
+	hexchat_plugin *pl;
 
-	pl = malloc (sizeof (xchat_plugin));
+	pl = malloc (sizeof (hexchat_plugin));
 	pl->handle = handle;
 	pl->filename = filename;
 	pl->context = ctx;
@@ -203,14 +203,14 @@ plugin_list_add (xchat_context *ctx, char *filename, const char *name,
 }
 
 static void *
-xchat_dummy (xchat_plugin *ph)
+xchat_dummy (hexchat_plugin *ph)
 {
 	return NULL;
 }
 
 #ifdef WIN32
 static int
-xchat_read_fd (xchat_plugin *ph, GIOChannel *source, char *buf, int *len)
+xchat_read_fd (hexchat_plugin *ph, GIOChannel *source, char *buf, int *len)
 {
 	GError *error = NULL;
 
@@ -234,7 +234,7 @@ void
 plugin_add (session *sess, char *filename, void *handle, void *init_func,
 				void *deinit_func, char *arg, int fake)
 {
-	xchat_plugin *pl;
+	hexchat_plugin *pl;
 	char *file;
 
 	file = NULL;
@@ -247,47 +247,47 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
 	if (!fake)
 	{
 		/* win32 uses these because it doesn't have --export-dynamic! */
-		pl->xchat_hook_command = xchat_hook_command;
-		pl->xchat_hook_server = xchat_hook_server;
-		pl->xchat_hook_print = xchat_hook_print;
-		pl->xchat_hook_timer = xchat_hook_timer;
-		pl->xchat_hook_fd = xchat_hook_fd;
-		pl->xchat_unhook = xchat_unhook;
-		pl->xchat_print = xchat_print;
-		pl->xchat_printf = xchat_printf;
-		pl->xchat_command = xchat_command;
-		pl->xchat_commandf = xchat_commandf;
-		pl->xchat_nickcmp = xchat_nickcmp;
-		pl->xchat_set_context = xchat_set_context;
-		pl->xchat_find_context = xchat_find_context;
-		pl->xchat_get_context = xchat_get_context;
-		pl->xchat_get_info = xchat_get_info;
+		pl->hexchat_hook_command = hexchat_hook_command;
+		pl->hexchat_hook_server = hexchat_hook_server;
+		pl->hexchat_hook_print = hexchat_hook_print;
+		pl->hexchat_hook_timer = hexchat_hook_timer;
+		pl->hexchat_hook_fd = hexchat_hook_fd;
+		pl->hexchat_unhook = hexchat_unhook;
+		pl->hexchat_print = hexchat_print;
+		pl->hexchat_printf = hexchat_printf;
+		pl->hexchat_command = hexchat_command;
+		pl->hexchat_commandf = hexchat_commandf;
+		pl->hexchat_nickcmp = hexchat_nickcmp;
+		pl->hexchat_set_context = hexchat_set_context;
+		pl->hexchat_find_context = hexchat_find_context;
+		pl->hexchat_get_context = hexchat_get_context;
+		pl->hexchat_get_info = hexchat_get_info;
 		pl->xchat_get_prefs = xchat_get_prefs;
-		pl->xchat_list_get = xchat_list_get;
-		pl->xchat_list_free = xchat_list_free;
-		pl->xchat_list_fields = xchat_list_fields;
-		pl->xchat_list_str = xchat_list_str;
-		pl->xchat_list_next = xchat_list_next;
-		pl->xchat_list_int = xchat_list_int;
-		pl->xchat_plugingui_add = xchat_plugingui_add;
-		pl->xchat_plugingui_remove = xchat_plugingui_remove;
-		pl->xchat_emit_print = xchat_emit_print;
+		pl->hexchat_list_get = hexchat_list_get;
+		pl->hexchat_list_free = hexchat_list_free;
+		pl->hexchat_list_fields = hexchat_list_fields;
+		pl->hexchat_list_str = hexchat_list_str;
+		pl->hexchat_list_next = hexchat_list_next;
+		pl->hexchat_list_int = hexchat_list_int;
+		pl->hexchat_plugingui_add = hexchat_plugingui_add;
+		pl->hexchat_plugingui_remove = hexchat_plugingui_remove;
+		pl->hexchat_emit_print = hexchat_emit_print;
 #ifdef WIN32
 		pl->xchat_read_fd = (void *) xchat_read_fd;
 #else
 		pl->xchat_read_fd = xchat_dummy;
 #endif
-		pl->xchat_list_time = xchat_list_time;
-		pl->xchat_gettext = xchat_gettext;
-		pl->xchat_send_modes = xchat_send_modes;
-		pl->xchat_strip = xchat_strip;
-		pl->xchat_free = xchat_free;
-		pl->xchat_pluginpref_set_str = xchat_pluginpref_set_str;
-		pl->xchat_pluginpref_get_str = xchat_pluginpref_get_str;
-		pl->xchat_pluginpref_set_int = xchat_pluginpref_set_int;
-		pl->xchat_pluginpref_get_int = xchat_pluginpref_get_int;
-		pl->xchat_pluginpref_delete = xchat_pluginpref_delete;
-		pl->xchat_pluginpref_list = xchat_pluginpref_list;
+		pl->hexchat_list_time = hexchat_list_time;
+		pl->hexchat_gettext = hexchat_gettext;
+		pl->hexchat_send_modes = hexchat_send_modes;
+		pl->hexchat_strip = hexchat_strip;
+		pl->hexchat_free = hexchat_free;
+		pl->hexchat_pluginpref_set_str = hexchat_pluginpref_set_str;
+		pl->hexchat_pluginpref_get_str = hexchat_pluginpref_get_str;
+		pl->hexchat_pluginpref_set_int = hexchat_pluginpref_set_int;
+		pl->hexchat_pluginpref_get_int = hexchat_pluginpref_get_int;
+		pl->hexchat_pluginpref_delete = hexchat_pluginpref_delete;
+		pl->hexchat_pluginpref_list = hexchat_pluginpref_list;
 
 		/* incase new plugins are loaded on older xchat */
 		pl->xchat_dummy4 = xchat_dummy;
@@ -295,7 +295,7 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
 		pl->xchat_dummy2 = xchat_dummy;
 		pl->xchat_dummy1 = xchat_dummy;
 
-		/* run xchat_plugin_init, if it returns 0, close the plugin */
+		/* run hexchat_plugin_init, if it returns 0, close the plugin */
 		if (((xchat_init_func *)init_func) (pl, &pl->name, &pl->desc, &pl->version, arg) == 0)
 		{
 			plugin_free (pl, FALSE, FALSE);
@@ -314,7 +314,7 @@ int
 plugin_kill (char *name, int by_filename)
 {
 	GSList *list;
-	xchat_plugin *pl;
+	hexchat_plugin *pl;
 
 	list = plugin_list;
 	while (list)
@@ -345,7 +345,7 @@ void
 plugin_kill_all (void)
 {
 	GSList *list, *next;
-	xchat_plugin *pl;
+	hexchat_plugin *pl;
 
 	list = plugin_list;
 	while (list)
@@ -375,15 +375,15 @@ plugin_load (session *sess, char *filename, char *arg)
 	if (handle == NULL)
 		return (char *)g_module_error ();
 
-	/* find the init routine xchat_plugin_init */
-	if (!g_module_symbol (handle, "xchat_plugin_init", (gpointer *)&init_func))
+	/* find the init routine hexchat_plugin_init */
+	if (!g_module_symbol (handle, "hexchat_plugin_init", (gpointer *)&init_func))
 	{
 		g_module_close (handle);
-		return _("No xchat_plugin_init symbol; is this really an xchat plugin?");
+		return _("No hexchat_plugin_init symbol; is this really an xchat plugin?");
 	}
 
 	/* find the plugin's deinit routine, if any */
-	if (!g_module_symbol (handle, "xchat_plugin_deinit", (gpointer *)&deinit_func))
+	if (!g_module_symbol (handle, "hexchat_plugin_deinit", (gpointer *)&deinit_func))
 		deinit_func = NULL;
 
 #else
@@ -414,17 +414,17 @@ plugin_load (session *sess, char *filename, char *arg)
 		return (char *)dlerror ();
 	dlerror ();		/* Clear any existing error */
 
-	/* find the init routine xchat_plugin_init */
-	init_func = dlsym (handle, "xchat_plugin_init");
+	/* find the init routine hexchat_plugin_init */
+	init_func = dlsym (handle, "hexchat_plugin_init");
 	error = (char *)dlerror ();
 	if (error != NULL)
 	{
 		dlclose (handle);
-		return _("No xchat_plugin_init symbol; is this really an xchat plugin?");
+		return _("No hexchat_plugin_init symbol; is this really an xchat plugin?");
 	}
 
 	/* find the plugin's deinit routine, if any */
-	deinit_func = dlsym (handle, "xchat_plugin_deinit");
+	deinit_func = dlsym (handle, "hexchat_plugin_deinit");
 	error = (char *)dlerror ();
 #endif
 
@@ -506,7 +506,7 @@ plugin_auto_load (session *sess)
 static GSList *
 plugin_hook_find (GSList *list, int type, char *name)
 {
-	xchat_hook *hook;
+	hexchat_hook *hook;
 
 	while (list)
 	{
@@ -534,7 +534,7 @@ static int
 plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[], int type)
 {
 	GSList *list, *next;
-	xchat_hook *hook;
+	hexchat_hook *hook;
 	int ret, eat = 0;
 
 	list = hook_list;
@@ -558,7 +558,7 @@ plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[], int
 			ret = ((xchat_serv_cb *)hook->callback) (word, word_eol, hook->userdata);
 			break;
 		default: /*case HOOK_PRINT:*/
-			ret = ((xchat_print_cb *)hook->callback) (word, hook->userdata);
+			ret = ((hexchat_print_cb *)hook->callback) (word, hook->userdata);
 			break;
 		}
 
@@ -659,7 +659,7 @@ plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval,
 }
 
 static int
-plugin_timeout_cb (xchat_hook *hook)
+plugin_timeout_cb (hexchat_hook *hook)
 {
 	int ret;
 
@@ -676,7 +676,7 @@ plugin_timeout_cb (xchat_hook *hook)
 	if (ret == 0)
 	{
 		hook->tag = 0;	/* avoid fe_timeout_remove, returning 0 is enough! */
-		xchat_unhook (hook->pl, hook);
+		hexchat_unhook (hook->pl, hook);
 	}
 
 	return ret;
@@ -685,10 +685,10 @@ plugin_timeout_cb (xchat_hook *hook)
 /* insert a hook into hook_list according to its priority */
 
 static void
-plugin_insert_hook (xchat_hook *new_hook)
+plugin_insert_hook (hexchat_hook *new_hook)
 {
 	GSList *list;
-	xchat_hook *hook;
+	hexchat_hook *hook;
 
 	list = hook_list;
 	while (list)
@@ -706,7 +706,7 @@ plugin_insert_hook (xchat_hook *new_hook)
 }
 
 static gboolean
-plugin_fd_cb (GIOChannel *source, GIOCondition condition, xchat_hook *hook)
+plugin_fd_cb (GIOChannel *source, GIOCondition condition, hexchat_hook *hook)
 {
 	int flags = 0, ret;
 	typedef int (xchat_fd_cb2) (int fd, int flags, void *user_data, GIOChannel *);
@@ -727,7 +727,7 @@ plugin_fd_cb (GIOChannel *source, GIOCondition condition, xchat_hook *hook)
 	if (ret == 0)
 	{
 		hook->tag = 0; /* avoid fe_input_remove, returning 0 is enough! */
-		xchat_unhook (hook->pl, hook);
+		hexchat_unhook (hook->pl, hook);
 	}
 
 	return ret;
@@ -735,14 +735,14 @@ plugin_fd_cb (GIOChannel *source, GIOCondition condition, xchat_hook *hook)
 
 /* allocate and add a hook to our list. Used for all 4 types */
 
-static xchat_hook *
-plugin_add_hook (xchat_plugin *pl, int type, int pri, const char *name,
+static hexchat_hook *
+plugin_add_hook (hexchat_plugin *pl, int type, int pri, const char *name,
 					  const  char *help_text, void *callb, int timeout, void *userdata)
 {
-	xchat_hook *hook;
+	hexchat_hook *hook;
 
-	hook = malloc (sizeof (xchat_hook));
-	memset (hook, 0, sizeof (xchat_hook));
+	hook = malloc (sizeof (hexchat_hook));
+	memset (hook, 0, sizeof (hexchat_hook));
 
 	hook->type = type;
 	hook->pri = pri;
@@ -766,7 +766,7 @@ plugin_add_hook (xchat_plugin *pl, int type, int pri, const char *name,
 GList *
 plugin_command_list(GList *tmp_list)
 {
-	xchat_hook *hook;
+	hexchat_hook *hook;
 	GSList *list = hook_list;
 
 	while (list)
@@ -784,7 +784,7 @@ plugin_command_foreach (session *sess, void *userdata,
 			void (*cb) (session *sess, void *userdata, char *name, char *help))
 {
 	GSList *list;
-	xchat_hook *hook;
+	hexchat_hook *hook;
 
 	list = hook_list;
 	while (list)
@@ -802,7 +802,7 @@ int
 plugin_show_help (session *sess, char *cmd)
 {
 	GSList *list;
-	xchat_hook *hook;
+	hexchat_hook *hook;
 
 	list = plugin_hook_find (hook_list, HOOK_COMMAND, cmd);
 	if (list)
@@ -823,7 +823,7 @@ plugin_show_help (session *sess, char *cmd)
 /* ========================================================= */
 
 void *
-xchat_unhook (xchat_plugin *ph, xchat_hook *hook)
+hexchat_unhook (hexchat_plugin *ph, hexchat_hook *hook)
 {
 	/* perl.c trips this */
 	if (!g_slist_find (hook_list, hook) || hook->type == HOOK_DELETED)
@@ -845,40 +845,40 @@ xchat_unhook (xchat_plugin *ph, xchat_hook *hook)
 	return hook->userdata;
 }
 
-xchat_hook *
-xchat_hook_command (xchat_plugin *ph, const char *name, int pri,
+hexchat_hook *
+hexchat_hook_command (hexchat_plugin *ph, const char *name, int pri,
 						  xchat_cmd_cb *callb, const char *help_text, void *userdata)
 {
 	return plugin_add_hook (ph, HOOK_COMMAND, pri, name, help_text, callb, 0,
 									userdata);
 }
 
-xchat_hook *
-xchat_hook_server (xchat_plugin *ph, const char *name, int pri,
+hexchat_hook *
+hexchat_hook_server (hexchat_plugin *ph, const char *name, int pri,
 						 xchat_serv_cb *callb, void *userdata)
 {
 	return plugin_add_hook (ph, HOOK_SERVER, pri, name, 0, callb, 0, userdata);
 }
 
-xchat_hook *
-xchat_hook_print (xchat_plugin *ph, const char *name, int pri,
-						xchat_print_cb *callb, void *userdata)
+hexchat_hook *
+hexchat_hook_print (hexchat_plugin *ph, const char *name, int pri,
+						hexchat_print_cb *callb, void *userdata)
 {
 	return plugin_add_hook (ph, HOOK_PRINT, pri, name, 0, callb, 0, userdata);
 }
 
-xchat_hook *
-xchat_hook_timer (xchat_plugin *ph, int timeout, xchat_timer_cb *callb,
+hexchat_hook *
+hexchat_hook_timer (hexchat_plugin *ph, int timeout, xchat_timer_cb *callb,
 					   void *userdata)
 {
 	return plugin_add_hook (ph, HOOK_TIMER, 0, 0, 0, callb, timeout, userdata);
 }
 
-xchat_hook *
-xchat_hook_fd (xchat_plugin *ph, int fd, int flags,
+hexchat_hook *
+hexchat_hook_fd (hexchat_plugin *ph, int fd, int flags,
 					xchat_fd_cb *callb, void *userdata)
 {
-	xchat_hook *hook;
+	hexchat_hook *hook;
 
 	hook = plugin_add_hook (ph, HOOK_FD, 0, 0, 0, callb, 0, userdata);
 	hook->pri = fd;
@@ -889,11 +889,11 @@ xchat_hook_fd (xchat_plugin *ph, int fd, int flags,
 }
 
 void
-xchat_print (xchat_plugin *ph, const char *text)
+hexchat_print (hexchat_plugin *ph, const char *text)
 {
 	if (!is_session (ph->context))
 	{
-		DEBUG(PrintTextf(0, "%s\txchat_print called without a valid context.\n", ph->name));
+		DEBUG(PrintTextf(0, "%s\thexchat_print called without a valid context.\n", ph->name));
 		return;
 	}
 
@@ -901,7 +901,7 @@ xchat_print (xchat_plugin *ph, const char *text)
 }
 
 void
-xchat_printf (xchat_plugin *ph, const char *format, ...)
+hexchat_printf (hexchat_plugin *ph, const char *format, ...)
 {
 	va_list args;
 	char *buf;
@@ -910,19 +910,19 @@ xchat_printf (xchat_plugin *ph, const char *format, ...)
 	buf = g_strdup_vprintf (format, args);
 	va_end (args);
 
-	xchat_print (ph, buf);
+	hexchat_print (ph, buf);
 	g_free (buf);
 }
 
 void
-xchat_command (xchat_plugin *ph, const char *command)
+hexchat_command (hexchat_plugin *ph, const char *command)
 {
 	char *conv;
 	int len = -1;
 
 	if (!is_session (ph->context))
 	{
-		DEBUG(PrintTextf(0, "%s\txchat_command called without a valid context.\n", ph->name));
+		DEBUG(PrintTextf(0, "%s\thexchat_command called without a valid context.\n", ph->name));
 		return;
 	}
 
@@ -933,7 +933,7 @@ xchat_command (xchat_plugin *ph, const char *command)
 }
 
 void
-xchat_commandf (xchat_plugin *ph, const char *format, ...)
+hexchat_commandf (hexchat_plugin *ph, const char *format, ...)
 {
 	va_list args;
 	char *buf;
@@ -942,24 +942,24 @@ xchat_commandf (xchat_plugin *ph, const char *format, ...)
 	buf = g_strdup_vprintf (format, args);
 	va_end (args);
 
-	xchat_command (ph, buf);
+	hexchat_command (ph, buf);
 	g_free (buf);
 }
 
 int
-xchat_nickcmp (xchat_plugin *ph, const char *s1, const char *s2)
+hexchat_nickcmp (hexchat_plugin *ph, const char *s1, const char *s2)
 {
 	return ((session *)ph->context)->server->p_cmp (s1, s2);
 }
 
-xchat_context *
-xchat_get_context (xchat_plugin *ph)
+hexchat_context *
+hexchat_get_context (hexchat_plugin *ph)
 {
 	return ph->context;
 }
 
 int
-xchat_set_context (xchat_plugin *ph, xchat_context *context)
+hexchat_set_context (hexchat_plugin *ph, hexchat_context *context)
 {
 	if (is_session (context))
 	{
@@ -969,8 +969,8 @@ xchat_set_context (xchat_plugin *ph, xchat_context *context)
 	return 0;
 }
 
-xchat_context *
-xchat_find_context (xchat_plugin *ph, const char *servname, const char *channel)
+hexchat_context *
+hexchat_find_context (hexchat_plugin *ph, const char *servname, const char *channel)
 {
 	GSList *slist, *clist, *sessions = NULL;
 	server *serv;
@@ -1030,7 +1030,7 @@ xchat_find_context (xchat_plugin *ph, const char *servname, const char *channel)
 }
 
 const char *
-xchat_get_info (xchat_plugin *ph, const char *id)
+hexchat_get_info (hexchat_plugin *ph, const char *id)
 {
 	session *sess;
 	guint32 hash;
@@ -1063,7 +1063,7 @@ xchat_get_info (xchat_plugin *ph, const char *id)
 	sess = ph->context;
 	if (!is_session (sess))
 	{
-		DEBUG(PrintTextf(0, "%s\txchat_get_info called without a valid context.\n", ph->name));
+		DEBUG(PrintTextf(0, "%s\thexchat_get_info called without a valid context.\n", ph->name));
 		return NULL;
 	}
 
@@ -1137,7 +1137,7 @@ xchat_get_info (xchat_plugin *ph, const char *id)
 }
 
 int
-xchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int *integer)
+xchat_get_prefs (hexchat_plugin *ph, const char *name, const char **string, int *integer)
 {
 	int i = 0;
 
@@ -1183,12 +1183,12 @@ xchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int *i
 	return 0;
 }
 
-xchat_list *
-xchat_list_get (xchat_plugin *ph, const char *name)
+hexchat_list *
+hexchat_list_get (hexchat_plugin *ph, const char *name)
 {
-	xchat_list *list;
+	hexchat_list *list;
 
-	list = malloc (sizeof (xchat_list));
+	list = malloc (sizeof (hexchat_list));
 	list->pos = NULL;
 
 	switch (str_hash (name))
@@ -1232,7 +1232,7 @@ xchat_list_get (xchat_plugin *ph, const char *name)
 }
 
 void
-xchat_list_free (xchat_plugin *ph, xchat_list *xlist)
+hexchat_list_free (hexchat_plugin *ph, hexchat_list *xlist)
 {
 	if (xlist->type == LIST_USERS)
 		g_slist_free (xlist->head);
@@ -1240,7 +1240,7 @@ xchat_list_free (xchat_plugin *ph, xchat_list *xlist)
 }
 
 int
-xchat_list_next (xchat_plugin *ph, xchat_list *xlist)
+hexchat_list_next (hexchat_plugin *ph, hexchat_list *xlist)
 {
 	if (xlist->next == NULL)
 		return 0;
@@ -1262,7 +1262,7 @@ xchat_list_next (xchat_plugin *ph, xchat_list *xlist)
 }
 
 const char * const *
-xchat_list_fields (xchat_plugin *ph, const char *name)
+hexchat_list_fields (hexchat_plugin *ph, const char *name)
 {
 	static const char * const dcc_fields[] =
 	{
@@ -1312,7 +1312,7 @@ xchat_list_fields (xchat_plugin *ph, const char *name)
 }
 
 time_t
-xchat_list_time (xchat_plugin *ph, xchat_list *xlist, const char *name)
+hexchat_list_time (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
 {
 	guint32 hash = str_hash (name);
 	gpointer data;
@@ -1346,7 +1346,7 @@ xchat_list_time (xchat_plugin *ph, xchat_list *xlist, const char *name)
 }
 
 const char *
-xchat_list_str (xchat_plugin *ph, xchat_list *xlist, const char *name)
+hexchat_list_str (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
 {
 	guint32 hash = str_hash (name);
 	gpointer data = ph->context;
@@ -1430,7 +1430,7 @@ xchat_list_str (xchat_plugin *ph, xchat_list *xlist, const char *name)
 }
 
 int
-xchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
+hexchat_list_int (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
 {
 	guint32 hash = str_hash (name);
 	gpointer data = ph->context;
@@ -1547,7 +1547,7 @@ xchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
 }
 
 void *
-xchat_plugingui_add (xchat_plugin *ph, const char *filename,
+hexchat_plugingui_add (hexchat_plugin *ph, const char *filename,
 							const char *name, const char *desc,
 							const char *version, char *reserved)
 {
@@ -1561,7 +1561,7 @@ xchat_plugingui_add (xchat_plugin *ph, const char *filename,
 }
 
 void
-xchat_plugingui_remove (xchat_plugin *ph, void *handle)
+hexchat_plugingui_remove (hexchat_plugin *ph, void *handle)
 {
 #ifdef USE_PLUGIN
 	plugin_free (handle, FALSE, FALSE);
@@ -1569,7 +1569,7 @@ xchat_plugingui_remove (xchat_plugin *ph, void *handle)
 }
 
 int
-xchat_emit_print (xchat_plugin *ph, const char *event_name, ...)
+hexchat_emit_print (hexchat_plugin *ph, const char *event_name, ...)
 {
 	va_list args;
 	/* currently only 4 because no events use more than 4.
@@ -1596,7 +1596,7 @@ xchat_emit_print (xchat_plugin *ph, const char *event_name, ...)
 }
 
 char *
-xchat_gettext (xchat_plugin *ph, const char *msgid)
+hexchat_gettext (hexchat_plugin *ph, const char *msgid)
 {
 	/* so that plugins can use xchat's internal gettext strings. */
 	/* e.g. The EXEC plugin uses this on Windows. */
@@ -1604,7 +1604,7 @@ xchat_gettext (xchat_plugin *ph, const char *msgid)
 }
 
 void
-xchat_send_modes (xchat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
+hexchat_send_modes (hexchat_plugin *ph, const char **targets, int ntargets, int modes_per_line, char sign, char mode)
 {
 	char tbuf[514];	/* modes.c needs 512 + null */
 
@@ -1612,19 +1612,19 @@ xchat_send_modes (xchat_plugin *ph, const char **targets, int ntargets, int mode
 }
 
 char *
-xchat_strip (xchat_plugin *ph, const char *str, int len, int flags)
+hexchat_strip (hexchat_plugin *ph, const char *str, int len, int flags)
 {
 	return strip_color ((char *)str, len, flags);
 }
 
 void
-xchat_free (xchat_plugin *ph, void *ptr)
+hexchat_free (hexchat_plugin *ph, void *ptr)
 {
 	g_free (ptr);
 }
 
 static int
-xchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
+hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
 {
 	FILE *fpIn;
 	int fhOut;
@@ -1737,13 +1737,13 @@ xchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *va
 }
 
 int
-xchat_pluginpref_set_str (xchat_plugin *pl, const char *var, const char *value)
+hexchat_pluginpref_set_str (hexchat_plugin *pl, const char *var, const char *value)
 {
-	return xchat_pluginpref_set_str_real (pl, var, value, 1);
+	return hexchat_pluginpref_set_str_real (pl, var, value, 1);
 }
 
 int
-xchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest)
+hexchat_pluginpref_get_str (hexchat_plugin *pl, const char *var, char *dest)
 {
 	int fh;
 	int l;
@@ -1795,20 +1795,20 @@ xchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest)
 }
 
 int
-xchat_pluginpref_set_int (xchat_plugin *pl, const char *var, int value)
+hexchat_pluginpref_set_int (hexchat_plugin *pl, const char *var, int value)
 {
 	char buffer[12];
 
 	sprintf (buffer, "%d", value);
-	return xchat_pluginpref_set_str_real (pl, var, buffer, 1);
+	return hexchat_pluginpref_set_str_real (pl, var, buffer, 1);
 }
 
 int
-xchat_pluginpref_get_int (xchat_plugin *pl, const char *var)
+hexchat_pluginpref_get_int (hexchat_plugin *pl, const char *var)
 {
 	char buffer[12];
 
-	if (xchat_pluginpref_get_str (pl, var, buffer))
+	if (hexchat_pluginpref_get_str (pl, var, buffer))
 	{
 		return atoi (buffer);
 	}
@@ -1819,13 +1819,13 @@ xchat_pluginpref_get_int (xchat_plugin *pl, const char *var)
 }
 
 int
-xchat_pluginpref_delete (xchat_plugin *pl, const char *var)
+hexchat_pluginpref_delete (hexchat_plugin *pl, const char *var)
 {
-	return xchat_pluginpref_set_str_real (pl, var, 0, 0);
+	return hexchat_pluginpref_set_str_real (pl, var, 0, 0);
 }
 
 int
-xchat_pluginpref_list (xchat_plugin *pl, char* dest)
+hexchat_pluginpref_list (hexchat_plugin *pl, char* dest)
 {
 	FILE *fpIn;
 	char confname[64];
diff --git a/src/common/plugin.h b/src/common/plugin.h
index 8b2b00dc..e61b5111 100644
--- a/src/common/plugin.h
+++ b/src/common/plugin.h
@@ -2,121 +2,121 @@
 #define HEXCHAT_COMMONPLUGIN_H
 
 #ifdef PLUGIN_C
-struct _xchat_plugin
+struct _hexchat_plugin
 {
 	/* Keep these in sync with hexchat-plugin.h */
 	/* !!don't change the order, to keep binary compat!! */
-	xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_command) (hexchat_plugin *ph,
 		    const char *name,
 		    int pri,
 		    int (*callback) (char *word[], char *word_eol[], void *user_data),
 		    const char *help_text,
 		    void *userdata);
-	xchat_hook *(*xchat_hook_server) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_server) (hexchat_plugin *ph,
 		   const char *name,
 		   int pri,
 		   int (*callback) (char *word[], char *word_eol[], void *user_data),
 		   void *userdata);
-	xchat_hook *(*xchat_hook_print) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_print) (hexchat_plugin *ph,
 		  const char *name,
 		  int pri,
 		  int (*callback) (char *word[], void *user_data),
 		  void *userdata);
-	xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_timer) (hexchat_plugin *ph,
 		  int timeout,
 		  int (*callback) (void *user_data),
 		  void *userdata);
-	xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph,
+	hexchat_hook *(*hexchat_hook_fd) (hexchat_plugin *ph,
 		   int fd,
 		   int flags,
 		   int (*callback) (int fd, int flags, void *user_data),
 		   void *userdata);
-	void *(*xchat_unhook) (xchat_plugin *ph,
-	      xchat_hook *hook);
-	void (*xchat_print) (xchat_plugin *ph,
+	void *(*hexchat_unhook) (hexchat_plugin *ph,
+	      hexchat_hook *hook);
+	void (*hexchat_print) (hexchat_plugin *ph,
 	     const char *text);
-	void (*xchat_printf) (xchat_plugin *ph,
+	void (*hexchat_printf) (hexchat_plugin *ph,
 	      const char *format, ...);
-	void (*xchat_command) (xchat_plugin *ph,
+	void (*hexchat_command) (hexchat_plugin *ph,
 	       const char *command);
-	void (*xchat_commandf) (xchat_plugin *ph,
+	void (*hexchat_commandf) (hexchat_plugin *ph,
 		const char *format, ...);
-	int (*xchat_nickcmp) (xchat_plugin *ph,
+	int (*hexchat_nickcmp) (hexchat_plugin *ph,
 	       const char *s1,
 	       const char *s2);
-	int (*xchat_set_context) (xchat_plugin *ph,
-		   xchat_context *ctx);
-	xchat_context *(*xchat_find_context) (xchat_plugin *ph,
+	int (*hexchat_set_context) (hexchat_plugin *ph,
+		   hexchat_context *ctx);
+	hexchat_context *(*hexchat_find_context) (hexchat_plugin *ph,
 		    const char *servname,
 		    const char *channel);
-	xchat_context *(*xchat_get_context) (xchat_plugin *ph);
-	const char *(*xchat_get_info) (xchat_plugin *ph,
+	hexchat_context *(*hexchat_get_context) (hexchat_plugin *ph);
+	const char *(*hexchat_get_info) (hexchat_plugin *ph,
 		const char *id);
-	int (*xchat_get_prefs) (xchat_plugin *ph,
+	int (*xchat_get_prefs) (hexchat_plugin *ph,
 		 const char *name,
 		 const char **string,
 		 int *integer);
-	xchat_list * (*xchat_list_get) (xchat_plugin *ph,
+	hexchat_list * (*hexchat_list_get) (hexchat_plugin *ph,
 		const char *name);
-	void (*xchat_list_free) (xchat_plugin *ph,
-		 xchat_list *xlist);
-	const char * const * (*xchat_list_fields) (xchat_plugin *ph,
+	void (*hexchat_list_free) (hexchat_plugin *ph,
+		 hexchat_list *xlist);
+	const char * const * (*hexchat_list_fields) (hexchat_plugin *ph,
 		   const char *name);
-	int (*xchat_list_next) (xchat_plugin *ph,
-		 xchat_list *xlist);
-	const char * (*xchat_list_str) (xchat_plugin *ph,
-		xchat_list *xlist,
+	int (*hexchat_list_next) (hexchat_plugin *ph,
+		 hexchat_list *xlist);
+	const char * (*hexchat_list_str) (hexchat_plugin *ph,
+		hexchat_list *xlist,
 		const char *name);
-	int (*xchat_list_int) (xchat_plugin *ph,
-		xchat_list *xlist,
+	int (*hexchat_list_int) (hexchat_plugin *ph,
+		hexchat_list *xlist,
 		const char *name);
-	void * (*xchat_plugingui_add) (xchat_plugin *ph,
+	void * (*hexchat_plugingui_add) (hexchat_plugin *ph,
 		     const char *filename,
 		     const char *name,
 		     const char *desc,
 		     const char *version,
 		     char *reserved);
-	void (*xchat_plugingui_remove) (xchat_plugin *ph,
+	void (*hexchat_plugingui_remove) (hexchat_plugin *ph,
 			void *handle);
-	int (*xchat_emit_print) (xchat_plugin *ph,
+	int (*hexchat_emit_print) (hexchat_plugin *ph,
 			const char *event_name, ...);
-	void *(*xchat_read_fd) (xchat_plugin *ph);
-	time_t (*xchat_list_time) (xchat_plugin *ph,
-		xchat_list *xlist,
+	void *(*xchat_read_fd) (hexchat_plugin *ph);
+	time_t (*hexchat_list_time) (hexchat_plugin *ph,
+		hexchat_list *xlist,
 		const char *name);
-	char *(*xchat_gettext) (xchat_plugin *ph,
+	char *(*hexchat_gettext) (hexchat_plugin *ph,
 		const char *msgid);
-	void (*xchat_send_modes) (xchat_plugin *ph,
+	void (*hexchat_send_modes) (hexchat_plugin *ph,
 		  const char **targets,
 		  int ntargets,
 		  int modes_per_line,
 		  char sign,
 		  char mode);
-	char *(*xchat_strip) (xchat_plugin *ph,
+	char *(*hexchat_strip) (hexchat_plugin *ph,
 	     const char *str,
 	     int len,
 	     int flags);
-	void (*xchat_free) (xchat_plugin *ph,
+	void (*hexchat_free) (hexchat_plugin *ph,
 	    void *ptr);
-	int (*xchat_pluginpref_set_str) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_set_str) (hexchat_plugin *ph,
 		const char *var,
 		const char *value);
-	int (*xchat_pluginpref_get_str) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_get_str) (hexchat_plugin *ph,
 		const char *var,
 		char *dest);
-	int (*xchat_pluginpref_set_int) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_set_int) (hexchat_plugin *ph,
 		const char *var,
 		int value);
-	int (*xchat_pluginpref_get_int) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_get_int) (hexchat_plugin *ph,
 		const char *var);
-	int (*xchat_pluginpref_delete) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_delete) (hexchat_plugin *ph,
 		const char *var);
-	int (*xchat_pluginpref_list) (xchat_plugin *ph,
+	int (*hexchat_pluginpref_list) (hexchat_plugin *ph,
 		char *dest);
-	void *(*xchat_dummy4) (xchat_plugin *ph);
-	void *(*xchat_dummy3) (xchat_plugin *ph);
-	void *(*xchat_dummy2) (xchat_plugin *ph);
-	void *(*xchat_dummy1) (xchat_plugin *ph);
+	void *(*xchat_dummy4) (hexchat_plugin *ph);
+	void *(*xchat_dummy3) (hexchat_plugin *ph);
+	void *(*xchat_dummy2) (hexchat_plugin *ph);
+	void *(*xchat_dummy1) (hexchat_plugin *ph);
 	/* PRIVATE FIELDS! */
 	void *handle;		/* from dlopen */
 	char *filename;	/* loaded from */
@@ -124,8 +124,8 @@ struct _xchat_plugin
 	char *desc;
 	char *version;
 	session *context;
-	void *deinit_callback;	/* pointer to xchat_plugin_deinit */
-	unsigned int fake:1;		/* fake plugin. Added by xchat_plugingui_add() */
+	void *deinit_callback;	/* pointer to hexchat_plugin_deinit */
+	unsigned int fake:1;		/* fake plugin. Added by hexchat_plugingui_add() */
 	unsigned int free_strings:1;		/* free name,desc,version? */
 };
 #endif