From 0e40c288a8cb87e0712d5b0d9ca807b478e473b8 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 1 May 2015 10:39:51 -0400 Subject: [PATCH] More conversion to the new config system. WARNING BROKEN BUILD --- citadel/context.c | 11 ++++++----- citadel/internet_addressing.c | 21 ++++++++++++++++----- citadel/msgbase.c | 12 ++++++------ 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/citadel/context.c b/citadel/context.c index 81b597850..576e9359c 100644 --- a/citadel/context.c +++ b/citadel/context.c @@ -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; } diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index c2131cbff..a8868e954 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -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 #include @@ -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 { diff --git a/citadel/msgbase.c b/citadel/msgbase.c index a63c1b077..494dbeea9 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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"); } } -- 2.30.2