From 7781490912f80b67a0a27dafe0f5a564051cbc73 Mon Sep 17 00:00:00 2001 From: LittleCoder Date: Thu, 23 Mar 2017 13:10:50 +0800 Subject: [PATCH] Fix isAt compacity and reduce the size of pickle --- itchat/storage/__init__.py | 6 +++--- itchat/storage/messagequeue.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/itchat/storage/__init__.py b/itchat/storage/__init__.py index f074fbc1..8010c9a1 100644 --- a/itchat/storage/__init__.py +++ b/itchat/storage/__init__.py @@ -32,9 +32,9 @@ def dumps(self): return { 'userName' : self.userName, 'nickName' : self.nickName, - 'memberList' : self.memberList, - 'mpList' : self.mpList, - 'chatroomList' : self.chatroomList, + 'memberList' : [dict(member) for member in self.memberList], + 'mpList' : [dict(mp) for mp in self.mpList], + 'chatroomList' : [dict(chatroom) for chatroom in self.chatroomList], 'lastInputUserName' : self.lastInputUserName, } def loads(self, j): self.userName = j.get('userName', None) diff --git a/itchat/storage/messagequeue.py b/itchat/storage/messagequeue.py index fb915bdd..c1f6ae71 100644 --- a/itchat/storage/messagequeue.py +++ b/itchat/storage/messagequeue.py @@ -5,6 +5,8 @@ class Queue(queue.Queue): def put(self, message): + if 'IsAt' in message: + message['isAt'] = message['IsAt'] queue.Queue.put(self, Message(message)) class Message(dict):