mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-06-21 13:29:25 +00:00
new name after fork
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* dbus-plugin.c - hexchat plugin for remote access using D-Bus
|
||||
/* dbus-plugin.c - zoitechat plugin for remote access using D-Bus
|
||||
* Copyright (C) 2006 Claessens Xavier
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -25,16 +25,16 @@
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include "hexchat-plugin.h"
|
||||
#include "zoitechat-plugin.h"
|
||||
#include "dbus-plugin.h"
|
||||
|
||||
#define PNAME _("remote access")
|
||||
#define PDESC _("plugin for remote access using DBUS")
|
||||
#define PVERSION ""
|
||||
|
||||
#define DBUS_OBJECT_PATH "/org/hexchat"
|
||||
#define DBUS_OBJECT_PATH "/org/zoitechat"
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
static zoitechat_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;
|
||||
hexchat_context *context;
|
||||
zoitechat_context *context;
|
||||
char *dbus_path;
|
||||
char *filename;
|
||||
GHashTable *hooks;
|
||||
@@ -68,14 +68,14 @@ typedef struct
|
||||
{
|
||||
guint id;
|
||||
int return_value;
|
||||
hexchat_hook *hook;
|
||||
zoitechat_hook *hook;
|
||||
RemoteObject *obj;
|
||||
} HookInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guint id;
|
||||
hexchat_context *context;
|
||||
zoitechat_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 (hexchat_context *context);
|
||||
static hexchat_context* context_list_find_context (guint id);
|
||||
static guint context_list_find_id (zoitechat_context *context);
|
||||
static zoitechat_context* context_list_find_context (guint id);
|
||||
|
||||
/* Remote Object */
|
||||
|
||||
@@ -259,14 +259,14 @@ hook_info_destroy (gpointer data)
|
||||
if (info == NULL) {
|
||||
return;
|
||||
}
|
||||
hexchat_unhook (ph, info->hook);
|
||||
zoitechat_unhook (ph, info->hook);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
list_info_destroy (gpointer data)
|
||||
{
|
||||
hexchat_list_free (ph, (hexchat_list*)data);
|
||||
zoitechat_list_free (ph, (zoitechat_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);
|
||||
hexchat_plugingui_remove (ph, self->handle);
|
||||
zoitechat_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 = hexchat_get_context (ph);
|
||||
obj->context = zoitechat_get_context (ph);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -317,7 +317,7 @@ remote_object_class_init (RemoteObjectClass *klass)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
_hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
_zoitechat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
G_TYPE_NONE,
|
||||
4, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
@@ -327,7 +327,7 @@ remote_object_class_init (RemoteObjectClass *klass)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
_hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
_zoitechat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
G_TYPE_NONE,
|
||||
4, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
@@ -337,7 +337,7 @@ remote_object_class_init (RemoteObjectClass *klass)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
_hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
_zoitechat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
G_TYPE_NONE,
|
||||
3, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
@@ -379,7 +379,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 = hexchat_plugingui_add (ph,
|
||||
remote_object->handle = zoitechat_plugingui_add (ph,
|
||||
remote_object->filename,
|
||||
name,
|
||||
desc,
|
||||
@@ -415,8 +415,8 @@ remote_object_command (RemoteObject *obj,
|
||||
const char *command,
|
||||
GError **error)
|
||||
{
|
||||
if (hexchat_set_context (ph, obj->context)) {
|
||||
hexchat_command (ph, command);
|
||||
if (zoitechat_set_context (ph, obj->context)) {
|
||||
zoitechat_command (ph, command);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -426,8 +426,8 @@ remote_object_print (RemoteObject *obj,
|
||||
const char *text,
|
||||
GError **error)
|
||||
{
|
||||
if (hexchat_set_context (ph, obj->context)) {
|
||||
hexchat_print (ph, text);
|
||||
if (zoitechat_set_context (ph, obj->context)) {
|
||||
zoitechat_print (ph, text);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -439,7 +439,7 @@ remote_object_find_context (RemoteObject *obj,
|
||||
guint *ret_id,
|
||||
GError **error)
|
||||
{
|
||||
hexchat_context *context;
|
||||
zoitechat_context *context;
|
||||
|
||||
if (*server == '\0') {
|
||||
server = NULL;
|
||||
@@ -447,7 +447,7 @@ remote_object_find_context (RemoteObject *obj,
|
||||
if (*channel == '\0') {
|
||||
channel = NULL;
|
||||
}
|
||||
context = hexchat_find_context (ph, server, channel);
|
||||
context = zoitechat_find_context (ph, server, channel);
|
||||
*ret_id = context_list_find_id (context);
|
||||
|
||||
return TRUE;
|
||||
@@ -468,7 +468,7 @@ remote_object_set_context (RemoteObject *obj,
|
||||
gboolean *ret,
|
||||
GError **error)
|
||||
{
|
||||
hexchat_context *context;
|
||||
zoitechat_context *context;
|
||||
|
||||
context = context_list_find_context (id);
|
||||
if (context == NULL) {
|
||||
@@ -489,12 +489,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 (!hexchat_set_context (ph, obj->context) ||
|
||||
if (!zoitechat_set_context (ph, obj->context) ||
|
||||
g_str_equal (id, "win_ptr")) {
|
||||
*ret_info = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
*ret_info = g_strdup (hexchat_get_info (ph, id));
|
||||
*ret_info = g_strdup (zoitechat_get_info (ph, id));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -508,11 +508,11 @@ remote_object_get_prefs (RemoteObject *obj,
|
||||
{
|
||||
const char *str;
|
||||
|
||||
if (!hexchat_set_context (ph, obj->context)) {
|
||||
if (!zoitechat_set_context (ph, obj->context)) {
|
||||
*ret_type = 0;
|
||||
return TRUE;
|
||||
}
|
||||
*ret_type = hexchat_get_prefs (ph, name, &str, ret_int);
|
||||
*ret_type = zoitechat_get_prefs (ph, name, &str, ret_int);
|
||||
*ret_str = g_strdup (str);
|
||||
|
||||
return TRUE;
|
||||
@@ -529,7 +529,7 @@ server_hook_cb (char *word[],
|
||||
|
||||
arg1 = build_list (word + 1);
|
||||
arg2 = build_list (word_eol + 1);
|
||||
info->obj->context = hexchat_get_context (ph);
|
||||
info->obj->context = zoitechat_get_context (ph);
|
||||
g_signal_emit (info->obj,
|
||||
signals[SERVER_SIGNAL],
|
||||
0,
|
||||
@@ -552,7 +552,7 @@ command_hook_cb (char *word[],
|
||||
|
||||
arg1 = build_list (word + 1);
|
||||
arg2 = build_list (word_eol + 1);
|
||||
info->obj->context = hexchat_get_context (ph);
|
||||
info->obj->context = zoitechat_get_context (ph);
|
||||
g_signal_emit (info->obj,
|
||||
signals[COMMAND_SIGNAL],
|
||||
0,
|
||||
@@ -572,7 +572,7 @@ print_hook_cb (char *word[],
|
||||
char **arg1;
|
||||
|
||||
arg1 = build_list (word + 1);
|
||||
info->obj->context = hexchat_get_context (ph);
|
||||
info->obj->context = zoitechat_get_context (ph);
|
||||
g_signal_emit (info->obj,
|
||||
signals[PRINT_SIGNAL],
|
||||
0,
|
||||
@@ -598,7 +598,7 @@ remote_object_hook_command (RemoteObject *obj,
|
||||
info->obj = obj;
|
||||
info->return_value = return_value;
|
||||
info->id = ++obj->last_hook_id;
|
||||
info->hook = hexchat_hook_command (ph,
|
||||
info->hook = zoitechat_hook_command (ph,
|
||||
name,
|
||||
priority,
|
||||
command_hook_cb,
|
||||
@@ -624,7 +624,7 @@ remote_object_hook_server (RemoteObject *obj,
|
||||
info->obj = obj;
|
||||
info->return_value = return_value;
|
||||
info->id = ++obj->last_hook_id;
|
||||
info->hook = hexchat_hook_server (ph,
|
||||
info->hook = zoitechat_hook_server (ph,
|
||||
name,
|
||||
priority,
|
||||
server_hook_cb,
|
||||
@@ -649,7 +649,7 @@ remote_object_hook_print (RemoteObject *obj,
|
||||
info->obj = obj;
|
||||
info->return_value = return_value;
|
||||
info->id = ++obj->last_hook_id;
|
||||
info->hook = hexchat_hook_print (ph,
|
||||
info->hook = zoitechat_hook_print (ph,
|
||||
name,
|
||||
priority,
|
||||
print_hook_cb,
|
||||
@@ -675,14 +675,14 @@ remote_object_list_get (RemoteObject *obj,
|
||||
guint *ret_id,
|
||||
GError **error)
|
||||
{
|
||||
hexchat_list *xlist;
|
||||
zoitechat_list *xlist;
|
||||
guint *id;
|
||||
|
||||
if (!hexchat_set_context (ph, obj->context)) {
|
||||
if (!zoitechat_set_context (ph, obj->context)) {
|
||||
*ret_id = 0;
|
||||
return TRUE;
|
||||
}
|
||||
xlist = hexchat_list_get (ph, name);
|
||||
xlist = zoitechat_list_get (ph, name);
|
||||
if (xlist == NULL) {
|
||||
*ret_id = 0;
|
||||
return TRUE;
|
||||
@@ -703,14 +703,14 @@ remote_object_list_next (RemoteObject *obj,
|
||||
gboolean *ret,
|
||||
GError **error)
|
||||
{
|
||||
hexchat_list *xlist;
|
||||
zoitechat_list *xlist;
|
||||
|
||||
xlist = g_hash_table_lookup (obj->lists, &id);
|
||||
if (xlist == NULL) {
|
||||
*ret = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
*ret = hexchat_list_next (ph, xlist);
|
||||
*ret = zoitechat_list_next (ph, xlist);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -722,10 +722,10 @@ remote_object_list_str (RemoteObject *obj,
|
||||
char **ret_str,
|
||||
GError **error)
|
||||
{
|
||||
hexchat_list *xlist;
|
||||
zoitechat_list *xlist;
|
||||
|
||||
xlist = g_hash_table_lookup (obj->lists, &id);
|
||||
if (xlist == NULL && !hexchat_set_context (ph, obj->context)) {
|
||||
if (xlist == NULL && !zoitechat_set_context (ph, obj->context)) {
|
||||
*ret_str = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -733,7 +733,7 @@ remote_object_list_str (RemoteObject *obj,
|
||||
*ret_str = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
*ret_str = g_strdup (hexchat_list_str (ph, xlist, name));
|
||||
*ret_str = g_strdup (zoitechat_list_str (ph, xlist, name));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -745,19 +745,19 @@ remote_object_list_int (RemoteObject *obj,
|
||||
int *ret_int,
|
||||
GError **error)
|
||||
{
|
||||
hexchat_list *xlist;
|
||||
zoitechat_list *xlist;
|
||||
|
||||
xlist = g_hash_table_lookup (obj->lists, &id);
|
||||
if (xlist == NULL && !hexchat_set_context (ph, obj->context)) {
|
||||
if (xlist == NULL && !zoitechat_set_context (ph, obj->context)) {
|
||||
*ret_int = -1;
|
||||
return TRUE;
|
||||
}
|
||||
if (g_str_equal (name, "context")) {
|
||||
hexchat_context *context;
|
||||
context = (hexchat_context*)hexchat_list_str (ph, xlist, name);
|
||||
zoitechat_context *context;
|
||||
context = (zoitechat_context*)zoitechat_list_str (ph, xlist, name);
|
||||
*ret_int = context_list_find_id (context);
|
||||
} else {
|
||||
*ret_int = hexchat_list_int (ph, xlist, name);
|
||||
*ret_int = zoitechat_list_int (ph, xlist, name);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -770,14 +770,14 @@ remote_object_list_time (RemoteObject *obj,
|
||||
guint64 *ret_time,
|
||||
GError **error)
|
||||
{
|
||||
hexchat_list *xlist;
|
||||
zoitechat_list *xlist;
|
||||
|
||||
xlist = g_hash_table_lookup (obj->lists, &id);
|
||||
if (xlist == NULL) {
|
||||
*ret_time = (guint64) -1;
|
||||
return TRUE;
|
||||
}
|
||||
*ret_time = hexchat_list_time (ph, xlist, name);
|
||||
*ret_time = zoitechat_list_time (ph, xlist, name);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -788,7 +788,7 @@ remote_object_list_fields (RemoteObject *obj,
|
||||
char ***ret,
|
||||
GError **error)
|
||||
{
|
||||
*ret = g_strdupv ((char**)hexchat_list_fields (ph, name));
|
||||
*ret = g_strdupv ((char**)zoitechat_list_fields (ph, name));
|
||||
if (*ret == NULL) {
|
||||
*ret = g_new0 (char*, 1);
|
||||
}
|
||||
@@ -818,9 +818,9 @@ remote_object_emit_print (RemoteObject *obj,
|
||||
argv[i] = args[i];
|
||||
}
|
||||
|
||||
*ret = hexchat_set_context (ph, obj->context);
|
||||
*ret = zoitechat_set_context (ph, obj->context);
|
||||
if (*ret) {
|
||||
*ret = hexchat_emit_print (ph, event_name, argv[0], argv[1],
|
||||
*ret = zoitechat_emit_print (ph, event_name, argv[0], argv[1],
|
||||
argv[2], argv[3]);
|
||||
}
|
||||
|
||||
@@ -834,8 +834,8 @@ remote_object_nickcmp (RemoteObject *obj,
|
||||
int *ret,
|
||||
GError **error)
|
||||
{
|
||||
hexchat_set_context (ph, obj->context);
|
||||
*ret = hexchat_nickcmp (ph, nick1, nick2);
|
||||
zoitechat_set_context (ph, obj->context);
|
||||
*ret = zoitechat_nickcmp (ph, nick1, nick2);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ remote_object_strip (RemoteObject *obj,
|
||||
char **ret_str,
|
||||
GError **error)
|
||||
{
|
||||
*ret_str = hexchat_strip (ph, str, len, flag);
|
||||
*ret_str = zoitechat_strip (ph, str, len, flag);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -859,8 +859,8 @@ remote_object_send_modes (RemoteObject *obj,
|
||||
char mode,
|
||||
GError **error)
|
||||
{
|
||||
if (hexchat_set_context (ph, obj->context)) {
|
||||
hexchat_send_modes (ph, targets,
|
||||
if (zoitechat_set_context (ph, obj->context)) {
|
||||
zoitechat_send_modes (ph, targets,
|
||||
g_strv_length ((char**)targets),
|
||||
modes_per_line,
|
||||
sign, mode);
|
||||
@@ -896,7 +896,7 @@ init_dbus (void)
|
||||
|
||||
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
||||
if (connection == NULL) {
|
||||
hexchat_printf (ph, _("Couldn't connect to session bus: %s\n"),
|
||||
zoitechat_printf (ph, _("Couldn't connect to session bus: %s\n"),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
@@ -913,7 +913,7 @@ init_dbus (void)
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_UINT, &request_name_result,
|
||||
G_TYPE_INVALID)) {
|
||||
hexchat_printf (ph, _("Failed to acquire %s: %s\n"),
|
||||
zoitechat_printf (ph, _("Failed to acquire %s: %s\n"),
|
||||
DBUS_SERVICE,
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
@@ -938,7 +938,7 @@ init_dbus (void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* hexchat_plugin stuffs */
|
||||
/* zoitechat_plugin stuffs */
|
||||
|
||||
static char**
|
||||
build_list (char *word[])
|
||||
@@ -964,7 +964,7 @@ build_list (char *word[])
|
||||
}
|
||||
|
||||
static guint
|
||||
context_list_find_id (hexchat_context *context)
|
||||
context_list_find_id (zoitechat_context *context)
|
||||
{
|
||||
GList *l = NULL;
|
||||
|
||||
@@ -977,7 +977,7 @@ context_list_find_id (hexchat_context *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static hexchat_context*
|
||||
static zoitechat_context*
|
||||
context_list_find_context (guint id)
|
||||
{
|
||||
GList *l = NULL;
|
||||
@@ -999,7 +999,7 @@ open_context_cb (char *word[],
|
||||
|
||||
info = g_new0 (ContextInfo, 1);
|
||||
info->id = ++last_context_id;
|
||||
info->context = hexchat_get_context (ph);
|
||||
info->context = zoitechat_get_context (ph);
|
||||
contexts = g_list_prepend (contexts, info);
|
||||
|
||||
return HEXCHAT_EAT_NONE;
|
||||
@@ -1010,7 +1010,7 @@ close_context_cb (char *word[],
|
||||
void *userdata)
|
||||
{
|
||||
GList *l;
|
||||
hexchat_context *context = hexchat_get_context (ph);
|
||||
zoitechat_context *context = zoitechat_get_context (ph);
|
||||
|
||||
for (l = contexts; l != NULL; l = l->next) {
|
||||
if (((ContextInfo*)l->data)->context == context) {
|
||||
@@ -1051,7 +1051,7 @@ unload_plugin_cb (char *word[], char *word_eol[], void *userdata)
|
||||
}
|
||||
|
||||
int
|
||||
dbus_plugin_init (hexchat_plugin *plugin_handle,
|
||||
dbus_plugin_init (zoitechat_plugin *plugin_handle,
|
||||
char **plugin_name,
|
||||
char **plugin_desc,
|
||||
char **plugin_version,
|
||||
@@ -1063,24 +1063,24 @@ dbus_plugin_init (hexchat_plugin *plugin_handle,
|
||||
*plugin_version = PVERSION;
|
||||
|
||||
if (init_dbus()) {
|
||||
/*hexchat_printf (ph, _("%s loaded successfully!\n"), PNAME);*/
|
||||
/*zoitechat_printf (ph, _("%s loaded successfully!\n"), PNAME);*/
|
||||
|
||||
clients = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
g_free,
|
||||
g_object_unref);
|
||||
|
||||
hexchat_hook_print (ph, "Open Context",
|
||||
zoitechat_hook_print (ph, "Open Context",
|
||||
HEXCHAT_PRI_NORM,
|
||||
open_context_cb,
|
||||
NULL);
|
||||
|
||||
hexchat_hook_print (ph, "Close Context",
|
||||
zoitechat_hook_print (ph, "Close Context",
|
||||
HEXCHAT_PRI_NORM,
|
||||
close_context_cb,
|
||||
NULL);
|
||||
|
||||
hexchat_hook_command (ph, "unload",
|
||||
zoitechat_hook_command (ph, "unload",
|
||||
HEXCHAT_PRI_HIGHEST,
|
||||
unload_plugin_cb, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* dbus-plugin.c - hexchat plugin for remote access using DBUS
|
||||
/* dbus-plugin.c - zoitechat plugin for remote access using DBUS
|
||||
* Copyright (C) 2006 Claessens Xavier
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef HEXCHAT_DBUS_PLUGIN_H
|
||||
#define HEXCHAT_DBUS_PLUGIN_H
|
||||
|
||||
int dbus_plugin_init (hexchat_plugin *plugin_handle,
|
||||
int dbus_plugin_init (zoitechat_plugin *plugin_handle,
|
||||
char **plugin_name,
|
||||
char **plugin_desc,
|
||||
char **plugin_version,
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
#include <stdlib.h>
|
||||
#include "../marshal.c"
|
||||
|
||||
#define DBUS_SERVICE "org.hexchat.service"
|
||||
#define DBUS_REMOTE "/org/hexchat/Remote"
|
||||
#define DBUS_REMOTE_CONNECTION_INTERFACE "org.hexchat.connection"
|
||||
#define DBUS_REMOTE_PLUGIN_INTERFACE "org.hexchat.plugin"
|
||||
#define DBUS_SERVICE "org.zoitechat.service"
|
||||
#define DBUS_REMOTE "/org/zoitechat/Remote"
|
||||
#define DBUS_REMOTE_CONNECTION_INTERFACE "org.zoitechat.connection"
|
||||
#define DBUS_REMOTE_PLUGIN_INTERFACE "org.zoitechat.plugin"
|
||||
|
||||
guint command_id;
|
||||
guint server_id;
|
||||
@@ -73,7 +73,7 @@ test_command_cb (DBusGProxy *proxy,
|
||||
G_TYPE_INVALID, G_TYPE_INVALID)) {
|
||||
write_error ("Failed to complete unhook", &error);
|
||||
}
|
||||
/* Now if you write "/test blah" again in the HexChat window
|
||||
/* Now if you write "/test blah" again in the ZoiteChat window
|
||||
* you'll get a "Unknown command" error message */
|
||||
g_print ("test command received: %s\n", word_eol[1]);
|
||||
if (!dbus_g_proxy_call (proxy, "Print",
|
||||
@@ -159,7 +159,7 @@ main (int argc, char **argv)
|
||||
g_print ("Server hook id=%d\n", server_id);
|
||||
|
||||
dbus_g_object_register_marshaller (
|
||||
_hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
_zoitechat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
G_TYPE_NONE,
|
||||
G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT,
|
||||
G_TYPE_INVALID);
|
||||
@@ -195,7 +195,7 @@ main (int argc, char **argv)
|
||||
G_CALLBACK (unload_cb),
|
||||
NULL, NULL);
|
||||
|
||||
/* Now you can write on the HexChat windows: "/test arg1 arg2 ..." */
|
||||
/* Now you can write on the ZoiteChat windows: "/test arg1 arg2 ..." */
|
||||
mainloop = g_main_loop_new (NULL, FALSE);
|
||||
g_main_loop_run (mainloop);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# HexChat
|
||||
# ZoiteChat
|
||||
# Copyright (C) 1998-2010 Peter Zelezny.
|
||||
# Copyright (C) 2009-2013 Berke Viktor.
|
||||
#
|
||||
@@ -23,29 +23,29 @@ from gi.repository import Gio
|
||||
|
||||
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
|
||||
connection = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
|
||||
'org.hexchat.service', '/org/hexchat/Remote', 'org.hexchat.connection', None)
|
||||
'org.zoitechat.service', '/org/zoitechat/Remote', 'org.zoitechat.connection', None)
|
||||
path = connection.Connect('(ssss)',
|
||||
'example.py',
|
||||
'Python example',
|
||||
'Example of a D-Bus client written in python',
|
||||
'1.0')
|
||||
hexchat = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
|
||||
'org.hexchat.service', path, 'org.hexchat.plugin', None)
|
||||
zoitechat = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
|
||||
'org.zoitechat.service', path, 'org.zoitechat.plugin', None)
|
||||
|
||||
# Note the type before every arguement, this must be done.
|
||||
# Type requirements are listed in our docs and characters are listed in the dbus docs.
|
||||
# s = string, u = uint, i = int, etc.
|
||||
|
||||
channels = hexchat.ListGet ('(s)', "channels")
|
||||
while hexchat.ListNext ('(u)', channels):
|
||||
name = hexchat.ListStr ('(us)', channels, "channel")
|
||||
channels = zoitechat.ListGet ('(s)', "channels")
|
||||
while zoitechat.ListNext ('(u)', channels):
|
||||
name = zoitechat.ListStr ('(us)', channels, "channel")
|
||||
print("------- " + name + " -------")
|
||||
hexchat.SetContext ('(u)', hexchat.ListInt ('(us)', channels, "context"))
|
||||
hexchat.EmitPrint ('(sas)', "Channel Message", ["John", "Hi there", "@"])
|
||||
users = hexchat.ListGet ('(s)', "users")
|
||||
while hexchat.ListNext ('(u)', users):
|
||||
print("Nick: " + hexchat.ListStr ('(us)', users, "nick"))
|
||||
hexchat.ListFree ('(u)', users)
|
||||
hexchat.ListFree ('(u)', channels)
|
||||
zoitechat.SetContext ('(u)', zoitechat.ListInt ('(us)', channels, "context"))
|
||||
zoitechat.EmitPrint ('(sas)', "Channel Message", ["John", "Hi there", "@"])
|
||||
users = zoitechat.ListGet ('(s)', "users")
|
||||
while zoitechat.ListNext ('(u)', users):
|
||||
print("Nick: " + zoitechat.ListStr ('(us)', users, "nick"))
|
||||
zoitechat.ListFree ('(u)', users)
|
||||
zoitechat.ListFree ('(u)', channels)
|
||||
|
||||
print(hexchat.Strip ('(sii)', "\00312Blue\003 \002Bold!\002", -1, 1|2))
|
||||
print(zoitechat.Strip ('(sii)', "\00312Blue\003 \002Bold!\002", -1, 1|2))
|
||||
|
||||
@@ -19,16 +19,16 @@ if get_option('dbus-service-use-appid')
|
||||
dbus_output_file = 'io.github.Hexchat.service'
|
||||
dbus_cargs = '-DDBUS_SERVICE="io.github.Hexchat"'
|
||||
else
|
||||
dbus_service_name = 'org.hexchat.service'
|
||||
dbus_output_file = 'org.hexchat.service.service'
|
||||
dbus_cargs = '-DDBUS_SERVICE="org.hexchat.service"'
|
||||
dbus_service_name = 'org.zoitechat.service'
|
||||
dbus_output_file = 'org.zoitechat.service.service'
|
||||
dbus_cargs = '-DDBUS_SERVICE="org.zoitechat.service"'
|
||||
endif
|
||||
|
||||
dbus_conf = configuration_data()
|
||||
dbus_conf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
|
||||
dbus_conf.set('service_name', dbus_service_name)
|
||||
configure_file(
|
||||
input: 'org.hexchat.service.service.in',
|
||||
input: 'org.zoitechat.service.service.in',
|
||||
output: dbus_output_file,
|
||||
configuration: dbus_conf,
|
||||
install: true,
|
||||
@@ -43,7 +43,7 @@ dbus_remote_object = custom_target('remote-object-glue',
|
||||
'--output=@OUTPUT@', '@INPUT@']
|
||||
)
|
||||
|
||||
hexchat_dbus = static_library('hexchatdbus',
|
||||
zoitechat_dbus = static_library('zoitechatdbus',
|
||||
sources: [dbus_remote_object, marshal] + dbus_sources,
|
||||
c_args: dbus_cargs,
|
||||
dependencies: common_deps + dbus_deps,
|
||||
@@ -51,6 +51,6 @@ hexchat_dbus = static_library('hexchatdbus',
|
||||
pic: true
|
||||
)
|
||||
|
||||
hexchat_dbus_dep = declare_dependency(
|
||||
link_with: hexchat_dbus
|
||||
zoitechat_dbus_dep = declare_dependency(
|
||||
link_with: zoitechat_dbus
|
||||
)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[D-BUS Service]
|
||||
Name=@service_name@
|
||||
Exec=@bindir@/hexchat
|
||||
Exec=@bindir@/zoitechat
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<node name="/">
|
||||
|
||||
<interface name="org.hexchat.connection">
|
||||
<interface name="org.zoitechat.connection">
|
||||
<method name="Connect">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<arg type="s" name="filename" direction="in"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
<interface name="org.hexchat.plugin">
|
||||
<interface name="org.zoitechat.plugin">
|
||||
<method name="Command">
|
||||
<arg type="s" name="command" direction="in"/>
|
||||
</method>
|
||||
|
||||
Reference in New Issue
Block a user