From 8d94ff743c35335ec44c84c3ef97587db6d99b18 Mon Sep 17 00:00:00 2001 From: James Vega Date: Sun, 28 Feb 2010 21:17:35 -0500 Subject: [PATCH] Include hostmasks in JOIN, PART, QUIT logs. Signed-off-by: James Vega (cherry picked from commit 4a9596608abfbacf75d46237b29fee18ec2e9205) --- plugins/ChannelLogger/plugin.py | 13 ++++++++----- src/ircmsgs.py | 11 ++++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/ChannelLogger/plugin.py b/plugins/ChannelLogger/plugin.py index 719e306cc..93f9b3c06 100644 --- a/plugins/ChannelLogger/plugin.py +++ b/plugins/ChannelLogger/plugin.py @@ -1,6 +1,6 @@ ### # Copyright (c) 2002-2004, Jeremiah Fincher -# Copyright (c) 2009, James Vega +# Copyright (c) 2009-2010, James Vega # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -206,8 +206,8 @@ class ChannelLogger(callbacks.Plugin): def doJoin(self, irc, msg): for channel in msg.args[0].split(','): self.doLog(irc, channel, - '*** %s has joined %s\n', - msg.nick or msg.prefix, channel) + '*** %s <%s> has joined %s\n', + msg.nick, msg.prefix, channel) def doKick(self, irc, msg): if len(msg.args) == 3: @@ -226,7 +226,8 @@ class ChannelLogger(callbacks.Plugin): def doPart(self, irc, msg): for channel in msg.args[0].split(','): self.doLog(irc, channel, - '*** %s has left %s\n', msg.nick, channel) + '*** %s <%s> has left %s\n', + msg.nick, msg.prefix, channel) def doMode(self, irc, msg): channel = msg.args[0] @@ -248,7 +249,9 @@ class ChannelLogger(callbacks.Plugin): irc = irc.getRealIrc() for (channel, chan) in self.lastStates[irc].channels.iteritems(): if msg.nick in chan.users: - self.doLog(irc, channel, '*** %s has quit IRC\n', msg.nick) + self.doLog(irc, channel, + '*** %s <%s> has quit IRC\n', + msg.nick, msg.prefix) def outFilter(self, irc, msg): # Gotta catch my own messages *somehow* :) diff --git a/src/ircmsgs.py b/src/ircmsgs.py index 3d5a47e90..f2fec7aec 100644 --- a/src/ircmsgs.py +++ b/src/ircmsgs.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2002-2005, Jeremiah Fincher +# Copyright (c) 2010, James Vega # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -292,13 +293,17 @@ def prettyPrint(msg, addRecipients=False, timestampFormat=None, showNick=True): else: s = '-%s- %s' % (nick(), msg.args[1]) elif msg.command == 'JOIN': - s = '*** %s has joined %s' % (msg.nick, msg.args[0]) + prefix = msg.prefix + if msg.nick: + prefix = '%s <%s>' % (msg.nick, prefix) + s = '*** %s has joined %s' % (prefix, msg.args[0]) elif msg.command == 'PART': if len(msg.args) > 1: partmsg = ' (%s)' % msg.args[1] else: partmsg = '' - s = '*** %s has parted %s%s' % (msg.nick, msg.args[0], partmsg) + s = '*** %s <%s> has parted %s%s' % (msg.nick, msg.prefix, + msg.args[0], partmsg) elif msg.command == 'KICK': if len(msg.args) > 2: kickmsg = ' (%s)' % msg.args[1] @@ -312,7 +317,7 @@ def prettyPrint(msg, addRecipients=False, timestampFormat=None, showNick=True): quitmsg = ' (%s)' % msg.args[0] else: quitmsg = '' - s = '*** %s has quit IRC%s' % (msg.nick, quitmsg) + s = '*** %s <%s> has quit IRC%s' % (msg.nick, msg.prefix, quitmsg) elif msg.command == 'TOPIC': s = '*** %s changes topic to %s' % (nickorprefix(), msg.args[1]) elif msg.command == 'NICK':