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
79fe9076
Commit
79fe9076
authored
Dec 19, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unresolved references
parent
c2d2be6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
22 deletions
+25
-22
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/event/MemberPermission.kt
...amoe.mirai.timpc/network/packet/event/MemberPermission.kt
+9
-5
mirai-core-timpc/src/jvmTest/kotlin/BadQQFilter.kt
mirai-core-timpc/src/jvmTest/kotlin/BadQQFilter.kt
+5
-6
mirai-demos/mirai-demo-android/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
...roid/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
+11
-11
No files found.
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/event/MemberPermission.kt
View file @
79fe9076
...
@@ -5,16 +5,19 @@ package net.mamoe.mirai.timpc.network.packet.event
...
@@ -5,16 +5,19 @@ package net.mamoe.mirai.timpc.network.packet.event
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.io.core.discardExact
import
kotlinx.io.core.discardExact
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.network.data.Packet
import
net.mamoe.mirai.network.data.
Event
Packet
import
net.mamoe.mirai.timpc.network.packet.PacketVersion
import
net.mamoe.mirai.timpc.network.packet.PacketVersion
import
net.mamoe.mirai.utils.io.readQQ
import
net.mamoe.mirai.utils.io.readQQ
import
net.mamoe.mirai.contact.Member
import
net.mamoe.mirai.contact.Group
data class
MemberPermissionChangePacket
(
data class
MemberPermissionChangePacket
(
val
groupId
:
Long
,
val
member
:
Member
,
val
qq
:
Long
,
val
kind
:
Kind
val
kind
:
Kind
)
:
Packet
{
)
:
EventPacket
{
val
group
:
Group
get
()
=
member
.
group
enum
class
Kind
{
enum
class
Kind
{
/**
/**
* 变成管理员
* 变成管理员
...
@@ -35,12 +38,13 @@ internal object GroupMemberPermissionChangedEventFactory : KnownEventParserAndHa
...
@@ -35,12 +38,13 @@ internal object GroupMemberPermissionChangedEventFactory : KnownEventParserAndHa
// 取消管理员
// 取消管理员
// 00 00 00 08 00 0A 00 04 01 00 00 00 22 96 29 7B 01 00 76 E4 B8 DD 00
// 00 00 00 08 00 0A 00 04 01 00 00 00 22 96 29 7B 01 00 76 E4 B8 DD 00
discardExact
(
remaining
-
5
)
discardExact
(
remaining
-
5
)
val
group
=
bot
.
getGroup
(
identity
.
from
)
val
qq
=
readQQ
()
val
qq
=
readQQ
()
val
kind
=
when
(
readByte
().
toInt
())
{
val
kind
=
when
(
readByte
().
toInt
())
{
0
x00
->
MemberPermissionChangePacket
.
Kind
.
NO_LONGER_OPERATOR
0
x00
->
MemberPermissionChangePacket
.
Kind
.
NO_LONGER_OPERATOR
0
x01
->
MemberPermissionChangePacket
.
Kind
.
BECOME_OPERATOR
0
x01
->
MemberPermissionChangePacket
.
Kind
.
BECOME_OPERATOR
else
->
error
(
"Could not determine permission change kind"
)
else
->
error
(
"Could not determine permission change kind"
)
}
}
return
MemberPermissionChangePacket
(
identity
.
from
,
qq
,
kind
)
return
MemberPermissionChangePacket
(
group
.
getMember
(
qq
)
,
kind
)
}
}
}
}
mirai-core-timpc/src/jvmTest/kotlin/BadQQFilter.kt
View file @
79fe9076
...
@@ -5,7 +5,6 @@ import kotlinx.coroutines.GlobalScope
...
@@ -5,7 +5,6 @@ import kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.runBlocking
import
kotlinx.coroutines.runBlocking
import
kotlinx.coroutines.withContext
import
kotlinx.coroutines.withContext
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.network.data.LoginResult
import
net.mamoe.mirai.timpc.TIMPC
import
net.mamoe.mirai.timpc.TIMPC
import
java.util.*
import
java.util.*
...
@@ -47,12 +46,12 @@ suspend fun main() {
...
@@ -47,12 +46,12 @@ suspend fun main() {
if
(
password
.
endsWith
(
"."
))
password
.
substring
(
0
,
password
.
length
-
1
)
else
password
if
(
password
.
endsWith
(
"."
))
password
.
substring
(
0
,
password
.
length
-
1
)
else
password
)
)
withContext
(
Dispatchers
.
IO
)
{
try
{
bot
.
login
()
withContext
(
Dispatchers
.
IO
)
{
}.
let
{
state
->
bot
.
login
()
if
(
state
==
LoginResult
.
SUCCESS
)
{
goodBotList
.
add
(
bot
)
}
}
goodBotList
.
add
(
bot
)
}
catch
(
ignored
:
Exception
)
{
}
}
}
}
}
}
...
...
mirai-demos/mirai-demo-android/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
View file @
79fe9076
...
@@ -13,8 +13,8 @@ import kotlinx.coroutines.launch
...
@@ -13,8 +13,8 @@ import kotlinx.coroutines.launch
import
kotlinx.io.core.readBytes
import
kotlinx.io.core.readBytes
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.event.subscribeMessages
import
net.mamoe.mirai.event.subscribeMessages
import
net.mamoe.mirai.network.data.LoginResult
import
net.mamoe.mirai.timpc.TIMPC
import
net.mamoe.mirai.timpc.TIMPC
import
net.mamoe.mirai.utils.LoginFailedException
import
java.lang.ref.WeakReference
import
java.lang.ref.WeakReference
class
MiraiService
:
Service
()
{
class
MiraiService
:
Service
()
{
...
@@ -42,18 +42,18 @@ class MiraiService : Service() {
...
@@ -42,18 +42,18 @@ class MiraiService : Service() {
private
fun
login
(
qq
:
Long
,
pwd
:
String
)
{
private
fun
login
(
qq
:
Long
,
pwd
:
String
)
{
GlobalScope
.
launch
{
GlobalScope
.
launch
{
mBot
=
TIMPC
.
Bot
(
qq
,
pwd
).
apply
{
mBot
=
TIMPC
.
Bot
(
qq
,
pwd
).
apply
{
val
loginResult
=
login
{
try
{
captchaSolver
=
{
login
{
val
bytes
=
it
.
readBytes
()
captchaSolver
=
{
val
bitmap
=
BitmapFactory
.
decodeByteArray
(
bytes
,
0
,
bytes
.
size
)
val
bytes
=
it
.
readBytes
()
mCaptchaDeferred
=
CompletableDeferred
()
val
bitmap
=
BitmapFactory
.
decodeByteArray
(
bytes
,
0
,
bytes
.
size
)
mCallback
?.
get
()
?.
onCaptcha
(
bitmap
)
mCaptchaDeferred
=
CompletableDeferred
()
mCaptchaDeferred
.
await
()
mCallback
?.
get
()
?.
onCaptcha
(
bitmap
)
mCaptchaDeferred
.
await
()
}
}
}
}
if
(
loginResult
==
LoginResult
.
SUCCESS
)
{
mCallback
?.
get
()
?.
onSuccess
()
mCallback
?.
get
()
?.
onSuccess
()
}
else
{
}
catch
(
e
:
LoginFailedException
)
{
mCallback
?.
get
()
?.
onFailed
()
mCallback
?.
get
()
?.
onFailed
()
}
}
}
}
...
...
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