]> code.citadel.org Git - citadel.git/blobdiff - citadel/routines.c
* Multiple files: Convert most remaining client code to use new Citadel IPC
[citadel.git] / citadel / routines.c
index 15f954d36802391e3849b52df54459c80a4e171d..cb002dd5cba3d769b5f32d7bbd088fd9c3f22a2f 100644 (file)
@@ -61,7 +61,6 @@ struct utmp *getutline(struct utmp *ut);
 extern unsigned userflags;
 extern char *axdefs[7];
 extern char sigcaught;
-extern struct CtdlServInfo serv_info;
 extern char rc_floor_mode;
 extern int rc_ansi_color;
 extern int rc_prompt_control;
@@ -81,11 +80,11 @@ void hit_any_key(CtdlIPC *ipc) {    /* hit any key to continue */
 
        color(COLOR_PUSH);
        color(DIM_RED);
-       scr_printf("%s\r",serv_info.serv_moreprompt);
+       scr_printf("%s\r", ipc->ServInfo.moreprompt);
        color(COLOR_POP);
        sttybbs(0);
        b=inkey();
-       for (a=0; a<strlen(serv_info.serv_moreprompt); ++a)
+       for (a=0; a<strlen(ipc->ServInfo.moreprompt); ++a)
                scr_putc(' ');
        scr_putc(13);
        sttybbs(1);
@@ -107,7 +106,7 @@ void edituser(CtdlIPC *ipc)
 {
        char buf[SIZ];
        char who[USERNAME_SIZE];
-       struct usersupp *user = NULL;
+       struct ctdluser *user = NULL;
        int newnow = 0;
        int r;                          /* IPC response code */
 
@@ -134,6 +133,11 @@ void edituser(CtdlIPC *ipc)
        }
 
        user->axlevel = intprompt("Access level", user->axlevel, 0, 6);
+
+       user->flags = set_attr(ipc, user->flags,
+               "Permission to send Internet mail",
+               US_INTERNET, 0);
+
        if (boolprompt("Ask user to register again", !(user->flags & US_REGIS)))
                user->flags &= ~US_REGIS;
        else
@@ -199,7 +203,7 @@ int set_attr(CtdlIPC *ipc, unsigned int sval, char *prompt, unsigned int sbit, i
 void enter_config(CtdlIPC *ipc, int mode)
 {
        char buf[SIZ];
-       struct usersupp *user = NULL;
+       struct ctdluser *user = NULL;
        int r;                          /* IPC response code */
 
        r = CtdlIPCGetConfig(ipc, &user, buf);
@@ -326,17 +330,6 @@ int pattern(char *search, char *patn) {
 }
 
 
-/* display internal error as defined in errmsgs */
-/*
-void interr(int errnum) {
-       scr_printf("*** INTERNAL ERROR %d\n"
-               "(Press any key to continue)\n", errnum);
-       inkey();
-       logoff(errnum);
-}
-*/
-
-
 void strproc(char *string)
 {
        int a;
@@ -388,7 +381,7 @@ char *strerror(int e)
 #endif
 
 
-void progress(unsigned long curr, unsigned long cmax)
+void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax)
 {
        static char dots[] =
                "**************************************************";
@@ -398,7 +391,7 @@ void progress(unsigned long curr, unsigned long cmax)
 
        if (curr >= cmax) {
                sln_printf("\r%79s\r","");
-               status_line(serv_info.serv_humannode, serv_info.serv_bbs_city,
+               status_line(ipc->ServInfo.humannode, ipc->ServInfo.bbs_city,
                        room_name, secure, 0);
        } else {
                /* a will be range 0-50 rather than 0-100 */
@@ -417,7 +410,7 @@ void progress(unsigned long curr, unsigned long cmax)
  * NOT the same locate_host() in locate_host.c.  This one just does a
  * 'who am i' to try to discover where the user is...
  */
-void locate_host(char *hbuf)
+void locate_host(CtdlIPC* ipc, char *hbuf)
 {
 #ifndef HAVE_UTMP_H
        char buf[SIZ];
@@ -426,7 +419,7 @@ void locate_host(char *hbuf)
 
        who = (FILE *)popen("who am i","r");
        if (who==NULL) {
-               strcpy(hbuf,serv_info.serv_fqdn);
+               strcpy(hbuf, ipc->ServInfo.fqdn);
                return; 
        }
        fgets(buf,sizeof buf,who);
@@ -437,7 +430,7 @@ void locate_host(char *hbuf)
                if ((buf[a]=='(')||(buf[a]==')')) ++b;
        }
        if (b<2) {
-               strcpy(hbuf,serv_info.serv_fqdn);
+               strcpy(hbuf, ipc->ServInfo.fqdn);
                return;
        }
 
@@ -450,7 +443,7 @@ void locate_host(char *hbuf)
                if (buf[a]==')') buf[a] = 0;
        }
 
-       if (strlen(buf)==0) strcpy(hbuf,serv_info.serv_fqdn);
+       if (strlen(buf)==0) strcpy(hbuf, ipc->ServInfo.fqdn);
        else strncpy(hbuf,buf,24);
 #else
        char *tty = ttyname(0);
@@ -462,7 +455,7 @@ void locate_host(char *hbuf)
 
        if (tty == NULL) {
            fail:
-               safestrncpy(hbuf, serv_info.serv_fqdn, 24);
+               safestrncpy(hbuf, ipc->ServInfo.fqdn, 24);
                return;
        }
 
@@ -500,12 +493,12 @@ void locate_host(char *hbuf)
 void misc_server_cmd(CtdlIPC *ipc, char *cmd) {
        char buf[SIZ];
 
-       CtdlIPC_putline(ipc, cmd);
-       CtdlIPC_getline(ipc, buf);
+       CtdlIPC_chat_send(ipc, cmd);
+       CtdlIPC_chat_recv(ipc, buf);
        scr_printf("%s\n",buf);
        if (buf[0]=='1') {
                set_keepalives(KA_HALF);
-               while (CtdlIPC_getline(ipc, buf), strcmp(buf,"000")) {
+               while (CtdlIPC_chat_recv(ipc, buf), strcmp(buf,"000")) {
                        scr_printf("%s\n",buf);
                }
                set_keepalives(KA_YES);
@@ -514,7 +507,7 @@ void misc_server_cmd(CtdlIPC *ipc, char *cmd) {
        if (buf[0]=='4') {
                do {
                        newprompt("> ",buf,255);
-                       CtdlIPC_putline(ipc, buf);
+                       CtdlIPC_chat_send(ipc, buf);
                } while(strcmp(buf,"000"));
                return;
        }