comparison src/control.c @ 43:2842f50feb55 noffle

[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h, control.c, control.h, database.c, database.h, dynamicstring.c, dynamicstring.h, fetch.c, fetch.h, fetchlist.c, fetchlist.h, group.c, group.h, itemlist.c, itemlist.h, lock.c, lock.h, log.c, log.h, noffle.c, online.c, online.h, outgoing.c, outgoing.h, over.c, over.h, post.c, post.h, protocol.c, protocol.h, pseudo.c, pseudo.h, request.c, request.h, server.c, server.h, util.c, util.h, wildmat.c, wildmat.h: Moved files to the subdirectory src/ * Makefile.am, acconfig.h, configure.in, docs/Makefile.am, src/Makefile.am, Makefile.in, aclocal.m4, config.h.in, configure, install-sh, missing, mkinstalldirs, stamp-h.in, docs/Makefile.in, src/Makefile.in: Added files. They are used by aclocal, autoheader, autoconf and automake. * src/config.c, src/config.h: Renamed to configfile.c and configfile.h, because configure will generate a config.h file itself. * src/client.c, src/content.c, src/database.c, src/fetch.c, src/fetchlist.c, src/group.c, src/lock.c, src/noffle.c, src/online.c, src/outgoing.c, src/over.c, src/pseudo.c, src/request.c, src/server.c, src/util.c: Changed '#include "config.h"' to '#include "configfile.h"'. * src/client.c, src/content.c, src/database.c, src/fetch.c, src/fetchlist.c, src/group.c, src/lock.c, src/online.c, src/outgoing.c, src/post.c, src/protocol.c, src/request.c, src/server.c: Files now #include <config.h>. Added missing <stdio.h>. This removes the warnings about snprintf() not being declared. * Makefile: Removed. This is now generated by configure.
author uh1763
date Fri, 05 May 2000 22:45:56 +0100
parents
children 32ba1198c6fa
comparison
equal deleted inserted replaced
42:2467ff423c15 43:2842f50feb55
1 /*
2 control.c
3
4 $Id: control.c 49 2000-05-05 21:45:56Z uh1763 $
5 */
6
7 #include "control.h"
8 #include <stdio.h>
9 #include "common.h"
10 #include "content.h"
11 #include "database.h"
12 #include "group.h"
13 #include "itemlist.h"
14 #include "log.h"
15 #include "outgoing.h"
16
17 int
18 Ctrl_cancel( const char *msgId )
19 {
20 ItemList *refs;
21 const char *ref;
22 Str server;
23 Bool seen = FALSE;
24 int res = CANCEL_OK;
25
26 /* See if in outgoing and zap if so. */
27 if ( Out_find( msgId, server ) )
28 {
29 Out_remove( server, msgId );
30 Log_inf( "'%s' cancelled from outgoing queue for '%s'.\n",
31 msgId, server );
32 seen = TRUE;
33 }
34
35 if ( ! Db_contains( msgId ) )
36 {
37 Log_inf( "Cancel: '%s' not in database.", msgId );
38 return seen ? CANCEL_OK : CANCEL_NO_SUCH_MSG;
39 }
40
41 /*
42 Retrieve the Xrefs, remove from each group and then
43 remove from the database.
44 */
45 refs = new_Itl( Db_xref( msgId ), " " );
46 for( ref = Itl_first( refs ); ref != NULL; ref = Itl_next( refs ) )
47 {
48 Str grp;
49 int no;
50
51 if ( sscanf( ref, "%s:%d", grp, &no ) != 2 )
52 break;
53
54 if ( Grp_exists( grp ) )
55 {
56 Cont_read( grp );
57 Cont_delete( no );
58 Cont_write();
59
60 if ( ! Grp_local( grp ) && ! seen )
61 res = CANCEL_NEEDS_MSG;
62
63 Log_dbg( "Removed '%s' from group '%s'.", msgId, grp );
64 }
65 else
66 {
67 Log_inf( "Group '%s' in Xref for '%s' not found.", grp, msgId );
68 }
69 }
70 del_Itl( refs );
71 Db_delete( msgId );
72 Log_inf( "Message '%s' cancelled.", msgId );
73 return res;
74 }