summary refs log tree commit diff
path: root/src/MatrixClient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MatrixClient.cpp')
-rw-r--r--src/MatrixClient.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/MatrixClient.cpp b/src/MatrixClient.cpp
new file mode 100644
index 00000000..e41c66c1
--- /dev/null
+++ b/src/MatrixClient.cpp
@@ -0,0 +1,38 @@
+#include "MatrixClient.h"
+
+#include <memory>
+
+namespace {
+auto client_ = std::make_shared<mtx::http::Client>();
+}
+
+namespace http {
+
+mtx::http::Client *
+client()
+{
+        return client_.get();
+}
+
+bool
+is_logged_in()
+{
+        return !client_->access_token().empty();
+}
+
+void
+init()
+{
+        qRegisterMetaType<mtx::responses::Login>();
+        qRegisterMetaType<mtx::responses::Messages>();
+        qRegisterMetaType<mtx::responses::Notifications>();
+        qRegisterMetaType<mtx::responses::Rooms>();
+        qRegisterMetaType<mtx::responses::Sync>();
+        qRegisterMetaType<mtx::responses::JoinedGroups>();
+        qRegisterMetaType<mtx::responses::GroupProfile>();
+        qRegisterMetaType<std::string>();
+        qRegisterMetaType<std::vector<std::string>>();
+        qRegisterMetaType<std::vector<QString>>();
+}
+
+} // namespace http