Commit Graph

2898 Commits

Author SHA1 Message Date
Him188
767475f9ab Deprecate IMirai.calculateGroupUinByGroupCode, and migrate usages to getUin. Close #1479 2021-10-30 13:44:49 +01:00
Albert
790f37ce05
修复群联系人保存 (#1633) 2021-10-30 13:38:35 +01:00
Karlatemp
217907c58a
Support sending MusicShare to friends. (#1615)
* Support sending `MusicShare` to friends.

- Also fix a potential data out-of-bounds issues

* `TypeSafeMap.get` with default values

* Fix tests
2021-10-28 13:44:18 +01:00
Karlatemp
e61fbbcc70
Fix getRawGroupHonorListData, getRawGroupActiveData (#1616) 2021-10-28 13:44:00 +01:00
Karlatemp
527fe08446
Redesign MessageChain.cleanupRubbishMessageElements() (#1607)
* Redesign `MessageChain.cleanupRubbishMessageElements()`

* Fix logic

* `CleanupRubbishMessageElementsTest`

* Fix testing unit

* more testing
2021-10-28 13:43:41 +01:00
sandtechnology
3d502a496e
Handle other cases in jpeg header (#1611)
* Handle other cases in jpeg header

Co-authored-by: sandtechnology <a1294790523@hotmail.com>

* Add unit tests

Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
2021-10-28 13:43:31 +01:00
Karlatemp
d0171878ff
Fix GroupAllowConfessTalkEvent; fix #1622 2021-10-26 22:53:51 +08:00
Karlatemp
938e7eae57
Fix ImageDecoder of JPEG format; fix #1610 2021-10-17 17:11:34 +08:00
Karlatemp
ace32caa28
Fix cross images downloading url; fix #1600 2021-10-16 16:54:15 +08:00
Karlatemp
b31f7b1ba7
AudioToSilkService (#1591)
* AudioToSilkService

* Update mirai-core-api/src/commonMain/kotlin/utils/ExternalResource.kt

Co-authored-by: Eritque arcus <1930893235@qq.com>

* `@since`; `@Experimental`

Co-authored-by: Eritque arcus <1930893235@qq.com>
2021-10-09 09:21:58 +01:00
Karlatemp
b027c6c7b7
Allow load settings from file 2021-10-07 12:04:43 +08:00
Karlatemp
0b2a759028
Image.isEmoji() (#1596)
- Also remove image regex inlining
2021-10-05 22:01:14 +08:00
Karlatemp
3e19e4b22a
Improve error message of ImageDecoder; #1593 2021-10-03 15:11:08 +08:00
Karlatemp
b1ad60fc11
Fix ForwardMessage length check; fix #1590 2021-10-02 19:03:30 +08:00
Karlatemp
c1932559a7
ssoVersion 2021-10-02 18:25:11 +08:00
lliiooll
d3425a7566
Add mac and ipad protocol from miraiGo (#1523)
* add mac and ipad protocol

* Update BotConfiguration.kt

* Update MiraiProtocolInternal.kt

* api

* Update mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.kt

Co-authored-by: Him188 <Him188@mamoe.net>
2021-10-01 22:38:04 +01:00
Him188
b0e25a5cb9 Fix FriendNickChangedEvent, fix #1536 2021-09-30 22:40:54 +01:00
Him188
6b63c323e5 Improve desensitizer: generate .serializer() for .toByteArray 2021-09-30 22:40:54 +01:00
Karlatemp
5fe9ad0658
Refine MessageSource (#1568)
* Refine MessageSource

* comments
2021-09-27 16:27:22 +01:00
Him188
cb3d4362ba Prefer using group code 2021-09-27 16:27:10 +01:00
Him188
9756a8dfa8 Fix duplicated BotJoinGroupEvent when BotInvitedJoinGroupRequestEvent is accepted by bot. Fixes #1213 2021-09-27 16:09:49 +01:00
sandtechnology
7ac65df02d
Update struct data (#1530) 2021-09-27 15:39:24 +01:00
sandtechnology
00ecf86094
Clarify specialTitle docs and support to detect specialTitle changes (#1531) 2021-09-27 15:39:11 +01:00
sandtechnology
c09f8ab192
Support for switching anonymousChat settings (#1522)
* Support for switching anonymousChat settings

* apiDump

* Applied suggestion from him188
2021-09-27 15:39:01 +01:00
Him188
ef301cc6e5
支持获取消息记录 (漫游消息) (#1520)
* Support roaming messages for friend

* Remove `RoamingMessage.getMessage`

* Remove `RoamingAuthenticator`

* Mark `@JavaFriendlyAPI`

* apiDump

Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
2021-09-18 19:37:13 +08:00
sandtechnology
4ce57f52a8
Add height, width, size and imageType attribute to Image class (#1548)
* Add height, width, size and imageType attribute to Image class
Close #1543 #1204 #1032

* Let ImageType enum code before the `Internals`, Also add @JvmStatic and OrNull version for match method

* Use runBIO and throws annotation for getImageInfo

* Add .kt suffix for MPP imagesImpl

* Return empty imageInfo for unsupported images

* Fix wrong file name

* apiDump

* Renaming MPP file instead of adding JvmName annotation

* Optimize readability and only use BIO at call-site

* Fix bug for detecting image type

* Detecting javax module for java 9+

* Clean up

* Disable some image types which not supported

* Use cross platform code to read images, readd support for apng

* Fix bug in reading image

* apiDump

* Fix bug in image reading and write unite test

* Fix wording

* Remove webp support and throws IllegalArgumentException for unsupported format

* Remove WEBP enum type

* Add unit test for unsupported image and correct comments

* Fix buffer input stream error when reading images

* Applying suggestions and fix jpg reading

* Add complete SOF decoding for jpg and clean up

* Caching jpg sof byte ranges

* Save `values()` as IMAGE_TYPE_ENUM_LIST for preventing clone operation

* Remove duplicated it
2021-09-16 04:38:59 +08:00
Him188
63fc45edd6 Try fix EventLaunchUndispatchedTest 2021-09-12 22:39:44 +08:00
Him188
062b8766a2 Raise deprecation levels:
- RichMessageOrigin
- SingleMessage.Serializer
- ForceOfflineException
- MessageSubscribersBuilder.sentByTemp
- subscribeTempMessages
- TempMessageSubscribersBuilder
- TempMessageEvent
- TempMessagePostSendEvent
- TempMessagePreSendEvent

close #1296
2021-09-12 20:57:04 +08:00
Him188
21513a92e4 Improve Bot.isOnline: do not initialize network 2021-09-12 20:42:03 +08:00
sandtechnology
e3fd680a2c
Fix #1546, revert wrong changes and request system messages (#1549)
* Fix #1546, revert wrong changes and request system messages when getting stranger

* Use faster long array

Co-authored-by: Him188 <Him188@mamoe.net>

Co-authored-by: Him188 <Him188@mamoe.net>
2021-09-12 16:51:17 +08:00
Karlatemp
d1b5c94231
Fix OnlineAudio.urlForDownload not exists when using pad with private chatting (#1551) 2021-09-12 13:17:48 +08:00
sandtechnology
394012ec3e
Support group disband kind decoding (#1525)
* Support group disband kind decoding

* Update mirai-core-api/src/commonMain/kotlin/event/events/group.kt

* Add useless comment for triggering build

Co-authored-by: Him188 <Him188@mamoe.net>
2021-09-11 14:29:39 +08:00
sandtechnology
25c489d238
#1536 Try to fix image sending error 2021-09-09 17:48:40 +08:00
Karlatemp
6cd7fa9709
#1509 try to fix bot is closed manually 2021-09-05 22:39:54 +08:00
RainChan
93fad9ee1c
#1509 try to fix bot is closed manually 2021-09-05 17:23:50 +08:00
Him188
b34dec29ca Fix serverTime diff: use currentTimeSeconds 2021-09-05 14:05:33 +08:00
Him188
2247543f65 Fix serverTime diff: ignore serverTime when it is zero 2021-09-05 13:57:58 +08:00
Him188
238ec52eea Adapt for server time difference, let MessageSource.time refer to server time. Fixes 1519 2021-09-04 21:31:10 +08:00
Him188
5188d88483 Improve CheckableResponse 2021-09-04 19:36:16 +08:00
Him188
a8acc4f4d9 Add androidMain/src/package.kt 2021-09-02 13:18:59 +08:00
Him188
7cef6277cd Rename ECDHJvmDesktop.kt in androidMain to ECDHAndroid.kt 2021-09-02 13:18:24 +08:00
Him188
4d0afc27dc Introduce auto close for ExternalResource 2021-09-01 20:05:05 +08:00
Him188
4e021d3b3e Fix cache service failure caused by users named "null" 2021-09-01 19:28:48 +08:00
Him188
66999aadaf Migrate to Kotlin 1.5.30 and review dependencies:
- Remove redundant atomicfu-common
- Do not expose kotlinx-io and atomicfu
2021-09-01 18:52:36 +08:00
Karlatemp
88b66d7863
Decode packets in netty event loop group (#1500)
* Decode packets in netty event loop group

* Update mirai-core/src/commonTest/kotlin/network/framework/AbstractNettyNHTest.kt

Co-authored-by: Him188 <Him188@mamoe.net>

Co-authored-by: Him188 <Him188@mamoe.net>
2021-09-01 14:00:27 +08:00
Him188
4d76aa82b0 Fix FriendAvatarChangedEvent
Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
2021-09-01 13:55:39 +08:00
Him188
de07e0eeb8 Use getGroupByUinOrCodeOrFail in OnlineMessageSourceFromTempImpl for tests 2021-09-01 13:55:39 +08:00
Him188
15ad3fbda6 Add BotInvitedJoinTest 2021-09-01 13:55:39 +08:00
Him188
c36d1b15f4 Remove more verbose default values in ConstructorCallCodegen 2021-09-01 13:55:39 +08:00
Him188
ec9ad7f0f1 Support nested structures in desensitizer 2021-09-01 13:55:39 +08:00
Him188
82719d6018 Ignore NewContact.SystemMsgNewGroup, subType=5, groupMsgType=16, fix #1467 2021-09-01 13:55:39 +08:00
Him188
f38089be78 Ignore NewContact.SystemMsgNewGroup, subType=0, groupMsgType=8, fix #1388 2021-09-01 13:55:39 +08:00
Him188
0ccb9c94e7 Handle possible MemberLeaveEvent.Kick for NewContact.SystemMsgNewGroup, subType=5, groupMsgType=6, fix #1171 2021-09-01 13:55:39 +08:00
Him188
cd8665b440 Add comments for kick event 2021-09-01 13:55:39 +08:00
Him188
1f2ff04c45 Get group by uin in OnlineMessageSourceFromTempImpl, fix the problem that some temp messages could not be received, fix #1410 2021-09-01 13:55:39 +08:00
Him188
9247c8b0fd Fix RecordingNoticeProcessorTest 2021-09-01 13:55:39 +08:00
Him188
86b3bbf3fb Add test for message events 2021-09-01 13:55:39 +08:00
Him188
4b4e7e1dcc Fix MemberJoinEvent processing and add MemberJoinTest 2021-09-01 13:55:39 +08:00
Him188
f51e721649 Fix group transfer and retrieve, add tests for notice events:
- GroupRetrieveTest
- GroupTransferTest
- MemberAdminChangeTest
- MemberQuitTest
- MuteTest
2021-09-01 13:55:39 +08:00
Him188
76e2b6c64c Redesign packet recording 2021-09-01 13:55:39 +08:00
Him188
c4939a7446 Add ConstructorCallCodegen 2021-09-01 13:55:39 +08:00
Him188
49c6734722 Fix ParseErrorPacket not logged 2021-09-01 13:55:39 +08:00
Him188
8663978d65 Add RecordingNoticeProcessor 2021-09-01 13:55:39 +08:00
Him188
a86c0384d4 Add AbstractPipelineContext 2021-09-01 13:55:39 +08:00
Him188
93ae89500a Fix EventBroadcasterPacketHandler.impl 2021-09-01 13:55:39 +08:00
Him188
4efbec6570 Make UnconsumedNoticesAlerter disabled by default 2021-09-01 13:55:39 +08:00
Him188
edb1713f91 Add TraceLoggingNoticeProcessor 2021-09-01 13:55:39 +08:00
Him188
2696f0b95e Remove .debug in mirai.network.debug.notice.pipeline.log.full 2021-09-01 13:55:39 +08:00
Him188
61c764bfe0 Ensure all items in MultiPacket are visited 2021-09-01 13:55:39 +08:00
Him188
9c272ebf1e Migrate more transformers to NoticeProcessorPipeline 2021-09-01 13:55:39 +08:00
Him188
edf1bc9a2e Migrate more transformers to NoticeProcessorPipeline 2021-09-01 13:55:39 +08:00
Him188
e097c5ab9d Add MutableProcessResult; remove locks 2021-09-01 13:55:39 +08:00
Him188
d15767fa9b Remove outdated todo in FriendNoticeProcessor 2021-09-01 13:55:39 +08:00
Him188
39773cd763 Move bkn from QQAndroidBot to WLoginSigInfo 2021-09-01 13:55:39 +08:00
Him188
8e947cd4e0 Delete empty ProtoBuf.kt 2021-09-01 13:55:39 +08:00
Him188
1b80fbc1e6 Redesign notice handling and introduce NoticeProcessorPipeline part 3:
- Extract `SyncController`;
- Add super type `ProtocolStruct` to `ProtoBuf` and `JceStruct` to standardize `NoticeProcessorPipeline.process`
- and other implementations for pipeline
2021-09-01 13:55:39 +08:00
Him188
be4423c993 Fix ByteArray.loadAs 2021-09-01 13:55:39 +08:00
Him188
d6b4bb9fb5 Remove Group.newAnonymousMember 2021-09-01 13:55:39 +08:00
Him188
089d0eed8c Improve performance 2021-09-01 13:55:39 +08:00
Him188
09265190e9 Add UnconsumedNoticesAlerter and cleanup
Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
2021-09-01 13:55:39 +08:00
Him188
56cbe2d8a2 Redesign notice handling and introduce NoticeProcessorPipeline part 2
Do not broadcast StrangerAddedEvent if added twice, fix stranger scope not closed

Do not add new instance if there is already one

Close and remove corresponding stranger instance if there is new friend.
2021-09-01 13:55:39 +08:00
Him188
e1ffaa5410 Fix incorrect coroutine scope created for contacts in IMirai.newFriend and IMirai.newStranger 2021-09-01 13:55:39 +08:00
Him188
dc54679acb Redesign notice handling and introduce NoticeProcessorPipeline 2021-09-01 13:55:39 +08:00
Him188
d7b493cd34 Use internal types in implementations of properties in Bot 2021-09-01 13:55:39 +08:00
Him188
975dd8e50b Use NormalMemberImpl for properties of GroupImpl 2021-09-01 13:55:39 +08:00
Him188
9590abd702
Try to fix network when sending lots of packets 2021-08-27 15:40:53 +08:00
Him188
7358d00bcf Allow NetworkHandler.State.LOADING in SelectorRecoveryTest 2021-08-26 08:01:35 +08:00
RainChan
06c1652d53
Bypass BC deprecation check on Android (#1481)
Co-authored-by: Karlatemp <karlatemp@vip.qq.com>

Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
2021-08-25 15:07:56 +08:00
Karlatemp
fe89533aed
Drop unnecessary anonGroupMsg 2021-08-24 21:34:37 +08:00
Karlatemp
beb83885c8
Simplify logic 2021-08-24 21:31:13 +08:00
Karlatemp
b3112dada3
Right exception when bot was muted 2021-08-23 10:59:23 +08:00
Karlatemp
fc8fd70014
Optimized IMirai.getUin() 2021-08-20 01:15:16 +08:00
Him188
98bca6ae44 Allow NetworkHandler.State.LOADING in SelectorRecoveryTest 2021-08-17 20:24:06 +08:00
Him188
13484c7a7a Remove redundant TODOs and unused classes 2021-08-13 16:21:46 +08:00
Him188
5950e9e1e8 Improve logging: use Log4j internally and support markers
Migrate usages of `MiraiLogger.create` to new API
apiDump for new logging
2021-08-11 15:24:32 +08:00
Him188
2562099884 Ensure backward-compatibility for AudioExtraData 2021-08-08 15:44:53 +08:00
Him188
40bbab4b5e Use mirai TestOnly annotation in ServerListImpl.<init> 2021-08-08 15:09:21 +08:00
Him188
8d8aca3f1c Introduce Audio for new API, revert changes on Voice 2021-08-05 21:48:20 +08:00
RainChan
bd61c1e80d
支持在踢出群成员时选择是否拉黑 (#1457)
* 支持在踢出群成员时选择是否拉黑

* fix binary-compatibility for kick NormalMember

* change doc
2021-08-03 22:20:53 +08:00
RainChan
615092e80b
修复默认情况下移除群成员即拉黑的问题 2021-08-03 20:06:12 +08:00