Make the SendBox work, send plaintext messages
This commit is contained in:
parent
6ab4acdc84
commit
a7649d1a7a
|
@ -185,3 +185,15 @@ class Client(QObject):
|
||||||
self.roomEventReceived.emit(
|
self.roomEventReceived.emit(
|
||||||
room_id, type(ev).__name__, ev.__dict__
|
room_id, type(ev).__name__, ev.__dict__
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pyqtSlot(str, str)
|
||||||
|
@futurize
|
||||||
|
def sendMessage(self, room_id: str, text: str) -> None:
|
||||||
|
content = {
|
||||||
|
"body": text,
|
||||||
|
"formatted_body": text,
|
||||||
|
"format": "org.matrix.custom.html",
|
||||||
|
"msgtype": "m.text",
|
||||||
|
}
|
||||||
|
self.net.talk(self.nio.room_send, room_id, "m.room.message", content)
|
||||||
|
|
|
@ -49,7 +49,10 @@ class NetworkManager:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _close_socket(sock: socket.socket) -> None:
|
def _close_socket(sock: socket.socket) -> None:
|
||||||
|
try:
|
||||||
sock.shutdown(how=socket.SHUT_RDWR)
|
sock.shutdown(how=socket.SHUT_RDWR)
|
||||||
|
except OSError: # Already closer by server
|
||||||
|
pass
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ Rectangle {
|
||||||
property real yPos: visibleArea.yPosition
|
property real yPos: visibleArea.yPosition
|
||||||
|
|
||||||
onYPosChanged: {
|
onYPosChanged: {
|
||||||
console.log(yPos)
|
|
||||||
if (yPos <= 0.1) {
|
if (yPos <= 0.1) {
|
||||||
Backend.loadPastEvents(chatPage.room.room_id)
|
Backend.loadPastEvents(chatPage.room.room_id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,8 @@ Rectangle {
|
||||||
|
|
||||||
if (textArea.text === "") { return }
|
if (textArea.text === "") { return }
|
||||||
|
|
||||||
Backend.sendMessage(chatPage.user.user_id,
|
Backend.clientManager.clients[chatPage.user_id]
|
||||||
chatPage.room.room_id,
|
.sendMessage(chatPage.room.room_id, textArea.text)
|
||||||
textArea.text)
|
|
||||||
textArea.clear()
|
textArea.clear()
|
||||||
}
|
}
|
||||||
Keys.onEnterPressed: Keys.onReturnPressed(event) // numpad enter
|
Keys.onEnterPressed: Keys.onReturnPressed(event) // numpad enter
|
||||||
|
|
Loading…
Reference in New Issue
Block a user