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
fda644d2
Commit
fda644d2
authored
Feb 12, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure info accessibility
parent
999ce68c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
23 deletions
+50
-23
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
...mmonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
+3
-8
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+18
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OIDB.kt
...mamoe/mirai/qqandroid/network/protocol/data/proto/OIDB.kt
+5
-4
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt
...qqandroid/network/protocol/packet/chat/TroopManagement.kt
+11
-6
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
...ndroid/network/protocol/packet/chat/receive/MessageSvc.kt
+9
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
...e/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
+3
-3
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
fda644d2
...
@@ -325,7 +325,7 @@ internal class GroupImpl(
...
@@ -325,7 +325,7 @@ internal class GroupImpl(
@UseExperimental
(
MiraiExperimentalAPI
::
class
)
@UseExperimental
(
MiraiExperimentalAPI
::
class
)
override
lateinit
var
botPermission
:
MemberPermission
override
lateinit
var
botPermission
:
MemberPermission
override
val
members
:
ContactList
<
Member
>
=
ContactList
(
members
.
asSequence
().
mapNotNull
{
override
val
members
:
ContactList
<
Member
>
=
ContactList
(
members
.
mapNotNull
{
if
(
it
.
uin
==
bot
.
uin
)
{
if
(
it
.
uin
==
bot
.
uin
)
{
botPermission
=
it
.
permission
botPermission
=
it
.
permission
null
null
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
View file @
fda644d2
...
@@ -24,7 +24,7 @@ import net.mamoe.mirai.event.events.BotEvent
...
@@ -24,7 +24,7 @@ import net.mamoe.mirai.event.events.BotEvent
import
net.mamoe.mirai.message.data.Image
import
net.mamoe.mirai.message.data.Image
import
net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler
import
net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.
QQAndroidGroupInfo
import
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.
GroupInfoImpl
import
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.TroopManagement
import
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.TroopManagement
import
net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
import
net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
import
net.mamoe.mirai.utils.*
import
net.mamoe.mirai.utils.*
...
@@ -92,11 +92,7 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -92,11 +92,7 @@ internal abstract class QQAndroidBotBase constructor(
TroopManagement
.
GetGroupInfo
(
TroopManagement
.
GetGroupInfo
(
client
=
bot
.
client
,
client
=
bot
.
client
,
groupCode
=
id
groupCode
=
id
).
sendAndExpect
<
QQAndroidGroupInfo
>().
apply
{
).
sendAndExpect
<
GroupInfoImpl
>()
if
(
this
.
delegate
.
groupUin
==
null
)
{
this
.
delegate
.
groupUin
=
Group
.
calculateGroupUinByGroupCode
(
id
)
}
}
}
}
override
suspend
fun
queryGroupMemberList
(
groupUin
:
Long
,
groupCode
:
Long
,
ownerId
:
Long
):
Sequence
<
MemberInfo
>
=
network
.
run
{
override
suspend
fun
queryGroupMemberList
(
groupUin
:
Long
,
groupCode
:
Long
,
ownerId
:
Long
):
Sequence
<
MemberInfo
>
=
network
.
run
{
...
@@ -110,8 +106,7 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -110,8 +106,7 @@ internal abstract class QQAndroidBotBase constructor(
nextUin
=
nextUin
nextUin
=
nextUin
).
sendAndExpect
<
FriendList
.
GetTroopMemberList
.
Response
>(
timeoutMillis
=
3000
)
).
sendAndExpect
<
FriendList
.
GetTroopMemberList
.
Response
>(
timeoutMillis
=
3000
)
sequence
+=
data
.
members
.
asSequence
().
map
{
troopMemberInfo
->
sequence
+=
data
.
members
.
asSequence
().
map
{
troopMemberInfo
->
MemberInfoImpl
(
troopMemberInfo
.
apply
{
MemberInfoImpl
(
troopMemberInfo
,
ownerId
)
},
ownerId
)
}
}
nextUin
=
data
.
nextUin
nextUin
=
data
.
nextUin
if
(
nextUin
==
0L
)
{
if
(
nextUin
==
0L
)
{
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
fda644d2
...
@@ -30,6 +30,7 @@ import net.mamoe.mirai.qqandroid.QQImpl
...
@@ -30,6 +30,7 @@ import net.mamoe.mirai.qqandroid.QQImpl
import
net.mamoe.mirai.qqandroid.event.PacketReceivedEvent
import
net.mamoe.mirai.qqandroid.event.PacketReceivedEvent
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import
net.mamoe.mirai.qqandroid.network.protocol.packet.*
import
net.mamoe.mirai.qqandroid.network.protocol.packet.*
import
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl
import
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvc
import
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvc
import
net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
import
net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.Heartbeat
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.Heartbeat
...
@@ -174,7 +175,23 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -174,7 +175,23 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
bot
=
bot
,
bot
=
bot
,
coroutineContext
=
bot
.
coroutineContext
,
coroutineContext
=
bot
.
coroutineContext
,
id
=
troopNum
.
groupCode
,
id
=
troopNum
.
groupCode
,
groupInfo
=
bot
.
queryGroupInfo
(
troopNum
.
groupCode
),
groupInfo
=
bot
.
queryGroupInfo
(
troopNum
.
groupCode
).
apply
{
this
as
GroupInfoImpl
if
(
this
.
delegate
.
groupName
==
null
)
{
this
.
delegate
.
groupName
=
troopNum
.
groupName
}
if
(
this
.
delegate
.
groupMemo
==
null
)
{
this
.
delegate
.
groupMemo
=
troopNum
.
groupMemo
}
if
(
this
.
delegate
.
groupUin
==
null
)
{
this
.
delegate
.
groupUin
=
troopNum
.
groupUin
}
this
.
delegate
.
groupCode
=
troopNum
.
groupCode
},
members
=
bot
.
queryGroupMemberList
(
troopNum
.
groupUin
,
troopNum
.
groupCode
,
troopNum
.
dwGroupOwnerUin
)
members
=
bot
.
queryGroupMemberList
(
troopNum
.
groupUin
,
troopNum
.
groupCode
,
troopNum
.
dwGroupOwnerUin
)
)
)
)
)
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OIDB.kt
View file @
fda644d2
...
@@ -180,8 +180,8 @@ class Oidb0x88d : ProtoBuf {
...
@@ -180,8 +180,8 @@ class Oidb0x88d : ProtoBuf {
@SerialId
(
12
)
val
groupDefaultPage
:
Int
?
=
null
,
@SerialId
(
12
)
val
groupDefaultPage
:
Int
?
=
null
,
@SerialId
(
13
)
val
groupInfoSeq
:
Int
?
=
null
,
@SerialId
(
13
)
val
groupInfoSeq
:
Int
?
=
null
,
@SerialId
(
14
)
val
groupRoamingTime
:
Int
?
=
null
,
@SerialId
(
14
)
val
groupRoamingTime
:
Int
?
=
null
,
@SerialId
(
15
)
va
l
groupName
:
String
?
=
null
,
@SerialId
(
15
)
va
r
groupName
:
String
?
=
null
,
@SerialId
(
16
)
va
l
groupMemo
:
String
?
=
null
,
@SerialId
(
16
)
va
r
groupMemo
:
String
?
=
null
,
@SerialId
(
17
)
val
ingGroupFingerMemo
:
String
?
=
null
,
@SerialId
(
17
)
val
ingGroupFingerMemo
:
String
?
=
null
,
@SerialId
(
18
)
val
ingGroupClassText
:
String
?
=
null
,
@SerialId
(
18
)
val
ingGroupClassText
:
String
?
=
null
,
@SerialId
(
19
)
val
groupAllianceCode
:
List
<
Int
>?
=
null
,
@SerialId
(
19
)
val
groupAllianceCode
:
List
<
Int
>?
=
null
,
...
@@ -254,7 +254,7 @@ class Oidb0x88d : ProtoBuf {
...
@@ -254,7 +254,7 @@ class Oidb0x88d : ProtoBuf {
@SerialId
(
86
)
val
isAllowConfGroupMemberNick
:
Int
?
=
null
,
@SerialId
(
86
)
val
isAllowConfGroupMemberNick
:
Int
?
=
null
,
@SerialId
(
87
)
val
isAllowConfGroupMemberAtAll
:
Int
?
=
null
,
@SerialId
(
87
)
val
isAllowConfGroupMemberAtAll
:
Int
?
=
null
,
@SerialId
(
88
)
val
isAllowConfGroupMemberModifyGroupName
:
Int
?
=
null
,
@SerialId
(
88
)
val
isAllowConfGroupMemberModifyGroupName
:
Int
?
=
null
,
@SerialId
(
89
)
val
ingLongGroupName
:
ByteArray
?
=
null
,
@SerialId
(
89
)
val
longGroupName
:
String
?
=
null
,
@SerialId
(
90
)
val
cmduinJoinRealMsgSeq
:
Int
?
=
null
,
@SerialId
(
90
)
val
cmduinJoinRealMsgSeq
:
Int
?
=
null
,
@SerialId
(
91
)
val
isGroupFreeze
:
Int
?
=
null
,
@SerialId
(
91
)
val
isGroupFreeze
:
Int
?
=
null
,
@SerialId
(
92
)
val
msgLimitFrequency
:
Int
?
=
null
,
@SerialId
(
92
)
val
msgLimitFrequency
:
Int
?
=
null
,
...
@@ -265,7 +265,8 @@ class Oidb0x88d : ProtoBuf {
...
@@ -265,7 +265,8 @@ class Oidb0x88d : ProtoBuf {
@SerialId
(
97
)
val
isAllowHlGuildBinary
:
Int
?
=
null
,
@SerialId
(
97
)
val
isAllowHlGuildBinary
:
Int
?
=
null
,
@SerialId
(
98
)
val
cmduinRingtoneId
:
Int
?
=
null
,
@SerialId
(
98
)
val
cmduinRingtoneId
:
Int
?
=
null
,
@SerialId
(
99
)
val
groupFlagext4
:
Int
?
=
null
,
@SerialId
(
99
)
val
groupFlagext4
:
Int
?
=
null
,
@SerialId
(
100
)
val
groupFreezeReason
:
Int
?
=
null
@SerialId
(
100
)
val
groupFreezeReason
:
Int
?
=
null
,
@SerialId
(
101
)
var
groupCode
:
Long
?
=
null
// mirai 添加
)
:
ProtoBuf
)
:
ProtoBuf
@Serializable
@Serializable
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt
View file @
fda644d2
...
@@ -31,14 +31,14 @@ import net.mamoe.mirai.utils.daysToSeconds
...
@@ -31,14 +31,14 @@ import net.mamoe.mirai.utils.daysToSeconds
import
net.mamoe.mirai.utils.io.encodeToString
import
net.mamoe.mirai.utils.io.encodeToString
import
net.mamoe.mirai.data.GroupInfo
as
MiraiGroupInfo
import
net.mamoe.mirai.data.GroupInfo
as
MiraiGroupInfo
internal
inline
class
QQAndroidGroupInfo
(
internal
inline
class
GroupInfoImpl
(
internal
val
delegate
:
Oidb0x88d
.
GroupInfo
internal
val
delegate
:
Oidb0x88d
.
GroupInfo
)
:
MiraiGroupInfo
,
Packet
{
)
:
MiraiGroupInfo
,
Packet
{
override
val
uin
:
Long
get
()
=
delegate
.
groupUin
?:
error
(
"cannot find groupUin"
)
override
val
uin
:
Long
get
()
=
delegate
.
groupUin
?:
error
(
"cannot find groupUin"
)
override
val
owner
:
Long
get
()
=
delegate
.
groupOwner
?:
error
(
"cannot find groupOwner"
)
override
val
owner
:
Long
get
()
=
delegate
.
groupOwner
?:
error
(
"cannot find groupOwner"
)
override
val
groupCode
:
Long
get
()
=
Group
.
calculateGroupCodeByGroupUin
(
uin
)
override
val
groupCode
:
Long
get
()
=
Group
.
calculateGroupCodeByGroupUin
(
uin
)
override
val
memo
:
String
get
()
=
delegate
.
groupMemo
?:
error
(
"cannot find groupMemo"
)
override
val
memo
:
String
get
()
=
delegate
.
groupMemo
?:
error
(
"cannot find groupMemo"
)
override
val
name
:
String
get
()
=
delegate
.
groupName
?:
error
(
"cannot find groupName"
)
override
val
name
:
String
get
()
=
delegate
.
groupName
?:
delegate
.
longGroupName
?:
error
(
"cannot find groupName"
)
override
val
allowMemberInvite
get
()
=
delegate
.
groupFlagExt
?.
and
(
0
x000000c0
)
!=
0
override
val
allowMemberInvite
get
()
=
delegate
.
groupFlagExt
?.
and
(
0
x000000c0
)
!=
0
override
val
allowAnonymousChat
get
()
=
delegate
.
groupFlagExt
?.
and
(
0
x40000000
)
==
0
override
val
allowAnonymousChat
get
()
=
delegate
.
groupFlagExt
?.
and
(
0
x40000000
)
==
0
override
val
autoApprove
get
()
=
delegate
.
groupFlagext3
?.
and
(
0
x00100000
)
==
0
override
val
autoApprove
get
()
=
delegate
.
groupFlagext3
?.
and
(
0
x00100000
)
==
0
...
@@ -86,7 +86,7 @@ internal class TroopManagement {
...
@@ -86,7 +86,7 @@ internal class TroopManagement {
}
}
internal
object
GetGroupInfo
:
OutgoingPacketFactory
<
QQAndroidGroupInfo
>(
"OidbSvc.0x88d_7"
)
{
internal
object
GetGroupInfo
:
OutgoingPacketFactory
<
GroupInfoImpl
>(
"OidbSvc.0x88d_7"
)
{
operator
fun
invoke
(
operator
fun
invoke
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
groupCode
:
Long
groupCode
:
Long
...
@@ -117,7 +117,12 @@ internal class TroopManagement {
...
@@ -117,7 +117,12 @@ internal class TroopManagement {
createSourceFlag
=
0
,
createSourceFlag
=
0
,
noCodeFingerOpenFlag
=
0
,
noCodeFingerOpenFlag
=
0
,
ingGroupQuestion
=
""
,
ingGroupQuestion
=
""
,
ingGroupAnswer
=
""
ingGroupAnswer
=
""
,
groupName
=
""
,
longGroupName
=
""
,
groupMemo
=
""
,
groupUin
=
0
,
groupOwner
=
0
),
),
groupCode
=
groupCode
groupCode
=
groupCode
)
)
...
@@ -128,9 +133,9 @@ internal class TroopManagement {
...
@@ -128,9 +133,9 @@ internal class TroopManagement {
}
}
}
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
QQAndroidGroupInfo
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
GroupInfoImpl
{
with
(
this
.
readBytes
().
loadAs
(
OidbSso
.
OIDBSSOPkg
.
serializer
()).
bodybuffer
.
loadAs
(
Oidb0x88d
.
RspBody
.
serializer
()).
stzrspgroupinfo
!!
[
0
].
stgroupinfo
!!
)
{
with
(
this
.
readBytes
().
loadAs
(
OidbSso
.
OIDBSSOPkg
.
serializer
()).
bodybuffer
.
loadAs
(
Oidb0x88d
.
RspBody
.
serializer
()).
stzrspgroupinfo
!!
[
0
].
stgroupinfo
!!
)
{
return
QQAndroidGroupInfo
(
this
)
return
GroupInfoImpl
(
this
)
}
}
}
}
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
View file @
fda644d2
...
@@ -133,6 +133,15 @@ internal class MessageSvc {
...
@@ -133,6 +133,15 @@ internal class MessageSvc {
val
messages
=
resp
.
uinPairMsgs
.
asSequence
().
filterNot
{
it
.
msg
==
null
}.
flatMap
{
it
.
msg
!!
.
asSequence
()
}.
mapNotNull
{
val
messages
=
resp
.
uinPairMsgs
.
asSequence
().
filterNot
{
it
.
msg
==
null
}.
flatMap
{
it
.
msg
!!
.
asSequence
()
}.
mapNotNull
{
when
(
it
.
msgHead
.
msgType
)
{
when
(
it
.
msgHead
.
msgType
)
{
33
->
{
33
->
{
if
(
it
.
msgHead
.
authUin
==
bot
.
uin
)
{
val
group
=
bot
.
getGroupByUinOrNull
(
it
.
msgHead
.
fromUin
)
if
(
group
==
null
)
{
TODO
(
"查询群信息, 添加群"
)
}
}
TODO
(
"为 group 添加一个 fun Member() 来构造 member"
)
// bot.getGroupByUin(it.msgHead.fromUin).members.delegate.addLast()
println
(
"GroupUin"
+
it
.
msgHead
.
fromUin
+
"新群员"
+
it
.
msgHead
.
authUin
+
" 出现了["
+
it
.
msgHead
.
authNick
+
"] 添加刷新"
)
println
(
"GroupUin"
+
it
.
msgHead
.
fromUin
+
"新群员"
+
it
.
msgHead
.
authUin
+
" 出现了["
+
it
.
msgHead
.
authNick
+
"] 添加刷新"
)
null
null
}
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
View file @
fda644d2
...
@@ -21,17 +21,17 @@ interface GroupInfo {
...
@@ -21,17 +21,17 @@ interface GroupInfo {
/**
/**
* 名称
* 名称
*/
*/
val
name
:
String
val
name
:
String
// 不一定能获取到
/**
/**
* 群主
* 群主
*/
*/
val
owner
:
Long
val
owner
:
Long
// 不一定能获取到
/**
/**
* 入群公告
* 入群公告
*/
*/
val
memo
:
String
val
memo
:
String
// 不一定能获取到
/**
/**
* 允许群员邀请其他人加入群
* 允许群员邀请其他人加入群
...
...
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