fix command processor

This commit is contained in:
callebtc
2026-01-18 01:13:25 +07:00
parent f4dced3399
commit 173bfb9251
@@ -578,11 +578,10 @@ class CommandProcessor(
private fun resolvePeerIDForNickname(targetName: String, meshService: BluetoothMeshService): PeerResolutionResult {
val nicknames = meshService.getPeerNicknames()
val parts = targetName.split("#")
val baseName = parts[0]
val suffix = if (parts.size > 1) parts[1] else null
val (baseName, suffixWithHash) = splitSuffix(targetName)
if (suffix != null) {
if (suffixWithHash.isNotEmpty()) {
val suffix = suffixWithHash.removePrefix("#")
val peerID = nicknames.entries.find { (id, nick) ->
nick.equals(baseName, ignoreCase = true) && id.takeLast(4).equals(suffix, ignoreCase = true)
}?.key