From efa39f88b233d7fc11646d3e3141d59480f3d61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?poljar=20=28Damir=20Jeli=C4=87=29?= Date: Thu, 25 Jan 2018 13:15:21 +0100 Subject: [PATCH] Device name setting support. --- weechat-matrix.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/weechat-matrix.py b/weechat-matrix.py index 7cbc5da..d6000c4 100644 --- a/weechat-matrix.py +++ b/weechat-matrix.py @@ -491,7 +491,9 @@ def server_config_change_cb(server_name, option): elif option_name == "password": value = W.config_string(option) server.password = value - server.access_token = "" + elif option_name == "device_name": + value = W.config_string(option) + server.device_name = value else: pass @@ -507,6 +509,7 @@ class MatrixServer: self.address = "" # type: str self.port = 8448 # type: int self.options = dict() # type: Dict[str, weechat.config] + self.device_name = "Weechat Matrix" # type: str self.user = "" # type: str self.password = "" # type: str @@ -573,6 +576,10 @@ class MatrixServer: 'password', 'string', '', 0, 0, '', "Password for server" ), + Option( + 'device_name', 'string', '', 0, 0, 'Weechat Matrix', + "Device name to use while logging in to the matrix server" + ), ] section = W.config_search_section(config_file, 'server') @@ -2274,7 +2281,8 @@ def matrix_login(server): # type: (MatrixServer) -> None post_data = {"type": "m.login.password", "user": server.user, - "password": server.password} + "password": server.password, + "initial_device_display_name": server.device_name} message = MatrixMessage( server,