[ekiga] Better canonise_uri in the local roster code (and renamed to canonize_uri)



commit 6bbfb94c621a098a45aeb53f88c25ce17fe4d220
Author: Julien Puydt <jpuydt free fr>
Date:   Mon Oct 8 07:34:14 2012 +0200

    Better canonise_uri in the local roster code (and renamed to canonize_uri)

 lib/engine/components/local-roster/local-heap.cpp  |    2 +-
 .../components/local-roster/local-presentity.cpp   |    9 ++++++---
 .../components/local-roster/local-presentity.h     |    4 ++--
 3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/lib/engine/components/local-roster/local-heap.cpp b/lib/engine/components/local-roster/local-heap.cpp
index 86739ab..edbe97b 100644
--- a/lib/engine/components/local-roster/local-heap.cpp
+++ b/lib/engine/components/local-roster/local-heap.cpp
@@ -396,7 +396,7 @@ Local::Heap::new_presentity_form_submitted (bool submitted,
   else
     uri = result.text ("uri");
 
-  uri = canonise_uri (uri);
+  uri = canonize_uri (uri);
 
   if (presence_core->is_supported_uri (uri)
       && !has_presentity_with_uri (uri)) {
diff --git a/lib/engine/components/local-roster/local-presentity.cpp b/lib/engine/components/local-roster/local-presentity.cpp
index b154b11..145e7fd 100644
--- a/lib/engine/components/local-roster/local-presentity.cpp
+++ b/lib/engine/components/local-roster/local-presentity.cpp
@@ -46,7 +46,7 @@
 // remove leading and trailing spaces and tabs (useful for copy/paste)
 // also, if no protocol specified, add leading "sip:"
 std::string
-canonise_uri (std::string uri)
+canonize_uri (std::string uri)
 {
   const size_t begin_str = uri.find_first_not_of (" \t");
   if (begin_str == std::string::npos)  // there is no content
@@ -55,9 +55,12 @@ canonise_uri (std::string uri)
   const size_t end_str = uri.find_last_not_of (" \t");
   const size_t range = end_str - begin_str + 1;
   uri = uri.substr (begin_str, range);
-  const size_t pos = uri.find (":");
+  size_t pos = uri.find (":");
   if (pos == std::string::npos)
     uri = uri.insert (0, "sip:");
+  pos = uri.find ("@");
+  if (pos == std::string::npos)
+    uri = uri + "@ekiga.net";
   return uri;
 }
 
@@ -293,7 +296,7 @@ Local::Presentity::edit_presentity_form_submitted (bool submitted,
   bool preferred = result.boolean ("preferred");
   std::set<xmlNodePtr> nodes_to_remove;
 
-  new_uri = canonise_uri (new_uri);
+  new_uri = canonize_uri (new_uri);
 
   for (xmlNodePtr child = node->children ;
        child != NULL ;
diff --git a/lib/engine/components/local-roster/local-presentity.h b/lib/engine/components/local-roster/local-presentity.h
index 8f5824d..4577fac 100644
--- a/lib/engine/components/local-roster/local-presentity.h
+++ b/lib/engine/components/local-roster/local-presentity.h
@@ -49,8 +49,8 @@
 
 // remove leading and trailing spaces (useful for copy/paste)
 // also, if no protocol specified, add leading "sip:"
-std::string
-canonise_uri (std::string uri);
+// and if no server specified, append "@ekiga.net"
+std::string canonize_uri (std::string uri);
 
 namespace Local
 {



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