Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BillLi
ItChat
提交
0cc39825
I
ItChat
项目概览
BillLi
/
ItChat
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
ItChat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0cc39825
编写于
3月 29, 2017
作者:
L
LittleCoder
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix isAt, Self bugs in 1.3.0
上级
04bcc113
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
7 deletion
+21
-7
itchat/components/contact.py
itchat/components/contact.py
+3
-2
itchat/components/messages.py
itchat/components/messages.py
+2
-2
itchat/storage/messagequeue.py
itchat/storage/messagequeue.py
+16
-3
未找到文件。
itchat/components/contact.py
浏览文件 @
0cc39825
...
...
@@ -132,8 +132,9 @@ def update_local_chatrooms(core, l):
else
:
oldMemberList
.
append
(
member
)
else
:
oldChatroom
=
templates
.
wrap_user_dict
(
chatroom
)
core
.
chatroomList
.
append
(
oldChatroom
)
core
.
chatroomList
.
append
(
chatroom
)
oldChatroom
=
utils
.
search_dict_list
(
core
.
chatroomList
,
'UserName'
,
chatroom
[
'UserName'
])
# delete useless members
if
len
(
chatroom
[
'MemberList'
])
!=
len
(
oldChatroom
[
'MemberList'
])
and
\
chatroom
[
'MemberList'
]:
...
...
itchat/components/messages.py
浏览文件 @
0cc39825
...
...
@@ -246,8 +246,8 @@ def produce_group_chat(core, msg):
msg
[
'ActualNickName'
]
=
''
msg
[
'IsAt'
]
=
False
else
:
msg
[
'ActualNickName'
]
=
member
[
'DisplayName'
]
or
member
[
'NickName'
]
atFlag
=
'@'
+
chatroom
[
'Self'
].
get
(
'DisplayName'
,
core
.
storageClass
.
nickName
)
msg
[
'ActualNickName'
]
=
member
.
get
(
'DisplayName'
,
''
)
or
member
[
'NickName'
]
atFlag
=
'@'
+
(
chatroom
[
'Self'
].
get
(
'DisplayName'
,
''
)
or
core
.
storageClass
.
nickName
)
msg
[
'IsAt'
]
=
(
(
atFlag
+
(
u
'
\u2005
'
if
u
'
\u2005
'
in
msg
[
'Content'
]
else
' '
))
in
msg
[
'Content'
]
or
msg
[
'Content'
].
endswith
(
atFlag
))
...
...
itchat/storage/messagequeue.py
浏览文件 @
0cc39825
import
logging
try
:
import
Queue
as
queue
except
ImportError
:
import
queue
logger
=
logging
.
getLogger
(
'itchat'
)
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
):
...
...
@@ -17,7 +19,18 @@ class Message(dict):
return
b
''
def
__getattr__
(
self
,
value
):
value
=
value
[
0
].
upper
()
+
value
[
1
:]
return
self
.
get
(
value
,
''
)
return
self
[
value
]
def
__getitem__
(
self
,
value
):
if
value
in
(
'isAdmin'
,
'isAt'
):
v
=
value
[
0
].
upper
()
+
value
[
1
:]
# ''[1:] == ''
logger
.
debug
(
'%s is expired in 1.3.0, use %s instead.'
%
(
value
,
v
))
value
=
v
return
super
(
Message
,
self
).
__getitem__
(
value
)
def
get
(
self
,
v
,
d
):
try
:
return
self
[
v
]
except
KeyError
:
return
d
def
__str__
(
self
):
return
'{%s}'
%
', '
.
join
(
[
'%s: %s'
%
(
repr
(
k
),
repr
(
v
))
for
k
,
v
in
self
.
items
()])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录