comparison 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
comparison
equal deleted inserted replaced
25:ab6cf19be6d3 26:526a4c34ee2e
1 /* 1 /*
2 outgoing.c 2 outgoing.c
3 3
4 $Id: outgoing.c 3 2000-01-04 11:35:42Z enz $ 4 $Id: outgoing.c 32 2000-04-29 14:45:56Z enz $
5 */ 5 */
6 6
7 #include "outgoing.h" 7 #include "outgoing.h"
8 8
9 #include <dirent.h> 9 #include <dirent.h>
41 if ( r != 0 ) 41 if ( r != 0 )
42 Log_dbg( "mkdir: %s", strerror( errno ) ); 42 Log_dbg( "mkdir: %s", strerror( errno ) );
43 } 43 }
44 44
45 Bool 45 Bool
46 Out_add( const char *serv, const Str msgId, const DynStr *artTxt ) 46 Out_add( const char *serv, const char *msgId, const DynStr *artTxt )
47 { 47 {
48 Str file; 48 Str file;
49 FILE *f; 49 FILE *f;
50 50
51 fileOutgoing( file, serv, msgId ); 51 fileOutgoing( file, serv, msgId );
109 fclose( f ); 109 fclose( f );
110 return TRUE; 110 return TRUE;
111 } 111 }
112 112
113 void 113 void
114 Out_remove( const char *serv, Str msgId ) 114 Out_remove( const char *serv, const char *msgId )
115 { 115 {
116 Str file; 116 Str file;
117 117
118 fileOutgoing( file, serv, msgId ); 118 fileOutgoing( file, serv, msgId );
119 if ( unlink( file ) != 0 ) 119 if ( unlink( file ) != 0 )
120 Log_err( "Cannot remove %s", file ); 120 Log_err( "Cannot remove %s", file );
121 } 121 }
122
123 Bool
124 Out_find( const char *msgId, Str server )
125 {
126 Str servdir;
127 DIR *d;
128 struct dirent *entry;
129 Bool res;
130
131
132 snprintf( servdir, MAXCHAR, "%s/outgoing", Cfg_spoolDir() );
133 if ( ! ( d = opendir( servdir ) ) )
134 {
135 Log_dbg( "Cannot open %s", servdir );
136 return FALSE;
137 }
138
139 readdir( d ); /* '.' */
140 readdir( d ); /* '..' */
141
142 res = FALSE;
143 while ( ! res && ( entry = readdir( d ) ) != NULL )
144 {
145 Str file;
146 struct stat s;
147
148 fileOutgoing( file, entry->d_name, msgId );
149 if ( stat( file, &s ) == 0 )
150 {
151 res = TRUE;
152 Utl_cpyStr( server, entry->d_name );
153 }
154 }
155
156 closedir( d );
157 return res;
158 }
159
160
161
162
163