Fixed the one-channel bug.

This commit is contained in:
Jeremy Fincher 2004-07-30 22:35:51 +00:00
parent 7328bd50ba
commit a8a95c2ecc
5 changed files with 13 additions and 14 deletions

View File

@ -202,7 +202,6 @@ class SpaceSeparatedSetOfChannels(registry.SpaceSeparatedListOf):
self.value.remove(removal) self.value.remove(removal)
def registerNetwork(name, password='', servers=()): def registerNetwork(name, password='', servers=()):
name = intern(name)
network = registerGroup(supybot.networks, name) network = registerGroup(supybot.networks, name)
registerGlobalValue(network, 'password', registry.String(password, registerGlobalValue(network, 'password', registry.String(password,
"""Determines what password will be used on %s. Yes, we know that """Determines what password will be used on %s. Yes, we know that

View File

@ -639,11 +639,10 @@ class Irc(IrcCommandDispatcher):
def doNick(self, msg): def doNick(self, msg):
"""Handles NICK messages.""" """Handles NICK messages."""
if msg.nick == self.nick: if msg.nick == self.nick:
newNick = intern(msg.args[0]) newNick = msg.args[0]
self.nick = newNick self.nick = newNick
(nick, user, domain) = ircutils.splitHostmask(msg.prefix) (nick, user, domain) = ircutils.splitHostmask(msg.prefix)
self.prefix = ircutils.joinHostmask(self.nick, user, domain) self.prefix = ircutils.joinHostmask(self.nick, user, domain)
self.prefix = intern(self.prefix)
elif conf.supybot.followIdentificationThroughNickChanges(): elif conf.supybot.followIdentificationThroughNickChanges():
# We use elif here because this means it's someone else's nick # We use elif here because this means it's someone else's nick
# change, not our own. # change, not our own.

View File

@ -125,14 +125,13 @@ class IrcMsg(object):
else: else:
self.args = msg.args self.args = msg.args
else: else:
self.prefix = intern(prefix) self.prefix = prefix
self.command = intern(command) self.command = command
assert all(ircutils.isValidArgument, args) assert all(ircutils.isValidArgument, args)
self.args = args self.args = args
self.args = tuple(map(intern, self.args)) self.args = tuple(self.args)
if ircutils.isUserHostmask(self.prefix): if ircutils.isUserHostmask(self.prefix):
(self.nick,self.user,self.host) = \ (self.nick,self.user,self.host)=ircutils.splitHostmask(self.prefix)
map(intern, ircutils.splitHostmask(self.prefix))
else: else:
(self.nick, self.user, self.host) = (self.prefix,)*3 (self.nick, self.user, self.host) = (self.prefix,)*3

View File

@ -103,7 +103,7 @@ _lowertrans = string.maketrans(string.ascii_uppercase + r'\[]~',
string.ascii_lowercase + r'|{}^') string.ascii_lowercase + r'|{}^')
def toLower(s): def toLower(s):
"""Returns the string s lowered according to IRC case rules.""" """Returns the string s lowered according to IRC case rules."""
return intern(s.translate(_lowertrans)) return s.translate(_lowertrans)
def strEqual(nick1, nick2): def strEqual(nick1, nick2):
"""Returns True if nick1 == nick2 according to IRC case rules.""" """Returns True if nick1 == nick2 according to IRC case rules."""
@ -475,12 +475,10 @@ def unDccIP(i):
class IrcString(str): class IrcString(str):
"""This class does case-insensitive comparison and hashing of nicks.""" """This class does case-insensitive comparison and hashing of nicks."""
def __new__(cls, s=''): def __new__(cls, s=''):
return str.__new__(cls, intern(s)) x = super(IrcString, cls).__new__(cls, s)
x.lowered = toLower(x)
return x
def __init__(self, s):
assert isinstance(s, basestring), \
'Cannot make an IrcString from %r' % s
self.lowered = toLower(s)
def __eq__(self, s): def __eq__(self, s):
try: try:

View File

@ -39,6 +39,7 @@ import supybot.fix as fix
import os import os
import re import re
import sys
import md5 import md5
import new import new
import sha import sha
@ -51,6 +52,7 @@ import compiler
import textwrap import textwrap
import UserDict import UserDict
import itertools import itertools
import traceback
import htmlentitydefs import htmlentitydefs
from itertools import imap, ifilter from itertools import imap, ifilter
@ -669,6 +671,8 @@ def mungeEmailForWeb(s):
s = s.replace('.', ' DOT ') s = s.replace('.', ' DOT ')
return s return s
def stackTrace():
traceback.print_stack(sys._getframe())
if __name__ == '__main__': if __name__ == '__main__':
import sys, doctest import sys, doctest