Style fixes.

This commit is contained in:
poljar (Damir Jelić) 2018-01-15 11:11:38 +01:00
parent 2742796fa4
commit f16ac83837

View file

@ -125,6 +125,7 @@ class RequestType(Enum):
POST = 1 POST = 1
PUT = 2 PUT = 2
@unique @unique
class RedactType(Enum): class RedactType(Enum):
STRIKETHROUGH = 0 STRIKETHROUGH = 0
@ -640,16 +641,20 @@ def matrix_handle_room_text_message(server, room_id, event):
def matrix_handle_redacted_message(server, room_id, event): def matrix_handle_redacted_message(server, room_id, event):
# type: (MatrixServer, unicode, Dict[Any, Any]) -> None # type: (MatrixServer, unicode, Dict[Any, Any]) -> None
reason = ">" reason = ""
censor = strip_matrix_server( censor = strip_matrix_server(
event['unsigned']['redacted_because']['sender'] event['unsigned']['redacted_because']['sender']
)[1:] )[1:]
if 'reason' in event['unsigned']['redacted_because']['content']: if 'reason' in event['unsigned']['redacted_because']['content']:
reason = ", reason: \"{reason}\">".format( reason = ", reason: \"{reason}\"".format(
reason=event['unsigned']['redacted_because']['content']['reason']) reason=event['unsigned']['redacted_because']['content']['reason'])
msg = ("<Message redacted by: {censor}{reason}").format( msg = ("{del_color}<{log_color}Message redacted by: "
"{censor}{log_color}{reason}{del_color}>{ncolor}").format(
del_color=W.color("chat_delimiters"),
ncolor=W.color("reset"),
log_color=W.color("logger.color.backlog_line"),
censor=censor, censor=censor,
reason=reason) reason=reason)
@ -1252,7 +1257,6 @@ def init_matrix_config():
option.min, option.max, option.value, option.value, 0, "", option.min, option.max, option.value, option.value, 0, "",
"", "matrix_config_change_cb", "", "", "") "", "matrix_config_change_cb", "", "", "")
section = W.config_new_section(config_file, "color", 0, 0, "", "", "", "", section = W.config_new_section(config_file, "color", 0, 0, "", "", "", "",
"", "", "", "", "", "") "", "", "", "", "", "")
@ -2057,6 +2061,7 @@ def matrix_message_completion_cb(data, completion_item, buffer, completion):
return W.WEECHAT_RC_OK return W.WEECHAT_RC_OK
def init_hooks(): def init_hooks():
W.hook_completion( W.hook_completion(
"matrix_server_commands", "matrix_server_commands",
@ -2086,7 +2091,6 @@ def init_hooks():
"" ""
) )
W.hook_command( W.hook_command(
# Command name and short description # Command name and short description
'matrix', 'Matrix chat protocol command', 'matrix', 'Matrix chat protocol command',
@ -2141,7 +2145,6 @@ def init_hooks():
# Function name # Function name
'matrix_redact_command_cb', '') 'matrix_redact_command_cb', '')
W.hook_command_run('/topic', 'matrix_command_topic_cb', '') W.hook_command_run('/topic', 'matrix_command_topic_cb', '')