Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.www.
wechaty
提交
4dfbfe3c
W
wechaty
项目概览
.www.
/
wechaty
与 Fork 源项目一致
Fork自
wechaty / wechaty
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4dfbfe3c
编写于
12月 06, 2016
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#119
上级
a972102f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
17 deletion
+41
-17
doc/webwxapp.js
doc/webwxapp.js
+7
-5
src/contact.ts
src/contact.ts
+1
-0
src/puppet-web/bridge.ts
src/puppet-web/bridge.ts
+1
-1
src/puppet-web/wechaty-bro.js
src/puppet-web/wechaty-bro.js
+24
-3
src/room.ts
src/room.ts
+6
-6
src/util-lib.ts
src/util-lib.ts
+2
-2
未找到文件。
doc/webwxapp.js
浏览文件 @
4dfbfe3c
...
...
@@ -2916,12 +2916,14 @@ angular.module("Services", []),
},
addMember
:
function
(
e
,
t
,
o
)
{
var
n
=
r
.
getContact
(
e
);
n
.
MemberList
.
length
+
t
.
split
(
"
,
"
).
length
>=
40
?
(
console
.
log
(
"
invite
"
,
n
.
MemberList
.
length
+
t
.
split
(
"
,
"
).
length
),
this
.
_update
(
"
invitemember
"
,
e
,
{
inviteMembers
:
t
},
o
))
:
this
.
_update
(
"
addmember
"
,
e
,
{
n
.
MemberList
.
length
+
t
.
split
(
"
,
"
).
length
>=
40
?
(
console
.
log
(
"
invite
"
,
n
.
MemberList
.
length
+
t
.
split
(
"
,
"
).
length
),
this
.
_update
(
"
invitemember
"
,
e
,
{
inviteMembers
:
t
},
o
))
:
this
.
_update
(
"
addmember
"
,
e
,
{
addMembers
:
t
},
o
)
},
o
)
},
delMember
:
function
(
e
,
t
)
{
this
.
_update
(
"
delmember
"
,
e
,
{
...
...
src/contact.ts
浏览文件 @
4dfbfe3c
...
...
@@ -220,6 +220,7 @@ export class Contact implements Sayable {
public
remark
():
string
|
null
/**
* set the remark for contact
* @return {Promise<boolean>} A promise to the result. true for success, false for failure
*/
public
remark
(
newRemark
:
string
):
Promise
<
boolean
>
/**
...
...
src/puppet-web/bridge.ts
浏览文件 @
4dfbfe3c
...
...
@@ -177,7 +177,7 @@ export class Bridge {
if
(
!
roomId
||
!
contactId
)
{
throw
new
Error
(
'
no roomId or contactId
'
)
}
return
this
.
proxyWechaty
(
'
roomAddMember
'
,
roomId
,
contactId
)
return
this
.
proxyWechaty
(
'
roomAddMember
Async
'
,
roomId
,
contactId
)
.
catch
(
e
=>
{
log
.
error
(
'
PuppetWebBridge
'
,
'
roomAddMember(%s, %s) exception: %s
'
,
roomId
,
contactId
,
e
.
message
)
throw
e
...
...
src/puppet-web/wechaty-bro.js
浏览文件 @
4dfbfe3c
...
...
@@ -611,12 +611,33 @@
return
chatroomFactory
.
delMember
(
ChatRoomName
,
UserName
)
}
function
roomAddMember
(
ChatRoomName
,
UserName
)
{
function
roomAddMemberAsync
(
ChatRoomName
,
UserName
)
{
var
callback
=
arguments
[
arguments
.
length
-
1
]
if
(
typeof
callback
!==
'
function
'
)
{
// here we should in sync mode, because there's no callback
throw
new
Error
(
'
async method need to be called via webdriver.executeAsyncScript
'
)
}
var
chatroomFactory
=
WechatyBro
.
glue
.
chatroomFactory
// XXX
// log(ChatRoomName)
// log(UserName)
return
chatroomFactory
.
addMember
(
ChatRoomName
,
UserName
)
// There's no return value of addMember :(
// https://github.com/wechaty/webwx-app-tracker/blob/f22cb043ff4201ee841990dbeb59e22643092f92/formatted/webwxApp.js#L2404-L2413
var
timer
=
setTimeout
(
function
()
{
log
(
'
roomAddMemberAsync() timeout
'
)
callback
(
0
)
},
10
*
1000
)
chatroomFactory
.
addMember
(
ChatRoomName
,
UserName
,
function
(
result
)
{
clearTimeout
(
timer
)
callback
(
1
)
log
(
'
roomAddMemberAsync() return:
'
)
log
(
result
)
})
}
function
roomModTopic
(
ChatRoomName
,
topic
)
{
...
...
src/room.ts
浏览文件 @
4dfbfe3c
...
...
@@ -235,16 +235,16 @@ export class Room extends EventEmitter implements Sayable {
Object
.
keys
(
this
.
obj
).
forEach
(
k
=>
console
.
error
(
`
${
k
}
:
${
this
.
obj
&&
this
.
obj
[
k
]}
`
))
}
public
async
add
(
contact
:
Contact
):
Promise
<
any
>
{
public
async
add
(
contact
:
Contact
):
Promise
<
number
>
{
log
.
verbose
(
'
Room
'
,
'
add(%s)
'
,
contact
)
if
(
!
contact
)
{
throw
new
Error
(
'
contact not found
'
)
}
await
Config
.
puppetInstance
()
.
roomAdd
(
this
,
contact
)
return
const
n
=
Config
.
puppetInstance
()
.
roomAdd
(
this
,
contact
)
return
n
}
public
async
del
(
contact
:
Contact
):
Promise
<
number
>
{
...
...
@@ -254,8 +254,8 @@ export class Room extends EventEmitter implements Sayable {
throw
new
Error
(
'
contact not found
'
)
}
const
n
=
await
Config
.
puppetInstance
()
.
roomDel
(
this
,
contact
)
.
then
(
_
=>
this
.
delLocal
(
contact
))
.
roomDel
(
this
,
contact
)
.
then
(
_
=>
this
.
delLocal
(
contact
))
return
n
}
...
...
src/util-lib.ts
浏览文件 @
4dfbfe3c
...
...
@@ -112,12 +112,12 @@ export class UtilLib {
if
(
protocol
===
'
https:
'
)
{
// request = https.request.bind(https)
get
=
https
.
get
options
=
u
as
https
.
RequestOptions
options
=
u
as
any
as
https
.
RequestOptions
options
.
agent
=
https
.
globalAgent
}
else
if
(
protocol
===
'
http:
'
)
{
// request = http.request.bind(http)
get
=
http
.
get
options
=
u
as
http
.
RequestOptions
options
=
u
as
any
as
http
.
RequestOptions
options
.
agent
=
http
.
globalAgent
}
else
{
throw
new
Error
(
'
protocol unknown:
'
+
protocol
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录