from and reply-to field fix



Hi,

I enclose the patch against the current CVS version, that:
- allows edition of 'from' and 'reply-to' headers
- appends 'reply-to' header only when it is non-empty.
- does some minor code clean up.

(it basically includes and extends my previous 'from' patch that hasn't
been yet commited to CVS, as far as I can tell).

/Pawel

Index: libbalsa/address.h
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/address.h,v
retrieving revision 1.1
diff -c -r1.1 address.h
*** libbalsa/address.h	1999/10/18 02:10:56	1.1
--- libbalsa/address.h	2000/02/28 16:05:54
***************
*** 31,35 ****
--- 31,36 ----
  
  Address *address_new(void);
  void address_free(Address *address);
+ void address_list_free(GList *address_list);
  
  #endif /* __ADDRESS_H__ */
Index: libbalsa/mailbox.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/mailbox.c,v
retrieving revision 1.110
diff -c -r1.110 mailbox.c
*** libbalsa/mailbox.c	2000/01/30 17:32:18	1.110
--- libbalsa/mailbox.c	2000/02/28 16:05:54
***************
*** 1395,1401 ****
    g_free (address);
  }
  
! 
  
  static Address *
  translate_address (ADDRESS * caddr)
--- 1395,1407 ----
    g_free (address);
  }
  
! void address_list_free(GList * address_list)
! {
!   GList *list;
!   for (list = g_list_first (address_list); list; list = g_list_next (list))
!     if(list->data) address_free (list->data);
!   g_list_free (address_list);
! }
  
  static Address *
  translate_address (ADDRESS * caddr)
***************
*** 1426,1435 ****
--- 1432,1453 ----
        list = g_list_append (list, addr);
        address = address->next;
      }
+   rfc822_free_address (&address);
    return list;
  }
  
  
