summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Barnett <jbarnett@stanfordalumni.org>2012-05-03 10:52:31 -0700
committerJoe Barnett <jbarnett@stanfordalumni.org>2012-05-03 10:52:31 -0700
commitd08426dabddc84a1c845217e1d7f44c2a28ff708 (patch)
tree8e5d9424a8a23ad3fd929644f44c29c180ca2162
parent041ac655fd644408d39bd9b4cb31b1b4a7578628 (diff)
start of roomlist manager/channel
-rw-r--r--src/Makefile.am6
-rw-r--r--src/kindling-connection.c13
-rw-r--r--src/kindling-muc-manager.c30
-rw-r--r--src/kindling-muc-manager.h2
-rw-r--r--src/kindling-roomlist-channel.c134
-rw-r--r--src/kindling-roomlist-channel.h56
-rw-r--r--src/kindling-roomlist-manager.c230
-rw-r--r--src/kindling-roomlist-manager.h58
8 files changed, 494 insertions, 35 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7d28786..f2dfdc1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,7 +25,11 @@ telepathy_kindling_SOURCES = \
kindling-connection.c \
kindling-connection.h \
kindling-muc-manager.c \
- kindling-muc-manager.h
+ kindling-muc-manager.h \
+ kindling-roomlist-manager.c \
+ kindling-roomlist-manager.h \
+ kindling-roomlist-channel.c \
+ kindling-roomlist-channel.h
telepathy_kindling_LDFLAGS = \
-Wl,--export-dynamic
diff --git a/src/kindling-connection.c b/src/kindling-connection.c
index 96e5931..6e9a79d 100644
--- a/src/kindling-connection.c
+++ b/src/kindling-connection.c
@@ -17,6 +17,7 @@ telepathy-kindling is free software: you can redistribute it and/or modify it
* along with this program. If not, see <http://www.gnu.org/licenses/>.";
*/
#include "kindling-connection.h"
+#include "kindling-roomlist-manager.h"
#include "kindling-muc-manager.h"
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/handle-repo-dynamic.h>
@@ -55,7 +56,7 @@ struct _KindlingConnectionPrivate {
char *password;
char *api_token;
- KindlingMUCManager *muc_manager;
+ KindlingRoomlistManager *roomlist_manager;
//for actual auth
TpSimplePasswordManager *password_manager;
@@ -227,12 +228,14 @@ static GPtrArray *_iface_create_channel_managers(TpBaseConnection *self) {
g_printf("connection create chan manager\n");
KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self);
GPtrArray *managers = g_ptr_array_sized_new (1);
- priv->muc_manager = g_object_new (KINDLING_TYPE_MUC_MANAGER,
+ priv->roomlist_manager = g_object_new (KINDLING_TYPE_ROOMLIST_MANAGER,
"connection", self,
NULL);
- g_ptr_array_add (managers, priv->muc_manager);
+ g_ptr_array_add (managers, priv->roomlist_manager);
priv->password_manager = tp_simple_password_manager_new(self);
g_ptr_array_add(managers, priv->password_manager);
+
+ g_ptr_array_add(managers, g_object_new (KINDLING_TYPE_MUC_MANAGER, "connection", self, NULL));
return managers;
}
@@ -385,13 +388,13 @@ static void _print_status_cb (TpBaseConnection *self) {
static void _connected_cb (TpBaseConnection *self) {
g_printf("Status is : %d (connected) \n", self->status);
KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self);
- kindling_muc_manager_connected(priv->muc_manager);
+ //kindling_roomlist_manager_connected(priv->roomlist_manager);
}
static void _disconnected_cb (TpBaseConnection *self) {
g_printf("Status is : %d (disconnected) \n", self->status);
KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self);
- kindling_muc_manager_disconnected(priv->muc_manager);
+ //kindling_roomlist_manager_disconnected(priv->roomlist_manager);
}
static void
diff --git a/src/kindling-muc-manager.c b/src/kindling-muc-manager.c
index 69518d5..6e72194 100644
--- a/src/kindling-muc-manager.c
+++ b/src/kindling-muc-manager.c
@@ -39,7 +39,6 @@ enum {
typedef struct _KindlingMUCManagerPrivate KindlingMUCManagerPrivate;
struct _KindlingMUCManagerPrivate {
KindlingConnection *conn;
- GHashTable *channels;
guint timeout_id;
};
@@ -88,29 +87,6 @@ kindling_muc_manager_finalize (GObject *object)
G_OBJECT_CLASS (kindling_muc_manager_parent_class)->finalize (object);
}
-static void
-_list_channels_cb (SoupSession *session, SoupMessage *msg, gpointer user_data) {
- g_printf("got room list:\n\t%s\n",msg->response_body->data);
-}
-static gboolean _poll_channels_cb (gpointer data) {
- KindlingMUCManager *manager = KINDLING_MUC_MANAGER(data);
- KindlingMUCManagerPrivate *priv = KINDLING_MUC_MANAGER_GET_PRIVATE(manager);
- KindlingConnection *conn = priv->conn;
- g_printf("polling for channels\n");
- kindling_connection_list_rooms (conn, _list_channels_cb, manager);
- return TRUE;
-}
-
-void kindling_muc_manager_connected(KindlingMUCManager *manager) {
- KindlingMUCManagerPrivate *priv = KINDLING_MUC_MANAGER_GET_PRIVATE(manager);
- _poll_channels_cb(manager);
- priv->timeout_id = g_timeout_add_seconds (300, _poll_channels_cb, manager);
-}
-
-void kindling_muc_manager_disconnected(KindlingMUCManager *manager) {
- KindlingMUCManagerPrivate *priv = KINDLING_MUC_MANAGER_GET_PRIVATE(manager);
- g_source_remove (priv->timeout_id);
-}
static void kindling_muc_manager_foreach_channel(TpChannelManager *manager, TpExportableChannelFunc func, gpointer data) {
g_printf("foreach channel\n");
@@ -145,19 +121,19 @@ static void kindling_muc_manager_type_foreach_channel_class(GType type, TpChanne
static void kindling_muc_manager_ensure_channel(TpChannelManager *manager,
gpointer request_token,
GHashTable *request_properties) {
- g_printf("ensure channel\n");
+ g_printf("ensure channel %s\n", tp_asv_get_string (request_properties,TP_IFACE_CHANNEL ".ChannelType"));
}
static void kindling_muc_manager_request_channel(TpChannelManager *manager,
gpointer request_token,
GHashTable *request_properties) {
- g_printf("request channel\n");
+ g_printf("request channel %s\n", tp_asv_get_string (request_properties,TP_IFACE_CHANNEL ".ChannelType"));
}
static void kindling_muc_manager_create_channel(TpChannelManager *manager,
gpointer request_token,
GHashTable *request_properties) {
- g_printf("create channel\n");
+ g_printf("create channel %s\n", tp_asv_get_string (request_properties,TP_IFACE_CHANNEL ".ChannelType"));
}
static void
diff --git a/src/kindling-muc-manager.h b/src/kindling-muc-manager.h
index 97472b3..330eb61 100644
--- a/src/kindling-muc-manager.h
+++ b/src/kindling-muc-manager.h
@@ -50,8 +50,6 @@ struct _KindlingMUCManager
GType kindling_muc_manager_get_type (void) G_GNUC_CONST;
-void kindling_muc_manager_connected(KindlingMUCManager *manager);
-void kindling_muc_manager_disconnected(KindlingMUCManager *manager);
G_END_DECLS
diff --git a/src/kindling-roomlist-channel.c b/src/kindling-roomlist-channel.c
new file mode 100644
index 0000000..4f95a1d
--- /dev/null
+++ b/src/kindling-roomlist-channel.c
@@ -0,0 +1,134 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * telepathy-kindling
+ * Copyright (C) Joe Barnett 2012 <jbarnett@taplop>
+ *
+telepathy-kindling is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * telepathy-kindling is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.";
+ */
+
+#include "kindling-roomlist-channel.h"
+#include "kindling-connection.h"
+#include <telepathy-glib/svc-channel.h>
+#include <telepathy-glib/interfaces.h>
+
+
+static void roomlist_iface_init (gpointer, gpointer);
+
+G_DEFINE_TYPE_WITH_CODE (KindlingRoomlistChannel, kindling_roomlist_channel,
+ TP_TYPE_BASE_CHANNEL,
+ G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CHANNEL_TYPE_ROOM_LIST, roomlist_iface_init));
+
+enum {
+ PROP_CONNECTION = 1,
+ LAST_PROPERTY_ENUM
+};
+
+typedef struct _KindlingRoomlistChannelPrivate KindlingRoomlistChannelPrivate;
+struct _KindlingRoomlistChannelPrivate {
+ KindlingConnection *conn;
+
+};
+#define KINDLING_ROOMLIST_CHANNEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), KINDLING_TYPE_ROOMLIST_CHANNEL, KindlingRoomlistChannelPrivate))
+
+static void kindling_roomlist_channel_set_property(GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) {
+ g_printf("roomlist-channel set prop %d\n", prop_id);
+ KindlingRoomlistChannelPrivate *priv = KINDLING_ROOMLIST_CHANNEL_GET_PRIVATE(obj);
+ switch (prop_id) {
+ case PROP_CONNECTION:
+ priv->conn = g_value_get_object(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec);
+ break;
+ }
+}
+
+static void kindling_roomlist_channel_get_property(GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) {
+ g_printf("roomlist-channel get prop %d\n", prop_id);
+ KindlingRoomlistChannelPrivate *priv = KINDLING_ROOMLIST_CHANNEL_GET_PRIVATE(obj);
+ switch (prop_id) {
+ case PROP_CONNECTION:
+ g_value_set_object(value, priv->conn);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec);
+ break;
+ }
+
+}
+static void
+kindling_roomlist_channel_init (KindlingRoomlistChannel *kindling_roomlist_channel)
+{
+
+ g_printf("roomlist init\n");
+
+ /* TODO: Add initialization code here */
+}
+
+static void
+kindling_roomlist_channel_finalize (GObject *object)
+{
+ /* TODO: Add deinitalization code here */
+ g_printf("roomlist finalize\n");
+
+ G_OBJECT_CLASS (kindling_roomlist_channel_parent_class)->finalize (object);
+}
+static const gchar *kindling_roomlist_channel_interfaces[] = {
+ NULL
+};
+
+static void
+kindling_roomlist_channel_class_init (KindlingRoomlistChannelClass *klass)
+{
+ g_printf("roomlist class init\n");
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ TpBaseChannelClass* parent_class = TP_BASE_CHANNEL_CLASS (klass);
+ GParamSpec *param_spec;
+ g_type_class_add_private (klass, sizeof(KindlingRoomlistChannelPrivate));
+
+ object_class->set_property = kindling_roomlist_channel_set_property;
+ object_class->get_property = kindling_roomlist_channel_get_property;
+ object_class->finalize = kindling_roomlist_channel_finalize;
+ parent_class->channel_type = TP_IFACE_CHANNEL_TYPE_ROOM_LIST;
+ parent_class->interfaces = kindling_roomlist_channel_interfaces;
+ param_spec = g_param_spec_object
+ ("connection", "connection", "connection", KINDLING_TYPE_CONNECTION, G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
+}
+
+static void
+kindling_roomlist_channel_stop_listing (TpSvcChannelTypeRoomList *iface,
+ DBusGMethodInvocation *context) {
+ g_printf("roomlist stop listing\n");
+}
+
+static void
+kindling_roomlist_channel_list_rooms (TpSvcChannelTypeRoomList *iface,
+ DBusGMethodInvocation *context) {
+ g_printf("roomlist list rooms\n");
+}
+
+static void
+kindling_roomlist_channel_get_listing_rooms (TpSvcChannelTypeRoomList *iface,
+ DBusGMethodInvocation *context) {
+ g_printf("roomlist is listing?\n");
+}
+
+static void roomlist_iface_init (gpointer g_iface, gpointer iface_data) {
+ TpSvcChannelTypeRoomListClass *klass = (TpSvcChannelTypeRoomListClass *) g_iface;
+ tp_svc_channel_type_room_list_implement_get_listing_rooms (klass, kindling_roomlist_channel_get_listing_rooms);
+ tp_svc_channel_type_room_list_implement_list_rooms (klass, kindling_roomlist_channel_list_rooms);
+ tp_svc_channel_type_room_list_implement_stop_listing (klass, kindling_roomlist_channel_stop_listing);
+}
+
diff --git a/src/kindling-roomlist-channel.h b/src/kindling-roomlist-channel.h
new file mode 100644
index 0000000..8c33e6d
--- /dev/null
+++ b/src/kindling-roomlist-channel.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * telepathy-kindling
+ * Copyright (C) Joe Barnett 2012 <jbarnett@taplop>
+ *
+telepathy-kindling is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * telepathy-kindling is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.";
+ */
+
+#ifndef _KINDLING_ROOMLIST_CHANNEL_H_
+#define _KINDLING_ROOMLIST_CHANNEL_H_
+
+#include <glib-object.h>
+#include <telepathy-glib/base-channel.h>
+
+G_BEGIN_DECLS
+
+#define KINDLING_TYPE_ROOMLIST_CHANNEL (kindling_roomlist_channel_get_type ())
+#define KINDLING_ROOMLIST_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KINDLING_TYPE_ROOMLIST_CHANNEL, KindlingRoomlistChannel))
+#define KINDLING_ROOMLIST_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KINDLING_TYPE_ROOMLIST_CHANNEL, KindlingRoomlistChannelClass))
+#define KINDLING_IS_ROOMLIST_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KINDLING_TYPE_ROOMLIST_CHANNEL))
+#define KINDLING_IS_ROOMLIST_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KINDLING_TYPE_ROOMLIST_CHANNEL))
+#define KINDLING_ROOMLIST_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KINDLING_TYPE_ROOMLIST_CHANNEL, KindlingRoomlistChannelClass))
+
+typedef struct _KindlingRoomlistChannelClass KindlingRoomlistChannelClass;
+typedef struct _KindlingRoomlistChannel KindlingRoomlistChannel;
+
+
+
+struct _KindlingRoomlistChannelClass
+{
+ TpBaseChannelClass parent_class;
+};
+
+struct _KindlingRoomlistChannel
+{
+ TpBaseChannel parent_instance;
+
+
+};
+
+GType kindling_roomlist_channel_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* _KINDLING_ROOMLIST_CHANNEL_H_ */
diff --git a/src/kindling-roomlist-manager.c b/src/kindling-roomlist-manager.c
new file mode 100644
index 0000000..272b1bc
--- /dev/null
+++ b/src/kindling-roomlist-manager.c
@@ -0,0 +1,230 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * telepathy-kindling
+ * Copyright (C) Joe Barnett 2012 <jbarnett@taplop>
+ *
+telepathy-kindling is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * telepathy-kindling is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.";
+ */
+
+#include "kindling-roomlist-manager.h"
+#include "kindling-roomlist-channel.h"
+#include "kindling-connection.h"
+#include <telepathy-glib/channel-manager.h>
+#include <telepathy-glib/interfaces.h>
+
+
+static void _roomlist_manager_iface_init(gpointer, gpointer);
+
+
+G_DEFINE_TYPE_WITH_CODE (KindlingRoomlistManager, kindling_roomlist_manager, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE(TP_TYPE_CHANNEL_MANAGER, _roomlist_manager_iface_init));
+
+enum {
+ PROP_CONNECTION = 1,
+ LAST_PROPERTY_ENUM
+};
+
+typedef struct _KindlingRoomlistManagerPrivate KindlingRoomlistManagerPrivate;
+struct _KindlingRoomlistManagerPrivate {
+ KindlingConnection *conn;
+ GPtrArray *channels;
+ guint timeout_id;
+
+};
+#define KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), KINDLING_TYPE_ROOMLIST_MANAGER, KindlingRoomlistManagerPrivate))
+
+static void kindling_roomlist_manager_set_property(GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) {
+ g_printf("roomlist-manager set prop %d\n", prop_id);
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(obj);
+ switch (prop_id) {
+ case PROP_CONNECTION:
+ priv->conn = g_value_get_object(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec);
+ break;
+ }
+}
+
+static void kindling_roomlist_manager_get_property(GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) {
+ g_printf("roomlist-manager get prop %d\n", prop_id);
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(obj);
+ switch (prop_id) {
+ case PROP_CONNECTION:
+ g_value_set_object(value, priv->conn);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec);
+ break;
+ }
+
+}
+
+static void
+_list_channels_cb (SoupSession *session, SoupMessage *msg, gpointer user_data) {
+ g_printf("got room list:\n\t%s\n",msg->response_body->data);
+}
+static gboolean _poll_channels_cb (gpointer data) {
+ KindlingRoomlistManager *manager = KINDLING_ROOMLIST_MANAGER(data);
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(manager);
+ KindlingConnection *conn = priv->conn;
+ g_printf("polling for channels\n");
+ kindling_connection_list_rooms (conn, _list_channels_cb, manager);
+ return TRUE;
+}
+
+void kindling_roomlist_manager_connected(KindlingRoomlistManager *manager) {
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(manager);
+ _poll_channels_cb(manager);
+ priv->timeout_id = g_timeout_add_seconds (300, _poll_channels_cb, manager);
+}
+
+void kindling_roomlist_manager_disconnected(KindlingRoomlistManager *manager) {
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(manager);
+ g_source_remove (priv->timeout_id);
+}
+
+
+static void
+kindling_roomlist_manager_init (KindlingRoomlistManager *self)
+{
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(self);
+ priv->channels = g_ptr_array_sized_new (1);
+}
+
+static void
+kindling_roomlist_manager_finalize (GObject *object)
+{
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(object);
+ g_ptr_array_unref (priv->channels);
+
+ G_OBJECT_CLASS (kindling_roomlist_manager_parent_class)->finalize (object);
+}
+
+static void
+kindling_roomlist_manager_class_init (KindlingRoomlistManagerClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GObjectClass* parent_class = G_OBJECT_CLASS (klass);
+ GParamSpec *param_spec;
+
+ g_type_class_add_private (klass, sizeof(KindlingRoomlistManagerPrivate));
+
+ object_class->set_property = kindling_roomlist_manager_set_property;
+ object_class->get_property = kindling_roomlist_manager_get_property;
+ object_class->finalize = kindling_roomlist_manager_finalize;
+ param_spec = g_param_spec_object ("connection", "connection", "kindling connection", KINDLING_TYPE_CONNECTION, G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
+}
+
+static void kindling_roomlist_manager_foreach_channel (TpChannelManager *manager,
+ TpExportableChannelFunc foreach,
+ gpointer user_data) {
+ g_printf("foreach_channel\n");
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(manager);
+ guint i;
+ for (i = 0; i < priv->channels->len; i++) {
+ TpExportableChannel *channel = TP_EXPORTABLE_CHANNEL (
+ g_ptr_array_index (priv->channels, i));
+ foreach(channel, user_data);
+ }
+}
+
+static const gchar * const roomlist_channel_fixed_properties[] = {
+ TP_IFACE_CHANNEL ".ChannelType",
+ TP_IFACE_CHANNEL ".TargetHandleType",
+ NULL
+};
+
+static const gchar * const roomlist_channel_allowed_properties[] = {
+ TP_IFACE_CHANNEL_TYPE_ROOM_LIST ".Server",
+ NULL
+};
+
+static void kindling_roomlist_manager_type_foreach_channel_class (GType type,
+ TpChannelManagerTypeChannelClassFunc func,
+ gpointer user_data) {
+ g_printf("type_foreach_channel_class\n");
+ GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
+ NULL, (GDestroyNotify) tp_g_value_slice_free);
+ GValue *value;
+
+ value = tp_g_value_slice_new (G_TYPE_STRING);
+ g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_ROOM_LIST);
+ g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType", value);
+
+ value = tp_g_value_slice_new (G_TYPE_UINT);
+ g_value_set_uint (value, TP_HANDLE_TYPE_NONE);
+ g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType", value);
+
+ func (type, table, roomlist_channel_allowed_properties, user_data);
+ g_hash_table_unref (table);
+}
+
+
+static gboolean kindling_roomlist_manager_get_channel(TpChannelManager *manager,
+ gpointer request_token,
+ GHashTable *request_properties,
+ gboolean require_new) {
+ KindlingRoomlistManagerPrivate *priv = KINDLING_ROOMLIST_MANAGER_GET_PRIVATE(manager);
+ TpExportableChannel *channel;
+ g_printf("get channel %s\n", tp_asv_get_string (request_properties,TP_IFACE_CHANNEL ".ChannelType"));
+ if (tp_strdiff (tp_asv_get_string (request_properties, TP_IFACE_CHANNEL".ChannelType"),
+ TP_IFACE_CHANNEL_TYPE_ROOM_LIST)) {
+ return FALSE;
+ }
+ if (priv->channels->len > 0) {
+ tp_channel_manager_emit_request_already_satisfied (manager, request_token, TP_EXPORTABLE_CHANNEL(g_ptr_array_index (priv->channels,0)));
+ return TRUE;
+ }
+ channel = g_object_new(KINDLING_TYPE_ROOMLIST_CHANNEL, "connection", priv->conn);
+ g_ptr_array_add(priv->channels, channel);
+ GSList *request_tokens = g_slist_prepend (NULL, request_token);
+ tp_channel_manager_emit_new_channel (manager,
+ TP_EXPORTABLE_CHANNEL(channel),
+ request_tokens);
+ g_slist_free (request_tokens);
+ return FALSE;
+}
+
+static gboolean kindling_roomlist_manager_ensure_channel(TpChannelManager *manager,
+ gpointer request_token,
+ GHashTable *request_properties) {
+ return kindling_roomlist_manager_get_channel(manager, request_token, request_properties, FALSE);
+}
+
+static gboolean kindling_roomlist_manager_request_channel(TpChannelManager *manager,
+ gpointer request_token,
+ GHashTable *request_properties) {
+ return kindling_roomlist_manager_get_channel(manager, request_token, request_properties, FALSE);
+}
+
+
+static gboolean kindling_roomlist_manager_create_channel(TpChannelManager *manager,
+ gpointer request_token,
+ GHashTable *request_properties) {
+ return kindling_roomlist_manager_get_channel(manager, request_token, request_properties, TRUE);
+}
+
+
+static void _roomlist_manager_iface_init(gpointer g_iface, gpointer iface_data) {
+ g_printf("iface init kindling roomlist manager\n");
+ TpChannelManagerIface *iface = g_iface;
+ iface->foreach_channel = kindling_roomlist_manager_foreach_channel;
+ iface->type_foreach_channel_class = kindling_roomlist_manager_type_foreach_channel_class;
+ iface->ensure_channel = kindling_roomlist_manager_ensure_channel;
+ iface->request_channel = kindling_roomlist_manager_request_channel;
+ iface->create_channel = kindling_roomlist_manager_create_channel;
+}
+
diff --git a/src/kindling-roomlist-manager.h b/src/kindling-roomlist-manager.h
new file mode 100644
index 0000000..ffc35ff
--- /dev/null
+++ b/src/kindling-roomlist-manager.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * telepathy-kindling
+ * Copyright (C) Joe Barnett 2012 <jbarnett@taplop>
+ *
+telepathy-kindling is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * telepathy-kindling is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.";
+ */
+
+#ifndef _KINDLING_ROOMLIST_MANAGER_H_
+#define _KINDLING_ROOMLIST_MANAGER_H_
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define KINDLING_TYPE_ROOMLIST_MANAGER (kindling_roomlist_manager_get_type ())
+#define KINDLING_ROOMLIST_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KINDLING_TYPE_ROOMLIST_MANAGER, KindlingRoomlistManager))
+#define KINDLING_ROOMLIST_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KINDLING_TYPE_ROOMLIST_MANAGER, KindlingRoomlistManagerClass))
+#define KINDLING_IS_ROOMLIST_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KINDLING_TYPE_ROOMLIST_MANAGER))
+#define KINDLING_IS_ROOMLIST_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KINDLING_TYPE_ROOMLIST_MANAGER))
+#define KINDLING_ROOMLIST_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KINDLING_TYPE_ROOMLIST_MANAGER, KindlingRoomlistManagerClass))
+
+typedef struct _KindlingRoomlistManagerClass KindlingRoomlistManagerClass;
+typedef struct _KindlingRoomlistManager KindlingRoomlistManager;
+
+
+
+struct _KindlingRoomlistManagerClass
+{
+ GObjectClass parent_class;
+};
+
+struct _KindlingRoomlistManager
+{
+ GObject parent_instance;
+
+
+};
+
+GType kindling_roomlist_manager_get_type (void) G_GNUC_CONST;
+
+void kindling_roomlist_manager_connected(KindlingRoomlistManager *manager);
+void kindling_roomlist_manager_disconnected(KindlingRoomlistManager *manager);
+
+G_END_DECLS
+
+#endif /* _KINDLING_ROOMLIST_MANAGER_H_ */