aboutsummaryrefslogtreecommitdiffstats
path: root/libmatrix.c
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2015-10-22 17:08:58 +0100
committerRichard van der Hoff <richard@matrix.org>2015-10-22 17:17:04 +0100
commitcaff31061b68f3b26a889931503a61bf12b76329 (patch)
treee2068ca47d776c5c5760394a1807fcb7fb44dcb3 /libmatrix.c
parente8c4ddde265c060eb1466f39d3feb09694dd3482 (diff)
downloadpurple-matrix-caff31061b68f3b26a889931503a61bf12b76329.tar.gz
Refactor the connection code
Move all matrix-login and bits of matrix-sync into matrix-connection, where it seems to make more sense. Also move MatrixConnectionData into matrix-connection.h
Diffstat (limited to 'libmatrix.c')
-rw-r--r--libmatrix.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/libmatrix.c b/libmatrix.c
index 6712119..1a2a45f 100644
--- a/libmatrix.c
+++ b/libmatrix.c
@@ -45,7 +45,7 @@
#include "util.h"
#include "version.h"
-#include "matrix-login.h"
+#include "matrix-connection.h"
#include "matrix-room.h"
/**
@@ -62,6 +62,26 @@ static const char *matrixprpl_list_icon(PurpleAccount *acct, PurpleBuddy *buddy)
return "matrix";
}
+/**
+ * Start the connection to a matrix account
+ */
+void matrixprpl_login(PurpleAccount *acct)
+{
+ PurpleConnection *pc = purple_account_get_connection(acct);
+ matrix_connection_new(pc);
+ matrix_connection_start_login(pc);
+}
+
+
+/**
+ * Called to handle closing the connection to an account
+ */
+static void matrixprpl_close(PurpleConnection *pc)
+{
+ matrix_connection_free(pc);
+}
+
+
/* Get the list of information we need to add a chat to our buddy list */
static GList *matrixprpl_chat_info(PurpleConnection *gc)
{
@@ -396,12 +416,6 @@ static GList *matrixprpl_blist_node_menu(PurpleBlistNode *node) {
}
}
-static void matrixprpl_close(PurpleConnection *gc)
-{
- /* notify other matrixprpl accounts */
- foreach_matrixprpl_gc(report_status_change, gc, NULL);
-}
-
static int matrixprpl_send_im(PurpleConnection *gc, const char *who,
const char *message, PurpleMessageFlags flags)
{