On 16 May 2001 00:25:24 -0400, Wayne Davis wrote:
> Attached are some patches to support full headers.  There is an issue of
> how we want to handle a few issues like view headers and view source at
> the same time.  Let me know how you would like the toggling to work.
> There appears to be a bonobo limitation.

FWIW you should also attach this to the bug in bugzilla (that you
updated), just to make it easier not to lose the patch.


Looks basically ok, i'd like to have mail-display not read mail-config
stuff directly (as message-list doesn't any more), but thats no biggy.

Except the actual header writing.  You need to run the raw header text
(the 'value') through the camel utility function header_decode_string(),
this is so that any embedded =?iso-8859-1?q?blahblah?= type strings are
exploded, rather than being shown in source form (that's what
view-source is for, afterall).  You also dont need to g_strdup the
"row_end" text (but if you pass it through decode_string() it will do
this for you).

As for the toggles i'd say you want them mutually exclusive (view
source/view full headers). 

 !Z


> w
> 
> 
> 
> 
> --=-6t48RhMFZz9Z3eLHiq0i
> Index: folder-browser.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/folder-browser.c,v
> retrieving revision 1.150
> diff -u -r1.150 folder-browser.c
> --- folder-browser.c  2001/05/14 21:28:36     1.150
> +++ folder-browser.c  2001/05/16 04:24:29
> @@ -398,6 +398,22 @@
>  }
>  
>  void
> +folder_browser_toggle_view_full_headers (BonoboUIComponent           *component,
> +                                const char                  *path,
> +                                Bonobo_UIComponent_EventType type,
> +                                const char                  *state,
> +                                gpointer                     user_data)
> +{
> +     FolderBrowser *fb = user_data;
> +     
> +     if (type != Bonobo_UIComponent_STATE_CHANGED)
> +             return;
> +     
> +     mail_config_set_view_full_headers (atoi (state));
> +     mail_display_redisplay (fb->mail_display, TRUE);        
> +}
> +
> +void
>  vfolder_subject (GtkWidget *w, FolderBrowser *fb)
>  {
>       vfolder_gui_add_from_message (fb->mail_display->current_message, AUTO_SUBJECT, 
>fb->uri);
> 
> --=-6t48RhMFZz9Z3eLHiq0i
> Index: folder-browser.h
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/folder-browser.h,v
> retrieving revision 1.33
> diff -u -r1.33 folder-browser.h
> --- folder-browser.h  2001/04/24 20:56:56     1.33
> +++ folder-browser.h  2001/05/16 04:24:40
> @@ -115,6 +115,13 @@
>                                       const char                  *state,
>                                       gpointer                     user_data);
>  
> +void folder_browser_toggle_view_full_headers (BonoboUIComponent           
>*component,
> +                                     const char                  *path,
> +                                     Bonobo_UIComponent_EventType type,
> +                                     const char                  *state,
> +                                     gpointer                     user_data);
> +
> +
>  void folder_browser_toggle_hide_deleted (BonoboUIComponent           *component,
>                                        const char                  *path,
>                                        Bonobo_UIComponent_EventType type,
> 
> --=-6t48RhMFZz9Z3eLHiq0i
> Index: mail-config.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
> retrieving revision 1.101
> diff -u -r1.101 mail-config.c
> --- mail-config.c     2001/05/14 17:18:03     1.101
> +++ mail-config.c     2001/05/16 04:24:56
> @@ -52,6 +52,7 @@
>  typedef struct {
>       gboolean thread_list;
>       gboolean view_source;
> +     gboolean view_headers;
>       gboolean hide_deleted;
>       gint paned_size;
>       gboolean send_html;
> @@ -699,6 +700,18 @@
>  mail_config_set_view_source (gboolean value)
>  {
>       config->view_source = value;
> +}
> +
> +gboolean
> +mail_config_get_view_full_headers (void)
> +{
> +     return config->view_headers;
> +}
> +
> +void
> +mail_config_set_view_full_headers (gboolean value)
> +{
> +     config->view_headers = value;
>  }
>  
>  gboolean
> 
> --=-6t48RhMFZz9Z3eLHiq0i
> Index: mail-format.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/mail-format.c,v
> retrieving revision 1.139
> diff -u -r1.139 mail-format.c
> --- mail-format.c     2001/05/14 17:18:03     1.139
> +++ mail-format.c     2001/05/16 04:43:00
> @@ -47,6 +47,8 @@
>  #include "mail-display.h"
>  #include "mail-mt.h"
>  #include "mail-crypto.h"
> +#include "camel-mime-utils.h"
> +#include "mail-config.h"
>  
>  static char *get_data_wrapper_text (CamelDataWrapper *data);
>  
> @@ -749,19 +751,39 @@
>                        "<table bgcolor=\"#EEEEEE\" width=\"100%%\" cellpadding=0 
>cellspacing=0>"
>                        "<tr><td><table>\n");
>       
> -     write_address(md, camel_mime_message_get_from(message),
> -                   _("From:"), WRITE_BOLD);
> -     write_address(md, camel_mime_message_get_reply_to(message),
> -                   _("Reply-To:"), 0);
> -     write_address(md, camel_mime_message_get_recipients(message, 
>CAMEL_RECIPIENT_TYPE_TO),
> -                   _("To:"), WRITE_BOLD);
> -     write_address(md, camel_mime_message_get_recipients(message, 
>CAMEL_RECIPIENT_TYPE_CC),
> -                   _("Cc:"), WRITE_BOLD);
> -     
> -     write_subject (camel_mime_message_get_subject (message), WRITE_BOLD, md->html, 
>md->stream);
> -     
> -     write_date (message,WRITE_BOLD, md->html, md->stream);
> -     
> +     if (mail_config_get_view_full_headers()) {
> +             struct _header_raw *headers = CAMEL_MIME_PART (message)->headers;
> +             while (headers) {
> +                     char *row_begin, *row_end;
> +                     
> +                     row_begin = g_strconcat (((struct _header_raw*) 
>headers)->name, 
> +                                      ":", NULL);
> +                     write_field_row_begin (row_begin, WRITE_BOLD, md->html, 
>md->stream);
> +                     
> +                     row_end = g_strdup (((struct _header_raw*) headers)->value);
> +                     mail_html_write (md->html, md->stream, "<td>%s</td> </tr>", 
>row_end);
> +
> +                     free (row_begin);
> +                     free (row_end);
> +                     
> +                     headers = headers->next;
> +             }
> +
> +     } else {
> +             write_address(md, camel_mime_message_get_from(message),
> +                           _("From:"), WRITE_BOLD);
> +             write_address(md, camel_mime_message_get_reply_to(message),
> +                           _("Reply-To:"), 0);
> +             write_address(md, camel_mime_message_get_recipients(message, 
>CAMEL_RECIPIENT_TYPE_TO),
> +                           _("To:"), WRITE_BOLD);
> +             write_address(md, camel_mime_message_get_recipients(message, 
>CAMEL_RECIPIENT_TYPE_CC),
> +                           _("Cc:"), WRITE_BOLD);
> +             
> +             write_subject (camel_mime_message_get_subject (message), WRITE_BOLD, 
>md->html, md->stream);
> +             
> +             write_date (message,WRITE_BOLD, md->html, md->stream);
> +     }
> +
>       mail_html_write (md->html, md->stream,
>                        "</table></td></tr></table></td></tr></table></font>");
>  }




_______________________________________________
evolution-hackers maillist  -  [EMAIL PROTECTED]
http://lists.helixcode.com/mailman/listinfo/evolution-hackers

Reply via email to