From c23b59d7054bd80161cfb4ca2fa71f8ff61d5c38 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 8 Jan 2011 00:05:00 -0600 Subject: [PATCH] improve upon the splitting (which was excessive following the last commit). clarify the terminology a bit, too --- DrBotIRC.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DrBotIRC.py b/DrBotIRC.py index 009fa84..a282025 100644 --- a/DrBotIRC.py +++ b/DrBotIRC.py @@ -28,23 +28,23 @@ class DrBotServerConnection(irclib.ServerConnection): """Subclass irclib's ServerConnection, in order to expand privmsg.""" - hostname = None + nickmask = None def __init__(self, irclibobj): irclib.ServerConnection.__init__(self, irclibobj) # temporary. hopefully on_welcome() will set this - self.hostname = socket.getfqdn() + self.nickmask = socket.getfqdn() self.add_global_handler('welcome', self.on_welcome, 1) def on_welcome(self, connection, event): - """Set the hostname that the ircd tells us is us.""" + """Set the nickmask that the ircd tells us is us.""" what = event.arguments()[0] match = re.search('(\S+!\S+@\S+)', what) if match: - self.hostname = match.group(1) + self.nickmask = match.group(1) def privmsg(self, target, text): """Send a PRIVMSG command.""" @@ -52,10 +52,10 @@ class DrBotServerConnection(irclib.ServerConnection): splitter = "..." # split messages that are too long. Max length is 512. - # TODO: this does not properly handle when the hostname has been + # TODO: this does not properly handle when the nickmask has been # masked by the ircd # is the above still the case? - space = 512 - len('\r\n') - len('PRIVMSG ') - len(' :') - len(target) - len(self.nickname) - len('!') - len(self.username) - len('@') - len(self.hostname) + space = 512 - len('\r\n') - len(' PRIVMSG ') - len(target) - len(' :') - len(self.nickmask) - len(' :') splitspace = space - (len(splitter) + 1) if len(text) > space: