More error messages.

This commit is contained in:
poljar (Damir Jelić) 2018-01-12 16:49:29 +01:00
parent 44c73b7cad
commit 2742796fa4

View file

@ -1314,6 +1314,13 @@ def check_server_existence(server_name, servers):
def matrix_command_help(args): def matrix_command_help(args):
if not args:
message = ("{prefix}matrix: Too few arguments for command "
"\"/matrix help\" (see the help for the command: "
"/matrix help help").format(prefix=W.prefix("error"))
W.prnt("", message)
return
for command in args: for command in args:
message = "" message = ""
@ -1405,6 +1412,8 @@ def matrix_command_help(args):
W.prnt("", "") W.prnt("", "")
W.prnt("", message) W.prnt("", message)
return
def matrix_server_command_listfull(args): def matrix_server_command_listfull(args):
def get_value_string(value, default_value): def get_value_string(value, default_value):
@ -1708,13 +1717,16 @@ def matrix_command_cb(data, buffer, args):
split_args = list(filter(bool, args.split(' '))) split_args = list(filter(bool, args.split(' ')))
command, args = split_args[0], split_args[1:] if len(split_args) < 1:
message = ("{prefix}matrix: Too few arguments for command "
if not command: "\"/matrix\" (see the help for the command: "
# TODO print out error "/help matrix").format(prefix=W.prefix("error"))
W.prnt("", message)
return W.WEECHAT_RC_ERROR return W.WEECHAT_RC_ERROR
elif command == 'connect': command, args = split_args[0], split_args[1:]
if command == 'connect':
connect_server(args) connect_server(args)
elif command == 'disconnect': elif command == 'disconnect':
@ -1828,31 +1840,33 @@ def matrix_command_topic_cb(data, buffer, command):
if not topic: if not topic:
room = server.rooms[room_id] room = server.rooms[room_id]
if room.topic: if not room.topic:
message = ("{prefix}Topic for {color}{room}{ncolor} is " return W.WEECHAT_RC_OK
"\"{topic}\"").format(
prefix=W.prefix("network"),
color=W.color("chat_buffer"),
ncolor=W.color("reset"),
room=room.alias,
topic=room.topic)
date = int(time.time()) message = ("{prefix}Topic for {color}{room}{ncolor} is "
topic_date = room.topic_date.strftime("%a, %d %b %Y " "\"{topic}\"").format(
"%H:%M:%S") prefix=W.prefix("network"),
color=W.color("chat_buffer"),
ncolor=W.color("reset"),
room=room.alias,
topic=room.topic)
tags = "matrix_topic,log1" date = int(time.time())
W.prnt_date_tags(buffer, date, tags, message) topic_date = room.topic_date.strftime("%a, %d %b %Y "
"%H:%M:%S")
# TODO the nick should be colored tags = "matrix_topic,log1"
# TODO we should use the display name as well as W.prnt_date_tags(buffer, date, tags, message)
# the user name here
message = ("{prefix}Topic set by {author} on " # TODO the nick should be colored
"{date}").format( # TODO we should use the display name as well as
prefix=W.prefix("network"), # the user name here
author=room.topic_author, message = ("{prefix}Topic set by {author} on "
date=topic_date) "{date}").format(
W.prnt_date_tags(buffer, date, tags, message) prefix=W.prefix("network"),
author=room.topic_author,
date=topic_date)
W.prnt_date_tags(buffer, date, tags, message)
return W.WEECHAT_RC_OK_EAT return W.WEECHAT_RC_OK_EAT