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
3a8b2dd6
Commit
3a8b2dd6
authored
Apr 09, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MessageSource.id from offline quotations
parent
7f498604
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
105 deletions
+85
-105
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt
...in/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt
+5
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+68
-102
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
+3
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt
...Main/kotlin/net.mamoe.mirai/message/data/MessageSource.kt
+9
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt
View file @
3a8b2dd6
...
@@ -255,6 +255,10 @@ internal class OfflineMessageSourceImplBySourceMsg( // from others' quotation
...
@@ -255,6 +255,10 @@ internal class OfflineMessageSourceImplBySourceMsg( // from others' quotation
override
val
bot
:
Bot
,
override
val
bot
:
Bot
,
groupIdOrZero
:
Long
groupIdOrZero
:
Long
)
:
OfflineMessageSource
(),
MessageSourceImpl
{
)
:
OfflineMessageSource
(),
MessageSourceImpl
{
init
{
println
(
delegate
.
_miraiContentToString
())
}
override
val
kind
:
Kind
get
()
=
if
(
delegate
.
srcMsg
==
null
)
Kind
.
GROUP
else
Kind
.
FRIEND
override
val
kind
:
Kind
get
()
=
if
(
delegate
.
srcMsg
==
null
)
Kind
.
GROUP
else
Kind
.
FRIEND
private
val
isRecalled
:
AtomicBoolean
=
atomic
(
false
)
private
val
isRecalled
:
AtomicBoolean
=
atomic
(
false
)
...
@@ -276,7 +280,7 @@ internal class OfflineMessageSourceImplBySourceMsg( // from others' quotation
...
@@ -276,7 +280,7 @@ internal class OfflineMessageSourceImplBySourceMsg( // from others' quotation
override
val
id
:
Int
override
val
id
:
Int
get
()
=
delegate
.
pbReserve
.
loadAs
(
SourceMsg
.
ResvAttr
.
serializer
()).
origUids
?.
toInt
()
get
()
=
delegate
.
pbReserve
.
loadAs
(
SourceMsg
.
ResvAttr
.
serializer
()).
origUids
?.
toInt
()
?:
error
(
"在读取 OfflineMessageSourceImplBySourceMsg.id 时找不到 origUids, delegate=${delegate._miraiContentToString()}"
)
?:
0
// override val sourceMessage: MessageChain get() = delegate.toMessageChain()
// override val sourceMessage: MessageChain get() = delegate.toMessageChain()
override
val
fromId
:
Long
get
()
=
delegate
.
senderUin
override
val
fromId
:
Long
get
()
=
delegate
.
senderUin
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
3a8b2dd6
This diff is collapsed.
Click to expand it.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
View file @
3a8b2dd6
...
@@ -23,6 +23,7 @@ import net.mamoe.mirai.contact.Member
...
@@ -23,6 +23,7 @@ import net.mamoe.mirai.contact.Member
import
net.mamoe.mirai.contact.MemberPermission
import
net.mamoe.mirai.contact.MemberPermission
import
net.mamoe.mirai.contact.QQ
import
net.mamoe.mirai.contact.QQ
import
net.mamoe.mirai.data.MemberInfo
import
net.mamoe.mirai.data.MemberInfo
import
net.mamoe.mirai.event.Event
import
net.mamoe.mirai.event.events.BotJoinGroupEvent
import
net.mamoe.mirai.event.events.BotJoinGroupEvent
import
net.mamoe.mirai.event.events.BotOfflineEvent
import
net.mamoe.mirai.event.events.BotOfflineEvent
import
net.mamoe.mirai.event.events.MemberJoinEvent
import
net.mamoe.mirai.event.events.MemberJoinEvent
...
@@ -116,7 +117,8 @@ internal class MessageSvc {
...
@@ -116,7 +117,8 @@ internal class MessageSvc {
}
}
@OptIn
(
MiraiInternalAPI
::
class
)
@OptIn
(
MiraiInternalAPI
::
class
)
open
class
GetMsgSuccess
(
delegate
:
List
<
Packet
>)
:
Response
(
MsgSvc
.
SyncFlag
.
STOP
,
delegate
)
{
open
class
GetMsgSuccess
(
delegate
:
List
<
Packet
>)
:
Response
(
MsgSvc
.
SyncFlag
.
STOP
,
delegate
),
Event
,
Packet
.
NoLog
{
override
fun
toString
():
String
=
"MessageSvc.PbGetMsg.GetMsgSuccess(messages=<Iterable>))"
override
fun
toString
():
String
=
"MessageSvc.PbGetMsg.GetMsgSuccess(messages=<Iterable>))"
}
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt
View file @
3a8b2dd6
...
@@ -56,6 +56,8 @@ sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<OnlineMes
...
@@ -56,6 +56,8 @@ sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<OnlineMes
/**
/**
* 消息 id.
* 消息 id.
* 当 [OnlineMessageSource] 时为随机数.
* 当 [OfflineMessageSource] 时可能为 0, 取决于服务器是否提供这个值.
*/
*/
abstract
val
id
:
Int
// random
abstract
val
id
:
Int
// random
...
@@ -235,7 +237,7 @@ inline fun MessageSource.isAboutGroup(): Boolean {
...
@@ -235,7 +237,7 @@ inline fun MessageSource.isAboutGroup(): Boolean {
}
}
inline
fun
MessageSource
.
isAboutTemp
():
Boolean
{
inline
fun
MessageSource
.
isAboutTemp
():
Boolean
{
return
when
(
this
)
{
return
when
(
this
)
{
is
OnlineMessageSource
->
subject
is
Member
is
OnlineMessageSource
->
subject
is
Member
is
OfflineMessageSource
->
kind
==
OfflineMessageSource
.
Kind
.
TEMP
is
OfflineMessageSource
->
kind
==
OfflineMessageSource
.
Kind
.
TEMP
}
}
...
@@ -302,6 +304,12 @@ abstract class OfflineMessageSource : MessageSource() {
...
@@ -302,6 +304,12 @@ abstract class OfflineMessageSource : MessageSource() {
*/
*/
abstract
val
kind
:
Kind
abstract
val
kind
:
Kind
/**
* 消息 id.
* 服务器不一定提供 id. 因此此值可能为 0
*/
abstract
override
val
id
:
Int
// final override fun toString(): String = "OfflineMessageSource(sender=$senderId, target=$targetId)"
// final override fun toString(): String = "OfflineMessageSource(sender=$senderId, target=$targetId)"
}
}
...
...
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