head 1.7; access; symbols; locks; strict; comment @ * @; 1.7 date 2001.01.20.13.42.02; author simons; state dead; branches; next 1.6; 1.6 date 2001.01.19.14.56.33; author rse; state Exp; branches; next 1.5; 1.5 date 2001.01.19.14.53.23; author simons; state Exp; branches; next 1.4; 1.4 date 2001.01.19.12.49.44; author simons; state Exp; branches; next 1.3; 1.3 date 2001.01.18.20.30.50; author rse; state Exp; branches; next 1.2; 1.2 date 2001.01.15.16.58.58; author simons; state Exp; branches; next 1.1; 1.1 date 2001.01.15.16.29.11; author simons; state Exp; branches; next ; desc @@ 1.7 log @Underscores in file names suck, because you need an extra key-press to type them compared to the hyphen. For this reason (and for consistency) I corrected this horrible, horrible mistake of the past and renamed those files. @ text @/* $Source: /e/ossp/cvs/ossp-pkg/petidomo/queue_posting.c,v $ $Revision: 1.6 $ Copyright (C) 2000 by Peter Simons . This file is part of Petidomo. Petidomo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. Petidomo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include #include #include #include #include "libtext/text.h" #include "petidomo.h" char* queue_posting(const struct Mail* mail, const char* listname) { const struct PD_Config * MasterConfig = getMasterConfig(); char* buffer; char* cookie; FILE* fh; cookie = generate_cookie(mail->Header); buffer = text_easy_sprintf("%s/%s", MasterConfig->ack_queue_dir, cookie); fh = fopen(buffer, "w"); if (fh == NULL) { syslog(LOG_ERR, "Opening ack spool file \"%s\" failed: %s", buffer, strerror(errno)); exit(1); } fprintf(fh, "#! /bin/sh\n"); fprintf(fh, "\n"); fprintf(fh, "%s --mode=deliver --listname=%s --approved <<[end-of-%s-marker]\n", who_am_i, listname, cookie); fprintf(fh, "%s\n", mail->Header); fprintf(fh, "%s", mail->Body); fprintf(fh, "[end-of-%s-marker]\n", cookie); fclose(fh); chmod(buffer, 0755); free(buffer); return cookie; } @ 1.6 log @Get rid of all complaints from GCC 2.97 (except for two things which I do not want to change on my own) @ text @d3 1 a3 1 $Revision: 1.5 $ @ 1.5 log @Incorporated the cookie into the end-of-mail-marker used in the ack-script, so that the whole mechanism doesn't break when somebody has the words '[end-of-mail-marker]' in the mail body itself. @ text @d3 1 a3 1 $Revision: 1.4 $ d20 2 d39 1 a39 1 syslog(LOG_ERR, "Opening ack spool file \"%s\" failed: %m", buffer); @ 1.4 log @Petidomo needs to know the path to the executable in order to write the ack-spool file, which starts Petidomo again to process the acknowledged command or posting. I used BINDIR for that, but realized that this sucks when somebody manually moves the binary. Hence, I am using the contents of argv[0] now, normalized to an absolute path. This value is stored in the global variable who_am_i, which the queue_*() routines now use. @ text @d3 1 a3 1 $Revision: 1.3 $ d42 1 a42 1 fprintf(fh, "%s --mode=deliver --listname=%s --approved <<[end-of-mail-marker]\n", who_am_i, listname); d45 1 a45 1 fprintf(fh, "[end-of-mail-marker]\n"); @ 1.3 log @As we agreed today, Petidomo is now open because licensed under GPL and always will be licensed under GPL, so use "Petidomo" as the program name everywhere and consistently. @ text @d3 1 a3 1 $Revision: 1.2 $ d42 1 a42 1 fprintf(fh, BINDIR "/petidomo --mode=deliver --listname=%s --approved <<[end-of-mail-marker]\n", listname); @ 1.2 log @queue_command() and queue_posting() will now return the cookie used as filename, so that the calling code can mail back the request for confirmation. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/queue_posting.c,v $ $Revision: 1.1 $ d7 1 a7 1 This file is part of OpenPetidomo. d9 1 a9 1 OpenPetidomo is free software; you can redistribute it and/or modify d14 1 a14 1 OpenPetidomo is distributed in the hope that it will be useful, but @ 1.1 log @Implemented spooling mechanism for requests and postings that need an acknowledgement to be processed. The code is there, it just isn't called yet. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/subscribe.c,v $ $Revision: 1.8 $ d25 1 a25 1 void queue_posting(const struct Mail* mail, const char* listname) d49 1 @