From f4d187b1f1d2d0e6c4db1125dacd3d4a48284364 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 9 Apr 2003 18:57:25 +0000 Subject: [PATCH] Added __getstate__ and __setstate__ to set and Channel. --- src/fix.py | 6 ++++++ src/irclib.py | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/fix.py b/src/fix.py index ac7f2ec58..2edf395f5 100644 --- a/src/fix.py +++ b/src/fix.py @@ -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.""" diff --git a/src/irclib.py b/src/irclib.py index 21b5a6e6e..fa6d4bb17 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -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. """