From 52b23e39f3e12697d940b78e2678c73643c5463d Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Sat, 5 Apr 2025 08:54:54 +0300 Subject: [PATCH] Minor code simplification --- app/src/main/kotlin/com/tutpro/baresip/Account.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/Account.kt b/app/src/main/kotlin/com/tutpro/baresip/Account.kt index 55f04e6a..02503a25 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/Account.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/Account.kt @@ -94,7 +94,7 @@ class Account(val accp: Long) { if ((authPass != "") && !BaresipService.aorPasswords.containsKey(aor)) res += ";auth_pass=\"${authPass}\"" - if (outbound.size > 0) { + if (outbound.isNotEmpty()) { res += ";outbound=\"${outbound[0]}\"" if (outbound.size > 1) res += ";outbound2=\"${outbound[1]}\"" res = "$res;sipnat=outbound" @@ -111,7 +111,7 @@ class Account(val accp: Long) { if (stunPass != "") res += ";stunpass=\"${stunPass}\"" - if (audioCodec.size > 0) { + if (audioCodec.isNotEmpty()) { var first = true res = "$res;audio_codecs=" for (c in audioCodec) @@ -252,7 +252,7 @@ class Account(val accp: Long) { fun checkDisplayName(dn: String): Boolean { if (dn == "") return true - val dnRegex = Regex("^([* .!%_`'~]|[+]|[-a-zA-Z0-9]){1,64}\$") + val dnRegex = Regex("^([* .!%_`'~]|[+]|[-a-zA-Z0-9]){1,64}$") return dnRegex.matches(dn) } @@ -268,7 +268,7 @@ class Account(val accp: Long) { fun checkAuthPass(ap: String): Boolean { return (ap.isNotEmpty()) && (ap.length <= 64) && - Regex("^[ -~]*\$").matches(ap) && !ap.contains('"') + Regex("^[ -~]*$").matches(ap) && !ap.contains('"') } fun uniqueNickName(nickName: String): Boolean {