Re: Displaying User-Agent header

Heinrich Müller <heinrich.mueller82-gM/[email protected]> Fri, 21 Dec 2012 21:57:20 +0100
Newsgroups gmane.comp.gnome.apps.pan.devel
Message-ID <[email protected]>
Am 21.12.2012 16:42, schrieb Miroslav Sabljic:
> Hi guys!
>
> Recently I switched to Pan newsreader and started using it as my 
> default usenet client. I'm very happy with it so far. Good work guys!
>
> I have a few small things that I'm missing and which I was used to in 
> other newsreaders. One of those things is displaying User-Agent header 
> in the 'middle panel' along with Subject, From and Date headers. This 
> is just my habit, I like to see User-Agent header without displaying 
> full headers. I have browsed trough pan source code and created a 
> little patch for this behaviour. This behaviour is a default behaviour 
> in most of other newsreaders.
>
> So my question is, is this behaviour disabled on purpose and if it is 
> not on purpose are you willing to include this patch in git source?
>
> Thanks!
>
>
> Here is my simple patch:
>
> diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
> index 5cf5ba0..a8a7ff6 100644
> --- a/pan/gui/body-pane.cc
> +++ b/pan/gui/body-pane.cc
> @@ -1148,6 +1148,21 @@ BodyPane :: set_text_from_message (GMimeMessage 
> * message)
>        l = add_header_line (s, message, _("Newsgroups"), "Newsgroups", 
> fallback_charset);
>        w = std::max (w, l);
>      }
> +    const StringView user_agent (g_mime_object_get_header 
> ((GMimeObject *) message, "User-Agent"));
> +    if (!user_agent.empty()) {
> +      l = add_header_line (s, message, _("User-Agent"), "User-Agent", 
> fallback_charset);
> +      w = std::max (w, l);
> +    }
> +    const StringView x_newsreader (g_mime_object_get_header 
> ((GMimeObject *) message, "X-Newsreader"));
> +    if (!x_newsreader.empty()) {
> +      l = add_header_line (s, message, _("User-Agent"), 
> "X-Newsreader", fallback_charset);
> +      w = std::max (w, l);
> +    }
> +    const StringView x_mailer (g_mime_object_get_header ((GMimeObject 
> *) message, "X-Mailer"));
> +    if (!x_mailer.empty()) {
> +      l = add_header_line (s, message, _("User-Agent"), "X-Mailer", 
> fallback_charset);
> +      w = std::max (w, l);
> +    }
>      const StringView followup_to (g_mime_object_get_header 
> ((GMimeObject *) message, "Followup-To"));
>      if (!followup_to.empty() && (followup_to!=newsgroups)) {
>        l = add_header_line (s, message, _("Followup-To"), 
> "Followup-To", fallback_charset);
>
>
>
Thanks for the patch, will be in the next release.

Cheers.