mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Re-enabled __slots__ and added __getstate__, __setstate__
This commit is contained in:
parent
d0a569eb31
commit
d708a6f6d4
@ -43,7 +43,7 @@ import ircutils
|
|||||||
class IrcMsg(object):
|
class IrcMsg(object):
|
||||||
"""Class to represent an IRC message.
|
"""Class to represent an IRC message.
|
||||||
"""
|
"""
|
||||||
#__slots__ = ('_args', '_command', '_host', '_nick', '_prefix', '_user')
|
__slots__ = ('_args', '_command', '_host', '_nick', '_prefix', '_user')
|
||||||
def __init__(self, s='', command='', args=None, prefix='', msg=None):
|
def __init__(self, s='', command='', args=None, prefix='', msg=None):
|
||||||
if not s and not command and not msg:
|
if not s and not command and not msg:
|
||||||
raise ValueError, 'IRC messages require a command.'
|
raise ValueError, 'IRC messages require a command.'
|
||||||
@ -134,6 +134,12 @@ class IrcMsg(object):
|
|||||||
return '%s(prefix=%r, command=%r, args=%r)' % \
|
return '%s(prefix=%r, command=%r, args=%r)' % \
|
||||||
(self.__class__.__name__, self.prefix, self.command, self.args)
|
(self.__class__.__name__, self.prefix, self.command, self.args)
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
return str(self)
|
||||||
|
|
||||||
|
def __setstate__(self, s):
|
||||||
|
self.__init__(s)
|
||||||
|
|
||||||
|
|
||||||
def isAction(msg):
|
def isAction(msg):
|
||||||
return msg.command == 'PRIVMSG' and \
|
return msg.command == 'PRIVMSG' and \
|
||||||
|
Loading…
Reference in New Issue
Block a user