Skip to content

Commit

Permalink
Fixing pinging : you can't ping yourself anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuB8 authored and Wesmania committed Jan 19, 2018
1 parent ecf3715 commit 1afb1f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Redirect some larger game messages to a separate logfile (#952)
* Send logs from every game to a separate log file (#875, #975)
* Refactor downloading previews to fix issues with broken previews (#852)
* User's own messages can no longer ping him (#906)

Contributors:
- MathieuB8
Expand Down
8 changes: 6 additions & 2 deletions src/chat/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,13 @@ def printLine(self, chname, text, scroll_forced=False, formatter=Formatters.FORM
if player.clan is not None:
displayName = "<b>[%s]</b>%s" % (player.clan, chname)

sender_is_not_me = chatter.name != self._me.login

# Play a ping sound and flash the title under certain circumstances
mentioned = text.find(self.chat_widget.client.login) != -1
if mentioned or (self.private and not (formatter is Formatters.FORMATTER_RAW and text == "quit.")):
is_quit_msg = formatter is Formatters.FORMATTER_RAW and text == "quit."
private_msg = self.private and not is_quit_msg
if (mentioned or private_msg) and sender_is_not_me:
self.pingWindow()

avatar = None
Expand All @@ -268,7 +272,7 @@ def printLine(self, chname, text, scroll_forced=False, formatter=Formatters.FORM
# Fallback and ask the client. We have no Idea who this is.
color = self.chat_widget.client.player_colors.getUserColor(player.id)

if mentioned:
if mentioned and sender_is_not_me:
color = self.chat_widget.client.player_colors.getColor("you")

# scroll if close to the last line of the log
Expand Down

0 comments on commit 1afb1f0

Please sign in to comment.