Commit Graph

3149 Commits

Author SHA1 Message Date
Him188
71fb5585fe Update docs for NetworkHandler 2022-05-08 09:56:27 +01:00
Him188
b16b3a58ac sendAndExpect: complete the result of the listener with last exception only if it has not yet completed. Maybe fix #2006. 2022-05-06 15:51:44 +01:00
Him188
4fa853065c Add BotConfiguration.disableAccountSecretes 2022-05-02 14:01:53 +01:00
Him188
3a4a8d01a3 Fix test can auto log 2022-05-02 11:20:23 +01:00
Him188
2a417445a7 Invalidate account.secretes on failure to lo in 2022-05-02 10:15:02 +01:00
Him188
ed37609731 Fix TarsInput, fix #1998 2022-05-02 09:59:51 +01:00
Him188
d757764308 Remove MiraiImpl.INSTANCE and move initialization process to MiraiImpl.<clinit>. Close #1992 2022-04-25 15:49:43 +01:00
Him188
3be16c4644 Code cleanup. Remove duplicated internal utilities. 2022-04-25 14:15:29 +01:00
Him188
e7dcf676fc Handle leading length for ByteArray.loadAs, fix deserialization problem with RequestPush. Fix #1991, #1899. 2022-04-25 14:06:31 +01:00
Him188
7f85319a92 Deprecate BotConfiguration.json 2022-04-24 15:30:02 +01:00
Him188
4efdc98cc4 Update docs for NetworHandle.close. 2022-04-24 12:39:50 +01:00
Him188
a5b52a0b7b Network: change state initialization and update sequence:
- Do nothing in init block
- Start state after notifying  `beforeStateChanged`
- StateClosed: do close after being updated to public

close #1893
2022-04-24 12:35:34 +01:00
Him188
88e1146edc Handle exceptions in heartbeat jobs properly, #1893 2022-04-24 12:14:20 +01:00
Him188
f5f7b3736c Show bot id in coroutine name for heartbeat jobs 2022-04-24 11:47:06 +01:00
Him188
4acd74974a Migrate deprecated usages and cleanup code 2022-04-13 13:08:14 +01:00
Him188
8993de9a13 Review deprecation for 2.11, close #1837 2022-04-13 12:47:21 +01:00
Him188
d1cb05025e Deprecated IMirai.Http for future removal 2022-04-13 12:08:39 +01:00
Him188
b4bb1696de Fix commit 'Don't mark failed if received MessageSvcPushForceOffline
' (332e03377c)

