Allow exporting of baresip contacts to Android contacts
This commit is contained in:
@@ -22,7 +22,7 @@ class Contact(var name: String, var uri: String, var color: Int, val id: Long) {
|
||||
fun save(): Boolean {
|
||||
var contents = ""
|
||||
for (c in BaresipService.contacts) contents +=
|
||||
"\"${c.name}\" <${c.uri}>;id=${c.id};color=${c.color}\n"
|
||||
"\"${c.name}\" <${c.uri}>;id=${c.id};color=${c.color};android=${c.androidContact}\n"
|
||||
return Utils.putFileContents(BaresipService.filesPath + "/contacts",
|
||||
contents.toByteArray())
|
||||
}
|
||||
@@ -49,14 +49,16 @@ class Contact(var name: String, var uri: String, var color: Int, val id: Long) {
|
||||
color = colorValue.toInt()
|
||||
else
|
||||
color = Utils.randomColor()
|
||||
val androidContact = Utils.paramValue(params, "android" ) == "true"
|
||||
val idValue = Utils.paramValue(params, "id" )
|
||||
val id: Long
|
||||
if (idValue != "")
|
||||
id = idValue.toLong()
|
||||
else
|
||||
id = baseId + contactNo
|
||||
Log.d("Baresip", "Restoring contact $name, $uri, $color, $id")
|
||||
Log.d("Baresip", "Restoring contact $name, $uri, $color, $id, $androidContact")
|
||||
val contact = Contact(name, uri, color, id)
|
||||
contact.androidContact = androidContact
|
||||
val avatarFilePath = BaresipService.filesPath + "/$id.png"
|
||||
if (File(avatarFilePath).exists()) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user