More conversion to the new config system. WARNING BROKEN BUILD
authorArt Cancro <ajc@uncensored.citadel.org>
Fri, 1 May 2015 14:39:51 +0000 (10:39 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Fri, 1 May 2015 14:39:51 +0000 (10:39 -0400)
citadel/context.c
citadel/internet_addressing.c
citadel/msgbase.c

index 81b597850b1dbfbe00396ea6119ba1014ed80e3e..576e9359c7da3cc9efeea5b6f6644d8e740f174f 100644 (file)
@@ -2,7 +2,7 @@
  * Citadel context management stuff.
  * Here's where we (hopefully) have all the code that manipulates contexts.
  *
- * Copyright (c) 1987-2011 by the citadel.org team
+ * Copyright (c) 1987-2015 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, version 3.
@@ -22,6 +22,7 @@
 #include "locate_host.h"
 #include "context.h"
 #include "control.h"
+#include "config.h"
 
 int DebugSession = 0;
 
@@ -244,8 +245,8 @@ void terminate_idle_sessions(void)
        for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
                if (
                        (ccptr != CC)
-                       && (config.c_sleeping > 0)
-                       && (now - (ccptr->lastcmd) > config.c_sleeping)
+                       && (CtdlGetConfigLong("c_sleeping") > 0)
+                       && (now - (ccptr->lastcmd) > CtdlGetConfigLong("c_sleeping"))
                ) {
                        if (!ccptr->dont_term) {
                                ccptr->kill_me = KILLME_IDLE;
@@ -514,7 +515,7 @@ void begin_session(CitContext *con)
        *con->fake_hostname = '\0';
        *con->fake_roomname = '\0';
        *con->cs_clientinfo = '\0';
-       safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
+       safestrncpy(con->cs_host, CtdlGetConfigStr("c_fqdn"), sizeof con->cs_host);
        safestrncpy(con->cs_addr, "", sizeof con->cs_addr);
        con->cs_UDSclientUID = -1;
        con->cs_host[sizeof con->cs_host - 1] = 0;
@@ -566,7 +567,7 @@ void begin_session(CitContext *con)
        con->dl_is_net = 0;
 
        con->nologin = 0;
-       if (((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions)) || CtdlWantSingleUser()) {
+       if (((CtdlGetConfigInt("c_maxsessions") > 0)&&(num_sessions > CtdlGetConfigInt("c_maxsessions"))) || CtdlWantSingleUser()) {
                con->nologin = 1;
        }
 
index c2131cbff46ce421a37225fb78b21772dbd9ceba..a8868e954c7a12320e4567113473ccd5bb82ef72 100644 (file)
@@ -1,8 +1,19 @@
 /*
  * This file contains functions which handle the mapping of Internet addresses
  * to users on the Citadel system.
+ *
+ * Copyright (c) 1987-2015 by the citadel.org team
+ *
+ * This program is open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3.
+ *
+ * This program 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 "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -281,8 +292,8 @@ int CtdlHostAlias(char *fqdn) {
        if (fqdn == NULL) return(hostalias_nomatch);
        if (IsEmptyStr(fqdn)) return(hostalias_nomatch);
        if (!strcasecmp(fqdn, "localhost")) return(hostalias_localhost);
-       if (!strcasecmp(fqdn, config.c_fqdn)) return(hostalias_localhost);
-       if (!strcasecmp(fqdn, config.c_nodename)) return(hostalias_localhost);
+       if (!strcasecmp(fqdn, CtdlGetConfigStr("c_fqdn"))) return(hostalias_localhost);
+       if (!strcasecmp(fqdn, CtdlGetConfigStr("c_nodename"))) return(hostalias_localhost);
        if (inetcfg == NULL) return(hostalias_nomatch);
 
        config_lines = num_tokens(inetcfg, '\n');
@@ -633,7 +644,7 @@ recptypes *validate_recipients(const char *supplied_recipients,
                case MES_LOCAL:
                        if (!strcasecmp(this_recp, "sysop")) {
                                ++ret->num_room;
-                               strcpy(this_recp, config.c_aideroom);
+                               strcpy(this_recp, CtdlGetConfigStr("c_aideroom"));
                                if (!IsEmptyStr(ret->recp_room)) {
                                        strcat(ret->recp_room, "|");
                                }
@@ -1025,7 +1036,7 @@ void process_rfc822_addr(const char *rfc822, char *user, char *node, char *name)
        int a;
 
        strcpy(user, "");
-       strcpy(node, config.c_fqdn);
+       strcpy(node, CtdlGetConfigStr("c_fqdn"));
        strcpy(name, "");
 
        if (rfc822 == NULL) return;
@@ -1114,7 +1125,7 @@ void process_rfc822_addr(const char *rfc822, char *user, char *node, char *name)
                && (haschar(node, '%')==0)
                && (haschar(node, '!')==0)
        ) {
-               strcpy(node, config.c_nodename);
+               strcpy(node, CtdlGetConfigStr("c_nodename"));
        }
 
        else {
index a63c1b077f7fa92340aa1c166ac0af5dd818f85f..494dbeea9b8fdc196e1404b30584edc3488e57d4 100644 (file)
@@ -2851,7 +2851,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        if ((!CCC->internal_pgm) || (recps == NULL)) {
                if (CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 1, msg) != 0) {
                        MSGM_syslog(LOG_ERR, "ERROR saving message pointer!\n");
-                       CtdlSaveMsgPointerInRoom(config.c_aideroom, newmsgid, 0, msg);
+                       CtdlSaveMsgPointerInRoom(CtdlGetConfigStr("c_aideroom"), newmsgid, 0, msg);
                }
        }
 
@@ -2880,7 +2880,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        {
                if (CCC->logged_in) 
                        snprintf(bounce_to, sizeof bounce_to, "%s@%s",
-                                CCC->user.fullname, config.c_nodename);
+                                CCC->user.fullname, CtdlGetConfigStr("c_nodename"));
                else 
                        snprintf(bounce_to, sizeof bounce_to, "%s@%s",
                                 msg->cm_fields[eAuthor], msg->cm_fields[eNodeName]);
@@ -2913,7 +2913,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
                        }
                        else {
                                MSG_syslog(LOG_DEBUG, "No user <%s>\n", recipient);
-                               CtdlSaveMsgPointerInRoom(config.c_aideroom, newmsgid, 0, msg);
+                               CtdlSaveMsgPointerInRoom(CtdlGetConfigStr("c_aideroom"), newmsgid, 0, msg);
                        }
                }
                recps->recp_local = pch;
@@ -2958,13 +2958,13 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,     /* message to save */
        }
        else {
                if (recps == NULL) {
-                       qualified_for_journaling = config.c_journal_pubmsgs;
+                       qualified_for_journaling = CtdlGetConfigInt("c_journal_pubmsgs");
                }
                else if (recps->num_local + recps->num_ignet + recps->num_internet > 0) {
-                       qualified_for_journaling = config.c_journal_email;
+                       qualified_for_journaling = CtdlGetConfigInt("c_journal_email");
                }
                else {
-                       qualified_for_journaling = config.c_journal_pubmsgs;
+                       qualified_for_journaling = CtdlGetConfigInt("c_journal_pubmsgs");
                }
        }