config: Add typing notice conditions.
This commit is contained in:
parent
45ebb921a9
commit
624ecc4d77
3 changed files with 24 additions and 0 deletions
|
@ -827,6 +827,7 @@ class RoomBuffer(object):
|
||||||
|
|
||||||
self.typing_notice_time = None
|
self.typing_notice_time = None
|
||||||
self._typing = False
|
self._typing = False
|
||||||
|
self.typing_enabled = True
|
||||||
|
|
||||||
buffer_name = "{}.{}".format(server_name, room.room_id)
|
buffer_name = "{}.{}".format(server_name, room.room_id)
|
||||||
|
|
||||||
|
|
|
@ -612,6 +612,19 @@ class MatrixConfig(WeechatConfig):
|
||||||
"500",
|
"500",
|
||||||
("minimum lag to show (in milliseconds)"),
|
("minimum lag to show (in milliseconds)"),
|
||||||
),
|
),
|
||||||
|
Option(
|
||||||
|
"typing_notice_conditions",
|
||||||
|
"string",
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"${typing_enabled}",
|
||||||
|
("conditions to send typing notifications (note: content is "
|
||||||
|
"evaluated, see /help eval); besides the buffer and window "
|
||||||
|
"variables the typing_enabled variable is also expanded; "
|
||||||
|
"the typing_enabled variable can be manipulated with the "
|
||||||
|
"/room command, see /help room"),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
color_options = [
|
color_options = [
|
||||||
|
|
|
@ -685,6 +685,16 @@ class MatrixServer(object):
|
||||||
|
|
||||||
input = room_buffer.weechat_buffer.input
|
input = room_buffer.weechat_buffer.input
|
||||||
|
|
||||||
|
typing_enabled = bool(int(W.string_eval_expression(
|
||||||
|
G.CONFIG.network.typing_notice_conditions,
|
||||||
|
{},
|
||||||
|
{"typing_enabled": str(int(room_buffer.typing_enabled))},
|
||||||
|
{"type": "condition"}
|
||||||
|
)))
|
||||||
|
|
||||||
|
if not typing_enabled:
|
||||||
|
return
|
||||||
|
|
||||||
# Don't send a typing notice if the user is typing in a weechat command
|
# Don't send a typing notice if the user is typing in a weechat command
|
||||||
if input.startswith("/") and not input.startswith("//"):
|
if input.startswith("/") and not input.startswith("//"):
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue