Added possibility to nickname accounts
This commit is contained in:
@@ -8,6 +8,7 @@ import java.net.URLDecoder
|
||||
|
||||
class Account(val accp: Long) {
|
||||
|
||||
var nickName = ""
|
||||
var displayName = Api.account_display_name(accp)
|
||||
val aor = Api.account_aor(accp)
|
||||
var luri = Api.account_luri(accp)
|
||||
@@ -59,16 +60,13 @@ class Account(val accp: Long) {
|
||||
}
|
||||
|
||||
val extra = Api.account_extra(accp)
|
||||
if (Utils.paramExists(extra, "nickname"))
|
||||
nickName = Utils.paramValue(extra,"nickname")
|
||||
callHistory = Utils.paramValue(extra,"call_history") == ""
|
||||
countryCode = if (Utils.paramExists(extra, "country_code"))
|
||||
Utils.paramValue(extra,"country_code")
|
||||
else
|
||||
""
|
||||
telProvider = if (Utils.paramExists(extra, "tel_provider"))
|
||||
URLDecoder.decode(Utils.paramValue(extra,"tel_provider"), "UTF-8")
|
||||
else
|
||||
Utils.aorDomain(aor)
|
||||
|
||||
if (Utils.paramExists(extra, "country_code"))
|
||||
countryCode = Utils.paramValue(extra,"country_code")
|
||||
if (Utils.paramExists(extra, "tel_provider"))
|
||||
telProvider = URLDecoder.decode(Utils.paramValue(extra,"tel_provider"), "UTF-8")
|
||||
}
|
||||
|
||||
fun print() : String {
|
||||
@@ -128,6 +126,9 @@ class Account(val accp: Long) {
|
||||
|
||||
var extra = ""
|
||||
|
||||
if (nickName != "")
|
||||
extra += ";nickname=$nickName"
|
||||
|
||||
if (!callHistory)
|
||||
extra += ";call_history=no"
|
||||
|
||||
@@ -240,5 +241,12 @@ class Account(val accp: Long) {
|
||||
return (ap.isNotEmpty()) && (ap.length <= 64) &&
|
||||
Regex("^[ -~]*\$").matches(ap) && !ap.contains('"')
|
||||
}
|
||||
|
||||
fun uniqueNickName(nickName: String): Boolean {
|
||||
for (ua in BaresipService.uas)
|
||||
if (ua.account.nickName == nickName)
|
||||
return false
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user