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
d786f59f
Commit
d786f59f
authored
Oct 25, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix
parent
354321de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/Message.kt
.../src/commonMain/kotlin/net.mamoe.mirai/message/Message.kt
+18
-8
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/internal/MessageDataInternal.kt
...n/net.mamoe.mirai/message/internal/MessageDataInternal.kt
+1
-1
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/Message.kt
View file @
d786f59f
...
...
@@ -212,6 +212,8 @@ object NullMessageChain : MessageChain {
override
val
stringValue
:
String
get
()
=
""
override
fun
toString
():
String
=
stringValue
override
fun
contains
(
sub
:
String
):
Boolean
=
false
override
fun
contains
(
element
:
Message
):
Boolean
=
false
override
fun
concat
(
tail
:
Message
):
MessageChain
=
MessageChainImpl
(
tail
)
...
...
@@ -271,6 +273,8 @@ internal inline class MessageChainImpl constructor(
// region Message override
override
val
stringValue
:
String
get
()
=
this
.
delegate
.
joinToString
(
""
)
{
it
.
stringValue
}
override
fun
toString
():
String
=
stringValue
override
operator
fun
contains
(
sub
:
String
):
Boolean
=
delegate
.
any
{
it
.
contains
(
sub
)
}
override
fun
concat
(
tail
:
Message
):
MessageChain
{
if
(
tail
is
MessageChain
)
tail
.
forEach
{
child
->
this
.
concat
(
child
)
}
...
...
@@ -324,6 +328,7 @@ internal inline class SingleMessageChainImpl(
return
this
}
override
fun
toString
():
String
=
stringValue
// endregion
// region MutableList override
override
fun
containsAll
(
elements
:
Collection
<
Message
>):
Boolean
=
elements
.
all
{
it
===
delegate
}
...
...
@@ -339,23 +344,28 @@ internal inline class SingleMessageChainImpl(
override
fun
clear
()
=
throw
UnsupportedOperationException
()
override
fun
listIterator
():
MutableListIterator
<
Message
>
=
object
:
MutableListIterator
<
Message
>
{
private
var
hasNext
=
true
override
fun
hasPrevious
():
Boolean
=
false
override
fun
hasPrevious
():
Boolean
=
!
hasNext
override
fun
nextIndex
():
Int
=
if
(
hasNext
)
0
else
-
1
override
fun
previous
():
Message
=
throw
NoSuchElementException
()
override
fun
previousIndex
():
Int
=
-
1
override
fun
previous
():
Message
=
if
(
hasPrevious
())
{
hasNext
=
true
delegate
}
else
throw
NoSuchElementException
()
override
fun
previousIndex
():
Int
=
if
(!
hasNext
)
0
else
-
1
override
fun
add
(
element
:
Message
)
=
throw
UnsupportedOperationException
()
override
fun
hasNext
():
Boolean
=
!
hasNext
override
fun
hasNext
():
Boolean
=
hasNext
override
fun
next
():
Message
=
if
(
hasNext
)
{
hasNext
=
false
this
@SingleMessageChainImpl
delegate
}
else
throw
NoSuchElementException
()
override
fun
remove
()
=
throw
UnsupportedOperationException
()
override
fun
set
(
element
:
Message
)
=
throw
UnsupportedOperationException
()
}
override
fun
listIterator
(
index
:
Int
):
MutableListIterator
<
Message
>
=
throw
UnsupportedOperationException
()
override
fun
listIterator
(
index
:
Int
):
MutableListIterator
<
Message
>
=
if
(
index
==
0
)
listIterator
()
else
throw
UnsupportedOperationException
()
override
fun
remove
(
element
:
Message
):
Boolean
=
throw
UnsupportedOperationException
()
override
fun
removeAll
(
elements
:
Collection
<
Message
>):
Boolean
=
throw
UnsupportedOperationException
()
override
fun
removeAt
(
index
:
Int
):
Message
=
throw
UnsupportedOperationException
()
...
...
@@ -372,11 +382,11 @@ internal inline class SingleMessageChainImpl(
override
fun
iterator
():
MutableIterator
<
Message
>
=
object
:
MutableIterator
<
Message
>
{
private
var
hasNext
=
true
override
fun
hasNext
():
Boolean
=
!
hasNext
override
fun
hasNext
():
Boolean
=
hasNext
override
fun
next
():
Message
=
if
(
hasNext
)
{
hasNext
=
false
this
@SingleMessageChainImpl
delegate
}
else
throw
NoSuchElementException
()
override
fun
remove
()
=
throw
UnsupportedOperationException
()
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/internal/MessageDataInternal.kt
View file @
d786f59f
...
...
@@ -249,7 +249,7 @@ fun MessageChain.toPacket(forGroup: Boolean): ByteReadPacket = buildPacket {
}
}
else
->
throw
UnsupportedOperationException
(
"${this::class.simpleName} is not supported"
)
else
->
throw
UnsupportedOperationException
(
"${this::class.simpleName} is not supported
(Full MessageChain=${this@toPacket})
"
)
}
})
}
...
...
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