Skip to content

Commit

Permalink
Event.kt: code style
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarning committed Oct 9, 2022
1 parent 6a2fcd6 commit 0785ab2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/src/main/java/d/d/meshenger/Event.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ class Event(

fun createUnknownContact(name: String): Contact {
val addresses = mutableListOf<String>()
if (address != null && address.address != null) {
val address = address?.address
if (address != null) {
// extract MAC address if possible
val mac = AddressUtils.extractMacAddress(address.address)
val mac = AddressUtils.extractMacAddress(address)
if (mac != null && mac.size == 6) {
addresses.add(
"%02X:%02X:%02X:%02X:%02X:%02X".format(mac[0], mac[1], mac[2], mac[3], mac[4], mac[5])
"%02X:%02X:%02X:%02X:%02X:%02X".format(
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
)
)
} else {
addresses.add(address.address.toString())
addresses.add(address.toString())
}
}
return Contact(name, publicKey, addresses)
Expand Down

0 comments on commit 0785ab2

Please sign in to comment.