head 1.9; access; symbols PETIDOMO_4_0b6:1.9 PETIDOMO_4_0b5:1.9 PETIDOMO_4_0b4:1.9 PETIDOMO_4_0b3:1.9 BEFORETHL:1.9 petidomo-2-2:1.1.1.1 petidomo:1.1.1; locks; strict; comment @ * @; 1.9 date 2001.02.12.20.44.13; author simons; state Exp; branches; next 1.8; 1.8 date 2001.01.18.20.30.50; author rse; state Exp; branches; next 1.7; 1.7 date 2001.01.10.17.12.40; author simons; 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.9 log @Changed loglevel of sereval syslog() calls from NOTICE to INFO, because they do not really require the administrator's attention but are informational. @ text @/* $Source: /e/ossp/cvs/ossp-pkg/petidomo/help.c,v $ $Revision: 1.8 $ 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 "libtext/text.h" #include "petidomo.h" int SendHelp(struct Mail * MailStruct, const char * param1, const char * param2, const char * defaultlist) { const struct PD_Config * MasterConfig; const struct List_Config * ListConfig = NULL; FILE * fh; char * originator; char * p; char envelope[1024]; char * buffer; /* Find out who is who and what to send. */ MasterConfig = getMasterConfig(); if (defaultlist != NULL) { ListConfig = getListConfig(defaultlist); sprintf(envelope, "%s-owner@@%s", defaultlist, ListConfig->fqdn); } else sprintf(envelope, "petidomo-manager@@%s", MasterConfig->fqdn); originator = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; if (param1 != NULL) { if (isValidListName(param1) == TRUE) { /* Send list's description back. */ ListConfig = getListConfig(param1); sprintf(envelope, "%s-owner@@%s", param1, MasterConfig->fqdn); fh = vOpenMailer(envelope, originator, NULL); if (fh == NULL) { syslog(LOG_ERR, "Failed to send mail to \"%s\" regarding this request.", originator); return -1; } fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", param1, ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"help %s\"\n", param1); 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"); fprintf(fh, "Description of list \"%s\":\n\n", param1); p = loadfile(ListConfig->desc_file); if (p != NULL) { fprintf(fh, "%s\n", p); free(p); } else { syslog(LOG_INFO, "List \"%s\" doesn't have a description.", param1); fprintf(fh, "No description available.\n"); } CloseMailer(fh); } else { /* List does not exist, I am afraid. */ fh = vOpenMailer(envelope, originator, NULL); if (fh == NULL) { syslog(LOG_ERR, "Failed to send mail to \"%s\" regarding this request.", originator); return -1; } if (defaultlist != NULL) fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", defaultlist, ListConfig->fqdn); else fprintf(fh, "From: petidomo@@%s (Petidomo Mailing List Server)\n", MasterConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"help %s\"\n", param1); 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"); buffer = text_easy_sprintf( "There is no mailing list \"%s\" on this machine, I am afraid. Please check " \ "whether you spelled the name of the list correctly, or whether you have been " \ "sending this request to the wrong address.\n\nYou can receive a list of all " \ "mailing lists available here by sending the command \"INDEX\" to the " \ "mailing list server.", param1); text_wordwrap(buffer, 70); fprintf(fh, "%s\n", buffer); CloseMailer(fh); } } else { /* Send help text to the originator. */ fh = vOpenMailer(envelope, originator, NULL); if (fh == NULL) { syslog(LOG_ERR, "Failed to send mail to \"%s\" regarding this request.", originator); return -1; } if (defaultlist != NULL) fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", defaultlist, ListConfig->fqdn); else fprintf(fh, "From: petidomo@@%s (Petidomo Mailing List Server)\n", MasterConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"help\"\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->help_file); if (p != NULL) { fprintf(fh, "%s\n", p); free(p); } else { syslog(LOG_ERR, "There is no help file for Petidomo!"); fprintf(fh, "No help text available.\n"); } CloseMailer(fh); } return 0; } int Indecipherable(struct Mail * MailStruct, const char * defaultlist) { const struct PD_Config * MasterConfig; const struct List_Config * ListConfig = NULL; FILE * fh; char * replyto; char * p; char envelope[1024]; /* Find out who is who and what to send. */ MasterConfig = getMasterConfig(); if (defaultlist != NULL) { ListConfig = getListConfig(defaultlist); sprintf(envelope, "%s-owner@@%s", defaultlist, ListConfig->fqdn); } else sprintf(envelope, "petidomo-manager@@%s", MasterConfig->fqdn); replyto = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; /* Send the help file out. */ fh = vOpenMailer(envelope, replyto, NULL); if (fh == NULL) { syslog(LOG_ERR, "Failed to send mail to \"%s\" regarding this request.", replyto); return -1; } if (defaultlist != NULL) fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", defaultlist, ListConfig->fqdn); else fprintf(fh, "From: petidomo@@%s (Petidomo Mailing List Server)\n", MasterConfig->fqdn); fprintf(fh, "To: %s\n", replyto); fprintf(fh, "Subject: Petidomo: Your request \"indecipherable\"\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->help_file); if (p != NULL) { fprintf(fh, "%s\n", p); free(p); } else { syslog(LOG_ERR, "There is no help file for Petidomo!"); fprintf(fh, "No help text available.\n"); } CloseMailer(fh); return 0; } @ 1.8 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.7 $ d76 1 a76 1 syslog(LOG_NOTICE, "List \"%s\" doesn't have a description.", param1); @ 1.7 log @Set the right margin for word-wrapping to 70 characters instead of 75. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/help.c,v $ $Revision: 1.6 $ 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.6 log @Rewrote Petidomo so that virtually any file's path can be configured at run-time now. @ text @d3 1 a3 1 $Revision: 1.5 $ d110 1 a110 1 text_wordwrap(buffer, 75); @ 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 $ d70 1 a70 2 buffer = text_easy_sprintf("lists/%s/description", param1); p = loadfile(buffer); d138 1 a138 1 p = loadfile("etc/help"); d194 1 a194 1 p = loadfile("etc/help"); @ 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 $ d63 1 a63 1 fprintf(fh, "Subject: Your request \"help %s\"\n", param1); d99 1 a99 1 fprintf(fh, "Subject: Your request \"help %s\"\n", param1); d133 1 a133 1 fprintf(fh, "Subject: Your request \"help\"\n"); d189 1 a189 1 fprintf(fh, "Subject: Your request \"indecipherable\"\n"); @ 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 $ a79 1 AppendSignature(fh); a112 1 AppendSignature(fh); a147 1 AppendSignature(fh); a203 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$ a51 2 debug((DEBUG_COMMAND, 5, "Sending \"%s\" list \"%s\" description.", originator, param1)); a86 2 debug((DEBUG_COMMAND, 5, "Received HELP command for non-existing list \"%s\".", param1)); a121 1 debug((DEBUG_COMMAND, 5, "Sending helpfile to \"%s\".", originator)); a179 1 debug((DEBUG_COMMAND, 5, "Sending helpfile to \"%s\".", replyto)); @ 1.1 log @Initial revision @ text @d2 2 a3 7 * $Source: /usr/local/libdata/cvs/simons/petidomo/src/petidomo/help.c,v $ * $Revision: 1.9 $ * $Date: 1998/01/25 16:32:33 $ * * Copyright (C) 1996 by CyberSolutions GmbH. * All rights reserved. */ d5 17 a21 2 #include #include @ 1.1.1.1 log @Imported Petidomo 2.2 as found on www.petidomo.com. @ text @@