提交 c58174e1 编写于 作者: L LittleCoder

Fix bugs caused by strange contact return values [PR#208: lostdragon]

上级 71d5c572
...@@ -30,7 +30,7 @@ Python与基本的网络基础都不困难,所以即使没有这方面基础 ...@@ -30,7 +30,7 @@ Python与基本的网络基础都不困难,所以即使没有这方面基础
![QRCode](http://7xrip4.com1.z0.glb.clouddn.com/ItChat%2FQRCode2.jpg?imageView/2/w/400/) ![QRCode](http://7xrip4.com1.z0.glb.clouddn.com/ItChat%2FQRCode2.jpg?imageView/2/w/400/)
##本部分所需环境 ## 本部分所需环境
本文是这一教程的第一部分,需要配置抓包与Python环境。 本文是这一教程的第一部分,需要配置抓包与Python环境。
...@@ -59,6 +59,7 @@ Wireshark是常见的抓包软件,这里通过一些配置抓取微信网页 ...@@ -59,6 +59,7 @@ Wireshark是常见的抓包软件,这里通过一些配置抓取微信网页
我们都登录过网页端微信,没有的话可以现在做一个尝试:[微信网页端](https://wx.qq.com) 我们都登录过网页端微信,没有的话可以现在做一个尝试:[微信网页端](https://wx.qq.com)
这个过程简单而言可以分为如下几步: 这个过程简单而言可以分为如下几步:
1. 向服务器提供一些用于获取二维码的数据 1. 向服务器提供一些用于获取二维码的数据
1. 服务器返回二维码 1. 服务器返回二维码
1. 向服务器询问二维码扫描状态 1. 向服务器询问二维码扫描状态
...@@ -313,9 +314,9 @@ print('Log in as %s'%dic['User']['NickName']) ...@@ -313,9 +314,9 @@ print('Log in as %s'%dic['User']['NickName'])
那么做一个小练习好了,测试一下学到的东西:读取命令行的输入并发送给自己。(这部分的源码放在了文末) 那么做一个小练习好了,测试一下学到的东西:读取命令行的输入并发送给自己。(这部分的源码放在了文末)
##具体运用时可能遇到的难点 ## 具体运用时可能遇到的难点
###命令行登录一段时间后无法与服务器正常交互 ### 命令行登录一段时间后无法与服务器正常交互
这是因为微信网页端存在心跳机制,一段时间不交互将会断开连接。 这是因为微信网页端存在心跳机制,一段时间不交互将会断开连接。
......
...@@ -173,8 +173,10 @@ def update_local_friends(core, l): ...@@ -173,8 +173,10 @@ def update_local_friends(core, l):
''' '''
fullList = core.memberList + core.mpList fullList = core.memberList + core.mpList
for friend in l: for friend in l:
utils.emoji_formatter(friend, 'NickName') if 'NickName' in friend:
utils.emoji_formatter(friend, 'DisplayName') utils.emoji_formatter(friend, 'NickName')
if 'DisplayName' in friend:
utils.emoji_formatter(friend, 'DisplayName')
oldInfoDict = utils.search_dict_list( oldInfoDict = utils.search_dict_list(
fullList, 'UserName', friend['UserName']) fullList, 'UserName', friend['UserName'])
if oldInfoDict is None: if oldInfoDict is None:
...@@ -223,7 +225,13 @@ def update_local_uin(core, msg): ...@@ -223,7 +225,13 @@ def update_local_uin(core, msg):
update_chatroom(core, username) update_chatroom(core, username)
newChatroomDict = utils.search_dict_list( newChatroomDict = utils.search_dict_list(
core.chatroomList, 'UserName', username) core.chatroomList, 'UserName', username)
newChatroomDict['Uin'] = uin if newChatroomDict is None:
newChatroomDict = utils.struct_friend_info({
'UserName': username,
'Uin': uin, })
core.chatroomList.append(newChatroomDict)
else:
newChatroomDict['Uin'] = uin
elif '@' in username: elif '@' in username:
update_friend(core, username) update_friend(core, username)
newFriendDict = utils.search_dict_list( newFriendDict = utils.search_dict_list(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册