*/
int network_usetable(struct CtdlMessage *msg)
{
+ StrBuf *msgid;
struct CitContext *CCC = CC;
- char msgid[SIZ];
- struct cdbdata *cdbut;
- struct UseTable ut;
+ time_t now;
/* Bail out if we can't generate a message ID */
- if (msg == NULL) {
- return(0);
- }
- if (msg->cm_fields['I'] == NULL) {
- return(0);
- }
- if (IsEmptyStr(msg->cm_fields['I'])) {
+ if ((msg == NULL) || (msg->cm_fields['I'] == NULL) || (IsEmptyStr(msg->cm_fields['I'])))
+ {
return(0);
}
/* Generate the message ID */
- strcpy(msgid, msg->cm_fields['I']);
- if (haschar(msgid, '@') == 0) {
- strcat(msgid, "@");
+ msgid = NewStrBufPlain(msg->cm_fields['I'], -1);
+ if (haschar(ChrPtr(msgid), '@') == 0) {
+ StrBufAppendBufPlain(msgid, HKEY("@"), 0);
if (msg->cm_fields['N'] != NULL) {
- strcat(msgid, msg->cm_fields['N']);
+ StrBufAppendBufPlain(msgid, msg->cm_fields['N'], -1, 0);
}
else {
+ FreeStrBuf(&msgid);
return(0);
}
}
-
- cdbut = cdb_fetch(CDB_USETABLE, msgid, strlen(msgid));
- if (cdbut != NULL) {
- cdb_free(cdbut);
- QN_syslog(LOG_DEBUG, "network_usetable() : we already have %s\n", msgid);
+ now = time(NULL);
+ if (CheckIfAlreadySeen("Networker Import",
+ msgid,
+ now, 0,
+ eCheckUpdate,
+ CCC->cs_pid, 0) != 0)
+ {
+ FreeStrBuf(&msgid);
return(1);
}
+ FreeStrBuf(&msgid);
- /* If we got to this point, it's unique: add it. */
- strcpy(ut.ut_msgid, msgid);
- ut.ut_timestamp = time(NULL);
- cdb_store(CDB_USETABLE, msgid, strlen(msgid), &ut, sizeof(struct UseTable) );
return(0);
}
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;
}
{
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);
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);
ptr->lcname[ptr->namelen] = '\0';
ptr->key = hashlittle(ptr->lcname, ptr->namelen, 9872345);
+ ptr->lastsent = OneRNCFG->lastsent;
ptr->OneRNCfg = OneRNCFG;
return ptr;
}
struct RoomProcList *ptr;
roomlists *RP = (roomlists*) data;
+ if (!HaveSpoolConfig(OneRNCfg))
+ return;
+
ptr = CreateRoomProcListEntry(qrbuf, OneRNCfg);
- ptr->next = RP->rplist;
- RP->rplist = ptr;
+ if (ptr != NULL)
+ {
+ ptr->next = RP->rplist;
+ RP->rplist = ptr;
+ }
}
/*
if (RNCfg == NULL)
return 1;
+ if (!HaveSpoolConfig(RNCfg))
+ return 1;
+
ptr = CreateRoomProcListEntry(qrbuf, RNCfg);
if (ptr == NULL)
return 1;
+ ptr->OneRNCfg = NULL;
begin_critical_section(S_RPLIST);
ptr->next = rplist;
rplist = ptr;
*/
if (msg->cm_fields['R'] == NULL) {
free(msg->cm_fields['R']);
+ msg->cm_fields['R'] = NULL;
}
if (msg->cm_fields['D'] == NULL) {
free(msg->cm_fields['D']);
+ msg->cm_fields['D'] = NULL;
}
snprintf(recipient, sizeof recipient, "%s@%s",
-
-
-
-
/*
* network_do_queue()
*
HashList *the_netmap = NULL;
int netmap_changed = 0;
roomlists RL;
+ SpoolControl *sc = NULL;
+ SpoolControl *pSC;
/*
* Run the full set of processing tasks no more frequently
}
if (ptr->namelen > 0) {
- network_spoolout_room(ptr,
- working_ignetcfg,
- the_netmap);
+ InspectQueuedRoom(&sc,
+ ptr,
+ working_ignetcfg,
+ the_netmap);
}
ptr = ptr->next;
}
}
+
+ pSC = sc;
+ while (pSC != NULL)
+ {
+ network_spoolout_room(pSC);
+ pSC = pSC->next;
+ }
+
+ pSC = sc;
+ while (pSC != NULL)
+ {
+ sc = pSC->next;
+ free_spoolcontrol_struct(&pSC);
+ pSC = sc;
+ }
/* If there is anything in the inbound queue, process it */
if (!server_shutting_down) {
network_do_spoolin(working_ignetcfg,