From 7edd77a042a33901a0f7c4ef85fef560fa4c8304 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 3 Jan 2016 00:22:07 -0500 Subject: [PATCH] more progress on callers --- citadel/include/ctdl_module.h | 4 +++- citadel/modules/listsub/serv_listsub.c | 28 ++++++++++++---------- citadel/modules/rssclient/serv_rssclient.c | 8 ++++--- citadel/netconfig.c | 1 + citadel/room_ops.c | 8 +++---- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/citadel/include/ctdl_module.h b/citadel/include/ctdl_module.h index 17f88fc65..57444eea0 100644 --- a/citadel/include/ctdl_module.h +++ b/citadel/include/ctdl_module.h @@ -346,7 +346,9 @@ void DeleteGenericCfgLine(const CfgLineType *ThisOne, RoomNetCfgLine **data); RoomNetCfgLine *DuplicateOneGenericCfgLine(const RoomNetCfgLine *data); void AddRoomCfgLine(OneRoomNetCfg *OneRNCfg, struct ctdlroom *qrbuf, RoomNetCfg LineType, RoomNetCfgLine *Line); -OneRoomNetCfg* CtdlGetNetCfgForRoom(long QRNumber); +OneRoomNetCfg *CtdlGetNetCfgForRoom(long QRNumber); +void SaveRoomNetConfigFile(OneRoomNetCfg *, long); +void FreeRoomNetworkStruct(OneRoomNetCfg **); typedef struct _nodeconf { int DeleteMe; diff --git a/citadel/modules/listsub/serv_listsub.c b/citadel/modules/listsub/serv_listsub.c index ae8554baf..658fbbc06 100644 --- a/citadel/modules/listsub/serv_listsub.c +++ b/citadel/modules/listsub/serv_listsub.c @@ -1,15 +1,15 @@ /* * This module handles self-service subscription/unsubscription to mail lists. * - * Copyright (c) 2002-2012 by the citadel.org team + * Copyright (c) 2002-2016 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. + * 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" @@ -134,7 +134,7 @@ void do_subscribe(StrBuf **room, StrBuf **email, StrBuf **subtype, StrBuf **webp RoomMailAddress = qrbuf.QRname; OneRNCfg = CtdlGetNetCfgForRoom(qrbuf.QRnumber); - if (OneRNCfg!=NULL) { + if (OneRNCfg != NULL) { found_sub = CountThisSubscriber(OneRNCfg, *email); if (StrLength(OneRNCfg->Sender) > 0) { EmailSender = RoomMailAddress = ChrPtr(OneRNCfg->Sender); @@ -147,6 +147,7 @@ void do_subscribe(StrBuf **room, StrBuf **email, StrBuf **subtype, StrBuf **webp ChrPtr(*email), RoomMailAddress); + FreeRoomNetworkStruct(&OneRNCfg); end_critical_section(S_NETCONFIGS); return; } @@ -270,6 +271,8 @@ void do_subscribe(StrBuf **room, StrBuf **email, StrBuf **subtype, StrBuf **webp "\n" "--__ctdlmultipart__--\n"), 0); + SaveRoomNetConfigFile(OneRNCfg, qrbuf.QRnumber); + FreeRoomNetworkStruct(&OneRNCfg); end_critical_section(S_NETCONFIGS); pcf_req = SmashStrBuf(&cf_req); @@ -333,11 +336,8 @@ void do_unsubscribe(StrBuf **room, StrBuf **email, StrBuf **webpage) { } if (found_sub == 0) { - cprintf("%d '%s' is not subscribed to '%s'.\n", - ERROR + NO_SUCH_USER, - ChrPtr(*email), - qrbuf.QRname); - + cprintf("%d '%s' is not subscribed to '%s'.\n", ERROR + NO_SUCH_USER, ChrPtr(*email), qrbuf.QRname); + FreeRoomNetworkStruct(&OneRNCfg); end_critical_section(S_NETCONFIGS); return; } @@ -461,6 +461,8 @@ void do_unsubscribe(StrBuf **room, StrBuf **email, StrBuf **webpage) { "\n" "--__ctdlmultipart__--\n"), 0); + SaveRoomNetConfigFile(OneRNCfg, qrbuf.QRnumber); + FreeRoomNetworkStruct(&OneRNCfg); end_critical_section(S_NETCONFIGS); pcf_req = SmashStrBuf(&cf_req); @@ -593,7 +595,6 @@ void do_confirm(StrBuf **room, StrBuf **token) { { /* whipe duplicate subscribe entry... */ OneRNCfg->changed = 1; - // SaveChangedConfigs(); FIXME FOOFOO SAVE CONFIG HERE errmsg = "already subscribed"; } } @@ -637,9 +638,10 @@ void do_confirm(StrBuf **room, StrBuf **token) { } DeleteGenericCfgLine(NULL/*TODO*/, &ConfirmLine); OneRNCfg->changed = 1; - // SaveChangedConfigs(); FIXME FOOFOO SAVE CONFIG HERE } + SaveRoomNetConfigFile(OneRNCfg, qrbuf.QRnumber); + FreeRoomNetworkStruct(&OneRNCfg); end_critical_section(S_NETCONFIGS); /* diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index 17b67317f..5893fe76b 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -1,7 +1,7 @@ /* * Bring external RSS feeds into rooms. * - * Copyright (c) 2007-2015 by the citadel.org team + * Copyright (c) 2007-2016 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. @@ -507,9 +507,9 @@ eNextState RSS_FetchNetworkUsetableEntry(AsyncIO *IO) void UpdateLastKnownGood(pRSSConfig *pCfg, time_t now) { - OneRoomNetCfg* pRNCfg; + OneRoomNetCfg *pRNCfg; begin_critical_section(S_NETCONFIGS); - pRNCfg = CtdlGetNetCfgForRoom (pCfg->QRnumber); + pRNCfg = CtdlGetNetCfgForRoom(pCfg->QRnumber); if (pRNCfg != NULL) { RSSCfgLine *RSSCfg = (RSSCfgLine *)pRNCfg->NetConfigs[rssclient]; @@ -528,6 +528,8 @@ void UpdateLastKnownGood(pRSSConfig *pCfg, time_t now) } } + SaveRoomNetConfigFile(pRNCfg, pCfg->QRnumber); + FreeRoomNetworkStruct(&pRNCfg); end_critical_section(S_NETCONFIGS); } diff --git a/citadel/netconfig.c b/citadel/netconfig.c index 1f68fe3ba..55d98d1ae 100644 --- a/citadel/netconfig.c +++ b/citadel/netconfig.c @@ -605,6 +605,7 @@ int CtdlNetconfigCheckRoomaccess( return (ERROR + NO_SUCH_USER); } found = is_recipient (RNCfg, RemoteIdentifier); + FreeRoomNetworkStruct(&RNCfg); end_critical_section(S_NETCONFIGS); if (found) { diff --git a/citadel/room_ops.c b/citadel/room_ops.c index a39cf314b..7d772c7da 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -633,7 +633,7 @@ void lputfloor(struct floor *flbuf, int floor_num) /* - * Traverse the room file... + * Iterate through the room table, performing a callback for each room. */ void CtdlForEachRoom(ForEachRoomCallBack CB, void *in_data) { @@ -657,7 +657,7 @@ void CtdlForEachRoom(ForEachRoomCallBack CB, void *in_data) } /* - * Traverse the room file... + * Iterate through the room table, performing a callback for each room that has a netconfig entry. */ void CtdlForEachNetCfgRoom(ForEachRoomNetCfgCallBack CB, void *in_data, RoomNetCfg filter) { @@ -676,13 +676,13 @@ void CtdlForEachNetCfgRoom(ForEachRoomNetCfgCallBack CB, void *in_data, RoomNetC room_sanity_check(&qrbuf); if (qrbuf.QRflags & QR_INUSE) { - OneRoomNetCfg* RNCfg; + OneRoomNetCfg *RNCfg; RNCfg = CtdlGetNetCfgForRoom(qrbuf.QRnumber); if ((RNCfg != NULL) && ((filter == maxRoomNetCfg) || (RNCfg->NetConfigs[filter] != NULL))) { CB(&qrbuf, in_data, RNCfg); + FreeRoomNetworkStruct(&RNCfg); } - // FIXME free RNCfg } } } -- 2.30.2