void citproto_begin_admin_session(void);
void help_subst (char *strbuf, char *source, char *dest);
char CtdlCheckExpress(void);
+int CheckIfAlreadySeen(StrBuf *guid);
extern int panic_fd;
extern time_t server_startup_time;
void cdb_checkpoint(void);
void check_handles(void *arg);
void cdb_compact(void);
-int CheckIfAlreadySeen(StrBuf *guid);
#endif
}
-// Has an item already been seen (is it in the CDB_USETABLE) ?
-// Returns 0 if it hasn't, 1 if it has
-// In either case, writes the item to the database for next time.
-int CheckIfAlreadySeen(StrBuf *guid) {
- int found = 0;
- struct UseTable ut;
- struct cdbdata *cdbut;
- int hash = HashLittle(ChrPtr(guid), StrLength(guid));
-
- syslog(LOG_DEBUG, "db: CheckIfAlreadySeen(0x%8x)", hash);
- cdbut = cdb_fetch(CDB_USETABLE, &hash, sizeof(hash));
- if (cdbut != NULL) {
- found = 1;
- cdb_free(cdbut);
- }
-
- // (Re)write the record, to update the timestamp.
- ut.hash = hash;
- ut.timestamp = time(NULL);
- cdb_store(CDB_USETABLE, &hash, sizeof(hash), &ut, sizeof(struct UseTable));
- return (found);
-}
-
-
char *ctdl_module_init_database() {
if (!threading) {
// nothing to do here
--- /dev/null
+// use table handler
+//
+// Copyright (c) 1987-2023 by the citadel.org team
+//
+// This program is open source software. Use, duplication, or disclosure
+// is subject to the terms of the GNU General Public License, version 3.
+
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <syslog.h>
+#include <libcitadel.h>
+#include "database.h"
+#include "server.h"
+
+
+// Has an item already been seen (is it in the CDB_USETABLE) ?
+// Returns 0 if it hasn't, 1 if it has
+// In either case, writes the item to the database for next time.
+int CheckIfAlreadySeen(StrBuf *guid) {
+ int found = 0;
+ struct UseTable ut;
+ struct cdbdata *cdbut;
+ int hash = HashLittle(ChrPtr(guid), StrLength(guid));
+
+ syslog(LOG_DEBUG, "usetable: CheckIfAlreadySeen(0x%8x)", hash);
+ cdbut = cdb_fetch(CDB_USETABLE, &hash, sizeof(hash));
+ if (cdbut != NULL) {
+ found = 1;
+ cdb_free(cdbut);
+ }
+
+ // (Re)write the record, to update the timestamp.
+ ut.hash = hash;
+ ut.timestamp = time(NULL);
+ cdb_store(CDB_USETABLE, &hash, sizeof(hash), &ut, sizeof(struct UseTable));
+ return (found);
+}