Add sync message class.
This commit is contained in:
parent
bc6db177a8
commit
7f9c09c16b
1 changed files with 25 additions and 1 deletions
|
@ -348,6 +348,26 @@ class MatrixLoginMessage(MatrixGenericMessage):
|
|||
)
|
||||
|
||||
|
||||
class MatrixSyncMessage(MatrixGenericMessage):
|
||||
def __init__(self, client, next_batch=None, limit=None):
|
||||
data = {}
|
||||
|
||||
if next_batch:
|
||||
data["next_batch"] = next_batch
|
||||
|
||||
if limit:
|
||||
data["sync_filter"] = {
|
||||
"room": {"timeline": {"limit": limit}}
|
||||
}
|
||||
|
||||
MatrixGenericMessage.__init__(
|
||||
self,
|
||||
MessageType.SYNC,
|
||||
client.sync,
|
||||
data
|
||||
)
|
||||
|
||||
|
||||
class MatrixSendMessage(MatrixGenericMessage):
|
||||
def __init__(self, client, room_id, formatted_message):
|
||||
self.room_id = room_id
|
||||
|
@ -402,7 +422,11 @@ def get_transaction_id(server):
|
|||
|
||||
|
||||
def matrix_sync(server):
|
||||
message = MatrixMessage(server, OPTIONS, MessageType.SYNC)
|
||||
message = MatrixSyncMessage(
|
||||
server.client,
|
||||
server.next_batch,
|
||||
OPTIONS.sync_limit
|
||||
)
|
||||
server.send_queue.append(message)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue