[ekiga] Potentially fixed problems with uris and party names.



commit fa8143fdeba5030c59fecf220a93a5f5bc59506c
Author: Damien Sandras <dsandras seconix com>
Date:   Sun May 17 13:43:37 2009 +0200

    Potentially fixed problems with uris and party names.
    
    OPAL has a weird API to determine the remote uri and party names.
    
    The remote party name defaults to the remote party address when it is
    unknown. Try guessing it is the case and use a sane default in that case
    instead of the OPAL one.
    
    Added more special chars to drop from OPAL uris by default.
---
 lib/engine/components/opal/opal-call.cpp |   53 ++++++++++++++++++------------
 1 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/lib/engine/components/opal/opal-call.cpp b/lib/engine/components/opal/opal-call.cpp
index d63ef7f..ae873f4 100644
--- a/lib/engine/components/opal/opal-call.cpp
+++ b/lib/engine/components/opal/opal-call.cpp
@@ -48,6 +48,24 @@
 
 using namespace Opal;
 
+static void
+strip_special_chars (std::string& str, char* special_chars, bool start)
+{
+  std::string::size_type idx;
+
+  unsigned i = 0;
+  while (i < strlen (special_chars)) {
+    idx = str.find_first_of (special_chars[i]);
+    if (idx != std::string::npos) {
+      if (start)
+        str = str.substr (idx+1);
+      else
+        str = str.substr (0, idx);
+    }
+    i++;
+  }
+}
+
 class CallSetup : public PThread
 {
   PCLASSINFO(CallSetup, PThread);
@@ -312,22 +330,24 @@ Opal::Call::is_outgoing () const
 void
 Opal::Call::parse_info (OpalConnection & connection)
 {
-  char special_chars [] = "([;=";
-  int i = 0;
-  std::string::size_type idx;
+  char start_special_chars [] = "$";
+  char end_special_chars [] = "([;=";
+  
   std::string l_party_name;
   std::string r_party_name;
   std::string app;
 
-  remote_uri = (const char *) connection.GetRemotePartyCallbackURL ();
   if (!PIsDescendant(&connection, OpalPCSSConnection)) {
 
     outgoing = connection.IsOriginating ();
 
     remote_uri = (const char *) connection.GetRemotePartyCallbackURL ();
 
-    l_party_name = (const char *) connection.GetCalledPartyURL ();
-    r_party_name = (const char *) connection.GetRemotePartyName ();
+    l_party_name = (const char *) connection.GetLocalPartyName ();
+    if (connection.GetRemotePartyName () == connection.GetRemotePartyAddress ())
+      r_party_name = remote_uri;
+    else
+      r_party_name = (const char *) connection.GetRemotePartyName ();
     app = (const char *) connection.GetRemoteProductInfo ().AsString ();
     start_time = connection.GetConnectionStartTime ();
     if (!start_time.IsValid ())
@@ -339,22 +359,13 @@ Opal::Call::parse_info (OpalConnection & connection)
       remote_party_name = r_party_name;
     if (!app.empty ())
       remote_application = app;
+    
+    strip_special_chars (remote_party_name, end_special_chars, false);
+    strip_special_chars (remote_application, end_special_chars, false);
+    strip_special_chars (remote_uri, end_special_chars, false);
 
-    while (i < 3) {
-
-      idx = remote_party_name.find_first_of (special_chars [i]);
-      if (idx != std::string::npos)
-        remote_party_name = remote_party_name.substr (0, idx);
-
-      idx = remote_application.find_first_of (special_chars [i]);
-      if (idx != std::string::npos)
-        remote_application = remote_application.substr (0, idx);
-
-      idx = remote_uri.find_first_of (special_chars [i]);
-      if (idx != std::string::npos)
-        remote_uri = remote_uri.substr (0, idx);
-      i++;
-    }
+    strip_special_chars (remote_party_name, start_special_chars, true);
+    strip_special_chars (remote_uri, start_special_chars, true);
   }
 }
 



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