From 90375f578d34433264628de40a7d351fe5253b35 Mon Sep 17 00:00:00 2001
From: pierre-luc <pierre-luc.bacon@savoirfairelinux.com>
Date: Tue, 25 Aug 2009 16:59:30 -0400
Subject: [PATCH] [#1904] Registration expire now appears as a spin box under
 gtk-ui.

---
 sflphone-client-gnome/src/accountlist.c       |  8 ++++++--
 .../src/config/accountwindow.c                | 20 +++++++++----------
 sflphone-common/src/sip/sipvoiplink.cpp       |  9 +++------
 sflphone-common/src/sip/sipvoiplink.h         |  2 +-
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/sflphone-client-gnome/src/accountlist.c b/sflphone-client-gnome/src/accountlist.c
index 8a4187df74..bd8621c694 100644
--- a/sflphone-client-gnome/src/accountlist.c
+++ b/sflphone-client-gnome/src/accountlist.c
@@ -298,9 +298,13 @@ gchar * account_list_get_ordered_list (void) {
     gchar *order="";
     guint i;
 
-    for( i=0; i<account_list_get_size(); i++ )
+    for( i=0; i < account_list_get_size(); i++ )
     {
-        order = g_strconcat (order, account_list_get_nth (i)->accountID, "/", NULL);
+        account_t * account = NULL;
+        account = account_list_get_nth(i);    
+        if (account != NULL) {
+            order = g_strconcat (order, account->accountID, "/", NULL);
+        }
     }
     return order;
 }
diff --git a/sflphone-client-gnome/src/config/accountwindow.c b/sflphone-client-gnome/src/config/accountwindow.c
index c34b0cc4e9..455b43aa11 100644
--- a/sflphone-client-gnome/src/config/accountwindow.c
+++ b/sflphone-client-gnome/src/config/accountwindow.c
@@ -57,7 +57,7 @@ GtkWidget * entryHostname;
 GtkWidget * entryPassword;
 GtkWidget * entryMailbox;
 GtkWidget * entryResolveNameOnlyOnce;
-GtkWidget * entryExpire;
+GtkWidget * expireSpinBox;
 GtkListStore * credentialStore;
 GtkWidget * deleteCredButton;
 GtkWidget * treeViewCredential;
@@ -693,14 +693,14 @@ GtkWidget * create_advanced_tab(account_t **a)
     gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
 	gtk_container_set_border_width (GTK_CONTAINER(table), 10);
 	gtk_table_set_row_spacings( GTK_TABLE(table), 5);	
-	
-	label = gtk_label_new_with_mnemonic (_("Registration _expire"));
-	gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 0, 1);
-	gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
-	entryExpire = gtk_entry_new();
-	gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryExpire);
-	gtk_entry_set_text(GTK_ENTRY(entryExpire), account_expire);
-	gtk_table_attach_defaults( GTK_TABLE( table ), entryExpire, 1, 2, 0, 1);
+
+	label = gtk_label_new_with_mnemonic (_("Local port"));
+	gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
+	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+    expireSpinBox = gtk_spin_button_new_with_range(1, 65535, 1);
+	gtk_label_set_mnemonic_widget(GTK_LABEL(label), expireSpinBox);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(expireSpinBox), g_ascii_strtod(account_expire, NULL));
+	gtk_table_attach_defaults(GTK_TABLE(table), expireSpinBox, 1, 2, 0, 1);
 
 	entryResolveNameOnlyOnce = gtk_check_button_new_with_mnemonic(_("_Comply with RFC 3263"));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(entryResolveNameOnlyOnce),
@@ -961,7 +961,7 @@ show_account_window (account_t * a)
 				g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryMailbox))));
 		g_hash_table_replace(currentAccount->properties,
 				g_strdup(ACCOUNT_REGISTRATION_EXPIRE),
-				g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryExpire))));				
+				g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(expireSpinBox))));				
         
 		if (strcmp(proto, "SIP") == 0) {
 			guint i, size;
diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp
index 755585d251..b6fe244883 100644
--- a/sflphone-common/src/sip/sipvoiplink.cpp
+++ b/sflphone-common/src/sip/sipvoiplink.cpp
@@ -2329,8 +2329,8 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
         if (link)
             link->SIPCallAnswered (call, rdata);
     } else if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
-        _debug ("Invitation falled in state \"disconnected\".\n");
-        _debug ("State: %i, Disconnection cause: %i\n", inv->state, inv->cause);
+    
+        _debug ("State: %s. Cause: %.*s\n", invitationStateMap[inv->state], (int)inv->cause_text.slen, inv->cause_text.ptr);
 
         switch (inv->cause) {
                 /* The call terminates normally - BYE / CANCEL */
@@ -2343,11 +2343,8 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
                 if (link) {
                     link->SIPCallClosed (call);
                 }
-
                 break;
-
-                /* The call connection failed */
-
+                
             case PJSIP_SC_NOT_FOUND:            /* peer not found */
             case PJSIP_SC_DECLINE:
             case PJSIP_SC_REQUEST_TIMEOUT:      /* request timeout */
diff --git a/sflphone-common/src/sip/sipvoiplink.h b/sflphone-common/src/sip/sipvoiplink.h
index 723d3240d7..65e91ec3a3 100644
--- a/sflphone-common/src/sip/sipvoiplink.h
+++ b/sflphone-common/src/sip/sipvoiplink.h
@@ -48,7 +48,7 @@ namespace sfl {
 #define RANDOM_SIP_PORT   rand() % 64000 + 1024
 
 // To set the verbosity. From 0 (min) to 6 (max)
-#define PJ_LOG_LEVEL 6 
+#define PJ_LOG_LEVEL 0 
 
 /**
  * @file sipvoiplink.h
-- 
GitLab