From c28049514f9c3b0d14816e88d05557af8d22e49e Mon Sep 17 00:00:00 2001 From: GrotheFAF Date: Tue, 19 Dec 2017 20:33:23 +0100 Subject: [PATCH] fix #930 announcement link url type QtUrl was not converted to string for msg + game.state for announcing host was queried PLAYING instead of OPEN + some lower case and line break --- changelog.md | 1 + src/client/gameannouncer.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/changelog.md b/changelog.md index a5b8abf81..02dfd86f5 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ * Fix players in chat sometimes not displayed with their clan tags (#922, #923) * Fix channel autojoin settings not loading properly * Don't show checked user's name among other alias users + * Fix host and link in announcements in chat (#930, #934) Contributors: - Wesmania diff --git a/src/client/gameannouncer.py b/src/client/gameannouncer.py index 589ee61bd..ae35edf1a 100644 --- a/src/client/gameannouncer.py +++ b/src/client/gameannouncer.py @@ -13,8 +13,8 @@ def __init__(self, gameset, me, colors, client): self._colors = colors self._client = client - self._gameset.newLobby.connect(self._announceHosting) - self._gameset.newLiveReplay.connect(self._announceReplay) + self._gameset.newLobby.connect(self._announce_hosting) + self._gameset.newLiveReplay.connect(self._announce_replay) self.announce_games = True self.announce_replays = True @@ -24,7 +24,7 @@ def _is_friend_host(self, game): return (game.host_player is not None and self._me.isFriend(game.host_player.id)) - def _announceHosting(self, game): + def _announce_hosting(self, game): if not self._is_friend_host(game) or not self.announce_games: return announce_delay = QTimer() @@ -39,17 +39,17 @@ def _delayed_announce_hosting(self): if (not self._is_friend_host(game) or not self.announce_games or - game.state != GameState.PLAYING): + game.state != GameState.OPEN): return self._announce(game, "hosting") - def _announceReplay(self, game): + def _announce_replay(self, game): if not self._is_friend_host(game) or not self.announce_replays: return self._announce(game, "playing live") def _announce(self, game, activity): - url = game.url(game.host_player.id) + url = game.url(game.host_player.id).toString() url_color = self._colors.getColor("url") mapname = maps.getDisplayName(game.mapname) fmt = 'is {} {}{} (on {})' @@ -57,6 +57,5 @@ def _announce(self, game, activity): modname = "" else: modname = game.featured_mod + " " - msg = fmt.format(activity, modname, url_color, url, - game.title, mapname) + msg = fmt.format(activity, modname, url_color, url, game.title, mapname) self._client.forwardLocalBroadcast(game.host, msg)