+ /* returns only first address on the list; ignores remaining ones */
+ Address*
+ make_address_from_string(gchar* str) {
+   ADDRESS *address = NULL;
+   Address *addr = NULL;
+ 
+   address = rfc822_parse_adrlist (address, str);
+   addr = translate_address (address);
+   rfc822_free_address (&address);
+   return addr;
+ }
  
  /*
   * body
Index: libbalsa/message.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/message.c,v
retrieving revision 1.10
diff -c -r1.10 message.c
*** libbalsa/message.c	1997/01/03 15:23:29	1.10
--- libbalsa/message.c	2000/02/28 16:05:54
***************
*** 179,185 ****
  static void
  libbalsa_message_real_destroy(GtkObject *object)
  {
-   GList* list;
    Message *message;
  
    g_return_if_fail(object != NULL);
--- 179,184 ----
***************
*** 194,210 ****
    address_free (message->reply_to);
    g_free (message->subject);
  
!   for (list = g_list_first (message->to_list); list; list = g_list_next (list))
!     address_free (list->data);
!   g_list_free (message->to_list);
! 
!   for (list = g_list_first (message->cc_list); list; list = g_list_next (list))
!     address_free (list->data);
!   g_list_free (message->cc_list);
! 
!   for (list = g_list_first (message->bcc_list); list; list = g_list_next (list))
!     address_free (list->data);
!   g_list_free (message->bcc_list);
  
    g_free (message->in_reply_to);
    g_free (message->message_id); 
--- 193,201 ----
    address_free (message->reply_to);
    g_free (message->subject);
  
!   address_list_free(message->to_list);
!   address_list_free(message->cc_list);
!   address_list_free(message->bcc_list);
  
    g_free (message->in_reply_to);
    g_free (message->message_id); 
Index: libbalsa/send.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/send.c,v
retrieving revision 1.46
diff -c -r1.46 send.c
*** libbalsa/send.c	2000/02/06 06:50:18	1.46
--- libbalsa/send.c	2000/02/28 16:05:54
***************
*** 351,359 ****
    msg->env->from = rfc822_parse_adrlist (msg->env->from, tmp);
    g_free (tmp);
  
!   tmp = address_to_gchar (message->reply_to);
!   msg->env->reply_to = rfc822_parse_adrlist (msg->env->reply_to, tmp);
!   g_free (tmp);
  
    msg->env->subject = g_strdup (message->subject);
  
--- 351,361 ----
    msg->env->from = rfc822_parse_adrlist (msg->env->from, tmp);
    g_free (tmp);
  
!   if(message->reply_to) {
!      tmp = address_to_gchar (message->reply_to);
!      msg->env->reply_to = rfc822_parse_adrlist (msg->env->reply_to, tmp);
!      g_free (tmp);
!   }
  
    msg->env->subject = g_strdup (message->subject);
  
***************
*** 718,726 ****
    msg->env->from = rfc822_parse_adrlist (msg->env->from, tmp);
    g_free (tmp);
  
!   tmp = address_to_gchar (message->reply_to);
!   msg->env->reply_to = rfc822_parse_adrlist (msg->env->reply_to, tmp);
!   g_free (tmp);
  
    msg->env->subject = g_strdup (message->subject);
  
--- 720,730 ----
    msg->env->from = rfc822_parse_adrlist (msg->env->from, tmp);
    g_free (tmp);
  
!   if(message->reply_to) {
!      tmp = address_to_gchar (message->reply_to);
!      msg->env->reply_to = rfc822_parse_adrlist (msg->env->reply_to, tmp);
!      g_free (tmp);
!   }
  
    msg->env->subject = g_strdup (message->subject);
  
Index: src/sendmsg-window.c
===================================================================
RCS file: /cvs/gnome/balsa/src/sendmsg-window.c,v
retrieving revision 1.157
diff -c -r1.157 sendmsg-window.c
*** src/sendmsg-window.c	2000/02/26 21:03:32	1.157
--- src/sendmsg-window.c	2000/02/28 16:05:54
***************
*** 60,65 ****
--- 60,66 ----
  static gint toggle_cc_cb (GtkWidget *, BalsaSendmsg *);
  static gint toggle_bcc_cb (GtkWidget *, BalsaSendmsg *);
  static gint toggle_fcc_cb (GtkWidget *, BalsaSendmsg *);
+ static gint toggle_reply_cb (GtkWidget *, BalsaSendmsg *);
  static gint toggle_attachments_cb (GtkWidget *, BalsaSendmsg *);
  
  static gint iso_font_set(BalsaSendmsg*, gint , gint );
***************
*** 150,156 ****
    GNOMEUIINFO_TOGGLEITEM( N_ ("_Bcc"), NULL, toggle_bcc_cb, NULL),
  #define MENU_TOGGLE_FCC_POS 5
    GNOMEUIINFO_TOGGLEITEM( N_ ("_Fcc"), NULL, toggle_fcc_cb, NULL),
! #define MENU_TOGGLE_ATTACHMENTS_POS 6
    GNOMEUIINFO_TOGGLEITEM( N_ ("_Attachments"),NULL,toggle_attachments_cb,NULL),
    GNOMEUIINFO_END
  };
--- 151,159 ----
    GNOMEUIINFO_TOGGLEITEM( N_ ("_Bcc"), NULL, toggle_bcc_cb, NULL),
  #define MENU_TOGGLE_FCC_POS 5
    GNOMEUIINFO_TOGGLEITEM( N_ ("_Fcc"), NULL, toggle_fcc_cb, NULL),
! #define MENU_TOGGLE_REPLY_POS 6
!   GNOMEUIINFO_TOGGLEITEM( N_ ("_Reply To"), NULL, toggle_reply_cb, NULL),
! #define MENU_TOGGLE_ATTACHMENTS_POS 7
    GNOMEUIINFO_TOGGLEITEM( N_ ("_Attachments"),NULL,toggle_attachments_cb,NULL),
    GNOMEUIINFO_END
  };
***************
*** 227,233 ****
     gtk_widget_destroy (bsm->window);
     if(balsa_app.debug) printf("balsa_sendmsg_destroy: Freeing bsm\n");
     g_free (bsm);
!    bsm = NULL; // useless - it's just a local variable...
  }
  
  static void
--- 230,236 ----
     gtk_widget_destroy (bsm->window);
     if(balsa_app.debug) printf("balsa_sendmsg_destroy: Freeing bsm\n");
     g_free (bsm);
!    bsm = NULL; // useless - it is just a local variable...
  }
  
  static void
***************
*** 422,427 ****
--- 425,459 ----
     }
  }
  
+ static void
+ create_email_entry(GtkWidget* table, const gchar * label, int y_pos, 
+ 		   const gchar* icon, GtkWidget* arr[]) {
+    arr[0] = gtk_label_new (label);
+    gtk_misc_set_alignment (GTK_MISC (arr[0]), 0.0, 0.5);
+    gtk_table_attach (GTK_TABLE (table), arr[0], 0, 1, y_pos, y_pos+1,
+ 		     GTK_FILL, GTK_FILL | GTK_SHRINK, 0, 0);
+ 
+    arr[1] = gtk_entry_new ();
+    gtk_table_attach (GTK_TABLE (table), arr[1], 1, 2, y_pos, y_pos+1,
+ 		     GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
+ 
+    arr[2] = gtk_button_new ();
+    gtk_button_set_relief (GTK_BUTTON (arr[2]), GTK_RELIEF_NONE);
+    GTK_WIDGET_UNSET_FLAGS (arr[2], GTK_CAN_FOCUS);
+    gtk_container_add (GTK_CONTAINER (arr[2]),
+ 		      gnome_stock_pixmap_widget(NULL, icon));
+    gtk_table_attach (GTK_TABLE (table), arr[2], 2, 3, y_pos, y_pos+1,
+ 		    0, 0, 0, 0);
+   gtk_signal_connect(GTK_OBJECT(arr[2]), "clicked", 
+ 		     GTK_SIGNAL_FUNC(address_book_cb),
+ 		     (gpointer) arr[1]);
+   gtk_signal_connect (GTK_OBJECT (arr[1]), "drag_data_received",
+ 		      GTK_SIGNAL_FUNC (to_add), NULL);
+   gtk_drag_dest_set (GTK_WIDGET (arr[1]), GTK_DEST_DEFAULT_ALL,
+ 		     email_field_drop_types, ELEMENTS (email_field_drop_types),
+ 		     GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
+ }
+ 
  static GtkWidget *
  create_info_pane (BalsaSendmsg * msg, SendType type)
  {
***************
*** 429,484 ****
    GtkWidget *table;
    GtkWidget *frame;
  
!   table = gtk_table_new (7, 3, FALSE);
    gtk_table_set_row_spacings (GTK_TABLE (table), 2);
    gtk_table_set_col_spacings (GTK_TABLE (table), 2);
  
    /* To: */
