whittle whittle whittle
authorArt Cancro <ajc@citadel.org>
Tue, 23 Jan 2018 16:40:13 +0000 (11:40 -0500)
committerArt Cancro <ajc@citadel.org>
Tue, 23 Jan 2018 16:40:13 +0000 (11:40 -0500)
citadel/modules/network/serv_netspool.c
citadel/modules/network/serv_network.c

index 141dd565a3b60ccb352cc9675b785ae9219b35f3..da479d7a154076a6e7090339515f8eeb9fb36df0 100644 (file)
 #include "citadel_dirs.h"
 #include "threads.h"
 #include "context.h"
-
 #include "ctdl_module.h"
-
 #include "netspool.h"
 #include "netmail.h"
 
 
-#ifndef DT_UNKNOWN
-#define DT_UNKNOWN     0
-#define DT_DIR         4
-#define DT_REG         8
-#define DT_LNK         10
-
-#define IFTODT(mode)   (((mode) & 0170000) >> 12)
-#define DTTOIF(dirtype)        ((dirtype) << 12)
-#endif
-
-
 void ParseLastSent(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, OneRoomNetCfg *OneRNCFG)
 {
        RoomNetCfgLine *nptr;
@@ -177,11 +164,12 @@ void Netmap_AddMe(struct CtdlMessage *msg, const char *defl, long defllen)
        CM_PrependToField(msg, eMessagePath, buf, node_len + 1);
 }
 
+
 void InspectQueuedRoom(SpoolControl **pSC,
                       RoomProcList *room_to_spool,     
                       HashList *working_ignetcfg,
-                      HashList *the_netmap)
-{
+                      HashList *the_netmap
+{
        SpoolControl *sc;
        int i = 0;
 
@@ -306,7 +294,7 @@ void CalcListID(SpoolControl *sc)
                /*
                 * this used to be:
                 * roomname <Room-Number.list-id.fqdn>
-                * according to rfc2919.txt it only has to be a uniq identifier
+                * according to rfc2919.txt it only has to be a unique identifier
                 * under the domain of the system; 
                 * in general MUAs use it to calculate the reply address nowadays.
                 */
@@ -375,7 +363,6 @@ void network_spoolout_room(SpoolControl *sc)
                if (isspace(buf[i])) buf[i] = '_';
        }
 
-
        /* If we wrote a digest, deliver it and then close it */
        if ( (sc->Users[digestrecp] != NULL) && (sc->digestfp != NULL) )
        {
index 819ec09ab93d71c74d0f49a390a1bcf5552621ea..4434044de20cfd8134067b0d89199aa23d49b713 100644 (file)
@@ -95,98 +95,6 @@ typedef struct __roomlists {
  */
 struct RoomProcList *rplist = NULL;
 
-
-/*
- * Send the *entire* contents of the current room to one specific network node,
- * ignoring anything we know about which messages have already undergone
- * network processing.  This can be used to bring a new node into sync.
- */
-int network_sync_to(char *target_node, long len)
-{
-       struct CitContext *CCC = CC;
-       OneRoomNetCfg OneRNCFG;
-       OneRoomNetCfg *pRNCFG;
-       const RoomNetCfgLine *pCfgLine;
-       SpoolControl sc;
-       int num_spooled = 0;
-
-       /* Load the netconfig for this room */
-       pRNCFG = CtdlGetNetCfgForRoom(CCC->room.QRnumber);
-       if (pRNCFG == NULL) {                                   // no netconfig at all?
-               return -1;
-       }
-       if (pRNCFG->NetConfigs[ignet_push_share] == NULL)       // no ignet push shares?
-       {
-               FreeRoomNetworkStruct(&pRNCFG);
-               return -1;
-       }
-
-       /* Search for an ignet_oush_share configuration bearing the target node's name */
-       for (pCfgLine = pRNCFG->NetConfigs[ignet_push_share]; pCfgLine != NULL; pCfgLine = pCfgLine->next)
-       {
-               if (!strcmp(ChrPtr(pCfgLine->Value[0]), target_node))
-                       break;
-       }
-
-       /* If we aren't sharing with that node, bail out */
-       if (pCfgLine == NULL)
-       {
-               FreeRoomNetworkStruct(&pRNCFG);
-               return -1;
-       }
-
-       /* If we got here, we're good to go ... make up a dummy spoolconfig and roll with it */
-
-       begin_critical_section(S_NETCONFIGS);
-       memset(&sc, 0, sizeof(SpoolControl));
-       memset(&OneRNCFG, 0, sizeof(OneRoomNetCfg));
-       sc.RNCfg = &OneRNCFG;
-       sc.RNCfg->NetConfigs[ignet_push_share] = DuplicateOneGenericCfgLine(pCfgLine);
-       sc.Users[ignet_push_share] = NewStrBufPlain(NULL, (StrLength(pCfgLine->Value[0]) + StrLength(pCfgLine->Value[1]) + 10) );
-       StrBufAppendBuf(sc.Users[ignet_push_share], pCfgLine->Value[0], 0);
-       StrBufAppendBufPlain(sc.Users[ignet_push_share], HKEY(","), 0);
-       StrBufAppendBuf(sc.Users[ignet_push_share], pCfgLine->Value[1], 0);
-       CalcListID(&sc);
-       end_critical_section(S_NETCONFIGS);
-
-       sc.working_ignetcfg = CtdlLoadIgNetCfg();
-       sc.the_netmap = CtdlReadNetworkMap();
-
-       /* Send ALL messages */
-       num_spooled = CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL, network_spool_msg, &sc);
-
-       /* Concise cleanup because we know there's only one node in the sc */
-       DeleteGenericCfgLine(NULL, &sc.RNCfg->NetConfigs[ignet_push_share]);
-
-       DeleteHash(&sc.working_ignetcfg);
-       DeleteHash(&sc.the_netmap);
-       free_spoolcontrol_struct_members(&sc);
-
-       syslog(LOG_NOTICE, "network: synchronized %d messages to <%s>", num_spooled, target_node);
-       return(num_spooled);
-}
-
-
-/*
- * Implements the NSYN command
- */
-void cmd_nsyn(char *argbuf) {
-       int num_spooled;
-       long len;
-       char target_node[256];
-
-       if (CtdlAccessCheck(ac_aide)) return;
-
-       len = extract_token(target_node, argbuf, 0, '|', sizeof target_node);
-       num_spooled = network_sync_to(target_node, len);
-       if (num_spooled >= 0) {
-               cprintf("%d Spooled %d messages.\n", CIT_OK, num_spooled);
-       }
-       else {
-               cprintf("%d No such room/node share exists.\n", ERROR + ROOM_NOT_FOUND);
-       }
-}
-
 RoomProcList *CreateRoomProcListEntry(struct ctdlroom *qrbuf, OneRoomNetCfg *OneRNCFG)
 {
        int i;
@@ -447,7 +355,6 @@ CTDL_MODULE_INIT(network)
                CtdlFillSystemContext(&networker_spool_CC, "CitNetSpool");
                CtdlRegisterSessionHook(network_cleanup_function, EVT_STOP, PRIO_STOP + 30);
                 CtdlRegisterSessionHook(network_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 10);
-               CtdlRegisterProtoHook(cmd_nsyn, "NSYN", "Synchronize room to node");
                CtdlRegisterRoomHook(network_room_handler);
                CtdlRegisterCleanupHook(destroy_network_queue_room_locked);
                CtdlRegisterSessionHook(network_do_queue, EVT_TIMER, PRIO_QUEUE + 10);