NSYN: fix the NSYN command
[citadel.git] / citadel / modules / network / serv_network.c
index 5dedf0c536ec52754710e18c0078b74182fd8f20..6c9ed94b95c7625c1656f1b8814ccb8aa02383bf 100644 (file)
@@ -176,7 +176,7 @@ int network_sync_to(char *target_node, long len)
        pCfgLine = pRNCFG->NetConfigs[ignet_push_share];
        while (pCfgLine != NULL)
        {
-               if (strcmp(ChrPtr(pCfgLine->Value[0]), target_node))
+               if (!strcmp(ChrPtr(pCfgLine->Value[0]), target_node))
                        break;
                pCfgLine = pCfgLine->next;
        }
@@ -184,10 +184,25 @@ int network_sync_to(char *target_node, long len)
        {
                return -1;
        }
+
        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);
 
@@ -203,6 +218,7 @@ int network_sync_to(char *target_node, long len)
 
        DeleteHash(&sc.working_ignetcfg);
        DeleteHash(&sc.the_netmap);
+       free_spoolcontrol_struct_members(&sc);
 
        QN_syslog(LOG_NOTICE, "Synchronized %d messages to <%s>\n",
                  num_spooled, target_node);
@@ -439,19 +455,6 @@ void network_bounce(struct CtdlMessage *msg, char *reason)
 }
 
 
-void free_network_spoolout_room(SpoolControl *sc)
-{
-       if (sc != NULL)
-       {
-               int i;
-               for (i = subpending; i < maxRoomNetCfg; i++)
-                       FreeStrBuf(&sc->Users[i]);
-               free(sc);
-       }
-}
-
-
-
 
 /*
  * network_do_queue()
@@ -551,7 +554,7 @@ void network_do_queue(void)
        while (pSC != NULL)
        {
                sc = pSC->next;
-               free_network_spoolout_room(pSC);
+               free_spoolcontrol_struct(&pSC);
                pSC = sc;
        }
        /* If there is anything in the inbound queue, process it */