Ensure RLS URI is set on FriendLists when subscription is enabled

This commit is contained in:
Sylvain Berfini 2021-06-08 10:33:02 +02:00
parent e045e6daad
commit 271d3c8c9f

View file

@ -236,6 +236,22 @@ class AsyncContactsLoader(private val context: Context) :
if (core.isFriendListSubscriptionEnabled) { if (core.isFriendListSubscriptionEnabled) {
Log.i("[Contacts Loader] Matching friends created, updating subscription") Log.i("[Contacts Loader] Matching friends created, updating subscription")
for (list in core.friendsLists) { for (list in core.friendsLists) {
if (list.rlsAddress == null) {
Log.w("[Contacts Loader] Friend list subscription enabled but RLS URI not set!")
val defaultRlsUri = core.config.getString("sip", "rls_uri", null)
if (defaultRlsUri != null) {
val rlsAddress = core.interpretUrl(defaultRlsUri)
if (rlsAddress != null) {
Log.i("[Contacts Loader] Using new RLS URI: ${rlsAddress.asStringUriOnly()}")
list.rlsAddress = rlsAddress
} else {
Log.e("[Contacts Loader] Couldn't parse RLS URI: $defaultRlsUri")
}
} else {
Log.e("[Contacts Loader] RLS URI not found in config file!")
}
}
list.updateSubscriptions() list.updateSubscriptions()
} }
} }