more progress on callers
authorArt Cancro <ajc@citadel.org>
Sun, 3 Jan 2016 05:22:07 +0000 (00:22 -0500)
committerArt Cancro <ajc@citadel.org>
Sun, 3 Jan 2016 05:22:07 +0000 (00:22 -0500)
citadel/include/ctdl_module.h
citadel/modules/listsub/serv_listsub.c
citadel/modules/rssclient/serv_rssclient.c
citadel/netconfig.c
citadel/room_ops.c

index 17f88fc654177a9e0a12c72f7e7525439f7dc7fa..57444eea0e79a88b0842683833f4848663f2a719 100644 (file)
@@ -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;
index ae8554bafb0ce9f065b60fcc220949126a2e0211..658fbbc062657e2cbaef2c66cad632a161d9b0dc 100644 (file)
@@ -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);
        
        /*
index 17b67317fd7a5ac42c25e3e888ec954ab1acb73c..5893fe76b73b157822d8f0f3d6cda5195d0a7b0a 100644 (file)
@@ -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)
 {
-       OneRoomNetCfgpRNCfg;
+       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);
 }
 
index 1f68fe3ba0af8faa04d51fde5303f11987bde1d8..55d98d1ae148dd1cc238a47b771cade392ddbdb3 100644 (file)
@@ -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) {
index a39cf314beb8e622168931f112237c787f5a5987..7d772c7daa8f30c84104d4ead96eaf8cab6d2526 100644 (file)
@@ -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)
                {
-                       OneRoomNetCfgRNCfg;
+                       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
                }
        }
 }