[ekiga] Fixed SIP URIs in LDAP



commit ae277e80a475c003d111b9d760799a2b806a38c8
Author: Howard Chu <hyc symas com>
Date:   Wed Jul 8 10:50:47 2009 +0200

    Fixed SIP URIs in LDAP

 lib/engine/components/ldap/ldap-book.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/lib/engine/components/ldap/ldap-book.cpp b/lib/engine/components/ldap/ldap-book.cpp
index db61db6..c199f89 100644
--- a/lib/engine/components/ldap/ldap-book.cpp
+++ b/lib/engine/components/ldap/ldap-book.cpp
@@ -95,10 +95,14 @@ OPENLDAP::Book::parse_result (LDAPMessage* message)
     } else {
       for (i=1; attributes[i]; i++) {
         if (!strcasecmp(bv.bv_val,attributes[i]) && bvals && bvals[0].bv_val ) {
-	  call_addresses[attributes[i]] =
-	    /* FIXME: next line is annoying */
-	    std::string ("sip:") +
-	    std::string (bvals[0].bv_val, bvals[0].bv_len);
+          /* FIXME: this is annoying. Assume if a colon is present that
+           * the value is already in URI form, otherwise add a sip: prefix.
+           */
+          if (strchr(bvals[0].bv_val, ':'))
+            call_addresses[attributes[i]] = std::string (bvals[0].bv_val, bvals[0].bv_len);
+          else
+            call_addresses[attributes[i]] = std::string ("sip:") +
+              std::string (bvals[0].bv_val, bvals[0].bv_len);
         }
       }
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]