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
68d86a92
Commit
68d86a92
authored
Feb 07, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce _ vars
parent
ca43cf68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
95 deletions
+118
-95
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+118
-95
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
68d86a92
...
...
@@ -20,7 +20,6 @@ import net.mamoe.mirai.qqandroid.utils.toIpV4AddressString
import
net.mamoe.mirai.utils.*
import
net.mamoe.mirai.utils.io.toUHexString
import
kotlin.coroutines.CoroutineContext
import
kotlin.properties.Delegates
internal
abstract
class
ContactImpl
:
Contact
{
override
fun
hashCode
():
Int
{
...
...
@@ -51,6 +50,7 @@ internal class QQImpl(bot: QQAndroidBot, override val coroutineContext: Coroutin
)
{
"send message failed"
}
}
}
override
suspend
fun
uploadImage
(
image
:
ExternalImage
):
Image
=
try
{
bot
.
network
.
run
{
val
response
=
LongConn
.
OffPicUp
(
...
...
@@ -129,8 +129,8 @@ internal class QQImpl(bot: QQAndroidBot, override val coroutineContext: Coroutin
internal
class
MemberImpl
(
qq
:
QQImpl
,
initG
roupCard
:
String
,
initS
pecialTitle
:
String
,
var
_g
roupCard
:
String
,
var
_s
pecialTitle
:
String
,
group
:
GroupImpl
,
override
val
coroutineContext
:
CoroutineContext
,
override
val
permission
:
MemberPermission
...
...
@@ -138,37 +138,41 @@ internal class MemberImpl(
override
val
group
:
GroupImpl
by
group
.
unsafeWeakRef
()
val
qq
:
QQImpl
by
qq
.
unsafeWeakRef
()
override
var
groupCard
:
String
by
Delegates
.
observable
(
initGroupCard
)
{
_
,
old
,
new
->
group
.
checkBotPermissionOperator
()
if
(
new
!=
old
)
{
launch
{
bot
.
network
.
run
{
TroopManagement
.
EditGroupNametag
(
bot
.
client
,
this
@MemberImpl
,
new
).
sendWithoutExpect
()
override
var
groupCard
:
String
get
()
=
_groupCard
set
(
newValue
)
{
group
.
checkBotPermissionOperator
()
if
(
_groupCard
!=
newValue
)
{
_groupCard
=
newValue
launch
{
bot
.
network
.
run
{
TroopManagement
.
EditGroupNametag
(
bot
.
client
,
this
@MemberImpl
,
newValue
).
sendWithoutExpect
()
}
}
}
}
}
override
var
specialTitle
:
String
by
Delegates
.
observable
(
initSpecialTitle
)
{
_
,
old
,
new
->
group
.
checkBotPermissionOperator
()
if
(
new
!=
old
)
{
launch
{
bot
.
network
.
run
{
TroopManagement
.
EditSpecialTitle
(
bot
.
client
,
this
@MemberImpl
,
new
).
sendWithoutExpect
()
override
var
specialTitle
:
String
get
()
=
_specialTitle
set
(
newValue
)
{
group
.
checkBotPermissionOperator
()
if
(
_specialTitle
!=
newValue
)
{
_specialTitle
=
newValue
launch
{
bot
.
network
.
run
{
TroopManagement
.
EditSpecialTitle
(
bot
.
client
,
this
@MemberImpl
,
newValue
).
sendWithoutExpect
()
}
}
}
}
}
override
val
bot
:
QQAndroidBot
get
()
=
qq
.
bot
...
...
@@ -233,100 +237,119 @@ internal class GroupImpl(
bot
:
QQAndroidBot
,
override
val
coroutineContext
:
CoroutineContext
,
override
val
id
:
Long
,
val
uin
:
Long
,
initN
ame
:
String
,
initA
nnouncement
:
String
,
initA
llowMemberInvite
:
Boolean
,
initC
onfessTalk
:
Boolean
,
initM
uteAll
:
Boolean
,
initA
utoApprove
:
Boolean
,
initA
nonymousChat
:
Boolean
,
var
_n
ame
:
String
,
var
_a
nnouncement
:
String
,
var
_a
llowMemberInvite
:
Boolean
,
var
_c
onfessTalk
:
Boolean
,
var
_m
uteAll
:
Boolean
,
var
_a
utoApprove
:
Boolean
,
var
_a
nonymousChat
:
Boolean
,
override
val
members
:
ContactList
<
Member
>
)
:
ContactImpl
(),
Group
{
override
var
name
by
Delegates
.
observable
(
initName
)
{
_
,
oldValue
,
newValue
->
this
.
checkBotPermissionOperator
()
if
(
oldValue
!=
newValue
)
{
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
name
(
client
=
bot
.
client
,
groupCode
=
id
,
newName
=
newValue
).
sendWithoutExpect
()
override
var
name
:
String
get
()
=
_name
set
(
newValue
)
{
this
.
checkBotPermissionOperator
()
if
(
_name
!=
newValue
)
{
_name
=
newValue
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
name
(
client
=
bot
.
client
,
groupCode
=
id
,
newName
=
newValue
).
sendWithoutExpect
()
}
}
}
}
}
override
var
announcement
:
String
by
Delegates
.
observable
(
initAnnouncement
)
{
_
,
oldValue
,
newValue
->
this
.
checkBotPermissionOperator
()
if
(
oldValue
!=
newValue
)
{
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
memo
(
client
=
bot
.
client
,
groupCode
=
id
,
newMemo
=
newValue
).
sendWithoutExpect
()
override
var
announcement
:
String
get
()
=
_announcement
set
(
newValue
)
{
this
.
checkBotPermissionOperator
()
if
(
_announcement
!=
newValue
)
{
_announcement
=
newValue
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
memo
(
client
=
bot
.
client
,
groupCode
=
id
,
newMemo
=
newValue
).
sendWithoutExpect
()
}
}
}
}
}
override
var
allowMemberInvite
:
Boolean
by
Delegates
.
observable
(
initAllowMemberInvite
)
{
_
,
oldValue
,
newValue
->
this
.
checkBotPermissionOperator
()
if
(
oldValue
!=
newValue
)
{
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
allowMemberInvite
(
client
=
bot
.
client
,
groupCode
=
id
,
switch
=
newValue
).
sendWithoutExpect
()
override
var
allowMemberInvite
:
Boolean
get
()
=
_allowMemberInvite
set
(
newValue
)
{
this
.
checkBotPermissionOperator
()
if
(
_allowMemberInvite
!=
newValue
)
{
_allowMemberInvite
=
newValue
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
allowMemberInvite
(
client
=
bot
.
client
,
groupCode
=
id
,
switch
=
newValue
).
sendWithoutExpect
()
}
}
}
}
}
override
var
autoApprove
:
Boolean
by
Delegates
.
observable
(
initAutoApprove
)
{
_
,
oldValue
,
newValue
->
TODO
(
"Group.autoApprove implementation"
)
}
override
var
autoApprove
:
Boolean
get
()
=
_autoApprove
set
(
newValue
)
{
TODO
()
}
override
val
anonymousChat
:
Boolean
by
Delegates
.
observable
(
initAnonymousChat
)
{
_
,
oldValue
,
newValue
->
TODO
(
"Group.anonymousChat implementation"
)
}
override
var
anonymousChat
:
Boolean
get
()
=
_anonymousChat
set
(
newValue
)
{
TODO
()
}
override
var
confessTalk
:
Boolean
by
Delegates
.
observable
(
initConfessTalk
)
{
_
,
oldValue
,
newValue
->
this
.
checkBotPermissionOperator
()
if
(
oldValue
!=
newValue
)
{
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
confessTalk
(
client
=
bot
.
client
,
groupCode
=
id
,
switch
=
newValue
).
sendWithoutExpect
()
override
var
confessTalk
:
Boolean
get
()
=
_confessTalk
set
(
newValue
)
{
this
.
checkBotPermissionOperator
()
if
(
_confessTalk
!=
newValue
)
{
_confessTalk
=
newValue
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
confessTalk
(
client
=
bot
.
client
,
groupCode
=
id
,
switch
=
newValue
).
sendWithoutExpect
()
}
}
}
}
}
override
var
muteAll
:
Boolean
by
Delegates
.
observable
(
initMuteAll
)
{
_
,
oldValue
,
newValue
->
this
.
checkBotPermissionOperator
()
if
(
oldValue
!=
newValue
)
{
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
muteAll
(
client
=
bot
.
client
,
groupCode
=
id
,
switch
=
newValue
).
sendWithoutExpect
()
override
var
muteAll
:
Boolean
get
()
=
_muteAll
set
(
newValue
)
{
this
.
checkBotPermissionOperator
()
if
(
_muteAll
!=
newValue
)
{
_muteAll
=
newValue
launch
{
bot
.
network
.
run
{
TroopManagement
.
GroupOperation
.
muteAll
(
client
=
bot
.
client
,
groupCode
=
id
,
switch
=
newValue
).
sendWithoutExpect
()
}
}
}
}
}
override
lateinit
var
owner
:
Member
...
...
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