[ekiga] Disallow dialing empty uris.



commit 93d7de7247846e0ae7a5933f65d7e8b4fb95b610
Author: Damien Sandras <dsandras seconix com>
Date:   Wed May 13 19:57:24 2009 +0200

    Disallow dialing empty uris.
---
 src/gui/main.cpp        |   14 +++++++++++++-
 src/gui/preferences.cpp |    2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index bfbaabf..631587d 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -1465,10 +1465,18 @@ place_call_cb (GtkWidget * /*widget*/,
   if (mw->priv->calling_state == Standby && !mw->priv->current_call) {
 
     size_t pos;
+    
+    // Check for empty uri
+    uri = ekiga_main_window_get_call_url (mw);
+    pos = uri.find (":");
+    if (pos != std::string::npos)
+      if (uri.substr (++pos).empty ())
+        return;
 
     ekiga_main_window_update_calling_state (mw, Calling);
     gmref_ptr<Ekiga::CallCore> call_core = mw->priv->core->get ("call-core");
-    uri = ekiga_main_window_get_call_url (mw);
+
+    // Append the missing part for SIP uris
     pos = uri.find ("@");
     if (pos == std::string::npos
 	&& uri.find ("h323:") == std::string::npos
@@ -1478,9 +1486,13 @@ place_call_cb (GtkWidget * /*widget*/,
       uri = uri + "@" + (*it);
       ekiga_main_window_set_call_url (mw, uri.c_str ());
     }
+
+    // Remove appended spaces
     pos = uri.find_first_of (' ');
     if (pos != std::string::npos)
       uri = uri.substr (0, pos);
+
+    // Dial
     if (call_core->dial (uri)) {
 
       pos = uri.find ("@");
diff --git a/src/gui/preferences.cpp b/src/gui/preferences.cpp
index cff5e21..e17e438 100644
--- a/src/gui/preferences.cpp
+++ b/src/gui/preferences.cpp
@@ -513,7 +513,7 @@ gm_pw_init_call_options_page (GtkWidget *prefs_window,
                                            _("Call Options"), 2, 3);
 
   /* Add all the fields */
-  gnome_prefs_spin_new (subsection, _("Timeout to reject or forward unanswered incoming calls (in seconds):"), CALL_OPTIONS_KEY "no_answer_timeout", _("Automatically reject or forward incoming calls if no answer is given after the specified amount of time (in seconds)"), 10.0, 299.0, 1.0, 1, NULL, true);
+  gnome_prefs_spin_new (subsection, _("Timeout to reject or forward unanswered incoming calls (in seconds):"), CALL_OPTIONS_KEY "no_answer_timeout", _("Automatically reject or forward incoming calls if no answer is given after the specified amount of time (in seconds)"), 10.0, 299.0, 1.0, 0, NULL, true);
   gnome_prefs_toggle_new (subsection, _("_Automatically answer incoming calls"), CALL_OPTIONS_KEY "auto_answer", _("If enabled, automatically answer incoming calls"), 1);
 }
 



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