bug fix on chatroom msg handling

This commit is contained in:
Yuxin Wu
2017-02-09 13:24:37 +08:00
parent 080c751eb2
commit 9eecc6dd38
3 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -38,8 +38,8 @@ On Debian/Ubuntu systems, these dependencies can be installed via:
```sh
sudo apt-get install python-requests python-pil python-pyquery python-numpy libsox-dev
sudo pip install pysqlcipher csscompressor
sudo pip install --pre pysox
pip install --user pysqlcipher csscompressor
pip install --user --pre pysox
```
#### Get Necessary Data:
+1
View File
@@ -91,6 +91,7 @@ class WeChatMsg(object):
return self.content
elif self.type == TYPE_REDENVELOPE:
pq = PyQuery(self.content_xml_ready, parser='xml')
title = pq('sendertitle').text()
return u"[RED ENVELOPE]\n{}".format(title)
else:
+3 -1
View File
@@ -135,6 +135,7 @@ SELECT {} FROM message
if values['chat'].endswith('@chatroom'):
values['chat'] = self.contacts[values['chat']]
content = values['content']
if values['isSend'] == 1:
values['talker'] = self.username
elif values['type'] == TYPE_SYSTEM:
@@ -142,7 +143,8 @@ SELECT {} FROM message
else:
talker = content[:content.find(':')]
values['talker'] = self.contacts.get(talker, talker)
values['content'] = content[content.find('\n') + 1:]
values['content'] = content[content.find('\n') + 1:]
else:
tk_id = values['talker']
values['chat'] = self.contacts[tk_id]