]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_bio.c
Moved to new module init structure.
[citadel.git] / citadel / serv_bio.c
index 0331b13e19e7aab644eceb06ae9855e74c19d3d8..9f5589b3b2434af55248a65e177375a58a8c5931 100644 (file)
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "database.h"
 #include "msgbase.h"
 #include "tools.h"
+#include "citadel_dirs.h"
 
-
-
+#include "ctdl_module.h"
 
 /*
  * enter user bio
@@ -62,7 +60,7 @@ void cmd_ebio(char *cmdbuf) {
                return;
        }
 
-       snprintf(buf, sizeof buf, "./bio/%ld",CC->user.usernum);
+       snprintf(buf, sizeof buf, "%s%ld",ctdl_bio_dir,CC->user.usernum);
        fp = fopen(buf,"w");
        if (fp == NULL) {
                cprintf("%d Cannot create file: %s\n", ERROR + INTERNAL_ERROR,
@@ -92,7 +90,7 @@ void cmd_rbio(char *cmdbuf)
                cprintf("%d No such user.\n",ERROR + NO_SUCH_USER);
                return;
        }
-       snprintf(buf, sizeof buf, "./bio/%ld",ruser.usernum);
+       snprintf(buf, sizeof buf, "%s%ld",ctdl_bio_dir,ruser.usernum);
        
        cprintf("%d OK|%s|%ld|%d|%ld|%ld|%ld\n", LISTING_FOLLOWS,
                ruser.fullname, ruser.usernum, ruser.axlevel,
@@ -114,8 +112,10 @@ void cmd_lbio(char *cmdbuf) {
        char buf[256];
        FILE *ls;
        struct ctdluser usbuf;
+       char listbios[256];
 
-       ls = popen("cd ./bio; ls", "r");
+       snprintf(listbios, sizeof(listbios),"cd %s; ls",ctdl_bio_dir);
+       ls = popen(listbios, "r");
        if (ls == NULL) {
                cprintf("%d Cannot open listing.\n", ERROR + FILE_NOT_FOUND);
                return;
@@ -132,11 +132,13 @@ void cmd_lbio(char *cmdbuf) {
 
 
 
-char *serv_bio_init(void)
+CTDL_MODULE_INIT(bio)
 {
         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 our Subversion id for the Log */
         return "$Id$";
 }