3 // Copyright (c) 1987-2023 by the citadel.org team
5 // This program is open source software. Use, duplication, or disclosure
6 // is subject to the terms of the GNU General Public License, version 3.
10 #include <libcitadel.h>
12 #include "citserver.h"
13 #include "ctdl_module.h"
18 // Has an item already been seen (is it in the CDB_USETABLE) ?
19 // Returns 0 if it hasn't, 1 if it has
20 // In either case, writes the item to the database for next time.
21 int CheckIfAlreadySeen(StrBuf *guid) {
25 int hash = HashLittle(ChrPtr(guid), StrLength(guid));
27 syslog(LOG_DEBUG, "usetable: CheckIfAlreadySeen(0x%8x)", hash);
28 cdbut = cdb_fetch(CDB_USETABLE, &hash, sizeof(hash));
29 if (cdbut.ptr != NULL) {
33 // (Re)write the record, to update the timestamp.
35 ut.timestamp = time(NULL);
36 cdb_store(CDB_USETABLE, &hash, sizeof(hash), &ut, sizeof(struct UseTable));