IGnet sharing is working properly with the configdb now.
authorArt Cancro <ajc@citadel.org>
Sat, 23 Jan 2016 04:15:37 +0000 (23:15 -0500)
committerArt Cancro <ajc@citadel.org>
Sat, 23 Jan 2016 04:15:37 +0000 (23:15 -0500)
There might be one edge case where a room has a lastsent but
no shares, and does processing anyway, will check that.

citadel/modules/listsub/serv_listsub.c
citadel/modules/network/serv_netmail.c
citadel/modules/network/serv_netspool.c

index ae41d1746f8b3a639b5564ac1a51dc53273f7d47..c719615fbc986ce021751ed04785e3cd8ee66907 100644 (file)
@@ -63,9 +63,7 @@ void listsub_generate_token(char *buf) {
         * tinfoil-hat secure, it just needs to be reasonably unguessable
         * and unique.
         */
-       len = sprintf(sourcebuf, "%lx",
-               (long) (++seq + getpid() + time(NULL))
-       );
+       len = sprintf(sourcebuf, "%lx", (long) (++seq + getpid() + time(NULL)));
 
        /* Convert it to base64 so it looks cool */     
        len = CtdlEncodeBase64(buf, sourcebuf, len, 0);
@@ -74,6 +72,7 @@ void listsub_generate_token(char *buf) {
        }
 }
 
+
 const RoomNetCfg ActiveSubscribers[] = {listrecp, digestrecp};
 
 int CountThisSubscriber(OneRoomNetCfg *OneRNCfg, StrBuf *email)
index 9ca6ba5a957af81458a21d1323a9a639e9f851af..0c90b46cfdd952da6e5bf88f2abc188f3d3e240f 100644 (file)
@@ -2,15 +2,15 @@
  * This module handles shared rooms, inter-Citadel mail, and outbound
  * mailing list processing.
  *
- * Copyright (c) 2000-2015 by the citadel.org team
+ * Copyright (c) 2000-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 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.
  *
  * ** NOTE **   A word on the S_NETCONFIGS semaphore:
  * This is a fairly high-level type of critical section.  It ensures that no
@@ -585,23 +585,18 @@ void network_process_ignetpush(SpoolControl *sc, struct CtdlMessage *omsg, long
 /*
  * Spools out one message from the list.
  */
-void network_spool_msg(long msgnum,
-                      void *userdata)
+void network_spool_msg(long msgnum, void *userdata)
 {
-       struct CitContext *CCC = CC;
        struct CtdlMessage *msg = NULL;
        long delete_after_send = 0;     /* Set to 1 to delete after spooling */
        SpoolControl *sc;
 
        sc = (SpoolControl *)userdata;
-
        msg = CtdlFetchMessage(msgnum, 1, 1);
 
        if (msg == NULL)
        {
-               QN_syslog(LOG_ERR,
-                         "failed to load Message <%ld> from disk\n",
-                         msgnum);
+               syslog(LOG_ERR, "failed to load Message <%ld> from disk\n", msgnum);
                return;
        }
        network_process_list(sc, msg, &delete_after_send);
index 3b53305b153eb074c5295541af4dd312de09e801..697ca62c095a844477a4c71402aa8c1ac3f9305e 100644 (file)
@@ -271,7 +271,6 @@ void InspectQueuedRoom(SpoolControl **pSC,
 
        sc = (SpoolControl*)malloc(sizeof(SpoolControl));
        memset(sc, 0, sizeof(SpoolControl));
-       sc->lastsent = room_to_spool->lastsent;
        sc->working_ignetcfg = working_ignetcfg;
        sc->the_netmap = the_netmap;
 
@@ -294,7 +293,7 @@ void InspectQueuedRoom(SpoolControl **pSC,
        if ( (!HaveSpoolConfig(sc->RNCfg)) || (sc->room.QRhighest <= sc->RNCfg->lastsent) ) 
        {
                // There is nothing to send from this room.
-               syslog(LOG_DEBUG, "nothing to do for <%s>", room_to_spool->name);
+               syslog(LOG_DEBUG, "Nothing to do for <%s>", room_to_spool->name);
                FreeRoomNetworkStruct(&sc->RNCfg);
                sc->RNCfg = NULL;
                free(sc);
@@ -302,6 +301,7 @@ void InspectQueuedRoom(SpoolControl **pSC,
        }
 
        sc->lastsent = sc->RNCfg->lastsent;
+       room_to_spool->lastsent = sc->lastsent;
 
        /* Now lets remember whats needed for the actual work... */
 
@@ -433,7 +433,7 @@ void network_spoolout_room(SpoolControl *sc)
         */
        memcpy (&CCC->room, &sc->room, sizeof(ctdlroom));
 
-       syslog(LOG_INFO, "network_spoolout_room(%s)", CCC->room.QRname);
+       syslog(LOG_INFO, "network_spoolout_room(room=%s, lastsent=%ld)", CCC->room.QRname, sc->lastsent);
 
        CalcListID(sc);
 
@@ -441,8 +441,7 @@ void network_spoolout_room(SpoolControl *sc)
        lastsent = sc->lastsent;
 
        /* Fetch the messages we ought to send & prepare them. */
-       CtdlForEachMessage(MSGS_GT, sc->lastsent, NULL, NULL, NULL,
-               network_spool_msg, sc);
+       CtdlForEachMessage(MSGS_GT, sc->lastsent, NULL, NULL, NULL, network_spool_msg, sc);
 
        if (StrLength(sc->Users[roommailalias]) > 0)
        {
@@ -504,19 +503,14 @@ void network_spoolout_room(SpoolControl *sc)
        }
 
        /* Now rewrite the netconfig */
-
-       // THIS IS THE ONLY PLACE WHERE WE HAVE TO REWRITE THE NETCONFIG.
-
-
+       syslog(LOG_DEBUG, "lastsent was %ld , now it is %ld", lastsent, sc->lastsent);
        if (sc->lastsent != lastsent)
        {
                OneRoomNetCfg *r;
 
                begin_critical_section(S_NETCONFIGS);
                r = CtdlGetNetCfgForRoom(sc->room.QRnumber);
-
-               r->lastsent = sc->lastsent;             // FIXME we have to do something here !!!!!!!
-
+               r->lastsent = sc->lastsent;
                SaveRoomNetConfigFile(r, sc->room.QRnumber);
                FreeRoomNetworkStruct(&r);
                end_critical_section(S_NETCONFIGS);