Synched contacts handling
This commit is contained in:
@@ -89,9 +89,9 @@ sealed class Contact {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return URIs of contact name
|
|
||||||
fun contactUris(name: String, tel: Boolean = false): ArrayList<String> {
|
fun contactUris(name: String, tel: Boolean = false): ArrayList<String> {
|
||||||
val uris = ArrayList<String>()
|
val uris = ArrayList<String>()
|
||||||
|
synchronized(BaresipService.contacts) {
|
||||||
for (c in BaresipService.contacts)
|
for (c in BaresipService.contacts)
|
||||||
when (c) {
|
when (c) {
|
||||||
is BaresipContact -> {
|
is BaresipContact -> {
|
||||||
@@ -115,10 +115,12 @@ sealed class Contact {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return uris
|
return uris
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findContact(uri: String): Contact? {
|
fun findContact(uri: String): Contact? {
|
||||||
|
synchronized(BaresipService.contacts) {
|
||||||
for (c in BaresipService.contacts)
|
for (c in BaresipService.contacts)
|
||||||
when (c) {
|
when (c) {
|
||||||
is BaresipContact -> {
|
is BaresipContact -> {
|
||||||
@@ -129,11 +131,15 @@ sealed class Contact {
|
|||||||
is AndroidContact -> {
|
is AndroidContact -> {
|
||||||
val cleanUri = uri.filterNot { setOf('-', ' ', '(', ')').contains(it) }
|
val cleanUri = uri.filterNot { setOf('-', ' ', '(', ')').contains(it) }
|
||||||
for (u in c.uris)
|
for (u in c.uris)
|
||||||
if (Utils.uriMatch(u.filterNot{setOf('-', ' ', '(', ')').contains(it)},
|
if (Utils.uriMatch(
|
||||||
cleanUri))
|
u.filterNot { setOf('-', ' ', '(', ')').contains(it) },
|
||||||
|
cleanUri
|
||||||
|
)
|
||||||
|
)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user