summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-10-13 16:09:31 -0400
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-10-13 16:26:53 -0400
commitbb5edab6440c1809bc8ceebd52c040185413abe2 (patch)
tree5ae8b2f0ec56e0e2f8def222b89bb6e85821cddd /src
parent23acb636cb9400179e5ed51c9380acb7ff620e38 (diff)
downloadtelepathy-idle-bb5edab6440c1809bc8ceebd52c040185413abe2.tar.gz
add IrcCommand extension
Used to send arbitrary IRC commands to the server.
Diffstat (limited to 'src')
-rw-r--r--src/idle-connection.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/idle-connection.c b/src/idle-connection.c
index 9ba1d23..7f0aad6 100644
--- a/src/idle-connection.c
+++ b/src/idle-connection.c
@@ -65,12 +65,14 @@ static void _free_alias_pair(gpointer data, gpointer user_data)
static void _aliasing_iface_init(gpointer, gpointer);
static void _renaming_iface_init(gpointer, gpointer);
+static void irc_command_iface_init(gpointer, gpointer);
G_DEFINE_TYPE_WITH_CODE(IdleConnection, idle_connection, TP_TYPE_BASE_CONNECTION,
G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_ALIASING, _aliasing_iface_init);
G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_INFO, idle_contact_info_iface_init);
G_IMPLEMENT_INTERFACE(IDLE_TYPE_SVC_CONNECTION_INTERFACE_RENAMING, _renaming_iface_init);
G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACTS, tp_contacts_mixin_iface_init);
+ G_IMPLEMENT_INTERFACE(IDLE_TYPE_SVC_CONNECTION_INTERFACE_IRC_COMMAND, irc_command_iface_init);
);
typedef struct _IdleOutputPendingMsg IdleOutputPendingMsg;
@@ -1569,3 +1571,25 @@ static void _renaming_iface_init(gpointer g_iface, gpointer iface_data) {
#undef IMPLEMENT
}
+static void
+idle_connection_irc_command_send (IdleSvcConnectionInterfaceIrcCommand *iface,
+ const gchar *command,
+ DBusGMethodInvocation *context)
+{
+ IdleConnection *self = IDLE_CONNECTION(iface);
+
+ _send_with_priority (self, command, SERVER_CMD_NORMAL_PRIORITY);
+
+ dbus_g_method_return (context);
+}
+
+static void irc_command_iface_init(gpointer g_iface,
+ gpointer iface_data)
+{
+ IdleSvcConnectionInterfaceIrcCommandClass *klass = (IdleSvcConnectionInterfaceIrcCommandClass *) g_iface;
+
+#define IMPLEMENT(x) idle_svc_connection_interface_irc_command_implement_##x (\
+ klass, idle_connection_irc_command_##x)
+ IMPLEMENT(send);
+#undef IMPLEMENT
+}