diff outgoing.c @ 26:526a4c34ee2e noffle

[svn] Applied patch from Jim Hague: support for local groups / new command line options --create and --cancel.
author enz
date Sat, 29 Apr 2000 15:45:56 +0100
parents 04124a4423d4
children
line wrap: on
line diff
--- a/outgoing.c	Sat Apr 29 14:37:59 2000 +0100
+++ b/outgoing.c	Sat Apr 29 15:45:56 2000 +0100
@@ -1,7 +1,7 @@
 /*
   outgoing.c
 
-  $Id: outgoing.c 3 2000-01-04 11:35:42Z enz $
+  $Id: outgoing.c 32 2000-04-29 14:45:56Z enz $
 */
 
 #include "outgoing.h"
@@ -43,7 +43,7 @@
 }
 
 Bool
-Out_add( const char *serv, const Str msgId, const DynStr *artTxt )
+Out_add( const char *serv, const char *msgId, const DynStr *artTxt )
 {
     Str file;
     FILE *f;
@@ -111,7 +111,7 @@
 }
 
 void
-Out_remove( const char *serv, Str msgId )
+Out_remove( const char *serv, const char *msgId )
 {
     Str file;
 
@@ -119,3 +119,45 @@
     if ( unlink( file ) != 0 )
         Log_err( "Cannot remove %s", file );
 }
+
+Bool
+Out_find( const char *msgId, Str server )
+{
+    Str servdir;
+    DIR *d;
+    struct dirent *entry;
+    Bool res;
+    
+    
+    snprintf( servdir, MAXCHAR, "%s/outgoing", Cfg_spoolDir() );
+    if ( ! ( d = opendir( servdir ) ) )
+    {
+        Log_dbg( "Cannot open %s", servdir );
+        return FALSE;
+    }
+
+    readdir( d );	/* '.' */
+    readdir( d );	/* '..' */
+
+    res = FALSE;
+    while ( ! res && ( entry = readdir( d ) ) != NULL )
+    {
+	Str file;
+	struct stat s;
+
+	fileOutgoing( file, entry->d_name, msgId );
+	if ( stat( file, &s ) == 0 )
+	{
+	    res = TRUE;
+	    Utl_cpyStr( server, entry->d_name );
+	}
+    }
+
+    closedir( d );
+    return res;
+}
+
+
+
+
+