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
456903628e
Make MessageChain truly read-only; fix #1676
2021-11-15 23:22:52 +08:00
Him188
a42a024b5a
Add castUp
2021-11-15 01:44:42 +00:00
Him188
4a488f3416
Add utils threadLocal
2021-11-09 22:53:57 +00:00
Him188
cb4fb495a3
Rename ByteArray.encodeToString to .decodeToString
2021-11-09 22:12:11 +00: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
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
938e7eae57
Fix ImageDecoder of JPEG format; fix #1610
2021-10-17 17:11:34 +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
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
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
d727bae9d0
Add Either.left and Either.right
2021-09-02 16:03:32 +08:00
Him188
f239192677
Add trySafely
2021-09-01 20:05:05 +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
Him188
081e5d9b04
Use String constructor from Kotlin stdlib
2021-09-01 14:37:47 +08:00
Him188
f31f525343
Add util Array<Byte>.toUHexString
2021-09-01 13:55:39 +08:00
Him188
a1dba40f80
Add util CollectionDiff
2021-09-01 13:55:39 +08:00
Him188
f1c2393434
Add util readResource
2021-09-01 13:55:39 +08:00
Him188
f40659b1c7
Make TypeSafeMap()
returns TypeSafeMap.EMPTY
2021-09-01 13:55:39 +08:00
Him188
1ffa9eb957
Add toString
for TypeSafeMap implementations
2021-09-01 13:55:39 +08:00
Him188
f5fe442cc8
Add simple constructor for TypeSafeMap
2021-09-01 13:55:39 +08:00
Him188
f5b2dbc65d
Avoid boxing in TypeSafeMap
and support serialization
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
41733e23ef
Extract utils into multiple files
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
09265190e9
Add UnconsumedNoticesAlerter
and cleanup
...
Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
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
497a458be4
Add TypeSafeMap
2021-09-01 13:55:39 +08:00
Him188
dad2d965ab
Add contracts to cast
, safeCast
and castOrNull
; Add uncheckedCast
2021-09-01 13:55:39 +08:00
Him188
45cc60c8e9
Fix loadService
with fallback implementation
2021-08-11 15:24:32 +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
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
Him188
cf1c5d4d81
Add utility loadService
2021-08-05 21:48:20 +08:00
Him188
f4adc1232f
Add ComputeOnNullMutableProperty
2021-08-05 21:48:20 +08:00
Him188
482b62c0c3
Fix LateinitMutableProperty
: ensure visibility
2021-07-31 17:50:40 +08:00
Him188
883518b1f1
Remove unused expressions
2021-07-23 12:58:09 +08:00
Him188
dfbe73da9a
Do unwrap
even if wrapper exception has suppressed exceptions
2021-07-22 11:48:11 +08:00
Him188
8d41e18cdc
Improve Throwable.unwrap
on Android: improve performance
2021-07-22 11:48:11 +08:00
Him188
2929db7f38
Implement Throwable.unwrap
accordingly to the target platform. Fix #1404
2021-07-16 15:22:31 +08:00
Karlatemp
5b170ab63a
Add HtmlEntity
for decode html entity
2021-07-16 14:52:09 +08:00
Him188
dd606c3022
Improve performance of hexToBytes
and simplify similar extensions
2021-07-07 15:00:28 +08:00
Him188
51d354c5e9
Improve Announcement logging
2021-07-06 19:12:45 +08:00
Him188
251bf3d9df
Add JsonStruct
to simplify deserialization
2021-07-06 19:12:45 +08:00
Him188
f0dc3cdf7e
Add CheckableResult
to standardize checks for deserialized responses
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
7722a5a0b0
Move KSerializer.map
to mirai-core-utils
2021-07-04 17:56:23 +08:00
Him188
adc39a93b5
Update copyright
2021-07-02 00:39:10 +08:00
Him188
b9eb654a51
Reformat and cleanup code
2021-07-02 00:39:10 +08:00
Him188
5d57c33789
Improve Throwable.unwrap
: add the unwrapped-out exception to suppressed exceptions to avoid loss of debugging information
2021-06-29 23:10:06 +08:00
Him188
abb28ee6d2
Improve performance of Either.fold
, Either.mapLeft
and Either.mapRight
2021-06-25 20:16:59 +08:00
Him188
11ffb324c9
Add Either
2021-06-25 20:05:28 +08:00
Him188
a38f24cbe5
Redesign connection maintenance mechanism:
...
Reconnection is directed by `BotOfflineEvent`.
### Event Broadcasting
- PacketFactory `MessageSvcPushForceOffline` closes network with `ForceOfflineException`.
- `network.close(cause)` pass the cause to state observer from `QQAndroidBot.stateObserverChain`, the observer broadcasts as follows:
- Nothing if `cause` is `ForceOfflineException` or `BotClosedByEvent`(which is broadcast by user)
- `BotOfflineEvent.Dropped` if cause is NetworkException and is recoverable(which is from Netty handlers)
- `BotOfflineEvent.Force` if cause is `ForceOfflineException` is from the factory mentioned above.
- `BotOfflineEvent.Active` otherwise(any other unexpected exceptions considered as an error)
### Deciding whether to reconnect
User can listen and change `BotOfflineEvent.reconnect` to decide. Default values are determined by `BotConfiguration`.
### Event listening
- Component `BotOfflineEventMonitor` listens `BotOfflineEvent`, logs the event for users, and launches a coroutine to do `network.resumeConnection` to notify the selector to renew an instance.
- `BotOnlineWatchdog` in `SelectorNetworkHandler` is removed.
- Selector now handles `maxAttempts` correctly in such a way that `awaitResumeInstance` does not throw exception until maximum attempts reached.
- On every attempt, new exceptions are logged to provide debugging information, and further duplications are ignored.
2021-06-16 16:58:20 +08:00
Him188
9ceb7c3fc2
- Take line number into account of ExceptionCollector.collect
;
...
- Fix suppression;
- Add manual cleanup of references to help gc
2021-06-07 17:47:11 +08:00
Him188
71b128b06c
Improve ExceptionCollector.collect for better performance, close #1308
2021-06-07 12:57:00 +08:00
Him188
dadff42718
Unwrap NetworkException on logon failure
2021-06-06 13:58:46 +08:00
Him188
137e1a1235
Fix network scopes and exception handling. Support recovering after system hibernation and network failure.
2021-06-05 16:05:41 +08:00
Him188
a781941ede
Fix LateinitMutableProperty
2021-06-05 16:05:41 +08:00
Him188
e788aa09f7
Add awaitStateChange
2021-06-05 16:05:41 +08:00
Him188
bcdff1336b
Kotlin 1.5 and dependencies updates ( #1246 )
...
* Kotlin 1.5 and dependencies updates
* Update mirai-console ref
* Use Kotlin 1.5.10
* 2.7-M1-dev-3
* Update console ref
2021-05-27 14:39:13 +08:00
Him188
5e25c0e25b
Remove bintray
2021-05-25 12:25:53 +08:00
Him188
f7f4ccf4f5
Correct state transition logic:
...
- Linear lifecycle for NetworkHandler: no chance to change state back to previous ones
- No reconnection attempts in NetworkHandler but in NHSelector
- Ensure clashing checks performed in setState
- Print closure exception in TestNettyNH.setStateOK
2021-05-09 21:05:32 +08:00
Him188
d43a77b590
Update docs and improve source code readability
2021-05-09 15:31:50 +08:00
Him188
a62c570205
Add ExceptionCollector.throwLast
2021-05-09 13:12:33 +08:00
Him188
b53e546743
Prototype EventDispatcher
2021-05-09 00:54:48 +08:00
Him188
971685a2b0
Fix state resume
2021-05-09 00:54:48 +08:00
Him188
95d634233c
Close bot if first login failed
2021-05-09 00:54:48 +08:00
Him188
062492c546
Test: NettyEndlessReconnectionTest
2021-05-09 00:54:48 +08:00
Him188
29cb81ad64
Test: ExceptionCollectorTest
2021-05-09 00:54:48 +08:00
Him188
8db8e2fb03
Implement lifecycle management for network
2021-05-09 00:54:48 +08:00
Him188
f9ddf74d8e
Extract sync logic
2021-05-09 00:54:48 +08:00
Him188
b91bbfd2b8
Add NetworkHandlerFactory and tests for NetworkHandler
2021-05-09 00:54:48 +08:00
Him188
35b80dc700
Processors
2021-05-09 00:54:48 +08:00
Him188
840dd19dd0
Move EMPTY_BYTE_ARRAY to mirai-core-utils
2021-05-09 00:54:48 +08:00
Him188
d01f71ff8b
Remove rubbish; fix build; add todos
2021-05-09 00:54:48 +08:00
Him188
b844efb072
New network: framework infrastructure
2021-05-09 00:54:48 +08:00
Him188
48564056df
Add AtomicLazy
2021-05-09 00:54:48 +08:00
sandtechnology
db4c41f84a
Rework seq system ( #1230 )
...
* Rework seq system, should help #1209
* Use non-blocking (CAS) implement
* Making next seq code more clear for reading
* Fix mistake
2021-05-02 13:50:24 +08:00
Him188
70dc0a4da6
Remove kotlin.time.Duration usages ( #1215 )
...
* Remove kotlin.Duration usages
* Fix build
* update submodule console ref
2021-04-27 11:49:30 +08:00
AdoptOSS
09475efbda
fix: serialization plugin should not be put into runtime classpath ( #1197 )
2021-04-17 19:56:19 +08:00
Him188
f3d3130f2d
Support login cache and login without password. close #1158
2021-04-10 18:46:39 +08:00
AdoptOSS
21e8852e0f
buildscript: fix task not found errors when android sdk not available ( #1161 )
...
* buildscript: fix task not found errors when android sdk not available
* fix: this shadowed by run
* cleanup: code style
* improve: avoid breaking index map
2021-04-05 22:35:38 +08:00
Him188
36742a867f
Add util function systemProp
2021-04-03 23:06:15 +08:00
Him188
0f41c225f9
Move SerialDescriptor.copy to mirai-core-utils
2021-03-26 20:42:51 +08:00
Karlatemp
f9353b6aef
Compiled code verify ( #1080 )
...
* Compiled code verify
* Run `verifyCompiledClasses` in `check` task
* Redesign verification
Co-authored-by: Bo Zhang <bo@gradle.com>
* Disable console verify
* Decoupling
Co-authored-by: Bo Zhang <bo@gradle.com>
2021-03-20 13:34:04 +08:00
Him188
e256ec06d3
Support file operations ( #1069 )
...
* Proto structs for group file
* RemoteFile fundamental abstraction and proto structs
* Configure JVM target for mirai-console-intellij
* Add Group.filesRoot
* Fix build
* Implement a FileSystem for RemoteFile resolution
* Fix RemoteFile FileSystem and implement resolve and listFiles
* Implement file info query and file download
* Support uploading group file
* Support file feeds
* 2.5-M2-dev-1
* Fix tests
* 2.5-M2-dev-2
* Add uuid-based resolving, support getting file details
* Support FileMessage receive
* Support sending FileMessage
* 2.5-M2-dev-3
* Add DownloadInfo.id
* Improve RemoteFile.delete
* Support move, delete, rename, mkdir. Simplify listFiles
* - Rename RemoteFile.write to .upload.
- Prefer id matching
- Improve move
* Add permission checks
* Improve permission checks
* Rearrange functions and add constant ROOT_PATH
* Introduce FileSupported, add extensions
* Introduce ProgressionCallback
* Fix docs and uploadFileAndSend
* Remove empty FileHighway.kt
* Add test testNormalize
* Add RemoteFile.contact, change RemoteFile.uploadAndSend return type to MessageReceipt
* Move @JvmBlockingBridge to file
* Change FileMessage.toRemoteFile parameter type Group to FileSupported
* Add impl notes #1082
2021-03-08 18:34:45 +08:00
Him188
f010b1150c
Fix platform declarations in mirai-core-utils
2021-02-25 09:41:05 +08:00
Him188
2c14f0016f
Disable atomicFU compiler plugin
2021-02-25 09:35:51 +08:00
Karlatemp
7a7c88b783
Android api level check
2021-02-25 00:12:58 +08:00
Him188
d3583162a5
Replace usage of List.replaceAll with Kotlin's
2021-02-24 15:15:31 +08:00
Him188
0b971b2117
Merge branch 'dev' into android_target
...
# Conflicts:
# build.gradle.kts
# buildSrc/src/main/kotlin/Versions.kt
2021-02-24 09:20:47 +08:00
Him188
cda6aaa79b
Simplify cache configuration.
...
Improve cache saving:
- Use ProtoBuf to serialize BdhSession
- More readable servers.json
2021-02-10 15:20:39 +08:00
Him188
90d4030fe6
Support friend list cache, close #408
2021-02-06 22:52:41 +08:00
Him188
1768872bab
Rewrite message to struct conversions, add ReceiveMessageTransformer, for parsing long and forward messages in the future
2021-02-03 08:09:57 +08:00
Him188
bacfef584f
Add android compilation target
2021-02-01 12:23:28 +08:00
Karlatemp
db5e54507a
Fix image id conversion; fix #933
...
Signed-off-by: Karlatemp <karlatemp@vip.qq.com>
2021-01-31 14:27:10 +08:00
Him188
525d7c8de3
Do not publish jvm artifacts in root module, fix unresolved dependency with Android. fix #897
2021-01-27 13:57:32 +08:00