Re: some regressions in current HEAD



On 07/03/2009 11:00:04 AM, Ildar Mulyukov wrote:
On 03.07.2009 11:19:30, Pawel Salek wrote:
I am leaning towards a solution that if the message contained the signature before switching the identity of the sender, it will have the signature replaced with the signature of the new identity. Would you call it a consistent behaviour?

That's how it was and that's how it should be. IMO.

Can you please try the attached patch that replaces the one sent previously?

Pawel
diff --git a/src/mailbox-conf.c b/src/mailbox-conf.c
index 9e108d8..1f8a6e1 100644
--- a/src/mailbox-conf.c
+++ b/src/mailbox-conf.c
@@ -1095,7 +1095,7 @@ create_local_mailbox_dialog(MailboxConfWindow *mcw)
 
     action = mcw->mailbox_type == LIBBALSA_TYPE_MAILBOX_MBOX ?
         GTK_FILE_CHOOSER_ACTION_SAVE :
-        GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
+        GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
     dialog =
         gtk_file_chooser_dialog_new(_("Local Mailbox Configurator"),
                                     GTK_WINDOW(balsa_app.main_window),
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 9c651ab..0f625df 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -180,11 +180,11 @@ static void edit_with_gnome(GtkAction * action, BalsaSendmsg* bsmsg);
 #endif
 static void change_identity_dialog_cb(GtkAction * action,
                                       BalsaSendmsg * bsmsg);
-static void repl_identity_signature(BalsaSendmsg* bsmsg, 
-                                    LibBalsaIdentity* new_ident,
-                                    LibBalsaIdentity* old_ident,
-                                    gint* replace_offset, gint siglen, 
-                                    gchar* new_sig);
+static void replace_identity_signature(BalsaSendmsg* bsmsg, 
+                                       LibBalsaIdentity* new_ident,
+                                       LibBalsaIdentity* old_ident,
+                                       gint* replace_offset, gint siglen, 
+                                       const gchar* new_sig);
 static void update_bsmsg_identity(BalsaSendmsg*, LibBalsaIdentity*);
 
 static void sw_size_alloc_cb(GtkWidget * window, GtkAllocation * alloc);
@@ -1269,9 +1269,9 @@ change_identity_dialog_cb(GtkAction * action, BalsaSendmsg* bsmsg)
 
 /* NOTE: replace_offset and siglen are  utf-8 character offsets. */
 static void
-repl_identity_signature(BalsaSendmsg* bsmsg, LibBalsaIdentity* new_ident,
-                        LibBalsaIdentity* old_ident, gint* replace_offset, 
-                        gint siglen, gchar* new_sig) 
+replace_identity_signature(BalsaSendmsg* bsmsg, LibBalsaIdentity* new_ident,
+                           LibBalsaIdentity* old_ident, gint* replace_offset, 
+                           gint siglen, const gchar* new_sig) 
 {
     gint newsiglen;
     gboolean reply_type = (bsmsg->type == SEND_REPLY || 
@@ -1298,9 +1298,13 @@ repl_identity_signature(BalsaSendmsg* bsmsg, LibBalsaIdentity* new_ident,
     newsiglen = strlen(new_sig);
     
     /* check to see if this is a reply or forward and compare identity
-     * settings to determine whether to add signature */
-    if ((reply_type && new_ident->sig_whenreply) ||
-          (forward_type && new_ident->sig_whenforward)) {
+     * settings to determine whether to add signature. We always add a
+     * new signature when continuing a message, or when composing a
+     * new one.  */
+    if ( (bsmsg->type == SEND_NORMAL && new_ident->sig_sending) ||
+         (reply_type && new_ident->sig_whenreply) ||
+         (forward_type && new_ident->sig_whenforward) ||
+         bsmsg->type == SEND_CONTINUE ) {
 
         /* see if sig location is probably going to be the same */
         if (new_ident->sig_prepend == old_ident->sig_prepend) {
@@ -1549,8 +1553,8 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
     if (!old_sig) {
         replace_offset = bsmsg->ident->sig_prepend 
             ? 0 : g_utf8_strlen(message_text, -1);
-        repl_identity_signature(bsmsg, ident, old_ident, &replace_offset,
-                                0, new_sig);
+        replace_identity_signature(bsmsg, ident, old_ident, &replace_offset,
+                                   0, new_sig);
     } else {
         /* split on sig separator */
         message_split = g_strsplit(message_text, "\n-- \n", 0);
@@ -1561,8 +1565,8 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
 
 	if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
 	    g_free(compare_str);
-	    repl_identity_signature(bsmsg, ident, old_ident,
-				    &replace_offset, siglen - 1, new_sig);
+	    replace_identity_signature(bsmsg, ident, old_ident,
+                                       &replace_offset, siglen - 1, new_sig);
 	    found_sig = TRUE;
 	} else {
 	    g_free(compare_str);
@@ -1572,8 +1576,9 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
 
 		/* try to find occurance of old signature */
 		if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
-		    repl_identity_signature(bsmsg, ident, old_ident,
-					    &replace_offset, siglen, new_sig);
+		    replace_identity_signature(bsmsg, ident, old_ident,
+                                               &replace_offset, siglen,
+                                               new_sig);
 		    found_sig = TRUE;
 		}
 
@@ -1596,16 +1601,18 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
 
 	    if (g_ascii_strncasecmp(old_sig, tmpstr, siglen) == 0) {
 		g_free(tmpstr);
-		repl_identity_signature(bsmsg, ident, old_ident,
-					&replace_offset, siglen - 1, new_sig);
+		replace_identity_signature(bsmsg, ident, old_ident,
+                                           &replace_offset, siglen - 1,
+                                           new_sig);
 	    } else {
 		g_free(tmpstr);
 		replace_offset++;
 		compare_str = g_utf8_next_char(compare_str);
 		while (*compare_str) {
 		    if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
-			repl_identity_signature(bsmsg, ident, old_ident,
-						&replace_offset, siglen, new_sig);
+			replace_identity_signature(bsmsg, ident, old_ident,
+                                                   &replace_offset, siglen,
+                                                   new_sig);
 		    }
 		    replace_offset++;
 		    compare_str = g_utf8_next_char(compare_str);



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