buffer: Handle encrypted rooms in the state dict as well.
This commit is contained in:
parent
458f6580fb
commit
8d4415f873
2 changed files with 12 additions and 4 deletions
|
@ -22,7 +22,7 @@ from builtins import super
|
|||
from functools import partial
|
||||
from typing import NamedTuple
|
||||
|
||||
from .globals import W, SERVERS, OPTIONS, SCRIPT_NAME, ENCRYPTION
|
||||
from .globals import W, SERVERS, OPTIONS, SCRIPT_NAME
|
||||
from .utf import utf8_decode
|
||||
from .colors import Formatted
|
||||
from .utils import (
|
||||
|
@ -875,6 +875,11 @@ class RoomBuffer(object):
|
|||
self._handle_topic(event, True)
|
||||
elif isinstance(event, PowerLevelsEvent):
|
||||
self._handle_power_level(event)
|
||||
elif isinstance(event, RoomEncryptionEvent):
|
||||
message = ("This room is encrypted, encryption is "
|
||||
"currently unsuported. Message sending is disabled for "
|
||||
"this room.")
|
||||
self.weechat_buffer.error(message)
|
||||
|
||||
def handle_timeline_event(self, event):
|
||||
if isinstance(event, RoomMemberEvent):
|
||||
|
@ -962,9 +967,6 @@ class RoomBuffer(object):
|
|||
self._handle_redacted_message(event)
|
||||
|
||||
elif isinstance(event, RoomEncryptionEvent):
|
||||
if ENCRYPTION:
|
||||
return
|
||||
|
||||
message = ("This room is encrypted, encryption is "
|
||||
"currently unsuported. Message sending is disabled for "
|
||||
"this room.")
|
||||
|
|
|
@ -478,6 +478,9 @@ class MatrixServer(object):
|
|||
W.prnt(self.server_buffer, msg)
|
||||
|
||||
def room_send_state(self, room_buffer, body, event_type):
|
||||
if room_buffer.room.encrypted:
|
||||
return
|
||||
|
||||
_, request = self.client.room_put_state(
|
||||
room_buffer.room.room_id,
|
||||
event_type,
|
||||
|
@ -487,6 +490,9 @@ class MatrixServer(object):
|
|||
|
||||
def room_send_message(self, room_buffer, formatted, msgtype="m.text"):
|
||||
# type: (RoomBuffer, Formatted) -> None
|
||||
if room_buffer.room.encrypted:
|
||||
return
|
||||
|
||||
if msgtype == "m.emote":
|
||||
message_class = OwnAction
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue