* Moved bio-related commands out to a loadable module
authorArt Cancro <ajc@citadel.org>
Fri, 17 Mar 2000 04:11:24 +0000 (04:11 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 17 Mar 2000 04:11:24 +0000 (04:11 +0000)
citadel/ChangeLog
citadel/Makefile.in
citadel/citserver.c
citadel/serv_bio.c [new file with mode: 0644]
citadel/user_ops.c
citadel/user_ops.h

index 78d36639138b5c023cd07bc91e63637bc1a3511a..680521d00c589c65ccfe29bcb38f73e55476a6bb 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 1.490  2000/03/17 04:11:24  ajc
+ * Moved bio-related commands out to a loadable module
+
  Revision 1.489  2000/03/16 17:58:54  smw
  Created a docs directory.
  Moved install.txt to docs.
@@ -1750,3 +1753,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index 0bf427c4071030ec4f667d11c7b2d405ed42a9cd..8e50562cbb6312341112ba5cbb5f3be8897a2fa4 100644 (file)
@@ -31,6 +31,7 @@ SERV_MODULES=modules/serv_chat$(SO) modules/serv_vcard$(SO) \
        modules/serv_smtp$(SO) modules/serv_pop3$(SO) \
        modules/serv_inetcfg$(SO) \
        modules/serv_rwho$(SO) \
+       modules/serv_bio$(SO) \
        modules/serv_expire$(SO) $(SERV_ICQ)
 UTIL_TARGETS=aidepost netmailer netproc netsetup msgform readlog rcit \
        stats citmail netpoll mailinglist userlist sendcommand \
@@ -80,7 +81,7 @@ SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c commands.c \
        whobbs.c sendcommand.c mime_parser.c base64.c qpdecode.c getutline.c \
        auth.c chkpwd.c client_icq.c html.c vcard.c serv_upgrade.c \
        serv_smtp.c serv_pop3.c internet_addressing.c parsedate.c genstamp.c \
-       domain.c clientsocket.c serv_inetcfg.c serv_rwho.c
+       domain.c clientsocket.c serv_inetcfg.c serv_rwho.c serv_bio.c
 
 DEP_FILES=$(SOURCES:.c=.d)
 
@@ -160,6 +161,12 @@ modules/serv_rwho.so: serv_rwho.mo
 modules/serv_rwho.mo: serv_rwho.mo
        ln -f serv_rwho.mo modules
 
+modules/serv_bio.so: serv_bio.mo
+       $(LINK_SHARED) -o modules/serv_bio.so serv_bio.mo
+
+modules/serv_bio.mo: serv_bio.mo
+       ln -f serv_bio.mo modules
+
 modules/serv_expire.so: serv_expire.mo
        $(LINK_SHARED) -o modules/serv_expire.so serv_expire.mo
 
index 5aafb8a518a399a3253e7bcef46e277d1d7735fe..28656d0172e144318d7006b529ab084b8effe1d7 100644 (file)
@@ -1072,18 +1072,6 @@ void do_command_loop(void) {
                cmd_ipgm(&cmdbuf[5]);
                }
 
-       else if (!strncasecmp(cmdbuf,"EBIO",4)) {
-               cmd_ebio();
-               }
-
-       else if (!strncasecmp(cmdbuf,"RBIO",4)) {
-               cmd_rbio(&cmdbuf[5]);
-               }
-
-       else if (!strncasecmp(cmdbuf,"LBIO",4)) {
-               cmd_lbio();
-               }
-
        else if (!strncasecmp(cmdbuf,"TERM",4)) {
                cmd_term(&cmdbuf[5]);
                }
diff --git a/citadel/serv_bio.c b/citadel/serv_bio.c
new file mode 100644 (file)
index 0000000..6ac1f29
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * $Id$
+ *
+ * This module implementsserver commands related to the display and
+ * manipulation of user "bio" files.
+ *
+ */
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <pwd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <string.h>
+#include <limits.h>
+#include "citadel.h"
+#include "server.h"
+#include <time.h>
+#include "sysdep_decls.h"
+#include "citserver.h"
+#include "support.h"
+#include "config.h"
+#include "control.h"
+#include "dynloader.h"
+#include "room_ops.h"
+#include "user_ops.h"
+#include "policy.h"
+#include "database.h"
+#include "msgbase.h"
+#include "tools.h"
+
+
+
+
+/*
+ * enter user bio
+ */
+void cmd_ebio(char *cmdbuf) {
+       char buf[256];
+       FILE *fp;
+
+       if (!(CC->logged_in)) {
+               cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
+               return;
+       }
+
+       sprintf(buf,"./bio/%ld",CC->usersupp.usernum);
+       fp = fopen(buf,"w");
+       if (fp == NULL) {
+               cprintf("%d Cannot create file\n",ERROR);
+               return;
+       }
+       cprintf("%d  \n",SEND_LISTING);
+       while(client_gets(buf), strcmp(buf,"000")) {
+               fprintf(fp,"%s\n",buf);
+       }
+       fclose(fp);
+}
+
+/*
+ * read user bio
+ */
+void cmd_rbio(char *cmdbuf)
+{
+       struct usersupp ruser;
+       char buf[256];
+       FILE *fp;
+
+       extract(buf,cmdbuf,0);
+       if (getuser(&ruser,buf)!=0) {
+               cprintf("%d No such user.\n",ERROR+NO_SUCH_USER);
+               return;
+       }
+       sprintf(buf,"./bio/%ld",ruser.usernum);
+       
+       fp = fopen(buf,"r");
+       if (fp == NULL) {
+               cprintf("%d %s has no bio on file.\n",
+                       ERROR+FILE_NOT_FOUND,ruser.fullname);
+               return;
+       }
+       cprintf("%d  \n",LISTING_FOLLOWS);
+       while (fgets(buf,256,fp)!=NULL) cprintf("%s",buf);
+       fclose(fp);
+       cprintf("000\n");
+}
+
+/*
+ * list of users who have entered bios
+ */
+void cmd_lbio(char *cmdbuf) {
+       char buf[256];
+       FILE *ls;
+       struct usersupp usbuf;
+
+       ls=popen("cd ./bio; ls","r");
+       if (ls==NULL) {
+               cprintf("%d Cannot open listing.\n",ERROR+FILE_NOT_FOUND);
+               return;
+       }
+
+       cprintf("%d\n",LISTING_FOLLOWS);
+       while (fgets(buf,255,ls)!=NULL)
+               if (getuserbynumber(&usbuf,atol(buf))==0)
+                       cprintf("%s\n",usbuf.fullname);
+       pclose(ls);
+       cprintf("000\n");
+}
+
+
+
+
+char *Dynamic_Module_Init(void)
+{
+        CtdlRegisterProtoHook(cmd_ebio, "EBIO", "Enter your bio");
+        CtdlRegisterProtoHook(cmd_rbio, "RBIO", "Read a user's bio");
+        CtdlRegisterProtoHook(cmd_lbio, "LBIO", "List users with bios");
+        return "$Id$";
+}
+
+
index 75dda4ba4ddf2fb213a05b65733add72ad032380..7c94c1da92fc55810bff9ed6ce84dd1bcad4d4af 100644 (file)
@@ -1089,82 +1089,6 @@ void cmd_qusr(char *who)
        }
 
 
-/*
- * enter user bio
- */
-void cmd_ebio(void) {
-       char buf[256];
-       FILE *fp;
-
-       if (!(CC->logged_in)) {
-               cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
-               return;
-               }
-
-       sprintf(buf,"./bio/%ld",CC->usersupp.usernum);
-       fp = fopen(buf,"w");
-       if (fp == NULL) {
-               cprintf("%d Cannot create file\n",ERROR);
-               return;
-               }
-       cprintf("%d  \n",SEND_LISTING);
-       while(client_gets(buf), strcmp(buf,"000")) {
-               fprintf(fp,"%s\n",buf);
-               }
-       fclose(fp);
-       }
-
-/*
- * read user bio
- */
-void cmd_rbio(char *cmdbuf)
-{
-       struct usersupp ruser;
-       char buf[256];
-       FILE *fp;
-
-       extract(buf,cmdbuf,0);
-       if (getuser(&ruser,buf)!=0) {
-               cprintf("%d No such user.\n",ERROR+NO_SUCH_USER);
-               return;
-               }
-       sprintf(buf,"./bio/%ld",ruser.usernum);
-       
-       fp = fopen(buf,"r");
-       if (fp == NULL) {
-               cprintf("%d %s has no bio on file.\n",
-                       ERROR+FILE_NOT_FOUND,ruser.fullname);
-               return;
-               }
-       cprintf("%d  \n",LISTING_FOLLOWS);
-       while (fgets(buf,256,fp)!=NULL) cprintf("%s",buf);
-       fclose(fp);
-       cprintf("000\n");
-       }
-
-/*
- * list of users who have entered bios
- */
-void cmd_lbio(void) {
-       char buf[256];
-       FILE *ls;
-       struct usersupp usbuf;
-
-       ls=popen("cd ./bio; ls","r");
-       if (ls==NULL) {
-               cprintf("%d Cannot open listing.\n",ERROR+FILE_NOT_FOUND);
-               return;
-               }
-
-       cprintf("%d\n",LISTING_FOLLOWS);
-       while (fgets(buf,255,ls)!=NULL)
-               if (getuserbynumber(&usbuf,atol(buf))==0)
-                       cprintf("%s\n",usbuf.fullname);
-       pclose(ls);
-       cprintf("000\n");
-       }
-
-
 /*
  * Administrative Get User Parameters
  */
index 144a3c1117235b80efd0bcae64a8056178ededfb..d286d42748df37a9247e1e98633038997b12ffd5 100644 (file)
@@ -28,9 +28,6 @@ void ListThisUser(struct usersupp *usbuf, void *data);
 void cmd_list (void);
 void cmd_chek (void);
 void cmd_qusr (char *who);
-void cmd_ebio (void);
-void cmd_rbio (char *cmdbuf);
-void cmd_lbio (void);
 void cmd_agup (char *cmdbuf);
 void cmd_asup (char *cmdbuf);
 int NewMailCount(void);