From da46c06c019993e95df057562c508314a190ce7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Sun, 22 Sep 2019 11:41:41 +0200 Subject: [PATCH] weechat-matrix: Send out a hsignal when we launch the SSO helper. --- main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 0551640..7dcdf1a 100644 --- a/main.py +++ b/main.py @@ -407,13 +407,22 @@ def sso_login_cb(server_name, command, return_code, out, err): if msgtype == "redirectUrl": redirect_url = "http://{}:{}".format(ret["host"], ret["port"]) + + login_url = ( + "{}/_matrix/client/r0/login/sso/redirect?redirectUrl={}" + ).format(server.homeserver.geturl(), redirect_url) + server.info_highlight( "The server requested a single sign-on, please open " "this URL in your browser. Note that the " "browser needs to run on the same host as Weechat.") - server.info_highlight( - "{}/_matrix/client/r0/login/sso/redirect?redirectUrl={}".format( - server.homeserver.geturl(), redirect_url)) + server.info_highlight(login_url) + + message = { + "server": server.name, + "url": login_url + } + W.hook_hsignal_send("matrix_sso_login", message) elif msgtype == "token": token = ret["loginToken"]