!   msg->to[0] = gtk_label_new (_("To:"));
!   gtk_misc_set_alignment (GTK_MISC (msg->to[0]), 0.0, 0.5);
!   gtk_table_attach (GTK_TABLE (table), msg->to[0], 0, 1, 0, 1,
! 		    GTK_FILL, GTK_FILL | GTK_SHRINK, 0, 0);
! 
!   msg->to[1] = gtk_entry_new ();
!   gtk_table_attach (GTK_TABLE (table), msg->to[1], 1, 2, 0, 1,
! 		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
! 
!   msg->to[2] = gtk_button_new ();
!   gtk_button_set_relief (GTK_BUTTON (msg->to[2]), GTK_RELIEF_NONE);
!   GTK_WIDGET_UNSET_FLAGS (msg->to[2], GTK_CAN_FOCUS);
!   gtk_container_add (GTK_CONTAINER (msg->to[2]),
! 	       gnome_stock_pixmap_widget (NULL, GNOME_STOCK_MENU_BOOK_RED));
!   gtk_table_attach (GTK_TABLE (table), msg->to[2], 2, 3, 0, 1,
! 		    0, 0, 0, 0);
!   gtk_signal_connect(GTK_OBJECT(msg->to[2]), "clicked", 
! 		     GTK_SIGNAL_FUNC(address_book_cb),
! 		     (gpointer) msg->to[1]);
!   gtk_signal_connect (GTK_OBJECT (msg->to[1]), "drag_data_received",
! 		      GTK_SIGNAL_FUNC (to_add), NULL);
!   gtk_drag_dest_set (GTK_WIDGET (msg->to[1]), GTK_DEST_DEFAULT_ALL,
! 		     email_field_drop_types, ELEMENTS (email_field_drop_types),
! 		     GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
  
    /* From: */
!   msg->from[0] = gtk_label_new (_("From:"));
!   gtk_misc_set_alignment (GTK_MISC (msg->from[0]), 0.0, 0.5);
!   gtk_table_attach (GTK_TABLE (table), msg->from[0], 0, 1, 1, 2,
! 		    GTK_FILL, GTK_FILL | GTK_SHRINK, 0, 0);
  
-   msg->from[1] = gtk_entry_new ();
-   gtk_table_attach (GTK_TABLE (table), msg->from[1], 1, 2, 1, 2,
- 		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
-   GTK_WIDGET_UNSET_FLAGS (msg->from[1], GTK_CAN_FOCUS);
-   gtk_entry_set_editable (GTK_ENTRY (msg->from[1]), FALSE);
- 
-   msg->from[2] = gtk_button_new ();
-   gtk_button_set_relief (GTK_BUTTON (msg->from[2]), GTK_RELIEF_NONE);
-   GTK_WIDGET_UNSET_FLAGS (msg->from[2], GTK_CAN_FOCUS);
-   gtk_container_add (GTK_CONTAINER (msg->from[2]),
- 	      gnome_stock_pixmap_widget (NULL, GNOME_STOCK_MENU_BOOK_BLUE));
-   gtk_table_attach (GTK_TABLE (table), msg->from[2], 2, 3, 1, 2,
- 		    0, 0, 0, 0);
- 
    /* Subject: */
    msg->subject[0] = gtk_label_new (_("Subject:"));
    gtk_misc_set_alignment (GTK_MISC (msg->subject[0]), 0.0, 0.5);
--- 461,476 ----
    GtkWidget *table;
    GtkWidget *frame;
  
!   table = gtk_table_new (8, 3, FALSE);
    gtk_table_set_row_spacings (GTK_TABLE (table), 2);
    gtk_table_set_col_spacings (GTK_TABLE (table), 2);
  
    /* To: */
!   create_email_entry(table, _("To:"), 0,GNOME_STOCK_MENU_BOOK_RED, msg->to);
  
    /* From: */
!   create_email_entry(table, _("From:"),1,GNOME_STOCK_MENU_BOOK_BLUE,msg->from);
  
    /* Subject: */
    msg->subject[0] = gtk_label_new (_("Subject:"));
    gtk_misc_set_alignment (GTK_MISC (msg->subject[0]), 0.0, 0.5);
***************
*** 490,545 ****
  		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
  
    /* cc: */
!   msg->cc[0] = gtk_label_new (_("cc:"));
!   gtk_misc_set_alignment (GTK_MISC (msg->cc[0]), 0.0, 0.5);
!   gtk_table_attach (GTK_TABLE (table), msg->cc[0], 0, 1, 3, 4,
! 		    GTK_FILL, GTK_FILL | GTK_SHRINK, 0, 0);
! 
!   msg->cc[1] = gtk_entry_new ();
!   gtk_table_attach (GTK_TABLE (table), msg->cc[1], 1, 2, 3, 4,
! 		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
! 
!   msg->cc[2] = gtk_button_new ();
!   gtk_button_set_relief (GTK_BUTTON (msg->cc[2]), GTK_RELIEF_NONE);
!   GTK_WIDGET_UNSET_FLAGS (msg->cc[2], GTK_CAN_FOCUS);
!   gtk_container_add (GTK_CONTAINER (msg->cc[2]),
! 	    gnome_stock_pixmap_widget (NULL, GNOME_STOCK_MENU_BOOK_YELLOW));
!   gtk_table_attach (GTK_TABLE (table), msg->cc[2], 2, 3, 3, 4,
! 		    0, 0, 0, 0);
!   gtk_signal_connect(GTK_OBJECT(msg->cc[2]), "clicked", 
! 		     GTK_SIGNAL_FUNC(address_book_cb),
! 		     (gpointer) msg->cc[1]);
!   gtk_signal_connect (GTK_OBJECT (msg->cc[1]), "drag_data_received",
! 		      GTK_SIGNAL_FUNC (to_add), NULL);
!   gtk_drag_dest_set (GTK_WIDGET (msg->cc[1]), GTK_DEST_DEFAULT_ALL,
! 		     email_field_drop_types, ELEMENTS (email_field_drop_types),
! 		     GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
  
    /* bcc: */
!   msg->bcc[0] = gtk_label_new (_("bcc:"));
!   gtk_misc_set_alignment (GTK_MISC (msg->bcc[0]), 0.0, 0.5);
!   gtk_table_attach (GTK_TABLE (table), msg->bcc[0], 0, 1, 4, 5,
! 		    GTK_FILL, GTK_FILL | GTK_SHRINK, 0, 0);
! 
!   msg->bcc[1] = gtk_entry_new ();
!   gtk_table_attach (GTK_TABLE (table), msg->bcc[1], 1, 2, 4, 5,
! 		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
! 
!   msg->bcc[2] = gtk_button_new ();
!   gtk_button_set_relief (GTK_BUTTON (msg->bcc[2]), GTK_RELIEF_NONE);
!   GTK_WIDGET_UNSET_FLAGS (msg->bcc[2], GTK_CAN_FOCUS);
!   gtk_container_add (GTK_CONTAINER (msg->bcc[2]),
! 	     gnome_stock_pixmap_widget (NULL, GNOME_STOCK_MENU_BOOK_GREEN));
!   gtk_table_attach (GTK_TABLE (table), msg->bcc[2], 2, 3, 4, 5,
! 		    0, 0, 0, 0);
!   gtk_signal_connect(GTK_OBJECT(msg->bcc[2]), "clicked", 
! 		     GTK_SIGNAL_FUNC(address_book_cb),
! 		     (gpointer) msg->bcc[1]);
!   gtk_signal_connect (GTK_OBJECT (msg->bcc[1]), "drag_data_received",
! 		      GTK_SIGNAL_FUNC (to_add), NULL);
!   gtk_drag_dest_set (GTK_WIDGET (msg->bcc[1]), GTK_DEST_DEFAULT_ALL,
! 		     email_field_drop_types, ELEMENTS (email_field_drop_types),
! 		     GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
  
    /* fcc: */
    msg->fcc[0] = gtk_label_new (_("fcc:"));
--- 482,491 ----
  		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
  
    /* cc: */
!   create_email_entry(table, _("cc:"),3, GNOME_STOCK_MENU_BOOK_YELLOW, msg->cc);
  
    /* bcc: */
!   create_email_entry(table,_("bcc:"), 4,GNOME_STOCK_MENU_BOOK_GREEN, msg->bcc);
  
    /* fcc: */
    msg->fcc[0] = gtk_label_new (_("fcc:"));
***************
*** 569,578 ****
    gtk_table_attach (GTK_TABLE (table), msg->fcc[1], 1, 3, 5, 6, 
        GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
  
    /* Attachment list */
    msg->attachments[0] = gtk_label_new (_("Attachments:"));
    gtk_misc_set_alignment (GTK_MISC (msg->attachments[0]), 0.0, 0.5);
!   gtk_table_attach (GTK_TABLE (table), msg->attachments[0], 0, 1, 6, 7,
  		    GTK_FILL, GTK_FILL | GTK_SHRINK, 0, 0);
  
    /* create icon list */
--- 515,528 ----
    gtk_table_attach (GTK_TABLE (table), msg->fcc[1], 1, 3, 5, 6, 
        GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
  
+   /* Reply To: */
+   create_email_entry(table, _("Reply To:"), 6, GNOME_STOCK_MENU_BOOK_RED, 
+ 		     msg->reply_to);
+ 
    /* Attachment list */
    msg->attachments[0] = gtk_label_new (_("Attachments:"));
    gtk_misc_set_alignment (GTK_MISC (msg->attachments[0]), 0.0, 0.5);
!   gtk_table_attach (GTK_TABLE (table), msg->attachments[0], 0, 1, 7, 8,
  		    GTK_FILL, GTK_FILL | GTK_SHRINK, 0, 0);
  
    /* create icon list */
***************
*** 595,601 ****
    gtk_container_add (GTK_CONTAINER (sw), msg->attachments[1]);
    gtk_container_add (GTK_CONTAINER (frame), sw);
  
!   gtk_table_attach (GTK_TABLE (table), frame, 1, 3, 6, 7,
  		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
  		    0, 0);
  
--- 545,551 ----
    gtk_container_add (GTK_CONTAINER (sw), msg->attachments[1]);
    gtk_container_add (GTK_CONTAINER (frame), sw);
  
!   gtk_table_attach (GTK_TABLE (table), frame, 1, 3, 7, 8,
  		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
  		    0, 0);
  
***************
*** 1062,1067 ****
--- 1012,1018 ----
     return TRUE;
  }
  
+ 
  static gint
  send_message_cb (GtkWidget * widget, BalsaSendmsg * bsmsg)
  {
***************
*** 1093,1102 ****
  
    message = message_new ();
  
!   /* we should just copy balsa_app.address */
!   message->from = address_new ();
!   message->from->personal = g_strdup (balsa_app.address->personal);
!   message->from->mailbox = g_strdup (balsa_app.address->mailbox);
    message->subject = g_strdup (gtk_entry_get_text 
  			       (GTK_ENTRY (bsmsg->subject[1])));
  
--- 1044,1052 ----
  
    message = message_new ();
  
!   message->from = make_address_from_string(gtk_entry_get_text 
! 					   (GTK_ENTRY (bsmsg->from[1])));
! 
    message->subject = g_strdup (gtk_entry_get_text 
  			       (GTK_ENTRY (bsmsg->subject[1])));
  
***************
*** 1131,1142 ****
        }
      }
    }
- 
-   message->reply_to = address_new ();
- 
-   message->reply_to->personal = g_strdup (balsa_app.address->personal);
-   message->reply_to->mailbox = g_strdup (balsa_app.replyto);
  
  
    body = body_new ();
  
--- 1081,1090 ----
        }
      }
    }
  
+   if( (tmp = gtk_entry_get_text (GTK_ENTRY (bsmsg->reply_to[1]))) != NULL &&
+       strlen(tmp)>0) 
+      message->reply_to = make_address_from_string(tmp);
  
    body = body_new ();
  
***************
*** 1156,1163 ****
      for (i = 0; i < GNOME_ICON_LIST (bsmsg->attachments[1])->icons; i++)
        {
  	abody = body_new ();
! 	/* PKGW: This used to be g_strdup'ed. However, the original pointer was strduped and never freed, so
! 	   we'll take it. */
  	abody->filename = (gchar *) gnome_icon_list_get_icon_data 
  	   (GNOME_ICON_LIST (bsmsg->attachments[1]), i);
  	message->body_list = g_list_append (message->body_list, abody);
--- 1104,1111 ----
      for (i = 0; i < GNOME_ICON_LIST (bsmsg->attachments[1])->icons; i++)
        {
  	abody = body_new ();
! 	/* PKGW: This used to be g_strdup'ed. However, the original pointer 
! 	   was strduped and never freed, so we'll take it. */
  	abody->filename = (gchar *) gnome_icon_list_get_icon_data 
  	   (GNOME_ICON_LIST (bsmsg->attachments[1]), i);
  	message->body_list = g_list_append (message->body_list, abody);
***************
*** 1231,1240 ****
  
    message = message_new ();
  
!   /* we should just copy balsa_app.address */
!   message->from = address_new ();
!   message->from->personal = g_strdup (balsa_app.address->personal);
!   message->from->mailbox = g_strdup (balsa_app.address->mailbox);
    message->subject = g_strdup (gtk_entry_get_text 
  			       (GTK_ENTRY (bsmsg->subject[1])));
  
--- 1179,1187 ----
  
    message = message_new ();
  
!   message->from = make_address_from_string(gtk_entry_get_text 
! 					   (GTK_ENTRY (bsmsg->from[1])));
! 
    message->subject = g_strdup (gtk_entry_get_text 
  			       (GTK_ENTRY (bsmsg->subject[1])));
  
***************
*** 1245,1254 ****
    message->bcc_list = make_list_from_string (
       gtk_entry_get_text (GTK_ENTRY (bsmsg->bcc[1])));
    
!   message->reply_to = address_new ();
  
-   message->reply_to->personal = g_strdup (balsa_app.address->personal);
-   message->reply_to->mailbox = g_strdup (balsa_app.replyto);
  
  
    body = body_new ();
--- 1192,1201 ----
    message->bcc_list = make_list_from_string (
       gtk_entry_get_text (GTK_ENTRY (bsmsg->bcc[1])));
    
!   if( (tmp = gtk_entry_get_text (GTK_ENTRY (bsmsg->reply_to[1]))) != NULL &&
!       strlen(tmp)>0) 
!      message->reply_to = make_address_from_string(tmp);
  
  
  
    body = body_new ();
***************
*** 1482,1487 ****
--- 1429,1436 ----
  {return toggle_entry(bsmsg->bcc,  MENU_TOGGLE_BCC_POS,3); }
  static gint toggle_fcc_cb (GtkWidget * widget, BalsaSendmsg *bsmsg)
  {return toggle_entry(bsmsg->fcc, MENU_TOGGLE_FCC_POS,2); }
+ static gint toggle_reply_cb (GtkWidget * widget, BalsaSendmsg *bsmsg)
+ {return toggle_entry(bsmsg->reply_to, MENU_TOGGLE_REPLY_POS,3); }
  static gint toggle_attachments_cb (GtkWidget * widget, BalsaSendmsg *bsmsg)
  { 
     return toggle_entry(bsmsg->attachments, MENU_TOGGLE_ATTACHMENTS_POS,4);
***************
*** 1511,1516 ****
--- 1460,1469 ----
     gtk_check_menu_item_set_active(
        GTK_CHECK_MENU_ITEM(view_menu[MENU_TOGGLE_FCC_POS].widget), FALSE );
     toggle_entry(msg->fcc,  MENU_TOGGLE_BCC_POS,2); 
+ 
+    gtk_check_menu_item_set_active(
+       GTK_CHECK_MENU_ITEM(view_menu[MENU_TOGGLE_REPLY_POS].widget), FALSE );
+    toggle_entry(msg->reply_to, MENU_TOGGLE_BCC_POS,3); 
  
     gtk_check_menu_item_set_active(
        GTK_CHECK_MENU_ITEM(view_menu[MENU_TOGGLE_ATTACHMENTS_POS].widget),
Index: src/sendmsg-window.h
===================================================================
RCS file: /cvs/gnome/balsa/src/sendmsg-window.h,v
retrieving revision 1.18
diff -c -r1.18 sendmsg-window.h
*** src/sendmsg-window.h	2000/02/26 21:03:32	1.18
--- src/sendmsg-window.h	2000/02/28 16:05:54
***************
*** 41,47 ****
     struct _BalsaSendmsg
     {
  	 GtkWidget *window;
! 	 GtkWidget* to[3], *from[3], *subject[2], *cc[3], *bcc[3], *fcc[3];
  	 GtkWidget *attachments[4];
  	 GtkWidget *text;
  	 GdkFont   *font;
--- 41,48 ----
     struct _BalsaSendmsg
     {
  	 GtkWidget *window;
! 	 GtkWidget* to[3], *from[3], *subject[2], *cc[3], *bcc[3], *fcc[3],
! 	    *reply_to[3];
  	 GtkWidget *attachments[4];
  	 GtkWidget *text;
  	 GdkFont   *font;


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