The original commit was to fix the problem when receiving MessageSvcPushForceOffline on first login, which calls `setLoginHalted`, and stops the login process.
2022-04-13 11:50:32 +01:00
Karlatemp
efd864449e
Try to fix CI 2022-04-09 16:44:50 +08:00
Karlatemp
332e03377c
Don't mark failed if received MessageSvcPushForceOffline 2022-04-08 12:06:22 +08:00
Him188
e387d4b4a5 Abort first login if any error occurred. Fix #1963 2022-04-06 16:18:10 +01:00
Him188
a96f9cc8e2 PrivateMessageProcessor: ignore processing if FROM_SYNC is absent 2022-04-06 15:51:02 +01:00
Him188
2a8f7de23d Throw SendMessageFailedException with new reason AT_ALL_LIMITED, fix #1948 2022-04-02 13:24:30 +01:00
Him188
7bb788a2cf Relogin when receiving returnCode <= -10000, fix #1961 2022-04-02 13:16:01 +01:00
Karlatemp
7c87f2869b
Fix tests 2022-03-30 15:01:07 +08:00
Karlatemp
629226553c
Fix debug message leak; fix #1955 2022-03-30 14:38:53 +08:00
Karlatemp
cf39a628a2
Drop emoji when rendering at; fix #1938 2022-03-27 21:49:04 +08:00
Him188
ceb192937f Automatically produce detailed logs when failed to decode JceStructs, if 'mirai.jce.deserializer.debug' is set to true, helps #1899 2022-03-16 15:34:12 +00:00
微莹·纤绫
fa48507a78
Update issue report url 2022-02-19 21:22:03 +08:00
Karlatemp
7252879f46
Improve performance 2022-02-16 23:15:27 +08:00
Him188
92cd9e1712 Update copyright on OutgoingPacket.kt 2022-02-12 13:27:08 +00:00
Him188
1cc299431d Rename OutgoingPacketAndroid.kt in commonMain to OutgoingPacket.kt to eliminate ambiguity 2022-02-12 13:03:18 +00:00
Karlatemp
1d2c219b9d
Fix MessagePreSendEvent name; fix #1851 2022-02-09 22:21:09 +08:00
lz1998
e856a017a1 typo 2022-02-07 11:53:59 +00:00
Him188
bd71c486bd Fix botAsMemberInitialized, fix #1848 2022-01-22 15:04:00 +00:00
Him188
2d26f94769 Move AbstractImage, FriendImage, GroupImage from mirai-core-api to mirai-core, close #1670 2022-01-14 19:02:38 +00:00
Him188
4a32f03797 Add logging for uninitialized botAsMember on creating new GroupImpl instance. helps #1776 2022-01-14 18:45:25 +00:00
Him188
7d3971259d
Review deprecation for 2.10. close #1742 (#1774) 2022-01-14 18:26:44 +00:00
Him188
12999356e2 Prohibit sending FileMessage manually, except those from FileMessage.upload. close #1715 2022-01-14 18:21:50 +00:00
Him188
b52783d815 Fix BotOfflineEvent.Active not broadcast on bot.close, fix #1717 2022-01-14 17:57:22 +00:00
Him188
85b00f583b TestEventDispatcherImpl: ensure event is broadcast 2022-01-14 17:57:22 +00:00
Him188
920886434c Fix SafeStateObserver: add missing override beforeStateChanged 2022-01-14 17:57:22 +00:00
Him188
1ab48748ab Fix project structure for Dokka
Co-authored-by: 微莹·纤绫 <karlatemp@vip.qq.com>
2022-01-06 20:26:52 +00:00
Him188
3d864362aa Generalize binary validator 2022-01-06 20:26:52 +00:00
Him188
3844630550 Cleanup code 2022-01-06 20:07:22 +00:00
Him188
2a036d7bb3 Simplify buildscript: remove redundant comments 2022-01-06 04:46:58 +00:00
LaoLittle
0c964f3144
允许使用 IPAD 协议发送戳一戳 (#1711)
* 修改注释

* IPAD协议发送戳一戳时不抛出UnsupportedOperationException

* 修改注释

“安卓协议”的描述并不准确,ANDROID_PAD 也是安卓协议,但是完全不支持戳一戳
修改进行明确

* Apply suggestions from code review

* Update Nudge.kt

Co-authored-by: Initial-heart <63091661+Initial-heart-1@users.noreply.github.com>
Co-authored-by: Him188 <Him188@mamoe.net>
2022-01-06 01:16:42 +00:00
Karlatemp
6d16d77dad Secrets Protection 2022-01-03 17:38:34 +00:00
Karlatemp
09920d35ee
Fix size-less image sending; fix #1769 2021-12-30 22:51:49 +08:00
Karlatemp
1b7c1286ef
Fix migrate of soutv 2021-12-29 18:32:34 +08:00
Him188
55fe85473a Remove unused variables 2021-12-23 01:37:11 +00:00
Him188
7faf630454 Update kotlin-jvm-blocking-bridge to 2.0.0-160.2 2021-12-23 01:37:11 +00:00
Him188
46865721b0 Use new Duration methods 2021-12-23 01:37:11 +00:00
Him188
0f1227d401 Use Mutex than @Synchronized 2021-12-23 01:37:11 +00:00
Him188
df92607841 Use Mutex than @Synchronized 2021-12-23 01:37:11 +00:00
Him188
10af69f05e Filter out duplicated GroupTalkativeChangeEvent and relevant events with same subject. Fix #1707 2021-12-21 22:55:54 +00:00
Him188
aa53d92fbe Fix Desensitizer for NestedStructure 2021-12-21 22:22:15 +00:00
Him188
83d7c0d3d1 Add test for MemberJoinEvent.Active when request was accepted by bot 2021-12-21 22:21:41 +00:00
Him188
282f0b212c Ignore local test files 2021-12-21 19:19:17 +00:00
Him188
eb0bf21505 Fix FriendMessageSyncEvent, fix #1624 2021-12-21 19:18:57 +00:00
Him188
3a2663104b Rewrite and generalize ConstructorCallCodegen for multipurpose usage. 2021-12-21 18:46:25 +00:00
Him188
bf98ab7858 Move _contentToString outside mirai-core main sourceSets, and rename it to structureToString 2021-12-21 18:46:25 +00:00
Him188
68ec6d52e7 Fix FriendMessageSyncEvent, fix #1624 2021-12-21 03:32:27 +00:00
Him188
e202149c3a Improve AbstractNoticeProcessorTest 2021-12-21 03:32:27 +00:00
Him188
a7e0f1b288 Initialize ecKf before static-init for ECDH on Android, #1732 2021-12-15 21:14:29 +00:00
Him188
2367ee0fd9
Revert prohibition of sending file message: (#1716)
* Revert prohibition of sending file message:
- close #1715
- Report a warning in logging with stacktrace
- Show stacktrace only once

* Update util.kt
2021-12-06 15:32:51 +00:00
Him188
bc1cce313f
Support AbsoluteFolder.resolveFolderById (#1712)
* Support `AbsoluteFolder.resolveFolderById`

* resolveFolderById: Always return null when receiver is not root and id is not root
2021-12-06 15:23:27 +00:00
Karlatemp
561d333cc7
NetInternalKit 2021-12-05 18:28:44 +08:00
Him188
74fc5a5037 Throw specific SendMessageFailedException when reaching group chat limit, close #1220 2021-11-30 13:06:01 +00:00
Him188
a989ea9db1 Add SendMessageFailedException, change supertypes of MessageTooLargeException and BotIsBeingMutedException to the new exception 2021-11-30 13:06:01 +00:00
Him188
5b16414e9e Add note to NormalMemberImpl.kick 2021-11-26 18:21:48 +00:00
Him188
ca80f5285f Throw specific ISE when kicking members too fast, close #1503 2021-11-26 18:04:35 +00:00
Him188
8e8dd0e26b minor: Do not use Member but required properties in TroopManagement.Kick 2021-11-26 18:04:35 +00:00
Him188
25970cbf56 minor: move NormalMember.kick overloads from mirai-core to mirai-core-api 2021-11-26 17:59:07 +00:00
Him188
64920a399e Throw a specific exception when reaching maximum AtAll times limit, fix #1201 2021-11-26 17:31:35 +00:00
Him188
7c550bff7d
Add Image.Factory and Image.Builder for constructing Image inst… (#1673)
* Add `Image.Factory` and `Image.Builder` for constructing `Image` instances with specific properties. close #1672

* Remove redundant `create`s

* Add docs for `Image.Builder`

* Remove Image.Factory, use Image.Builder in all places.

* Fix cache & parameters

Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
2021-11-20 23:36:14 +00:00
Karlatemp
a35a19ffcc
Fix LightApp refining; fix #1660 2021-11-20 18:15:09 +08:00
Karlatemp
511d1fa4f8
Fix NetReplayHelper [no ci] 2021-11-20 17:40:58 +08:00
Karlatemp
3da565ab02
AbstractRealTimeActionTestUnit 2021-11-19 23:12:09 +08:00
Karlatemp
813d8485b6 Fix AbsoluteFileFolder resolving with absolute path 2021-11-19 15:06:41 +00:00
sandtechnology
4e3873c3d3
Fix #1674, apply right nick and remark impl to contact design (#1678)
* Fix #1674, apply right nick and remark impl for contact design

* Fix build, add missed member impl

* Fix wrong delegate in AbstractMember impl

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

Co-authored-by: Him188 <him188@mamoe.net>
2021-11-16 14:54:39 +00:00
Karlatemp
736f52275f
Drop InternalFlag in MessageReceipt 2021-11-16 22:12:02 +08:00
Him188
bd041e43d1
Support Image.isUploaded, (#1671)
* Support `Image.isUploaded`,
add member `Image.md5`,
add `Image.calculateImageMd5ByImageId`,
close #1401

* Update docs
2021-11-16 10:50:17 +00:00
Karlatemp
79d92a0114
Fix old RemoteFile uploading logic 2021-11-16 18:21:55 +08:00
Karlatemp
cf2b4a193c
Fix bytecode analyze 2021-11-16 18:13:22 +08:00
Karlatemp
42510d7c1c
Fix UserProfile.sign, fix #1620 2021-11-16 12:32:55 +08:00
Karlatemp
2422aa34b5
Add image caches; Fix deserialized image not rendering in ForwardMessage; fix #1507, fix #1636 2021-11-16 12:32:28 +08:00
Karlatemp
b5d8c708bd
Redesign MultiMsg; Support nested ForwardMessage sending; close #1198 2021-11-16 12:32:28 +08:00
Karlatemp
b42a57736d
Fix ServiceMessage not refined in ANDROID_WATCH; fix #1652 2021-11-16 12:29:11 +08:00
Karlatemp
4db04e2a76
Fix group detection; fix #1661 2021-11-12 21:35:41 +08:00
Eritque arcus
12e3c4fa90
check permission before recall (#1662)
* recall check(owner sender)

* recall check

* test

* fix permission check and test

* update test

* add one more test
2021-11-10 14:39:18 +00:00
sandtechnology
57a20ea08c
Handle service unavailable case when sending message, thanks to EDG (#1659)
* Handle server busy case in sending message, thanks to EDG

* Rename to ServiceUnavailable and throw ServiceUnavailableException

* Rename to ServiceUnavailable

* Remove ServiceUnavailableException, replace with IllegalStateException
2021-11-09 22:54:19 +00:00
Him188
cb4fb495a3 Rename ByteArray.encodeToString to .decodeToString 2021-11-09 22:12:11 +00:00
Karlatemp
e1ca6dd6c9
Avoid user injection 2021-11-09 18:20:56 +08:00
Karlatemp
fa364b4b45
Reject sending FileMessage (#1657)
* Reject sending `FileMessage`

* Update docs

* Update mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFile.kt

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

Co-authored-by: Him188 <Him188@mamoe.net>
2021-11-07 10:55:02 +00:00
Karlatemp
76d23c5b0c
NetReplayHelper 2021-11-07 12:33:02 +08:00
Karlatemp
0403de2b39
Improve error message of downloadLongMessage&ForwardMessage 2021-11-06 23:24:09 +08:00
Karlatemp
69931538f5
Fix QuoteReply without msgHead, fix #1641 2021-11-06 23:20:48 +08:00
Karlatemp
8870558d4c
Fix message logging 2021-11-06 19:15:30 +08:00
Albert
3f51867f52
删除多余登录服务器 (#1634) 2021-10-30 16:06:16 +01:00
Him188
9e151e7026
Redesign group files (#1589)
* Prototype new `RemoteFiles` design

* add `@JavaFriendlyAPI`

* remove `quietly`

* move `moveTo` to `AbsoluteFile`

* Add java friendly apis

* Remove `condoneMissing`

* Change `renameTo`

* Extract interface declarations

* update docs

* Add `AbsoluteFileFolder.exists`

* Add common ProgressionCallback

* Implement `RemoteFiles` and relevant `Absolute*`

* Implement `refresh` and `refreshed`

* Update docs

* Forbid blank paths

* Update docs

* Deprecate `RemoteFile` and implement `FileMessage.toAbsoluteFile`

* Change corresponding properties on operations

* Deprecate more old declarations

* Update docs

* Add check for permission

* Allow relative paths and fix upload

* fix absolutePath

* doc update

* api dump

* `Result<R>.onSuccessCatching`

* return null when file not exists

* Fix file uploading

* Fix folder.absolutePath

* add `resolveFileById`

* Implement toString

* Add `nameWithoutExtension` and `extension`

* Add `deep` to resolveFileById

* Implement permission check

* Remove notes

* Fix `resolveFileById`

* Fix `extension`

* add docs

* Improve docs

Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
2021-10-30 16:05:57 +01:00
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
Karlatemp
6079cbb6e0
Fix ForwardMessage not rendering when message contains & 2021-08-02 23:16:27 +08:00
Him188
d8819bd615 Add tests for AccountSecrets 2021-08-02 14:46:55 +08:00
Him188
2ae12f4d37 Hold strong reference in RemoteFileImpl.contact 2021-08-02 13:52:48 +08:00
Karlatemp
f95482989d
Fix message rendering error with not-head QuoteReply; fix #1451 2021-07-31 19:20:09 +08:00
Him188
4a2b8ac92c Fix cancellation check in AbstractKeepAliveNetworkHandlerSelector 2021-07-31 17:50:56 +08:00
Him188
c19265b954 Inline NetworkHandler.isOk 2021-07-31 17:50:23 +08:00
Him188
3fc6fbed85 Change all system property names mirai.debug.network.* to mirai.network.* 2021-07-28 11:45:43 +08:00
Him188
24d52bbe90 Convert ComponentKey.componentName and .smartToString to extension 2021-07-28 11:04:32 +08:00
Him188
2d5c434146 Delete package context 2021-07-28 10:58:04 +08:00
Him188
3772861e17 Move AccountSecrets from package context to components 2021-07-28 10:57:39 +08:00
Him188
2995e47f40 Move SsoProcessorContext from package context to components 2021-07-28 10:55:26 +08:00
Him188
0e45deef68 Move SsoSession from package context to components 2021-07-28 10:53:03 +08:00
Him188
4f1a22cd20 Move BdhSession from package context to components 2021-07-28 10:52:02 +08:00
Him188
3b5ec941b3 Always throw MaxAttemptsReachedException when for consistency;
Correctly count failure attempts;
Tolerant `NetworkException` thrown while `resumeInstanceCatchingException`, fix #1361
2021-07-23 13:19:28 +08:00
Karlatemp
2a641415a7 Fix network not reconnect when received ReqMSFOffline 2021-07-21 00:54:49 +08:00
Karlatemp
b74b6da8a3 Add testing 2021-07-21 00:54:49 +08:00
Karlatemp
6ab2d7e4c0 Flatten NetworkException 2021-07-21 00:54:49 +08:00
Karlatemp
2730c80d2d
Fix logging of MessageSyncEvent, fix #1380 2021-07-19 09:38:29 +08:00
Karlatemp
3a9889b8c0 Decode html entities when polling announcements 2021-07-16 14:52:09 +08:00
Karlatemp
d40b74b311
Fix announcement publishing with sendToNewMember=true 2021-07-15 22:26:09 +08:00
sandtechnology
95a36443fe Fix #1192 again, taken suggestion from @AdoptOSS and @takayama-lily 2021-07-12 02:46:40 +08:00
sandtechnology
69a48987e7 Revert "Fix #1192, request admin when loading groups (#1257)"
This reverts commit ad7f95d0
2021-07-12 02:46:40 +08:00
sandtechnology
b2d6e7423a
Fix #1405, before it is a compiler undefined behavior (#1408) 2021-07-11 10:07:41 +08:00
Him188
dd606c3022 Improve performance of hexToBytes and simplify similar extensions 2021-07-07 15:00:28 +08:00
Him188
a0baa65193 Announcement API: Refine naming of properties:
- pinned -> isPinned
- popup -> showPopup
- needConfirm -> requireConfirmation

- readMemberNumber -> confirmedMembersCount
- publishTime -> publicationTime
- isAllRead -> allConfirmed
2021-07-06 19:45:51 +08:00
Him188
9d9b9ce7e2 Change AnnouncementImage's width and height to Int 2021-07-06 19:12:45 +08:00
Him188
51d354c5e9 Improve Announcement logging 2021-07-06 19:12:45 +08:00
Him188
d10cd270e8 Make AnnouncementParameters better for Java 2021-07-06 19:12:45 +08:00
Him188
5c89645056 Add a stable factory-method for AnnouncementImage 2021-07-06 19:12:45 +08:00
Him188
b239c57679 Re-order parameters of AnnouncementImage 2021-07-06 19:12:45 +08:00
Him188
47192f3ee3 Make Announcements.asStream not suspend 2021-07-06 19:12:45 +08:00
Him188
cf7b2a14a1 Catch exceptions when fetching group announcements and log with logger 2021-07-06 19:12:45 +08:00
Him188
b319e2bc5c Remove parameter title of Announcement 2021-07-06 19:12:45 +08:00
Him188
4a2b510a70 Remove announcements' low-level API and bundle them into AnnouncementProtocol, improve code style and maintainability 2021-07-06 19:12:45 +08:00
Him188
f5ce64ba4f Redesign Announcement API
Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
2021-07-06 19:12:45 +08:00
Him188
d6c4b5456f Remove inappropriate weak references 2021-07-06 19:12:10 +08:00
Him188
ddcac473dd Improve logging on updating account secrets 2021-07-05 17:50:38 +08:00
sandtechnology
b7869888f0
StatSvc.Register: Provide SSO Ip and correct logic (#1240)
* StatSvc.Register: Provide SSO Ip and correct logic

* Remove unnessacy launch

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

* Test for last polled ip

* Normal login test for last ip

* Fix test failed and remove debug code

* Fix unit test and build

* Optimize pollCurrent and pollAny method

* Use uOldSSOIp and uNewSSOIp only when protocol is PHONE

* Fix bug in toIpV4Long

* Fix new line in NettyBotNormalLoginTest.kt

* Using Inet4Address and toInt method for toIpV4Long

* Return Unsigned Long for toIpV4Long

* Remove unnessacy synchronized annotation

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

* Using createAddress method instead of address

* Moving lastDisconnectedIp and lastConnectedIp to Server
List

* Fix build

* Fix build and remove empty line

* Keeping naming consistent

* Use bot.components instead of overrideComponents

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

* Revert overrideComponents changes and add comment for overrideComponents

Co-authored-by: Him188 <Him188@mamoe.net>
2021-07-03 22:04:49 +08:00
Him188
2713127466 Fix reconnection on Heartbeat timeout: add PacketTimeoutException 2021-07-03 21:57:12 +08:00
Him188
7b42fc6888 Fix recalling friend message, fix #1293 2021-07-02 22:36:24 +08:00
Him188
6b18a6fea9 Improve PbMessageSvc.PbMsgWithDraw logging, helps #1293 2021-07-02 22:18:15 +08:00
Him188
ec5ad17ac4 Improve ForceOfflineException.message: use canonical message tips 2021-07-02 21:43:48 +08:00
Him188
8647d38b34 Add MessageReceiptTest for #1371 2021-07-02 21:06:31 +08:00
Him188
a59d7208cb Add getMiraiImpl to replace direct calls of MiraiImpl.INSTANCE 2021-07-02 21:06:31 +08:00
Him188
91a9e63877 Do light refine after constructing MessageReceipt, fix #1371 2021-07-02 21:06:31 +08:00
Karlatemp
a4b62b0909
Voice serialization (#1368)
* Voice serialization

* Implement `hashCode` and `equals` for `Voice`

* Update test

* Update test

* Add note of `PttMessage.pttInternalInstance`

* Fix logic of `Voice.equals`
2021-07-02 12:10:20 +08:00
Him188
5aae46218f Do not throw exception from PacketCodec but log with CoroutineExceptionHandler 2021-07-02 01:18:40 +08:00
Him188
b90f86258c Add property recoverable to HeartbeatFailedException, to control recoverability.
Fix `SelectorRecoveryTest`
2021-07-02 01:18:40 +08:00
Him188
adc39a93b5 Update copyright 2021-07-02 00:39:10 +08:00