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
a5853ba2
Commit
a5853ba2
authored
Dec 04, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `delegate` to `mutable`
parent
9db853e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
.../src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
+11
-11
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/internal/ContactImpl.kt
...in/kotlin/net.mamoe.mirai/contact/internal/ContactImpl.kt
+4
-4
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
View file @
a5853ba2
...
...
@@ -59,7 +59,7 @@ inline fun <R> Contact.withSession(block: BotSession.() -> R): R {
/**
* 只读联系人列表
*/
class
ContactList
<
C
:
Contact
>
@PublishedApi
internal
constructor
(
internal
val
delegat
e
:
MutableContactList
<
C
>)
:
Map
<
UInt
,
C
>
{
class
ContactList
<
C
:
Contact
>
@PublishedApi
internal
constructor
(
internal
val
mutabl
e
:
MutableContactList
<
C
>)
:
Map
<
UInt
,
C
>
{
/**
* ID 列表的字符串表示.
* 如:
...
...
@@ -69,19 +69,19 @@ class ContactList<C : Contact> @PublishedApi internal constructor(internal val d
*/
val
idContentString
:
String
get
()
=
this
.
keys
.
joinToString
(
prefix
=
"["
,
postfix
=
"]"
)
{
it
.
toLong
().
toString
()
}
override
fun
toString
():
String
=
delegat
e
.
toString
()
override
fun
toString
():
String
=
mutabl
e
.
toString
()
// TODO: 2019/12/2 应该使用属性代理, 但属性代理会导致 UInt 内联错误. 等待 kotlin 修复后替换
override
val
size
:
Int
get
()
=
delegat
e
.
size
override
fun
containsKey
(
key
:
UInt
):
Boolean
=
delegat
e
.
containsKey
(
key
)
override
fun
containsValue
(
value
:
C
):
Boolean
=
delegat
e
.
containsValue
(
value
)
override
fun
get
(
key
:
UInt
):
C
?
=
delegat
e
[
key
]
override
fun
isEmpty
():
Boolean
=
delegat
e
.
isEmpty
()
override
val
entries
:
MutableSet
<
MutableMap
.
MutableEntry
<
UInt
,
C
>>
get
()
=
delegat
e
.
entries
override
val
keys
:
MutableSet
<
UInt
>
get
()
=
delegat
e
.
keys
override
val
values
:
MutableCollection
<
C
>
get
()
=
delegat
e
.
values
override
val
size
:
Int
get
()
=
mutabl
e
.
size
override
fun
containsKey
(
key
:
UInt
):
Boolean
=
mutabl
e
.
containsKey
(
key
)
override
fun
containsValue
(
value
:
C
):
Boolean
=
mutabl
e
.
containsValue
(
value
)
override
fun
get
(
key
:
UInt
):
C
?
=
mutabl
e
[
key
]
override
fun
isEmpty
():
Boolean
=
mutabl
e
.
isEmpty
()
override
val
entries
:
MutableSet
<
MutableMap
.
MutableEntry
<
UInt
,
C
>>
get
()
=
mutabl
e
.
entries
override
val
keys
:
MutableSet
<
UInt
>
get
()
=
mutabl
e
.
keys
override
val
values
:
MutableCollection
<
C
>
get
()
=
mutabl
e
.
values
}
/**
...
...
@@ -93,7 +93,7 @@ internal class MutableContactList<C : Contact> : MutableMap<UInt, C> {
// TODO: 2019/12/2 应该使用属性代理, 但属性代理会导致 UInt 内联错误. 等待 kotlin 修复后替换
private
val
delegate
=
mutable
MapOf
<
UInt
,
C
>()
private
val
delegate
=
linked
MapOf
<
UInt
,
C
>()
override
val
size
:
Int
get
()
=
delegate
.
size
override
fun
containsKey
(
key
:
UInt
):
Boolean
=
delegate
.
containsKey
(
key
)
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/internal/ContactImpl.kt
View file @
a5853ba2
...
...
@@ -73,7 +73,7 @@ internal data class GroupImpl internal constructor(override val bot: Bot, val gr
}
override
suspend
fun
updateGroupInfo
():
GroupInfo
=
bot
.
withSession
{
GroupPacket
.
QueryGroupInfo
(
qqAccount
,
internalId
,
sessionKey
).
sendAndExpect
<
RawGroupInfo
>().
parseBy
(
this
@GroupImpl
)
GroupPacket
.
QueryGroupInfo
(
qqAccount
,
internalId
,
sessionKey
).
sendAndExpect
<
RawGroupInfo
>().
parseBy
(
this
@GroupImpl
)
.
also
{
info
=
it
}
}
override
suspend
fun
quit
():
QuitGroupResponse
=
bot
.
withSession
{
...
...
@@ -84,17 +84,17 @@ internal data class GroupImpl internal constructor(override val bot: Bot, val gr
override
suspend
fun
CoroutineContext
.
startUpdater
()
{
subscribeAlways
<
MemberJoinEventPacket
>
{
// FIXME: 2019/11/29 非线程安全!!
members
.
delegat
e
[
it
.
member
.
id
]
=
it
.
member
members
.
mutabl
e
[
it
.
member
.
id
]
=
it
.
member
}
subscribeAlways
<
MemberQuitEvent
>
{
// FIXME: 2019/11/29 非线程安全!!
members
.
delegat
e
.
remove
(
it
.
member
.
id
)
members
.
mutabl
e
.
remove
(
it
.
member
.
id
)
}
}
override
fun
toString
():
String
=
"Group(${this.id})"
override
fun
iterator
():
Iterator
<
Member
>
=
members
.
delegate
.
values
.
iterator
()
override
fun
iterator
():
Iterator
<
Member
>
=
members
.
values
.
iterator
()
}
internal
data class
QQImpl
internal
constructor
(
override
val
bot
:
Bot
,
override
val
id
:
UInt
,
override
val
coroutineContext
:
CoroutineContext
)
:
ContactImpl
(),
...
...
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