Update libqmatrixclient.
This update brings some changes, and more debugging is needed.
This commit is contained in:
parent
6550f2411a
commit
3e9a12e4cb
|
@ -1 +1 @@
|
||||||
Subproject commit dc3acd336e30a17d6b5d0cbe6cde2838737c9030
|
Subproject commit 527a12eb5b6009f679b7e18eceda782f3f5747b7
|
|
@ -230,12 +230,12 @@ Item {
|
||||||
|
|
||||||
if (text.indexOf(PREFIX_ME) === 0) {
|
if (text.indexOf(PREFIX_ME) === 0) {
|
||||||
text = text.substr(PREFIX_ME.length)
|
text = text.substr(PREFIX_ME.length)
|
||||||
currentRoom.postMessage("m.emote", text)
|
matriqueController.postMessage(currentRoom, "m.emote", text)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (text.indexOf(PREFIX_NOTICE) === 0) {
|
if (text.indexOf(PREFIX_NOTICE) === 0) {
|
||||||
text = text.substr(PREFIX_NOTICE.length)
|
text = text.substr(PREFIX_NOTICE.length)
|
||||||
currentRoom.postMessage("m.notice", text)
|
matriqueController.postMessage(currentRoom, "m.notice", text)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (text.indexOf(PREFIX_RAINBOW) === 0) {
|
if (text.indexOf(PREFIX_RAINBOW) === 0) {
|
||||||
|
@ -246,7 +246,7 @@ Item {
|
||||||
for (var i = 0; i < text.length; i++) {
|
for (var i = 0; i < text.length; i++) {
|
||||||
parsedText = parsedText + "<font color='" + rainbowColor[i % 7] + "'>" + text.charAt(i) + "</font>"
|
parsedText = parsedText + "<font color='" + rainbowColor[i % 7] + "'>" + text.charAt(i) + "</font>"
|
||||||
}
|
}
|
||||||
currentRoom.postHtmlMessage(text, parsedText, "m.text")
|
currentRoom.postHtmlMessage(text, parsedText)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (text.indexOf(PREFIX_HTML) === 0) {
|
if (text.indexOf(PREFIX_HTML) === 0) {
|
||||||
|
@ -259,11 +259,11 @@ Item {
|
||||||
if (text.indexOf(PREFIX_MARKDOWN) === 0) {
|
if (text.indexOf(PREFIX_MARKDOWN) === 0) {
|
||||||
text = text.substr(PREFIX_MARKDOWN.length)
|
text = text.substr(PREFIX_MARKDOWN.length)
|
||||||
var parsedText = Markdown.markdown_parser(text)
|
var parsedText = Markdown.markdown_parser(text)
|
||||||
currentRoom.postHtmlMessage(text, parsedText, "m.text")
|
currentRoom.postHtmlMessage(text, parsedText)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
currentRoom.postMessage("m.text", text)
|
matriqueController.postMessage(currentRoom, "m.text", text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,12 @@ void Controller::reconnect() {
|
||||||
m_connection->connectWithToken(userID, token, "");
|
m_connection->connectWithToken(userID, token, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Controller::postMessage(Room* room, const QString& type,
|
||||||
|
const QString& text) {
|
||||||
|
room->postMessage("m.room.message",
|
||||||
|
QJsonObject{{"msgtype", type}, {"body", text}});
|
||||||
|
}
|
||||||
|
|
||||||
void Controller::postFile(Room* room, const QUrl& localFile,
|
void Controller::postFile(Room* room, const QUrl& localFile,
|
||||||
const QUrl& mxcUrl) {
|
const QUrl& mxcUrl) {
|
||||||
const QString mime = getMIME(localFile);
|
const QString mime = getMIME(localFile);
|
||||||
|
|
|
@ -95,6 +95,7 @@ class Controller : public QObject {
|
||||||
void errorOccured();
|
void errorOccured();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void postMessage(Room* room, const QString& type, const QString& text);
|
||||||
void postFile(Room* room, const QUrl& localFile, const QUrl& mxcUrl);
|
void postFile(Room* room, const QUrl& localFile, const QUrl& mxcUrl);
|
||||||
QString getMIME(const QUrl& fileUrl) const;
|
QString getMIME(const QUrl& fileUrl) const;
|
||||||
void forgetRoom(const QString& roomID);
|
void forgetRoom(const QString& roomID);
|
||||||
|
|
|
@ -22,7 +22,6 @@ int main(int argc, char *argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
qRegisterMetaType<Room *>("Room*");
|
qRegisterMetaType<Room *>("Room*");
|
||||||
|
|
||||||
qRegisterMetaType<User *>("User*");
|
qRegisterMetaType<User *>("User*");
|
||||||
|
|
||||||
qmlRegisterType<Controller>("Matrique", 0, 1, "Controller");
|
qmlRegisterType<Controller>("Matrique", 0, 1, "Controller");
|
||||||
|
|
Loading…
Reference in New Issue