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
cb06520b
Commit
cb06520b
authored
Feb 20, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicitly override `hashCode` and `toString` in `interface Contact`, close #80
parent
9660b441
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+6
-17
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
.../src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
+10
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
...re/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
+3
-2
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
cb06520b
...
@@ -162,16 +162,11 @@ internal class QQImpl(
...
@@ -162,16 +162,11 @@ internal class QQImpl(
TODO
(
"not implemented"
)
TODO
(
"not implemented"
)
}
}
override
fun
equals
(
other
:
Any
?):
Boolean
{
override
fun
toString
():
String
=
"QQ($id)"
if
(
this
===
other
)
return
true
return
other
is
QQ
&&
other
.
id
==
this
.
id
}
override
fun
hashCode
():
Int
=
super
.
hashCode
()
}
}
@Suppress
(
"MemberVisibilityCanBePrivate"
)
@Suppress
(
"MemberVisibilityCanBePrivate"
,
"DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE"
)
internal
class
MemberImpl
(
internal
class
MemberImpl
(
qq
:
QQImpl
,
qq
:
QQImpl
,
group
:
GroupImpl
,
group
:
GroupImpl
,
...
@@ -279,12 +274,9 @@ internal class MemberImpl(
...
@@ -279,12 +274,9 @@ internal class MemberImpl(
}
}
}
}
override
fun
equals
(
other
:
Any
?):
Boolean
{
override
fun
toString
():
String
{
if
(
this
===
other
)
return
true
return
"Member($id)"
return
other
is
Member
&&
other
.
id
==
this
.
id
}
}
override
fun
hashCode
():
Int
=
super
.
hashCode
()
}
}
internal
class
MemberInfoImpl
(
internal
class
MemberInfoImpl
(
...
@@ -600,10 +592,7 @@ internal class GroupImpl(
...
@@ -600,10 +592,7 @@ internal class GroupImpl(
image
.
input
.
close
()
image
.
input
.
close
()
}
}
override
fun
equals
(
other
:
Any
?):
Boolean
{
override
fun
toString
():
String
{
if
(
this
===
other
)
return
true
return
"Group($id)"
return
other
is
Group
&&
other
.
id
==
this
.
id
}
}
override
fun
hashCode
():
Int
=
super
.
hashCode
()
}
}
\ No newline at end of file
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
View file @
cb06520b
...
@@ -74,6 +74,16 @@ interface Contact : CoroutineScope {
...
@@ -74,6 +74,16 @@ interface Contact : CoroutineScope {
* 而 [QQ] 含义为一个独立的人, 可以是好友, 也可以是陌生人.
* 而 [QQ] 含义为一个独立的人, 可以是好友, 也可以是陌生人.
*/
*/
override
fun
equals
(
other
:
Any
?):
Boolean
override
fun
equals
(
other
:
Any
?):
Boolean
/**
* @return `bot.hashCode() * 31 + id.hashCode()`
*/
override
fun
hashCode
():
Int
/**
* @return "QQ($id)" or "Group($id)" or "Member($id)"
*/
override
fun
toString
():
String
}
}
suspend
inline
fun
Contact
.
sendMessage
(
message
:
Message
)
=
sendMessage
(
message
.
toChain
())
suspend
inline
fun
Contact
.
sendMessage
(
message
:
Message
)
=
sendMessage
(
message
.
toChain
())
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
View file @
cb06520b
...
@@ -97,11 +97,11 @@ interface Group : Contact, CoroutineScope {
...
@@ -97,11 +97,11 @@ interface Group : Contact, CoroutineScope {
/**
/**
* 机器人在这个群里的权限
* 机器人在这个群里的权限
*
*
* **MiraiExperimentalAPI**: 在未来可能会被修改
* @see Group.checkBotPermission
* @see Group.checkBotPermissionOperator
*
*
* @see BotGroupPermissionChangeEvent
* @see BotGroupPermissionChangeEvent
*/
*/
@MiraiExperimentalAPI
val
botPermission
:
MemberPermission
val
botPermission
:
MemberPermission
...
@@ -129,6 +129,7 @@ interface Group : Contact, CoroutineScope {
...
@@ -129,6 +129,7 @@ interface Group : Contact, CoroutineScope {
/**
/**
* 让机器人退出这个群. 机器人必须为非群主才能退出. 否则将会失败
* 让机器人退出这个群. 机器人必须为非群主才能退出. 否则将会失败
*/
*/
@MiraiExperimentalAPI
(
"还未支持"
)
suspend
fun
quit
():
Boolean
suspend
fun
quit
():
Boolean
/**
/**
...
...
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