* 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-2012 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
if (CM_IsEmpty(msg, eMessagePath)) {
CM_SetField(msg, eMessagePath, defl, defllen);
}
- node_len = strlen(CtdlGetConfigStr("c_nodename"));
+ node_len = configlen.c_nodename;
if (node_len >= SIZ)
node_len = SIZ - 1;
- memcpy(buf, CtdlGetConfigStr("c_nodename"), node_len);
+ memcpy(buf, config.c_nodename, node_len);
buf[node_len] = '!';
buf[node_len + 1] = '\0';
CM_PrependToField(msg, eMessagePath, buf, node_len + 1);
StrBufAppendBufPlain(sc->ListID, HKEY("room_"), 0);
StrBufAppendBuf(sc->ListID, RoomName, 0);
StrBufAppendBufPlain(sc->ListID, HKEY("."), 0);
- StrBufAppendBufPlain(sc->ListID, CtdlGetConfigStr("c_fqdn"), -1, 0);
+ StrBufAppendBufPlain(sc->ListID, config.c_fqdn, -1, 0);
/*
* this used to be:
* roomname <Room-Number.list-id.fqdn>
StrBufAppendBufPlain(sc->Users[roommailalias], HKEY("room_"), 0);
StrBufAppendBuf(sc->Users[roommailalias], RoomName, 0);
StrBufAppendBufPlain(sc->Users[roommailalias], HKEY("@"), 0);
- StrBufAppendBufPlain(sc->Users[roommailalias], CtdlGetConfigStr("c_fqdn"), -1, 0);
+ StrBufAppendBufPlain(sc->Users[roommailalias], config.c_fqdn, -1, 0);
StrBufLowerCase(sc->Users[roommailalias]);
}
}
else
{
- snprintf(buf, sizeof buf, "room_%s@%s", CCC->room.QRname, CtdlGetConfigStr("c_fqdn"));
+ snprintf(buf, sizeof buf, "room_%s@%s",
+ CCC->room.QRname, config.c_fqdn);
}
for (i=0; buf[i]; ++i) {
}
}
+
+/*
+ * Check the use table. This is a list of messages which have recently
+ * arrived on the system. It is maintained and queried to prevent the same
+ * message from being entered into the database multiple times if it happens
+ * to arrive multiple times by accident.
+ */
+int network_usetable(struct CtdlMessage *msg)
+{
+ StrBuf *msgid;
+ struct CitContext *CCC = CC;
+ time_t now;
+
+ /* Bail out if we can't generate a message ID */
+ if ((msg == NULL) || CM_IsEmpty(msg, emessageId))
+ {
+ return(0);
+ }
+
+ /* Generate the message ID */
+ msgid = NewStrBufPlain(CM_KEY(msg, emessageId));
+ if (haschar(ChrPtr(msgid), '@') == 0) {
+ StrBufAppendBufPlain(msgid, HKEY("@"), 0);
+ if (!CM_IsEmpty(msg, eNodeName)) {
+ StrBufAppendBufPlain(msgid, CM_KEY(msg, eNodeName), 0);
+ }
+ else {
+ FreeStrBuf(&msgid);
+ return(0);
+ }
+ }
+ now = time(NULL);
+ if (CheckIfAlreadySeen("Networker Import",
+ msgid,
+ now, 0,
+ eCheckUpdate,
+ CCC->cs_pid, 0) != 0)
+ {
+ FreeStrBuf(&msgid);
+ return(1);
+ }
+ FreeStrBuf(&msgid);
+
+ return(0);
+}
+
+
/*
* Process a buffer containing a single message from a single file
* from the inbound queue
/* Check for message routing */
if (!CM_IsEmpty(msg, eDestination)) {
- if (strcasecmp(msg->cm_fields[eDestination], CtdlGetConfigStr("c_nodename"))) {
+ if (strcasecmp(msg->cm_fields[eDestination], config.c_nodename)) {
/* route the message */
Buf = NewStrBufPlain(CM_KEY(msg,eDestination));