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
73d1a3d4
Commit
73d1a3d4
authored
Feb 02, 2020
by
Him188
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
36ef9c28
0d485059
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
16 deletions
+26
-16
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+18
-12
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+6
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
...re/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
+2
-2
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
73d1a3d4
...
...
@@ -73,25 +73,30 @@ internal class MemberImpl(
@UseExperimental
(
MiraiInternalAPI
::
class
)
internal
class
GroupImpl
(
bot
:
QQAndroidBot
,
override
val
coroutineContext
:
CoroutineContext
,
override
val
id
:
Long
)
:
ContactImpl
(),
Group
{
internal
class
GroupImpl
(
bot
:
QQAndroidBot
,
override
val
coroutineContext
:
CoroutineContext
,
override
val
id
:
Long
,
override
val
owner
:
Member
,
override
val
name
:
String
,
override
val
announcement
:
String
,
override
val
members
:
ContactList
<
Member
>
)
:
ContactImpl
(),
Group
{
override
val
internalId
:
GroupInternalId
=
GroupId
(
id
).
toInternalId
()
override
val
owner
:
Member
get
()
=
TODO
(
"not implemented"
)
override
val
name
:
String
get
()
=
TODO
(
"not implemented"
)
override
val
announcement
:
String
get
()
=
TODO
(
"not implemented"
)
override
val
members
:
ContactList
<
Member
>
=
ContactList
(
LockFreeLinkedList
())
override
fun
getMember
(
id
:
Long
):
Member
=
members
.
delegate
.
filteringGetOrAdd
({
it
.
id
==
id
},
{
MemberImpl
(
bot
.
getQQ
(
id
)
as
QQImpl
,
this
,
coroutineContext
)
})
members
.
delegate
.
filteringGetOrAdd
(
{
it
.
id
==
id
},
{
MemberImpl
(
bot
.
getQQ
(
id
)
as
QQImpl
,
this
,
coroutineContext
)
})
override
suspend
fun
updateGroupInfo
():
GroupInfo
{
TODO
(
"not implemented"
)
override
suspend
fun
updateGroupInfo
():
net
.
mamoe
.
mirai
.
data
.
GroupInfo
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
override
suspend
fun
quit
():
Boolean
{
TODO
(
"not implemented"
)
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
operator
fun
get
(
key
:
Long
):
Member
?
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
override
val
bot
:
QQAndroidBot
by
bot
.
unsafeWeakRef
()
...
...
@@ -112,4 +117,5 @@ internal class GroupImpl(bot: QQAndroidBot, override val coroutineContext: Corou
override
suspend
fun
uploadImage
(
image
:
ExternalImage
):
ImageId
{
TODO
(
"not implemented"
)
}
}
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
73d1a3d4
...
...
@@ -13,6 +13,7 @@ import net.mamoe.mirai.data.MultiPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.event.*
import
net.mamoe.mirai.network.BotNetworkHandler
import
net.mamoe.mirai.qqandroid.GroupImpl
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.QQImpl
import
net.mamoe.mirai.qqandroid.event.ForceOfflineEvent
...
...
@@ -148,11 +149,14 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
}
try
{
bot
.
logger
.
info
(
"开始加载组列表"
)
bot
.
logger
.
info
(
"开始加载
群
组列表"
)
val
troopData
=
FriendList
.
GetTroopListSimplify
(
bot
.
client
).
sendAndExpect
<
FriendList
.
GetTroopListSimplify
.
Response
>(
timeoutMillis
=
1000
)
println
(
troopData
.
contentToString
())
troopData
.
groups
.
forEach
{
bot
.
groups
.
delegate
.
addLast
(
GroupImpl
(
bot
,
EmptyCoroutineContext
,
it
.
groupUin
))
}
bot
.
logger
.
info
(
"群组列表加载完成, 共 ${troopData.groups.size}个"
)
}
catch
(
e
:
Exception
)
{
bot
.
logger
.
info
(
"加载组信息失败|一般这是由于加载过于频繁导致/将以热加载方式加载群列表"
)
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
View file @
73d1a3d4
...
...
@@ -15,7 +15,7 @@ import net.mamoe.mirai.utils.coerceAtLeastOrFail
* - Group ID([Group.internalId]) 是与调用 API 时使用的 id.(在 QQ 客户端中不可见)
* @author Him188moe
*/
interface
Group
:
Contact
,
CoroutineScope
/*, Map<UInt, Member>*/
{
// TODO: 2020/1/29 实现接口 Map<Long, Memebr>
interface
Group
:
Contact
,
CoroutineScope
{
/**
* 内部 ID. 内部 ID 为 [GroupId] 的映射
*/
...
...
@@ -101,4 +101,4 @@ fun Long.groupId(): GroupId = GroupId(this.coerceAtLeastOrFail(0))
* @see GroupInternalId.toId 由 [GroupInternalId] 转换为 [GroupId]
* @see GroupId.toInternalId 由 [GroupId] 转换为 [GroupInternalId]
*/
inline
class
GroupInternalId
(
inline
val
value
:
Long
)
inline
class
GroupInternalId
(
inline
val
value
:
Long
)
\ No newline at end of file
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