diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-08-03 15:12:42 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-08-05 01:15:29 +0900 |
| commit | daf9060561656f468a0ae366e5695f5eb74f48f7 (patch) | |
| tree | 4e096081884cc5039edb198b77d2bd0f70e5751e /platform-velocity | |
| parent | fd56ebaa1dc2cfa8f834edb06395e8fc02375d1d (diff) | |
| download | LunaticChat-daf9060561656f468a0ae366e5695f5eb74f48f7.tar.gz LunaticChat-daf9060561656f468a0ae366e5695f5eb74f48f7.tar.bz2 LunaticChat-daf9060561656f468a0ae366e5695f5eb74f48f7.zip | |
refactor: make the direct message failure reason an enum
DirectMessageError.reason was a String backed by two constants, so the
receiving side matched one case and let everything else fall through to
"the target is offline". Adding a third reason on the proxy would have
shipped it to Paper servers that silently reported the wrong thing - the
one string-keyed dispatch sitting next to a protocol layer whose messages
are otherwise a sealed hierarchy with exhaustiveness checking.
As an enum, the reader must decide what to show for each case, and
CrossServerDirectMessageManager's when no longer needs an else.
The wire format is unchanged: kotlinx serializes an enum as its name, so
the existing snapshots still decode. What did need care is the reverse
direction - a reason from a newer proxy would now fail to parse, where the
String version degraded. The property has a default and the codec enables
coerceInputValues, so an unknown reason lands on TARGET_OFFLINE, exactly
the old else branch. There is a compatibility test for that case.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'platform-velocity')
| -rw-r--r-- | platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/CrossServerDirectMessageRelay.kt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/CrossServerDirectMessageRelay.kt b/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/CrossServerDirectMessageRelay.kt index f9cc52d..70ca525 100644 --- a/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/CrossServerDirectMessageRelay.kt +++ b/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/CrossServerDirectMessageRelay.kt @@ -78,7 +78,7 @@ class CrossServerDirectMessageRelay( private fun sendError( sourceServer: RegisteredServer, message: PluginMessage.DirectMessageRelay, - reason: String, + reason: PluginMessage.DirectMessageError.Reason, ) { val error = PluginMessage.DirectMessageError( |
