From 989ab7ac3e1f99b1050d5a5e20f027cbce285ac3 Mon Sep 17 00:00:00 2001
From: aviau <alexandre@alexandreviau.net>
Date: Tue, 22 Nov 2016 15:39:20 -0500
Subject: [PATCH] track Ring ContactMethods by default

- Track Ring ContactMethods as soon as they have an account
  associated to them.

- Fix setTracked's subscribeBuddyto call include the USER_INFO, which
  is absolutely necessary for it to work.

Tuleap: #1379
Change-Id: I0e82021a3aac9cac1b3a4e0e2352d9859168c4b4
---
 src/contactmethod.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/contactmethod.cpp b/src/contactmethod.cpp
index c46c82d2..0e99a7fb 100644
--- a/src/contactmethod.cpp
+++ b/src/contactmethod.cpp
@@ -201,6 +201,12 @@ void ContactMethod::setAccount(Account* account)
 
    if (d_ptr->m_pAccount)
       connect (d_ptr->m_pAccount,SIGNAL(destroyed(QObject*)),this,SLOT(accountDestroyed(QObject*)));
+
+   //Track Ring contacts by default
+   if (this->protocolHint() == URI::ProtocolHint::RING || this->protocolHint() == URI::ProtocolHint::RING_USERNAME) {
+       setTracked(true);
+   }
+
    d_ptr->changed();
 }
 
@@ -303,6 +309,7 @@ void ContactMethod::setTracked(bool track)
       PresenceManager::instance().subscribeBuddy(d_ptr->m_pAccount->id(),
                                                  uri().format(URI::Section::CHEVRONS |
                                                               URI::Section::SCHEME |
+                                                              URI::Section::USER_INFO |
                                                               URI::Section::HOSTNAME),
                                                  track);
       d_ptr->changed();
-- 
GitLab