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
6f67edfd
Commit
6f67edfd
authored
Feb 05, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GetGroupOperationInfo
parent
ff1c075f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
23 deletions
+46
-23
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+5
-6
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+21
-7
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
.../mirai/qqandroid/network/protocol/packet/PacketFactory.kt
+2
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt
...qqandroid/network/protocol/packet/chat/TroopManagement.kt
+17
-7
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
...oid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
+1
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
6f67edfd
package
net.mamoe.mirai.qqandroid
package
net.mamoe.mirai.qqandroid
import
kotlinx.coroutines.async
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
net.mamoe.mirai.contact.*
import
net.mamoe.mirai.contact.*
import
net.mamoe.mirai.data.FriendNameRemark
import
net.mamoe.mirai.data.FriendNameRemark
...
@@ -134,7 +133,7 @@ internal class GroupImpl(
...
@@ -134,7 +133,7 @@ internal class GroupImpl(
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
this
.
bot
.
launch
{
this
.
bot
.
launch
{
bot
.
network
.
run
{
bot
.
network
.
run
{
TroopManagement
.
updateGroupInfo
.
name
(
TroopManagement
.
GroupOperation
.
name
(
client
=
bot
.
client
,
client
=
bot
.
client
,
groupCode
=
id
,
groupCode
=
id
,
newName
=
newValue
newName
=
newValue
...
@@ -148,7 +147,7 @@ internal class GroupImpl(
...
@@ -148,7 +147,7 @@ internal class GroupImpl(
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
this
.
bot
.
launch
{
this
.
bot
.
launch
{
bot
.
network
.
run
{
bot
.
network
.
run
{
TroopManagement
.
updateGroupInfo
.
memo
(
TroopManagement
.
GroupOperation
.
memo
(
client
=
bot
.
client
,
client
=
bot
.
client
,
groupCode
=
id
,
groupCode
=
id
,
newMemo
=
newValue
newMemo
=
newValue
...
@@ -163,7 +162,7 @@ internal class GroupImpl(
...
@@ -163,7 +162,7 @@ internal class GroupImpl(
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
this
.
bot
.
launch
{
this
.
bot
.
launch
{
bot
.
network
.
run
{
bot
.
network
.
run
{
TroopManagement
.
updateGroupInfo
.
allowMemberInvite
(
TroopManagement
.
GroupOperation
.
allowMemberInvite
(
client
=
bot
.
client
,
client
=
bot
.
client
,
groupCode
=
id
,
groupCode
=
id
,
switch
=
newValue
switch
=
newValue
...
@@ -185,7 +184,7 @@ internal class GroupImpl(
...
@@ -185,7 +184,7 @@ internal class GroupImpl(
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
this
.
bot
.
launch
{
this
.
bot
.
launch
{
bot
.
network
.
run
{
bot
.
network
.
run
{
TroopManagement
.
updateGroupInfo
.
confessTalk
(
TroopManagement
.
GroupOperation
.
confessTalk
(
client
=
bot
.
client
,
client
=
bot
.
client
,
groupCode
=
id
,
groupCode
=
id
,
switch
=
newValue
switch
=
newValue
...
@@ -200,7 +199,7 @@ internal class GroupImpl(
...
@@ -200,7 +199,7 @@ internal class GroupImpl(
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
if
(
this
.
botPermission
!=
MemberPermission
.
MEMBER
&&
oldValue
!=
newValue
)
{
this
.
bot
.
launch
{
this
.
bot
.
launch
{
bot
.
network
.
run
{
bot
.
network
.
run
{
TroopManagement
.
updateGroupInfo
.
muteAll
(
TroopManagement
.
GroupOperation
.
muteAll
(
client
=
bot
.
client
,
client
=
bot
.
client
,
groupCode
=
id
,
groupCode
=
id
,
switch
=
newValue
switch
=
newValue
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
6f67edfd
...
@@ -161,6 +161,20 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -161,6 +161,20 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
val
toGet
:
MutableMap
<
GroupImpl
,
ContactList
<
Member
>>
=
mutableMapOf
()
val
toGet
:
MutableMap
<
GroupImpl
,
ContactList
<
Member
>>
=
mutableMapOf
()
troopData
.
groups
.
forEach
{
troopData
.
groups
.
forEach
{
val
contactList
=
ContactList
(
LockFreeLinkedList
<
Member
>())
val
contactList
=
ContactList
(
LockFreeLinkedList
<
Member
>())
val
groupInfoResponse
=
try
{
TroopManagement
.
GetGroupOperationInfo
(
client
=
bot
.
client
,
groupCode
=
it
.
groupCode
).
sendAndExpect
<
TroopManagement
.
GetGroupOperationInfo
.
Response
>()
}
catch
(
e
:
Exception
)
{
bot
.
logger
.
info
(
"获取"
+
it
.
groupCode
+
"的群设置失败"
)
TroopManagement
.
GetGroupOperationInfo
.
Response
(
allowAnonymousChat
=
false
,
allowMemberInvite
=
false
,
autoApprove
=
false
,
confessTalk
=
false
)
}
val
group
=
val
group
=
GroupImpl
(
GroupImpl
(
bot
=
bot
,
bot
=
bot
,
...
@@ -169,11 +183,11 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -169,11 +183,11 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
uin
=
it
.
groupUin
,
uin
=
it
.
groupUin
,
initName
=
it
.
groupName
,
initName
=
it
.
groupName
,
initAnnouncement
=
it
.
groupMemo
,
initAnnouncement
=
it
.
groupMemo
,
initAllowMemberInvite
=
fals
e
,
initAllowMemberInvite
=
groupInfoResponse
.
allowMemberInvit
e
,
initConfessTalk
=
false
,
initConfessTalk
=
groupInfoResponse
.
confessTalk
,
initMuteAll
=
false
,
initMuteAll
=
false
,
//todo
initAutoApprove
=
fals
e
,
initAutoApprove
=
groupInfoResponse
.
autoApprov
e
,
initAnonymousChat
=
false
,
initAnonymousChat
=
groupInfoResponse
.
allowAnonymousChat
,
members
=
contactList
members
=
contactList
)
)
group
.
owner
=
group
.
owner
=
...
@@ -244,10 +258,10 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -244,10 +258,10 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
}
}
suspend
fun
getGroupInfo
(
uin
:
Long
)
{
suspend
fun
getGroupInfo
(
uin
:
Long
)
{
val
data
=
TroopManagement
.
getGroup
Info
(
val
data
=
TroopManagement
.
GetGroupOperation
Info
(
client
=
bot
.
client
,
client
=
bot
.
client
,
groupCode
=
uin
groupCode
=
uin
).
sendAndExpect
<
TroopManagement
.
getGroup
Info
.
Response
>(
timeoutMillis
=
3000
)
).
sendAndExpect
<
TroopManagement
.
GetGroupOperation
Info
.
Response
>(
timeoutMillis
=
3000
)
}
}
suspend
fun
getTroopMemberList
(
group
:
GroupImpl
,
list
:
ContactList
<
Member
>,
owner
:
Long
):
ContactList
<
Member
>
{
suspend
fun
getTroopMemberList
(
group
:
GroupImpl
,
list
:
ContactList
<
Member
>,
owner
:
Long
):
ContactList
<
Member
>
{
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
View file @
6f67edfd
...
@@ -127,8 +127,8 @@ internal object KnownPacketFactories {
...
@@ -127,8 +127,8 @@ internal object KnownPacketFactories {
LongConn
.
OffPicDown
,
LongConn
.
OffPicDown
,
TroopManagement
.
EditNametag
,
TroopManagement
.
EditNametag
,
TroopManagement
.
Mute
,
TroopManagement
.
Mute
,
TroopManagement
.
updateGroupInfo
,
TroopManagement
.
GroupOperation
,
TroopManagement
.
getGroup
Info
TroopManagement
.
GetGroupOperation
Info
)
)
object
IncomingFactories
:
List
<
IncomingPacketFactory
<
*
>>
by
mutableListOf
(
object
IncomingFactories
:
List
<
IncomingPacketFactory
<
*
>>
by
mutableListOf
(
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt
View file @
6f67edfd
...
@@ -6,6 +6,7 @@ import kotlinx.io.core.readBytes
...
@@ -6,6 +6,7 @@ import kotlinx.io.core.readBytes
import
kotlinx.io.core.toByteArray
import
kotlinx.io.core.toByteArray
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.loadAs
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
import
net.mamoe.mirai.qqandroid.io.serialization.writeProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.writeProtoBuf
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
...
@@ -18,7 +19,6 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory
...
@@ -18,7 +19,6 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory
import
net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket
import
net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.LoginPacket
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.LoginPacket
import
net.mamoe.mirai.utils.daysToSeconds
import
net.mamoe.mirai.utils.daysToSeconds
import
net.mamoe.mirai.utils.io.debugPrintThis
internal
object
TroopManagement
{
internal
object
TroopManagement
{
...
@@ -58,9 +58,13 @@ internal object TroopManagement {
...
@@ -58,9 +58,13 @@ internal object TroopManagement {
}
}
internal
object
get
GroupInfo
:
OutgoingPacketFactory
<
get
GroupInfo
.
Response
>(
"OidbSvc.0x88d_7"
)
{
internal
object
GetGroupOperationInfo
:
OutgoingPacketFactory
<
GetGroupOperationInfo
.
Response
>(
"OidbSvc.0x88d_7"
)
{
class
Response
(
class
Response
()
:
Packet
val
allowAnonymousChat
:
Boolean
,
val
allowMemberInvite
:
Boolean
,
val
autoApprove
:
Boolean
,
val
confessTalk
:
Boolean
)
:
Packet
operator
fun
invoke
(
operator
fun
invoke
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
...
@@ -104,12 +108,18 @@ internal object TroopManagement {
...
@@ -104,12 +108,18 @@ internal object TroopManagement {
}
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
debugPrintThis
()
with
(
this
.
readBytes
().
loadAs
(
OidbSso
.
OIDBSSOPkg
.
serializer
()).
bodybuffer
.
loadAs
(
Oidb0x88d
.
RspBody
.
serializer
()).
stzrspgroupinfo
!!
[
0
].
stgroupinfo
!!
)
{
return
Response
()
return
Response
(
allowMemberInvite
=
(
this
.
groupFlagExt
?.
and
(
0
x000000c0
)
!=
0
),
allowAnonymousChat
=
(
this
.
groupFlagExt
?.
and
(
0
x40000000
)
==
0
),
autoApprove
=
(
this
.
groupFlagext3
?.
and
(
0
x00100000
)
==
0
),
confessTalk
=
(
this
.
groupFlagext3
?.
and
(
0
x00002000
)
==
0
)
)
}
}
}
}
}
internal
object
update
GroupInfo
:
OutgoingPacketFactory
<
update
GroupInfo
.
Response
>(
"OidbSvc.0x89a_0"
)
{
internal
object
GroupOperation
:
OutgoingPacketFactory
<
GroupOperation
.
Response
>(
"OidbSvc.0x89a_0"
)
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
return
Response
return
Response
}
}
...
...
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
View file @
6f67edfd
...
@@ -6,7 +6,7 @@ import java.io.File
...
@@ -6,7 +6,7 @@ import java.io.File
fun
main
()
{
fun
main
()
{
println
(
println
(
File
(
"""/Users/jiahua.liu/Desktop/QQAndroid-F/app/src/main/java/tencent/im/oidb/
cmd0x88d/
"""
)
File
(
"""/Users/jiahua.liu/Desktop/QQAndroid-F/app/src/main/java/tencent/im/oidb/"""
)
.
generateUnarrangedClasses
().
toMutableList
().
arrangeClasses
().
joinToString
(
"\n\n"
)
.
generateUnarrangedClasses
().
toMutableList
().
arrangeClasses
().
joinToString
(
"\n\n"
)
)
)
}
}
...
...
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