[Telepathy-commits] [telepathy-qt4/master] Account: Support non spec-compliant account-specific part on account object path.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Tue Feb 17 05:33:46 PST 2009


---
 TelepathyQt4/Client/account.cpp |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/TelepathyQt4/Client/account.cpp b/TelepathyQt4/Client/account.cpp
index 10f8d23..7f92402 100644
--- a/TelepathyQt4/Client/account.cpp
+++ b/TelepathyQt4/Client/account.cpp
@@ -121,8 +121,21 @@ Account::Private::Private(AccountManager *am, Account *parent)
         cmName = rx.cap(1);
         protocol = rx.cap(2);
     } else {
-        warning() << "Not a valid Account object path:" <<
-            parent->objectPath();
+        warning() << "Account object path is not spec-compliant, "
+            "trying again with a different account-specific part check";
+
+        rx = QRegExp("^" TELEPATHY_ACCOUNT_OBJECT_PATH_BASE
+               "/([_A-Za-z][_A-Za-z0-9]*)"  // cap(1) is the CM
+               "/([_A-Za-z][_A-Za-z0-9]*)"  // cap(2) is the protocol
+               "/([_A-Za-z0-9]*)"  // account-specific part
+               );
+        if (rx.exactMatch(parent->objectPath())) {
+            cmName = rx.cap(1);
+            protocol = rx.cap(2);
+        } else {
+            warning() << "Not a valid Account object path:" <<
+                parent->objectPath();
+        }
     }
 }
 
-- 
1.5.6.5



More information about the telepathy-commits mailing list