Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
0f587cad
Commit
0f587cad
authored
Feb 03, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group Permissions
parent
826331c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
15 deletions
+31
-15
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+3
-6
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+28
-9
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
0f587cad
...
...
@@ -53,13 +53,12 @@ internal class QQImpl(bot: QQAndroidBot, override val coroutineContext: Coroutin
internal
class
MemberImpl
(
qq
:
QQImpl
,
group
:
GroupImpl
,
override
val
coroutineContext
:
CoroutineContext
override
val
coroutineContext
:
CoroutineContext
,
override
val
permission
:
MemberPermission
)
:
ContactImpl
(),
Member
,
QQ
by
qq
{
override
val
group
:
GroupImpl
by
group
.
unsafeWeakRef
()
val
qq
:
QQImpl
by
qq
.
unsafeWeakRef
()
override
val
permission
:
MemberPermission
get
()
=
TODO
(
"not implemented"
)
override
suspend
fun
mute
(
durationSeconds
:
Int
):
Boolean
{
TODO
(
"not implemented"
)
...
...
@@ -84,9 +83,7 @@ internal class GroupImpl(
override
lateinit
var
owner
:
Member
override
fun
getMember
(
id
:
Long
):
Member
=
members
.
delegate
.
filteringGetOrAdd
(
{
it
.
id
==
id
},
{
MemberImpl
(
bot
.
getQQ
(
id
)
as
QQImpl
,
this
,
coroutineContext
)
})
members
.
delegate
.
filterGetOrNull
{
it
.
id
==
id
}
?:
error
(
"Failed to find Member${id} in group ${groupCode}"
)
override
suspend
fun
updateGroupInfo
():
net
.
mamoe
.
mirai
.
data
.
GroupInfo
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
0f587cad
...
...
@@ -12,6 +12,7 @@ import kotlinx.io.core.use
import
net.mamoe.mirai.contact.ContactList
import
net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.Member
import
net.mamoe.mirai.contact.MemberPermission
import
net.mamoe.mirai.data.MultiPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.event.*
...
...
@@ -172,13 +173,18 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
contactList
)
group
.
owner
=
MemberImpl
(
QQImpl
(
bot
,
EmptyCoroutineContext
,
it
.
dwGroupOwnerUin
!!
),
group
,
EmptyCoroutineContext
)
MemberImpl
(
QQImpl
(
bot
,
EmptyCoroutineContext
,
it
.
dwGroupOwnerUin
!!
),
group
,
EmptyCoroutineContext
,
MemberPermission
.
OWNER
)
toGet
[
group
]
=
contactList
bot
.
groups
.
delegate
.
addLast
(
group
)
}
toGet
.
forEach
{
try
{
getTroopMemberList
(
it
.
key
,
it
.
value
)
getTroopMemberList
(
it
.
key
,
it
.
value
,
it
.
key
.
owner
.
id
)
}
catch
(
e
:
Exception
)
{
bot
.
logger
.
info
(
"群${it.key.groupCode}的列表拉取失败, 将采用动态加入"
)
}
...
...
@@ -191,7 +197,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
}
suspend
fun
getTroopMemberList
(
group
:
GroupImpl
,
list
:
ContactList
<
Member
>):
ContactList
<
Member
>
{
suspend
fun
getTroopMemberList
(
group
:
GroupImpl
,
list
:
ContactList
<
Member
>
,
owner
:
Long
):
ContactList
<
Member
>
{
bot
.
logger
.
info
(
"开始获取群[${group.groupCode}]成员列表"
)
var
size
=
0
var
nextUin
=
0L
...
...
@@ -203,13 +209,26 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
nextUin
).
sendAndExpect
<
FriendList
.
GetTroopMemberList
.
Response
>(
timeoutMillis
=
3000
)
data
.
members
.
forEach
{
list
.
delegate
.
addLast
(
MemberImpl
(
QQImpl
(
bot
,
EmptyCoroutineContext
,
it
.
memberUin
),
group
,
EmptyCoroutineContext
if
(
it
.
memberUin
!=
bot
.
uin
)
{
list
.
delegate
.
addLast
(
MemberImpl
(
QQImpl
(
bot
,
EmptyCoroutineContext
,
it
.
memberUin
),
group
,
EmptyCoroutineContext
,
when
{
it
.
memberUin
==
owner
->
{
MemberPermission
.
OWNER
}
it
.
dwFlag
==
1L
->
{
MemberPermission
.
ADMINISTRATOR
}
else
->
{
MemberPermission
.
MEMBER
}
}
)
)
)
}
}
size
+=
data
.
members
.
size
nextUin
=
data
.
nextUin
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment