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
748581b1
Commit
748581b1
authored
Jan 10, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enum Gender
parent
8d1a12d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
29 deletions
+29
-29
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/action/Profile.kt
...in/net.mamoe.mirai.timpc/network/packet/action/Profile.kt
+13
-13
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/event/MessageEvent.kt
...et.mamoe.mirai.timpc/network/packet/event/MessageEvent.kt
+9
-9
mirai-core-timpc/src/jvmTest/kotlin/BadQQFilter.kt
mirai-core-timpc/src/jvmTest/kotlin/BadQQFilter.kt
+3
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
...ore/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
+4
-6
No files found.
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/action/Profile.kt
View file @
748581b1
...
@@ -185,25 +185,25 @@ internal object RequestProfileDetailsPacket : SessionPacketFactory<RequestProfil
...
@@ -185,25 +185,25 @@ internal object RequestProfileDetailsPacket : SessionPacketFactory<RequestProfil
//map.mapValues { it.value.encodeToString() }.printTLVMap("Profile(qq=$qq) str=")
//map.mapValues { it.value.encodeToString() }.printTLVMap("Profile(qq=$qq) str=")
val
profile
=
Profile
(
val
profile
=
Profile
(
qq
=
qq
,
qq
=
qq
,
nickname
=
map
[
0
x4E22
u
]
?.
encodeToString
()
?:
""
,
//error("Cannot determine nickname")
nickname
=
map
[
0
x4E22
]
?.
encodeToString
()
?:
""
,
//error("Cannot determine nickname")
englishName
=
map
[
0
x4E54
u
]
?.
encodeToString
(),
englishName
=
map
[
0
x4E54
]
?.
encodeToString
(),
chineseName
=
map
[
0
x4E2A
u
]
?.
encodeToString
(),
chineseName
=
map
[
0
x4E2A
]
?.
encodeToString
(),
qAge
=
map
[
0
x6597
u
]
?.
get
(
0
)
?.
toInt
(),
qAge
=
map
[
0
x6597
]
?.
get
(
0
)
?.
toInt
(),
zipCode
=
map
[
0
x4E25
u
]
?.
encodeToString
(),
zipCode
=
map
[
0
x4E25
]
?.
encodeToString
(),
phone
=
map
[
0
x4E27
u
]
?.
encodeToString
(),
phone
=
map
[
0
x4E27
]
?.
encodeToString
(),
gender
=
when
(
map
[
0
x4E29
u
]
?.
let
{
it
[
0
]
}
?.
toUInt
())
{
gender
=
when
(
map
[
0
x4E29
]
?.
let
{
it
[
0
]
}
?.
toUInt
())
{
null
->
Gender
.
SECRET
//error("Cannot determine gender, entry 0x4E29u not found")
null
->
Gender
.
SECRET
//error("Cannot determine gender, entry 0x4E29u not found")
0
x02u
->
Gender
.
FEMALE
0
x02u
->
Gender
.
FEMALE
0
x01u
->
Gender
.
MALE
0
x01u
->
Gender
.
MALE
else
->
Gender
.
SECRET
// 猜的
else
->
Gender
.
SECRET
// 猜的
//else -> error("Cannot determine gender, bad value of 0x4E29u: ${map[0x4729u]!![0].toHexString()}")
//else -> error("Cannot determine gender, bad value of 0x4E29u: ${map[0x4729u]!![0].toHexString()}")
},
},
birthday
=
map
[
0
x4E3F
u
]
?.
let
{
GMTDate
(
it
.
toUInt
().
toLong
())
},
birthday
=
map
[
0
x4E3F
]
?.
let
{
GMTDate
(
it
.
toUInt
().
toLong
())
},
personalStatement
=
map
[
0
x4E33
u
]
?.
encodeToString
(),
personalStatement
=
map
[
0
x4E33
]
?.
encodeToString
(),
homepage
=
map
[
0
x4E2D
u
]
?.
encodeToString
(),
homepage
=
map
[
0
x4E2D
]
?.
encodeToString
(),
company
=
map
[
0
x5DC8
u
]
?.
encodeToString
(),
company
=
map
[
0
x5DC8
]
?.
encodeToString
(),
school
=
map
[
0
x4E35
u
]
?.
encodeToString
(),
school
=
map
[
0
x4E35
]
?.
encodeToString
(),
email
=
map
[
0
x4E2B
u
]
?.
encodeToString
()
email
=
map
[
0
x4E2B
]
?.
encodeToString
()
)
)
map
.
clear
()
map
.
clear
()
...
...
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/event/MessageEvent.kt
View file @
748581b1
...
@@ -31,14 +31,14 @@ internal object GroupMessageEventParserAndHandler : KnownEventParserAndHandler<G
...
@@ -31,14 +31,14 @@ internal object GroupMessageEventParserAndHandler : KnownEventParserAndHandler<G
var
senderPermission
:
MemberPermission
=
MemberPermission
.
MEMBER
var
senderPermission
:
MemberPermission
=
MemberPermission
.
MEMBER
var
senderName
=
""
var
senderName
=
""
val
map
=
readTLVMap
(
true
)
val
map
=
readTLVMap
(
true
,
1
)
if
(
map
.
containsKey
(
18
u
))
{
if
(
map
.
containsKey
(
18
))
{
map
.
getValue
(
18
u
).
read
{
map
.
getValue
(
18
).
read
{
val
tlv
=
readTLVMap
(
true
)
val
tlv
=
readTLVMap
(
true
,
1
)
senderPermission
=
when
(
tlv
.
takeIf
{
it
.
containsKey
(
0
x04
u
)
}
?.
get
(
0
x04u
)
?.
getOrNull
(
3
)
?.
toU
Int
())
{
senderPermission
=
when
(
tlv
.
takeIf
{
it
.
containsKey
(
0
x04
)
}
?.
get
(
0
x04
)
?.
getOrNull
(
3
)
?.
to
Int
())
{
null
->
MemberPermission
.
MEMBER
null
->
MemberPermission
.
MEMBER
0
x08
u
->
MemberPermission
.
OWNER
0
x08
->
MemberPermission
.
OWNER
0
x10
u
->
MemberPermission
.
ADMINISTRATOR
0
x10
->
MemberPermission
.
ADMINISTRATOR
else
->
{
else
->
{
tlv
.
printTLVMap
(
"TLV(tag=18) Map"
)
tlv
.
printTLVMap
(
"TLV(tag=18) Map"
)
MiraiLogger
.
warning
(
"Could not determine member permission, default permission MEMBER is being used"
)
MiraiLogger
.
warning
(
"Could not determine member permission, default permission MEMBER is being used"
)
...
@@ -47,8 +47,8 @@ internal object GroupMessageEventParserAndHandler : KnownEventParserAndHandler<G
...
@@ -47,8 +47,8 @@ internal object GroupMessageEventParserAndHandler : KnownEventParserAndHandler<G
}
}
senderName
=
when
{
senderName
=
when
{
tlv
.
containsKey
(
0
x01
u
)
->
kotlinx
.
io
.
core
.
String
(
tlv
.
getValue
(
0
x01u
))
//这个人的qq昵称
tlv
.
containsKey
(
0
x01
)
->
kotlinx
.
io
.
core
.
String
(
tlv
.
getValue
(
0
x01
))
//这个人的qq昵称
tlv
.
containsKey
(
0
x02
u
)
->
kotlinx
.
io
.
core
.
String
(
tlv
.
getValue
(
0
x02u
))
//这个人的群名片
tlv
.
containsKey
(
0
x02
)
->
kotlinx
.
io
.
core
.
String
(
tlv
.
getValue
(
0
x02
))
//这个人的群名片
else
->
{
else
->
{
tlv
.
printTLVMap
(
"TLV(tag=18) Map"
)
tlv
.
printTLVMap
(
"TLV(tag=18) Map"
)
MiraiLogger
.
warning
(
"Could not determine senderName"
)
MiraiLogger
.
warning
(
"Could not determine senderName"
)
...
...
mirai-core-timpc/src/jvmTest/kotlin/BadQQFilter.kt
View file @
748581b1
...
@@ -6,6 +6,7 @@ import kotlinx.coroutines.runBlocking
...
@@ -6,6 +6,7 @@ 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.timpc.TIMPC
import
net.mamoe.mirai.timpc.TIMPC
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
java.util.*
import
java.util.*
/**
/**
...
@@ -31,6 +32,7 @@ const val qqList = "" +
...
@@ -31,6 +32,7 @@ const val qqList = "" +
"\n"
+
"\n"
+
"\n"
"\n"
@UseExperimental
(
MiraiInternalAPI
::
class
)
suspend
fun
main
()
{
suspend
fun
main
()
{
val
goodBotList
=
Collections
.
synchronizedList
(
mutableListOf
<
Bot
>())
val
goodBotList
=
Collections
.
synchronizedList
(
mutableListOf
<
Bot
>())
...
@@ -58,5 +60,5 @@ suspend fun main() {
...
@@ -58,5 +60,5 @@ suspend fun main() {
}
}
println
(
"Filtering finished"
)
println
(
"Filtering finished"
)
println
(
goodBotList
.
joinToString
(
"\n"
)
{
it
.
account
.
id
.
toString
()
+
" "
+
it
.
account
.
passwordMd5
})
println
(
goodBotList
.
joinToString
(
"\n"
)
{
it
.
uin
.
toString
()
+
" "
+
it
.
account
.
passwordMd5
})
}
}
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
View file @
748581b1
...
@@ -45,10 +45,8 @@ data class Profile(
...
@@ -45,10 +45,8 @@ data class Profile(
/**
/**
* 性别
* 性别
*/
// 在 Android 中 enum 的使用被严格控制.
*/
// 在 Android 中 enum 的使用被严格控制.
inline
class
Gender
(
val
value
:
Byte
)
{
enum
class
Gender
(
val
value
:
Byte
)
{
companion
object
{
SECRET
(
0
),
val
SECRET
=
Gender
(
0
)
MALE
(
1
),
val
MALE
=
Gender
(
2
)
FEMALE
(
2
)
val
FEMALE
=
Gender
(
1
)
}
}
}
\ 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