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
4ac84cf1
Commit
4ac84cf1
authored
Jan 28, 2020
by
Him188
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
a68dec97
933eb1c2
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
863 additions
and
17 deletions
+863
-17
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgSvc.kt
...rai/qqandroid/network/protocol/packet/chat/data/MsgSvc.kt
+816
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt
...ork/protocol/packet/chat/receive/MessageSvc.PushNotify.kt
+2
-1
mirai-core-qqandroid/src/jvmTest/kotlin/test/JceDataClassGenerator.kt
...qandroid/src/jvmTest/kotlin/test/JceDataClassGenerator.kt
+44
-15
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
...oid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
+1
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgSvc.kt
0 → 100644
View file @
4ac84cf1
This diff is collapsed.
Click to expand it.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt
View file @
4ac84cf1
...
@@ -16,7 +16,6 @@ import net.mamoe.mirai.utils.cryptor.contentToString
...
@@ -16,7 +16,6 @@ import net.mamoe.mirai.utils.cryptor.contentToString
import
net.mamoe.mirai.utils.firstValue
import
net.mamoe.mirai.utils.firstValue
import
net.mamoe.mirai.utils.io.debugPrint
import
net.mamoe.mirai.utils.io.debugPrint
import
net.mamoe.mirai.utils.io.toReadPacket
import
net.mamoe.mirai.utils.io.toReadPacket
import
net.mamoe.mirai.utils.io.toUHexString
class
MessageSvc
{
class
MessageSvc
{
internal
object
PushNotify
:
PacketFactory
<
RequestPushNotify
>(
"MessageSvc.PushNotify"
)
{
internal
object
PushNotify
:
PacketFactory
<
RequestPushNotify
>(
"MessageSvc.PushNotify"
)
{
...
@@ -35,6 +34,8 @@ class MessageSvc {
...
@@ -35,6 +34,8 @@ class MessageSvc {
.
readRemainingAsJceStruct
(
RequestPushNotify
.
serializer
())
.
readRemainingAsJceStruct
(
RequestPushNotify
.
serializer
())
println
(
requestPushNotify
.
contentToString
())
println
(
requestPushNotify
.
contentToString
())
return
requestPushNotify
return
requestPushNotify
}
}
}
}
...
...
mirai-core-qqandroid/src/jvmTest/kotlin/test/JceDataClassGenerator.kt
View file @
4ac84cf1
...
@@ -24,13 +24,6 @@ class JCEInfo(
...
@@ -24,13 +24,6 @@ class JCEInfo(
override
fun
toString
():
String
{
override
fun
toString
():
String
{
properties
=
properties
.
sortedBy
{
it-
>
it
.
jceID
}
properties
=
properties
.
sortedBy
{
it-
>
it
.
jceID
}
/**
*
@Serializable
class RequestDataVersion2(
@SerialId(0) val map: Map<String, Map<String, ByteArray>>
) : JceStruct
*/
val
max
=
(
properties
.
size
-
1
).
toString
().
length
val
max
=
(
properties
.
size
-
1
).
toString
().
length
val
builder
:
StringBuilder
=
StringBuilder
(
"@Serializable"
)
val
builder
:
StringBuilder
=
StringBuilder
(
"@Serializable"
)
builder
.
append
(
"\n"
).
append
(
"internal class "
).
append
(
className
).
append
(
"("
)
builder
.
append
(
"\n"
).
append
(
"internal class "
).
append
(
className
).
append
(
"("
)
...
@@ -45,10 +38,11 @@ class JCEInfo(
...
@@ -45,10 +38,11 @@ class JCEInfo(
}
}
class
Property
(
class
Property
(
va
l
name
:
String
,
va
r
name
:
String
,
var
type
:
String
,
var
type
:
String
,
var
defaultValue
:
String
?
=
null
var
defaultValue
:
String
?
=
null
){
){
var
isRequired
:
Boolean
=
true
var
jceID
:
Int
=
-
1
var
jceID
:
Int
=
-
1
//convert type/default value to kotlin format
//convert type/default value to kotlin format
init
{
init
{
...
@@ -59,6 +53,28 @@ class Property(
...
@@ -59,6 +53,28 @@ class Property(
.
replace
(
"int"
,
"Int"
)
.
replace
(
"int"
,
"Int"
)
.
replace
(
"short"
,
"Short"
)
.
replace
(
"short"
,
"Short"
)
.
replace
(
"long"
,
"Long"
)
.
replace
(
"long"
,
"Long"
)
if
(
name
.
length
>
1
&&
name
.
get
(
1
).
isUpperCase
()){
if
(
name
.
get
(
0
)
==
'l'
||
name
.
get
(
0
)
==
'c'
||
name
.
get
(
0
)
==
'b'
){
name
=
name
.
substring
(
1
)
}
}
if
(
name
.
startsWith
(
"str"
)
||
name
.
startsWith
(
"bytes"
)){
name
=
name
.
replace
(
"str"
,
""
).
replace
(
"bytes"
,
""
)
}
if
(
name
.
contains
(
"_"
)){
val
x
=
name
.
split
(
"_"
)
name
=
x
.
get
(
0
);
var
z
=
1
;
repeat
(
x
.
size-1
){
name
+=
""
+
x
.
get
(
z
).
get
(
0
).
toUpperCase
()
+
x
.
get
(
z
).
substring
(
1
).
toLowerCase
()
++
z
;
}
}
name
=
""
+
name
.
get
(
0
).
toLowerCase
()
+
""
+
name
.
substring
(
1
)
}
}
//@SerialId(1) val iVersion: Short = 3,
//@SerialId(1) val iVersion: Short = 3,
override
fun
toString
():
String
{
override
fun
toString
():
String
{
...
@@ -70,10 +86,19 @@ class Property(
...
@@ -70,10 +86,19 @@ class Property(
fun
toStringWithSpacing
(
maxIDLength
:
Int
):
String
{
fun
toStringWithSpacing
(
maxIDLength
:
Int
):
String
{
val
space
=
" "
.
repeat
(
maxIDLength
-
(
jceID
.
toString
().
length
))
val
space
=
" "
.
repeat
(
maxIDLength
-
(
jceID
.
toString
().
length
))
if
(
defaultValue
!=
null
)
{
var
base
=
" @SerialId("
+
jceID
+
") "
+
space
+
"val "
+
name
+
":"
+
type
+
""
return
" @SerialId("
+
jceID
+
") "
+
space
+
"val "
+
name
+
":"
+
type
+
" = "
+
defaultValue
if
(!
isRequired
){
if
(
defaultValue
==
null
)
{
base
+=
"? = null"
}
else
{
base
+=
"? = $defaultValue"
}
}
else
{
if
(
defaultValue
!=
null
)
{
base
+=
" = "
+
defaultValue
}
}
}
return
" @SerialId("
+
jceID
+
") "
+
space
+
"val "
+
name
+
":"
+
type
+
"? = null"
return
base
}
}
}
}
...
@@ -128,10 +153,14 @@ fun toJCEInfo(source:String):JCEInfo{
...
@@ -128,10 +153,14 @@ fun toJCEInfo(source:String):JCEInfo{
if
(!
allProperties
.
containsKey
(
key
)){
if
(!
allProperties
.
containsKey
(
key
)){
println
(
key
+
" is found in readFrom but not in properties"
)
println
(
key
+
" is found in readFrom but not in properties"
)
}
}
val
id
=
it
val
src
=
it
.
substringBetween
(
".read("
,
");"
)
.
replace
(
".readString("
,
".read(\" \","
)
.
split
(
","
)[
1
].
trim
().
toInt
()
.
substringBetween
(
"("
,
");"
)
allProperties
.
get
(
key
)
?.
jceID
=
id
;
.
split
(
","
)
with
(
allProperties
.
get
(
key
)
!!
){
this
.
jceID
=
src
[
1
].
trim
().
toInt
()
this
.
isRequired
=
src
[
2
].
trim
().
toBoolean
()
}
}
}
}
}
}
}
...
...
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
View file @
4ac84cf1
...
@@ -6,7 +6,7 @@ import java.io.File
...
@@ -6,7 +6,7 @@ import java.io.File
fun
main
()
{
fun
main
()
{
println
(
println
(
File
(
"""
E:\Projects\QQAndroidFF\app\src\main\java\msf\onlinepush
"""
)
File
(
"""
/Users/jiahua.liu/Desktop/QQAndroid-F/app/src/main/java/tencent/im/s2c/msgtype0x210/submsgtype0x1a/
"""
)
.
generateUnarrangedClasses
().
toMutableList
().
arrangeClasses
().
joinToString
(
"\n\n"
)
.
generateUnarrangedClasses
().
toMutableList
().
arrangeClasses
().
joinToString
(
"\n\n"
)
)
)
}
}
...
...
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