Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 22 Aug 2005 00:43:47 +0000 (00:43 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 22 Aug 2005 00:43:47 +0000 (00:43 +0000)
- move version string creation to central place + update all others
- drop ~/.muttngrc-$version and ~/.muttng/muttngrc-$version as it doesn't make sense without a version released so far
- add one more pop magic number to some switch statement (just disables warning; not really sure if this is really correct)
- as NNTP currently doubles some functionality from mutt_parse_rfc822_line(), copy bug "fix": copy complete From: line even if address is invalid to show at least _something_; this is required for some non de.ALL newsgroups ;-((((

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@420 e385b8ad-14ed-0310-8656-cc95a2468c6d

12 files changed:
UPGRADING
commands.c
compose.c
init.c
main.c
muttlib.c
nntp/nntp.c
parse.c
pop/pop_lib.c
protos.h
sendlib.c
status.c

index 172b3e1..2f0c01f 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -10,6 +10,12 @@ This document is not the place for verbose documentation; it only offers
 the necessary keywords to look them up in the manual, ChangeLog or other
 sources of information.
 
+2005-08-22:
+
+  Reading configurations from ~/.muttngrc-$version and
+  ~/.muttng/muttngrc-$version is no longer supported;
+  ~/.muttngrc and ~/.muttng/muttngrc remain.
+
 2005-08-18:
 
   The $max_display_recips option has been added.
index 3eea904..4271849 100644 (file)
@@ -825,7 +825,7 @@ int mutt_save_message (HEADER * h, int delete,
 
 void mutt_version (void)
 {
-  mutt_message (mutt_make_version ());
+  mutt_message (mutt_make_version (1));
 }
 
 void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
index 4e283b0..cc62149 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -479,8 +479,7 @@ static const char *compose_format_str (char *buf, size_t buflen, char op,
     break;
 
   case 'v':
-    snprintf (fmt, sizeof (fmt), "Mutt-ng %%s");
-    snprintf (buf, buflen, fmt, MUTT_VERSION);
+    strncpy (buf, mutt_make_version (0), buflen);
     break;
 
   case 0:
diff --git a/init.c b/init.c
index a00f1f7..3e34dc8 100644 (file)
--- a/init.c
+++ b/init.c
@@ -2150,14 +2150,18 @@ void mutt_init (int skip_sys_rc, LIST * commands)
 
 
   if (!Muttrc) {
+#if 0
     snprintf (buffer, sizeof (buffer), "%s/.muttngrc-%s", NONULL (Homedir),
               MUTT_VERSION);
     if (access (buffer, F_OK) == -1)
+#endif
       snprintf (buffer, sizeof (buffer), "%s/.muttngrc", NONULL (Homedir));
     if (access (buffer, F_OK) == -1)
+#if 0
       snprintf (buffer, sizeof (buffer), "%s/.muttng/muttngrc-%s",
                 NONULL (Homedir), MUTT_VERSION);
     if (access (buffer, F_OK) == -1)
+#endif
       snprintf (buffer, sizeof (buffer), "%s/.muttng/muttngrc",
                 NONULL (Homedir));
 
diff --git a/main.c b/main.c
index 2fbb58e..b8a5a11 100644 (file)
--- a/main.c
+++ b/main.c
@@ -125,7 +125,7 @@ void mutt_exit (int code)
 
 static void mutt_usage (void)
 {
-  puts (mutt_make_version ());
+  puts (mutt_make_version (1));
 
   puts
     _
@@ -178,7 +178,7 @@ static void show_version (void)
   char buf[STRING];
 #endif
 
-  puts (mutt_make_version ());
+  puts (mutt_make_version (1));
   puts (_(Notice));
 
   uname (&uts);
@@ -732,7 +732,7 @@ int main (int argc, char **argv)
     show_version ();
     break;
   default:
-    puts (mutt_make_version ());
+    puts (mutt_make_version (1));
     puts (_(Copyright));
     puts (_(ReachingUs));
     exit (0);
index c0df6d1..b55dfda 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -1285,12 +1285,17 @@ time_t mutt_decrease_mtime (const char *f, struct stat *st)
   return mtime;
 }
 
-const char *mutt_make_version (void)
+const char *mutt_make_version (int full)
 {
   static char vstring[STRING];
 
-  snprintf (vstring, sizeof (vstring), "Mutt-ng %s-%s (based on Mutt 1.5.10/%s)",
-            MUTT_VERSION, MUTTNG_SVNREV, ReleaseDate);
+  if (full)
+    snprintf (vstring, sizeof (vstring), "Mutt-ng %s-%s (based "
+              "on Mutt 1.5.10/%s)", MUTT_VERSION, MUTTNG_SVNREV,
+              ReleaseDate);
+  else
+    snprintf (vstring, sizeof (vstring), "mutt-ng/%s-%s",
+              MUTT_VERSION, MUTTNG_SVNREV);
   return vstring;
 }
 
index 7121398..aebf3c4 100644 (file)
@@ -587,6 +587,15 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr)
       rfc822_free_address (&hdr->env->from);
       hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
       rfc2047_decode_adrlist (hdr->env->from);
+      /* same as for mutt_parse_rfc822_line():
+       * don't leave from info NULL if there's an invalid address (or
+       * whatever) in From: field; mutt would just display it as empty
+       * and mark mail/(esp.) news article as your own. aaargh! this
+       * bothered me for _years_ */
+      if (!hdr->env->from) {
+        hdr->env->from = rfc822_new_address ();
+        hdr->env->from->personal = str_dup (b);
+      }
       break;
     case 3:
       hdr->date_sent = mutt_parse_date (b, hdr);
diff --git a/parse.c b/parse.c
index a009063..34ba5ce 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1034,7 +1034,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
        * bothered me for _years_ */
       if (!e->from) {
         e->from = rfc822_new_address ();
-        e->from->personal = str_dup (line + 6);
+        e->from->personal = str_dup (p);
       }
       matched = 1;
     }
index 5e72d0c..c8764ef 100644 (file)
@@ -161,6 +161,7 @@ static pop_query_status pop_capabilities (POP_DATA * pop_data, int mode)
         pop_data->cmd_capa = CMD_AVAILABLE;
         break;
       }
+    case PFD_FUNCT_ERROR:
     case PQ_ERR:
       {
         pop_data->cmd_capa = CMD_NOT_AVAILABLE;
index b11b462..112ea54 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -98,7 +98,7 @@ char *mutt_get_parameter (const char *, PARAMETER *);
 char *mutt_crypt_hook (ADDRESS *);
 char *mutt_make_date (char *, size_t);
 
-const char *mutt_make_version (void);
+const char *mutt_make_version (int full);
 
 const char *mutt_fqdn (short);
 
index 6ae0b6b..b3f08b8 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -27,6 +27,7 @@
 #include "charset.h"
 #include "mutt_crypt.h"
 #include "mutt_idna.h"
+#include "svnrev.h"
 
 #include "lib/mem.h"
 #include "lib/str.h"
@@ -1615,7 +1616,7 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach,
       }
     }
     /* Add a vanity header */
-    fprintf (fp, "User-Agent: mutt-ng/%s (%s)\n", MUTT_VERSION, os);
+    fprintf (fp, "User-Agent: %s (%s)\n", mutt_make_version (0), os);
   }
 
   return (ferror (fp) == 0 ? 0 : -1);
index 5265a7c..212b007 100644 (file)
--- a/status.c
+++ b/status.c
@@ -279,8 +279,7 @@ static const char *status_format_str (char *buf, size_t buflen, char op,
     break;
 
   case 'v':
-    snprintf (fmt, sizeof (fmt), "Mutt-ng %%s");
-    snprintf (buf, buflen, fmt, MUTT_VERSION);
+    strncpy (buf, mutt_make_version (0), buflen);
     break;
 
   case 'V':