changeset 293:b0e754727abf noffle

[svn] * docs/noffle.1,src/outgoing.c,src/noffle.c: Added -O/--outgoing option to list articles waiting to be posted upstream. Modified Out_next() to return message ID if possible, regardless of whether article text was requested as well.
author bears
date Thu, 30 Jan 2003 15:49:23 +0000
parents b1d5c55b76f6
children c2704f070c5c
files ChangeLog docs/noffle.1 src/noffle.c src/outgoing.c
diffstat 4 files changed, 50 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jan 28 11:38:58 2003 +0000
+++ b/ChangeLog	Thu Jan 30 15:49:23 2003 +0000
@@ -1,3 +1,10 @@
+Thu Jan 30 2003 Jim Hague <jim.hague@acm.org>
+
+* docs/noffle.1,src/outgoing.c,src/noffle.c: Added -O/--outgoing
+  option to list articles waiting to be posted upstream. Modified
+  Out_next() to return message ID if possible, regardless of whether
+  article text was requested as well.
+	
 Tue Jan 28 2003 Jim Hague <jim.hague@acm.org>
 
 * TODO: Add 'retry lost connections' item.
--- a/docs/noffle.1	Tue Jan 28 11:38:58 2003 +0000
+++ b/docs/noffle.1	Thu Jan 30 15:49:23 2003 +0000
@@ -1,5 +1,5 @@
 .TH noffle 1
-.\" $Id: noffle.1 422 2003-01-11 09:30:05Z bears $
+.\" $Id: noffle.1 425 2003-01-30 15:49:23Z bears $
 .SH NAME
 noffle \- Usenet package optimized for dialup connections.
 
@@ -48,6 +48,9 @@
 \-o | \-\-offline
 .br
 .B noffle
+\-O | \-\-outgoing [server pattern]
+.br
+.B noffle
 \-p | \-\-post
 .br
 .B noffle
@@ -184,8 +187,6 @@
 and
 .B omitgroups.
 
- 
-
 .TP
 .B \-g, \-\-groups
 List all groups available at remote server.
@@ -241,6 +242,11 @@
 .BR pppd (8).
 
 .TP
+.B \-O | \-\-outgoing [server pattern]
+List message IDs and destination server of articles queued for
+posting.
+
+.TP
 .B \-p, \-\-post
 Read a news article from standard input and post it.
 Posting always observes the group post permission flag.
--- a/src/noffle.c	Tue Jan 28 11:38:58 2003 +0000
+++ b/src/noffle.c	Thu Jan 30 15:49:23 2003 +0000
@@ -10,7 +10,7 @@
   received for some seconds (to allow multiple clients connect at the same
   time).
 
-  $Id: noffle.c 420 2003-01-10 23:25:45Z bears $
+  $Id: noffle.c 425 2003-01-30 15:49:23Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -194,6 +194,31 @@
     Lock_releaseFetchLock();
 }
 
+/* List articles queued for posting to one particular server */
+static void
+listOutgoing1( const char* serv )
+{
+  Str msgid;
+
+  if ( ! Out_first( serv, msgid, NULL ) )
+      return;
+  do
+      printf( "%s %s\n", msgid, serv );
+  while ( Out_next( msgid, NULL ) );
+}
+
+/* List articles queued for posting to a particular server. */
+static void
+doOutgoing( const char *arg )
+{
+    Str serv;
+
+    Cfg_beginServEnum();   
+    while ( Cfg_nextServ( serv ) )
+	if ( ! arg || Wld_match( serv, arg ) )
+	    listOutgoing1( serv );
+}
+
 static Bool
 doPost( FILE *f, unsigned flags )
 {
@@ -543,6 +568,7 @@
       " -m | --modify post <grp> (y|n)   Modify posting status of a local group\n"
       " -n | --online                    Switch to online mode\n"
       " -o | --offline                   Switch to offline mode\n"
+      " -O | --outgoing [server]         List articles queued for posting\n"
       " -p | --post                      Post article on stdin\n"
       " -q | --query groups [server]     Get group list from server\n"
       " -q | --query desc [server]       Get group descriptions from server\n"
@@ -808,6 +834,7 @@
 	{ "--modify", 		"-m" },
 	{ "--offline", 		"-o" },
 	{ "--online", 		"-n" },
+	{ "--outgoing", 	"-O" },
 	{ "--post", 		"-p" },
 	{ "--query", 		"-q" },
 	{ "--rebuild", 		"-B" },
@@ -973,6 +1000,9 @@
         else
             Online_set( TRUE );
         break;
+    case 'O':
+        doOutgoing( *argv );
+        break;
     case 'o':
         if ( ! Online_true() )
             fprintf( stderr, "NOFFLE is already offline\n" );
--- a/src/outgoing.c	Tue Jan 28 11:38:58 2003 +0000
+++ b/src/outgoing.c	Thu Jan 30 15:49:23 2003 +0000
@@ -1,7 +1,7 @@
 /*
   outgoing.c
 
-  $Id: outgoing.c 316 2001-10-31 11:44:53Z bears $
+  $Id: outgoing.c 425 2003-01-30 15:49:23Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -110,6 +110,8 @@
         outgoing.dir = NULL;
         return FALSE;
     }
+    if ( msgId != NULL )
+    	Utl_cpyStr( msgId, d->d_name );
     if ( artTxt == NULL )
         return ( d->d_name != NULL );
     fileOutgoing( file, outgoing.serv, d->d_name );
@@ -121,7 +123,6 @@
     DynStr_clear( artTxt );
     while ( fgets( line, MAXCHAR, f ) )
         DynStr_app( artTxt, line );
-    Utl_cpyStr( msgId, d->d_name );
     fclose( f );
     return TRUE;
 }