Add topic message class.
This commit is contained in:
parent
7f9c09c16b
commit
d0c695dc09
2 changed files with 21 additions and 5 deletions
|
@ -392,6 +392,24 @@ class MatrixSendMessage(MatrixGenericMessage):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class MatrixTopicMessage(MatrixGenericMessage):
|
||||||
|
def __init__(self, client, room_id, topic):
|
||||||
|
self.room_id = room_id
|
||||||
|
self.topic = topic
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"room_id": self.room_id,
|
||||||
|
"topic": self.topic
|
||||||
|
}
|
||||||
|
|
||||||
|
MatrixGenericMessage.__init__(
|
||||||
|
self,
|
||||||
|
MessageType.TOPIC,
|
||||||
|
client.room_topic,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class MatrixUser:
|
class MatrixUser:
|
||||||
def __init__(self, name, display_name):
|
def __init__(self, name, display_name):
|
||||||
self.name = name # type: str
|
self.name = name # type: str
|
||||||
|
|
|
@ -24,7 +24,7 @@ import matrix.globals
|
||||||
from matrix.globals import W, OPTIONS, SERVERS
|
from matrix.globals import W, OPTIONS, SERVERS
|
||||||
|
|
||||||
from matrix.utf import utf8_decode
|
from matrix.utf import utf8_decode
|
||||||
from matrix.api import MatrixMessage, MessageType
|
from matrix.api import MatrixMessage, MessageType, MatrixTopicMessage
|
||||||
from matrix.utils import key_from_value, tags_from_line_data
|
from matrix.utils import key_from_value, tags_from_line_data
|
||||||
from matrix.plugin_options import DebugType
|
from matrix.plugin_options import DebugType
|
||||||
from matrix.server import MatrixServer
|
from matrix.server import MatrixServer
|
||||||
|
@ -907,10 +907,8 @@ def matrix_command_topic_cb(data, buffer, command):
|
||||||
|
|
||||||
return W.WEECHAT_RC_OK_EAT
|
return W.WEECHAT_RC_OK_EAT
|
||||||
|
|
||||||
message = MatrixMessage(
|
message = MatrixTopicMessage(
|
||||||
server,
|
server.client,
|
||||||
OPTIONS,
|
|
||||||
MessageType.TOPIC,
|
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
topic=topic
|
topic=topic
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue