head 1.8; access; symbols PETIDOMO_4_0b6:1.8 PETIDOMO_4_0b5:1.8 PETIDOMO_4_0b4:1.8 PETIDOMO_4_0b3:1.8 BEFORETHL:1.8 petidomo-2-2:1.1.1.1 petidomo:1.1.1; locks; strict; comment @ * @; 1.8 date 2001.01.19.14.56.33; author rse; state Exp; branches; next 1.7; 1.7 date 2001.01.18.20.30.50; author rse; state Exp; branches; next 1.6; 1.6 date 2001.01.08.20.36.19; author simons; state Exp; branches; next 1.5; 1.5 date 2001.01.06.11.05.08; author simons; state Exp; branches; next 1.4; 1.4 date 2000.12.15.16.16.07; author simons; state Exp; branches; next 1.3; 1.3 date 2000.12.15.15.48.00; author simons; state Exp; branches; next 1.2; 1.2 date 2000.12.13.15.35.14; author simons; state Exp; branches; next 1.1; 1.1 date 2000.12.13.13.19.23; author simons; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2000.12.13.13.19.23; author simons; state Exp; branches; next ; desc @@ 1.8 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 @/* $Source: /e/ossp/cvs/ossp-pkg/petidomo/index.c,v $ $Revision: 1.7 $ Copyright (C) 2000 by CyberSolutions GmbH, Germany. 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 #include "libtext/text.h" #include "petidomo.h" int GenIndex(struct Mail * MailStruct, const char * param1, const char * param2, const char * defaultlist) { const struct PD_Config * MasterConfig = getMasterConfig(); FILE * fh; const char * address = NULL; char from[4096]; char envelope[4096]; char * p; address = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; /* Initialize internal stuff. */ MasterConfig = getMasterConfig(); sprintf(envelope, "petidomo-manager@@%s", MasterConfig->fqdn); if (defaultlist != NULL) sprintf(from, "%s-request@@%s", defaultlist, MasterConfig->fqdn); else sprintf(from, "petidomo@@%s", MasterConfig->fqdn); /* Open the mailer. */ fh = vOpenMailer(envelope, address, NULL); if (fh == NULL) { syslog(LOG_ERR, "Failed to send mail to \"%s\": %s", address, strerror(errno)); return -1; } fprintf(fh, "From: %s (Petidomo Mailing List Server)\n", from); fprintf(fh, "To: %s\n", address); fprintf(fh, "Subject: Petidomo: Your request \"index\"\n"); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); p = loadfile(MasterConfig->index_file); if (p != NULL) { fprintf(fh, "%s\n", p); free(p); } else { syslog(LOG_ERR, "There is no index file for Petidomo!"); fprintf(fh, "No index available.\n"); } CloseMailer(fh); return 0; } @ 1.7 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.6 $ d24 1 d57 1 a57 1 syslog(LOG_ERR, "Failed to send mail to \"%s\": %m", address); @ 1.6 log @Rewrote Petidomo so that virtually any file's path can be configured at run-time now. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/index.c,v $ $Revision: 1.5 $ 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.5 log @- Added a "Petidomo:" prefix to all subject lines, to distinguish them from regular mail. Rejection mails furthermore have the prefix "BOUNCE :", mails that need approval have the prefix "APROVE :". - When a mail is rejected due to ACL, the mail body will tell you whether the global acl file or the list's local acl file hit. - If a file "lists//header" exists, it contents will be added to the headers of the article posted to the list. Be careful not to have blank lines in there, as this will screw the whole message up. - When generating the index of available mailing lists, the list type will now be typeset in brackets, e.g.: "(public mailing list)". - The index will no longer contain tabs in the mail body. @ text @d3 1 a3 1 $Revision: 1.4 $ a34 1 const struct List_Config * ListConfig; d39 1 a39 7 char * description; char * currLine; char * nextLine; char * buffer; DIR * dirp; struct dirent * entry; unsigned int entry_num; d67 2 a68 31 fprintf(fh, "Index of available lists:\n"); fprintf(fh, "=========================\n\n"); /* Scan the directory. */ entry_num = 0; dirp = opendir("lists"); if (dirp == NULL) { fprintf(fh, \ "An internal error has occured while processing your request. The\n" \ "server administrator has been notified. You don't need to re-submit\n" \ "your request, it will be processed as soon as the problem has been\n" \ "remedied.\n"); CloseMailer(fh); syslog(LOG_ERR, "Failed to read directory \"lists\": %m"); return -1; } while((entry = readdir(dirp)) != NULL) { if (!strcasecmp(entry->d_name, ".") || !strcasecmp(entry->d_name, "..")) continue; if (isValidListName(entry->d_name) == FALSE) continue; ListConfig = getListConfig(entry->d_name); if (ListConfig->showonindex == FALSE) continue; entry_num++; /* Print stuff to the mail. */ fprintf(fh, "%s", entry->d_name); d70 2 a71 6 int i; i = 40 - strlen(entry->d_name); if (i < 1) i = 1; while(i-- > 0) fputc(' ', fh); d73 4 a76 5 if (ListConfig->allowpubsub == TRUE) { if (ListConfig->listtype == LIST_MODERATED) fprintf(fh, "(moderated mailing list)\n"); else fprintf(fh, "(public mailing list)\n"); a77 32 else fprintf(fh, "(closed mailing list)\n"); buffer = text_easy_sprintf("lists/%s/description", entry->d_name); description = loadfile(buffer); if (description == NULL) { fprintf(fh, " no description available\n\n"); continue; } for (currLine = description; *currLine != '\0'; currLine = nextLine) { nextLine = text_find_next_line(currLine); if (nextLine[-1] == '\n') nextLine[-1] = '\0'; fprintf(fh, " %s\n", currLine); } fprintf(fh, "\n"); free(description); } closedir(dirp); switch (entry_num) { case 0: fprintf(fh, "No mailing lists found.\n"); break; case 1: fprintf(fh, "Found %d mailing list.\n", entry_num); break; default: fprintf(fh, "Found %d mailing lists.\n", entry_num); } a78 1 @ 1.4 log @Removed the signature code and all code that depended on it. In the new Petidomo, the signature mechanism for server mails will work differently. @ text @d3 1 a3 1 $Revision: 1.3 $ d68 1 a68 1 fprintf(fh, "Subject: Your request \"index\"\n"); d115 1 a115 1 fprintf(fh, "moderated mailing list\n"); d117 1 a117 1 fprintf(fh, "public mailing list\n"); d120 1 a120 1 fprintf(fh, "closed mailing list\n"); d125 1 a125 1 fprintf(fh, "\tno description available\n\n"); d133 1 a133 1 fprintf(fh, "\t%s\n", currLine); @ 1.3 log @ - Removed all debugging code. Now that Petidomo will be "rewritten" in C++, I need a new paradigm for debugging anyway and the old solution of mine was to messy for my taste anyway. - Petidomo no longer cares under what name it has been started. The different modes of operation will now be distinguished by a mandatory command line parameter. @ text @d3 1 a3 1 $Revision: 1.2 $ a150 1 AppendSignature(fh); @ 1.2 log @ - Added correct GNU GPL copyright statements to the files. - Removed unnecessary include statements. @ text @d2 2 a3 2 $Source$ $Revision$ a47 3 debug((DEBUG_COMMAND, 3, "GenIndex(\"%s\", \"%s\") with default list \"%s\".", param1, param2, defaultlist)); a95 1 debug((DEBUG_COMMAND, 5, "Found entry \"lists/%s\".", entry->d_name)); d98 1 a98 3 if (ListConfig->showonindex == FALSE) { debug((DEBUG_COMMAND, 5, "List \"%s\" won't appear on the index.", entry->d_name)); a99 1 } @ 1.1 log @Initial revision @ text @d2 17 a18 7 * $Source: /usr/local/libdata/cvs/simons/petidomo/src/petidomo/index.c,v $ * $Revision: 1.11 $ * $Date: 1997/12/09 21:18:46 $ * * Copyright (C) 1996 by CyberSolutions GmbH. * All rights reserved. */ d25 2 a26 2 #include #include @ 1.1.1.1 log @Imported Petidomo 2.2 as found on www.petidomo.com. @ text @@