diff options
Diffstat (limited to 'src/common/dbus')
-rw-r--r-- | src/common/dbus/dbus-plugin.c | 124 |
1 files changed, 62 insertions, 62 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); } |