From 2e810d36a66a6cc42c345bd924b4e2b7669af8cd Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 4 Aug 2015 21:56:18 +0200 Subject: [PATCH] Move function where its used. --- citadel/modules/network/serv_netspool.c | 47 ++++++++++++++++++++++++ citadel/modules/network/serv_network.c | 48 ------------------------- citadel/modules/network/serv_network.h | 1 - 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/citadel/modules/network/serv_netspool.c b/citadel/modules/network/serv_netspool.c index 0edb1f11e..df1c225df 100644 --- a/citadel/modules/network/serv_netspool.c +++ b/citadel/modules/network/serv_netspool.c @@ -434,6 +434,53 @@ void network_spoolout_room(SpoolControl *sc) } } + +/* + * 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 diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index 9fa82734e..c61d22593 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -96,54 +96,6 @@ typedef struct __roomlists { struct RoomProcList *rplist = NULL; - -/* - * 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); -} - - - /* * Send the *entire* contents of the current room to one specific network node, * ignoring anything we know about which messages have already undergone diff --git a/citadel/modules/network/serv_network.h b/citadel/modules/network/serv_network.h index 7de793905..7116eba8b 100644 --- a/citadel/modules/network/serv_network.h +++ b/citadel/modules/network/serv_network.h @@ -40,5 +40,4 @@ void load_network_filter_list(void); void network_queue_room(struct ctdlroom *, void *); ////void destroy_network_queue_room(void); void network_bounce(struct CtdlMessage *msg, char *reason); -int network_usetable(struct CtdlMessage *msg); -- 2.30.2