Skip to content
Snippets Groups Projects
Commit 64dab6e3 authored by Adrien Béraud's avatar Adrien Béraud Committed by Pierre Nicolas
Browse files

use Jami scheme by default

Change-Id: I29ae19d52e7b8a54fc83f40ea7aac5952149e91d
parent 71922005
No related branches found
No related tags found
No related merge requests found
...@@ -85,7 +85,7 @@ class Contact constructor(val uri: Uri, val isUser: Boolean = false) { ...@@ -85,7 +85,7 @@ class Contact constructor(val uri: Uri, val isUser: Boolean = false) {
mLookupKey = k mLookupKey = k
loadedProfile = Single.just(Profile(displayName, null)) loadedProfile = Single.just(Profile(displayName, null))
photoId = photo_id photoId = photo_id
if (username == null && displayName.contains(PREFIX_RING)) { if (username == null && displayName.startsWith(Uri.RING_URI_SCHEME) || displayName.startsWith(Uri.JAMI_URI_SCHEME)) {
username = Single.just(displayName) username = Single.just(displayName)
} }
} }
...@@ -136,7 +136,6 @@ class Contact constructor(val uri: Uri, val isUser: Boolean = false) { ...@@ -136,7 +136,6 @@ class Contact constructor(val uri: Uri, val isUser: Boolean = false) {
private val TAG = Contact::class.simpleName!! private val TAG = Contact::class.simpleName!!
const val UNKNOWN_ID = -1L const val UNKNOWN_ID = -1L
const val DEFAULT_ID = 0L const val DEFAULT_ID = 0L
const val PREFIX_RING = Uri.RING_URI_SCHEME
fun buildSIP(to: Uri): Contact = Contact(to).apply { username = Single.just("") } fun buildSIP(to: Uri): Contact = Contact(to).apply { username = Single.just("") }
fun build(uri: String, isUser: Boolean = false) = Contact(Uri.fromString(uri), isUser) fun build(uri: String, isUser: Boolean = false) = Contact(Uri.fromString(uri), isUser)
......
...@@ -54,7 +54,7 @@ class Uri : Serializable { ...@@ -54,7 +54,7 @@ class Uri : Serializable {
get() { get() {
if (isSwarm) return scheme + rawRingId if (isSwarm) return scheme + rawRingId
return if (isHexId) { return if (isHexId) {
RING_URI_SCHEME + rawRingId DEFAULT_CONTACT_SCHEME + rawRingId
} else toString() } else toString()
} }
...@@ -105,6 +105,7 @@ class Uri : Serializable { ...@@ -105,6 +105,7 @@ class Uri : Serializable {
private val URI_PATTERN = Pattern.compile("^\\s*(\\w+:)?(?:([\\w.]+)@)?(?:([\\d\\w.\\-]+)(?::(\\d+))?)\\s*$", Pattern.CASE_INSENSITIVE) private val URI_PATTERN = Pattern.compile("^\\s*(\\w+:)?(?:([\\w.]+)@)?(?:([\\d\\w.\\-]+)(?::(\\d+))?)\\s*$", Pattern.CASE_INSENSITIVE)
const val RING_URI_SCHEME = "ring:" const val RING_URI_SCHEME = "ring:"
const val JAMI_URI_SCHEME = "jami:" const val JAMI_URI_SCHEME = "jami:"
const val DEFAULT_CONTACT_SCHEME = JAMI_URI_SCHEME
const val SWARM_SCHEME = "swarm:" const val SWARM_SCHEME = "swarm:"
private const val ipv4Pattern = "(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])" private const val ipv4Pattern = "(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])"
private const val ipv6Pattern = "([0-9a-f]{1,4}:){7}([0-9a-f]){1,4}" private const val ipv6Pattern = "([0-9a-f]{1,4}:){7}([0-9a-f]){1,4}"
......
...@@ -549,7 +549,7 @@ class ConversationFacade( ...@@ -549,7 +549,7 @@ class ConversationFacade(
private fun parseNewMessage(txt: TextMessage) { private fun parseNewMessage(txt: TextMessage) {
val accountId = txt.account!! val accountId = txt.account!!
val uri = if (txt.messageId != null) Uri(Uri.SWARM_SCHEME, txt.conversationId!!) else Uri(Uri.JAMI_URI_SCHEME, txt.author!!) val uri = if (txt.messageId != null) Uri(Uri.SWARM_SCHEME, txt.conversationId!!) else Uri(Uri.DEFAULT_CONTACT_SCHEME, txt.author!!)
if (txt.isRead) { if (txt.isRead) {
if (txt.messageId == null) { if (txt.messageId == null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment