mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-28 13:42:36 +01:00
Added __getstate__ and __setstate__ to set and Channel.
This commit is contained in:
parent
64b60dceae
commit
f4d187b1f1
@ -140,6 +140,12 @@ class set(object):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def __getstate__(self):
|
||||
return self.d
|
||||
|
||||
def __setstate__(self, d):
|
||||
self.d = d
|
||||
|
||||
|
||||
class queue(dict):
|
||||
"""An FIFO Queue, O(1) for all operations."""
|
||||
|
@ -151,6 +151,17 @@ class Channel(object):
|
||||
self.halfops.discard(user)
|
||||
self.voices.discard(user)
|
||||
|
||||
def __getstate__(self):
|
||||
return (self.topic, self.users, self.ops, self.halfops, self.voices)
|
||||
|
||||
def __setstate__(self, (topic, users, ops, halfops, voices)):
|
||||
self.topic = topic
|
||||
self.users = users
|
||||
self.ops = ops
|
||||
self.halfops = halfops
|
||||
self.voices = voices
|
||||
|
||||
|
||||
class IrcState(object):
|
||||
"""Maintains state of the Irc connection. Should also become smarter.
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user