diff --git a/src/Makefile.am b/src/Makefile.am
index 379b756..2087aec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,6 +14,10 @@ libmatrix_convenience_la_SOURCES = \
matrix-handles.h \
matrix-connection.c \
matrix-connection.h \
+ matrix-im-manager.c \
+ matrix-im-manager.h \
+ matrix-muc-manager.c \
+ matrix-muc-manager.h \
$(NULL)
nodist_libmatrix_convenience_la_SOURCES = \
diff --git a/src/matrix-connection.c b/src/matrix-connection.c
index 6d313ac..ad04a8c 100644
--- a/src/matrix-connection.c
+++ b/src/matrix-connection.c
@@ -38,6 +38,17 @@ enum {
PROP_COUNT
};
+static const gchar *interfaces_always_present[] = {
+ TP_IFACE_CONNECTION_INTERFACE_ALIASING,
+ /*
+ TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO,
+ MATRIX_IFACE_CONNECTION_INTERFACE_RENAMING,
+ */
+ TP_IFACE_CONNECTION_INTERFACE_REQUESTS,
+ TP_IFACE_CONNECTION_INTERFACE_CONTACTS,
+ NULL
+};
+
G_DEFINE_TYPE_WITH_CODE(
MatrixConnection, matrix_connection, TP_TYPE_BASE_CONNECTION,
G_IMPLEMENT_INTERFACE(
@@ -414,3 +425,11 @@ matrix_connection_init(MatrixConnection *connection)
tp_base_connection_register_with_contacts_mixin(
(TpBaseConnection *)connection);
}
+
+const gchar * const *
+matrix_connection_get_implemented_interfaces(void)
+{
+ /* We don’t have any conditionally implemented interfaces */
+
+ return interfaces_always_present;
+}
diff --git a/src/matrix-connection.h b/src/matrix-connection.h
index d1343bb..db822de 100644
--- a/src/matrix-connection.h
+++ b/src/matrix-connection.h
@@ -51,6 +51,8 @@ struct _MatrixConnectionClass {
GType matrix_connection_get_type(void) G_GNUC_CONST;
+const gchar * const *matrix_connection_get_implemented_interfaces(void);
+
G_END_DECLS
#endif /* __MATRIX_CONNECTION_H__ */
diff --git a/src/matrix-im-manager.c b/src/matrix-im-manager.c
new file mode 100644
index 0000000..f73c5b9
--- /dev/null
+++ b/src/matrix-im-manager.c
@@ -0,0 +1,45 @@
+/*
+ * This file is part of telepathy-matrix
+ *
+ * telepathy-matrix 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-matrix 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 telepathy-matrix. If not, see
+ * .
+ */
+
+#include "matrix-im-manager.h"
+
+typedef struct _MatrixIMManagerPrivate {
+ /* TODO: You must add something here, or GLib will produce warnings! */
+} MatrixIMManagerPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE(MatrixIMManager, matrix_im_manager, G_TYPE_OBJECT);
+
+static void
+matrix_im_manager_finalize(GObject *gobject)
+{
+ g_signal_handlers_destroy(gobject);
+ G_OBJECT_CLASS(matrix_im_manager_parent_class)->finalize(gobject);
+}
+
+static void
+matrix_im_manager_class_init(MatrixIMManagerClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = matrix_im_manager_finalize;
+}
+
+static void
+matrix_im_manager_init(MatrixIMManager *im_manager)
+{
+}
diff --git a/src/matrix-im-manager.h b/src/matrix-im-manager.h
new file mode 100644
index 0000000..05ee9ee
--- /dev/null
+++ b/src/matrix-im-manager.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of telepathy-matrix
+ *
+ * telepathy-matrix 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-matrix 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 telepathy-matrix. If not, see
+ * .
+ */
+
+#ifndef __MATRIX_IM_MANAGER_H__
+#define __MATRIX_IM_MANAGER_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define MATRIX_TYPE_IM_MANAGER (matrix_im_manager_get_type())
+#define MATRIX_IM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), MATRIX_TYPE_IM_MANAGER, MatrixIMManager))
+#define MATRIX_IM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MATRIX_TYPE_IM_MANAGER, MatrixIMManagerClass))
+#define MATRIX_IS_IM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), MATRIX_TYPE_IM_MANAGER))
+#define MATRIX_IS_IM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), MATRIX_TYPE_IM_MANAGER))
+#define MATRIX_IM_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MATRIX_TYPE_IM_MANAGER, MatrixIMManagerClass))
+
+typedef struct _MatrixIMManager MatrixIMManager;
+typedef struct _MatrixIMManagerClass MatrixIMManagerClass;
+
+struct _MatrixIMManager {
+ /* Parent instance structure */
+ GObject parent_instance;
+
+ /* Instance members */
+};
+
+struct _MatrixIMManagerClass {
+ GObjectClass parent_class;
+};
+
+GType matrix_im_manager_get_type(void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __MATRIX_IM_MANAGER_H__ */
diff --git a/src/matrix-muc-manager.c b/src/matrix-muc-manager.c
new file mode 100644
index 0000000..8eb38f7
--- /dev/null
+++ b/src/matrix-muc-manager.c
@@ -0,0 +1,45 @@
+/*
+ * This file is part of telepathy-matrix
+ *
+ * telepathy-matrix 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-matrix 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 telepathy-matrix. If not, see
+ * .
+ */
+
+#include "matrix-muc-manager.h"
+
+typedef struct _MatrixMUCManagerPrivate {
+ /* TODO: You must add something here, or GLib will produce warnings! */
+} MatrixMUCManagerPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE(MatrixMUCManager, matrix_muc_manager, G_TYPE_OBJECT);
+
+static void
+matrix_muc_manager_finalize(GObject *gobject)
+{
+ g_signal_handlers_destroy(gobject);
+ G_OBJECT_CLASS(matrix_muc_manager_parent_class)->finalize(gobject);
+}
+
+static void
+matrix_muc_manager_class_init(MatrixMUCManagerClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = matrix_muc_manager_finalize;
+}
+
+static void
+matrix_muc_manager_init(MatrixMUCManager *muc_manager)
+{
+}
diff --git a/src/matrix-muc-manager.h b/src/matrix-muc-manager.h
new file mode 100644
index 0000000..37a228c
--- /dev/null
+++ b/src/matrix-muc-manager.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of telepathy-matrix
+ *
+ * telepathy-matrix 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-matrix 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 telepathy-matrix. If not, see
+ * .
+ */
+
+#ifndef __MATRIX_MUC_MANAGER_H__
+#define __MATRIX_MUC_MANAGER_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define MATRIX_TYPE_MUC_MANAGER (matrix_muc_manager_get_type())
+#define MATRIX_MUC_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), MATRIX_TYPE_MUC_MANAGER, MatrixMUCManager))
+#define MATRIX_MUC_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MATRIX_TYPE_MUC_MANAGER, MatrixMUCManagerClass))
+#define MATRIX_IS_MUC_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), MATRIX_TYPE_MUC_MANAGER))
+#define MATRIX_IS_MUC_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), MATRIX_TYPE_MUC_MANAGER))
+#define MATRIX_MUC_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MATRIX_TYPE_MUC_MANAGER, MatrixMUCManagerClass))
+
+typedef struct _MatrixMUCManager MatrixMUCManager;
+typedef struct _MatrixMUCManagerClass MatrixMUCManagerClass;
+
+struct _MatrixMUCManager {
+ /* Parent instance structure */
+ GObject parent_instance;
+
+ /* Instance members */
+};
+
+struct _MatrixMUCManagerClass {
+ GObjectClass parent_class;
+};
+
+GType matrix_muc_manager_get_type(void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __MATRIX_MUC_MANAGER_H__ */
diff --git a/src/matrix-protocol.c b/src/matrix-protocol.c
index 774733f..c67cace 100644
--- a/src/matrix-protocol.c
+++ b/src/matrix-protocol.c
@@ -19,10 +19,15 @@
#include "matrix-protocol.h"
#include "matrix-handles.h"
#include "matrix-connection.h"
+#include "matrix-im-manager.h"
+#include "matrix-muc-manager.h"
#include
#define PROTOCOL_NAME "matrix"
+#define ICON_NAME "im-" PROTOCOL_NAME
+#define ENGLISH_NAME "Matrix"
+#define VCARD_FIELD_NAME "x-" PROTOCOL_NAME
static gboolean filter_account(const TpCMParamSpec *, GValue *, GError **);
@@ -125,6 +130,42 @@ get_interfaces_array(TpBaseProtocol *protocol)
return interfaces;
}
+static void
+get_connection_details(TpBaseProtocol *protocol,
+ GStrv *connection_interfaces,
+ GType **channel_managers,
+ gchar **icon_name,
+ gchar **english_name,
+ gchar **vcard_field)
+{
+ if (connection_interfaces != NULL) {
+ *connection_interfaces = g_strdupv(
+ (GStrv)matrix_connection_get_implemented_interfaces());
+ }
+
+ if (channel_managers != NULL) {
+ GType types[] = {
+ MATRIX_TYPE_IM_MANAGER,
+ MATRIX_TYPE_MUC_MANAGER,
+ G_TYPE_INVALID
+ };
+
+ *channel_managers = g_memdup(types, sizeof(types));
+ }
+
+ if (icon_name != NULL) {
+ *icon_name = g_strdup(ICON_NAME);
+ }
+
+ if (vcard_field != NULL) {
+ *vcard_field = g_strdup(VCARD_FIELD_NAME);
+ }
+
+ if (english_name != NULL) {
+ *english_name = g_strdup(ENGLISH_NAME);
+ }
+}
+
static void
matrix_protocol_class_init(MatrixProtocolClass *klass)
{
@@ -135,8 +176,8 @@ matrix_protocol_class_init(MatrixProtocolClass *klass)
base_class->normalize_contact = normalize_contact;
base_class->identify_account = identify_account;
base_class->get_interfaces_array = get_interfaces_array;
- /*
base_class->get_connection_details = get_connection_details;
+ /*
base_class->dup_authentication_types = dup_authentication_types;
*/
}