Include hostmasks in JOIN, PART, QUIT logs.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 4a9596608a)
This commit is contained in:
James Vega 2010-02-28 21:17:35 -05:00
parent 0933621dab
commit 8d94ff743c
2 changed files with 16 additions and 8 deletions

View File

@ -1,6 +1,6 @@
### ###
# Copyright (c) 2002-2004, Jeremiah Fincher # Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega # Copyright (c) 2009-2010, James Vega
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -206,8 +206,8 @@ class ChannelLogger(callbacks.Plugin):
def doJoin(self, irc, msg): def doJoin(self, irc, msg):
for channel in msg.args[0].split(','): for channel in msg.args[0].split(','):
self.doLog(irc, channel, self.doLog(irc, channel,
'*** %s has joined %s\n', '*** %s <%s> has joined %s\n',
msg.nick or msg.prefix, channel) msg.nick, msg.prefix, channel)
def doKick(self, irc, msg): def doKick(self, irc, msg):
if len(msg.args) == 3: if len(msg.args) == 3:
@ -226,7 +226,8 @@ class ChannelLogger(callbacks.Plugin):
def doPart(self, irc, msg): def doPart(self, irc, msg):
for channel in msg.args[0].split(','): for channel in msg.args[0].split(','):
self.doLog(irc, channel, 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): def doMode(self, irc, msg):
channel = msg.args[0] channel = msg.args[0]
@ -248,7 +249,9 @@ class ChannelLogger(callbacks.Plugin):
irc = irc.getRealIrc() irc = irc.getRealIrc()
for (channel, chan) in self.lastStates[irc].channels.iteritems(): for (channel, chan) in self.lastStates[irc].channels.iteritems():
if msg.nick in chan.users: 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): def outFilter(self, irc, msg):
# Gotta catch my own messages *somehow* :) # Gotta catch my own messages *somehow* :)

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # 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: else:
s = '-%s- %s' % (nick(), msg.args[1]) s = '-%s- %s' % (nick(), msg.args[1])
elif msg.command == 'JOIN': 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': elif msg.command == 'PART':
if len(msg.args) > 1: if len(msg.args) > 1:
partmsg = ' (%s)' % msg.args[1] partmsg = ' (%s)' % msg.args[1]
else: else:
partmsg = '' 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': elif msg.command == 'KICK':
if len(msg.args) > 2: if len(msg.args) > 2:
kickmsg = ' (%s)' % msg.args[1] kickmsg = ' (%s)' % msg.args[1]
@ -312,7 +317,7 @@ def prettyPrint(msg, addRecipients=False, timestampFormat=None, showNick=True):
quitmsg = ' (%s)' % msg.args[0] quitmsg = ' (%s)' % msg.args[0]
else: else:
quitmsg = '' 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': elif msg.command == 'TOPIC':
s = '*** %s changes topic to %s' % (nickorprefix(), msg.args[1]) s = '*** %s changes topic to %s' % (nickorprefix(), msg.args[1])
elif msg.command == 'NICK': elif msg.command == 'NICK':