[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] default leafnode message in newsgroup



Enrico Luciano wrote:

> Hi there,
>         I want to change the welcome/default message that leafnode
> leaves in a new newsgroup...
> I've leafnode 1.9.2

The attached patch by Holger Repp allows for an additional parameter
in the /etc/leafnode/config file which is the pathname for another
default message. The reason I am not willing to put this into the
nntpd.c is simply that (a) you don't get any groupname-dependent
information out of this, and (b) I cannot see that it is meaningful.

The patch is for leafnode 1.9.2.

%cut here
--- leafnode.h.orig	Thu Jun 24 18:29:07 1999
+++ leafnode.h	Thu Jun 24 18:28:24 1999
@@ -212,6 +212,7 @@
 				   that many days */
 extern int timeout_active;	/* reread active file after that many days */
 extern char * filterfile;	/* filename where filter resides */
+extern char * pseudofile;	/* for custom placholder */
 extern char * owndn;		/* own domain name, if you can't set one */
 extern struct serverlist * servers;
 			/* list of servers to use */
--- configutil.c.orig	Thu Jun 24 18:29:19 1999
+++ configutil.c	Thu Jun 24 18:28:25 1999
@@ -53,6 +53,7 @@
 int timeout_active = 90;
 char * filterfile ;
 char * owndn = NULL;	/* own domain name, if you can't set a sensible one */
+char * pseudofile;	/* custom pseudofile for placeholder message */
 struct serverlist * servers = NULL;
 
 int parse_line ( char *l, char * param, char * value ) ;
@@ -311,7 +312,12 @@
 		else
 		    q->next = p;
 		q = p;
-	    }
+	    } /* config parameter placeholder */
+	    else if ( strcmp ( "placeholder", param ) == 0 ) {
+		pseudofile = strdup( value ); 
+		syslog( LOG_INFO, "placeholder: %s", value );
+	   }
+
 	}
     }
     debug = debugmode;
--- nntpd.c.orig	Thu Jun 24 18:28:54 1999
+++ nntpd.c	Thu Jun 24 18:28:22 1999
@@ -211,13 +211,15 @@
 /* build and return an open fd to pseudoart in group */
 FILE * buildpseudoart(const char * grp) {
     FILE * f;
-
+    FILE * f_pseudo; /* for custom placeholder filehandle*/
+    int c; /* int for fgetc for custom placeholder */
     f = tmpfile();
     if (!f) {
 	syslog( LOG_ERR, "Could not create pseudoarticle" );
 	return f;
     }
-
+    /* pseudo article start with if for default bzw. custom */ 
+    /* common header for placeholder message */
     fprintf(f, "Path: %s\n", fqdn);
     fprintf(f, "Newsgroups: %s\n", grp);
     fprintf(f, "From: Leafnode <nobody@%s>\n", fqdn);
@@ -225,9 +227,13 @@
     fprintf(f, "Date: %s\n", rfctime() );
     fprintf(f, "Message-ID: <leafnode:placeholder:%s@%s>\n", grp, fqdn);
     fprintf(f, "\n");
-    fprintf(f,
+    
+    if (( f_pseudo = fopen(pseudofile ,"r")) == 0 ) {
+	syslog( LOG_DEBUG, "default Placeholder");
+       	/* use the default placeholder message */
+       	fprintf(f,
 	  "This server is running leafnode, which is a dynamic NNTP proxy.\n"
-	  "This means that it does not retrieve newsgroups unless someone is\n"
+  	  "This means that it does not retrieve newsgroups unless someone is\n"
 	  "actively reading them.\n"
 	  "\n"
 	  "If you do an operation on a group - such as reading an article,\n"
@@ -247,7 +253,16 @@
 	  "\n"
 	  "Leafnode can be found at\n"
 	  "\thttp://wpxx02.toxi.uni-wuerzburg.de/~krasel/leafnode.html\n\n";, grp );
-
+    }
+    else {
+	syslog( LOG_DEBUG, "Custom placeholder FILE: %s", pseudofile);
+	while((c = getc(f_pseudo)) != EOF) { 
+	   fputc(c, f);
+	}
+	fprintf(f, "\n%s\n\n", grp);
+	fclose(f_pseudo); 
+	syslog( LOG_DEBUG, "file pseudo close: %s", pseudofile); 
+    } /* H.R.: Pseudo Article end */
     rewind(f);
     return f;
 }
%cut here

--Cornelius.

-- 
/* Cornelius Krasel, U Wuerzburg, Dept. of Pharmacology, Versbacher Str. 9 */
/* D-97078 Wuerzburg, Germany   email: phak004@xxxxxxxxxxxxxxxxxxxxxx  SP4 */
/* "Science is the game we play with God to find out what His rules are."  */

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list