Files
Arrow768 03f313a19d Moves various things to the new DBCore (#21544)
```
- server: "Changed the synthsprites to use the new DBCore"
- server: "Changed the MalfAI to use the new DBCore"
- server: "Changed the Alien Whitelists to use the new DBCore"
- server: "Changed the Requests Console to use the new DBCore"
- server: "Changed the Contracts Uplink to use the new DBCore"
- server: "Changed the Admin Ranks to use the new DBCore"
- server: "Changed the Job Bans to use the new DBCore"
- server: "Changed the Tickets to use the new DBCore"
- server: "Changed the Create Command Report to use the new DBCore"
- server: "Changed the WebInterface interconnect to use the new DBCore"
- server: "Changed the CCIA Recorder to use the new DBCore"
- server: "Changed the IPCTags to use the new DBCore"
- server: "Changed the Main Menu Poll-Check to use the new DBCore"
- server: "Changed the Client-Procs to use the new DBCore"
```

---------

Co-authored-by: Werner <Arrow768@users.noreply.github.com>
2026-04-13 22:45:29 +02:00

42 lines
1.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* # IPIntel datum
*
* Holds the result of an IPIntel lookup for a given IP address.
* Created by [/datum/controller/subsystem/ipintel/proc/get_ip_intel] and delivered to its `on_complete` callback.
*/
/datum/ipintel
/// The IP address that was looked up
var/ip
/// The raw intel score returned by the API (0.01.0), or -1 on error
var/intel = 0
/// Whether this result came from cache (memory or database) rather than a live API call
var/cache = FALSE
/// How many minutes ago the cached entry was written
var/cacheminutesago = 0
/// SQL timestamp of when the cache entry was written
var/cachedate = ""
/// world.realtime equivalent of the cache write time, used for in-memory cache expiry
var/cacherealtime = 0
/datum/ipintel/New()
cachedate = SQLtime()
cacherealtime = world.realtime
/**
* Returns TRUE if this cached result is still within its configured validity window.
*
* Good results (below [/datum/configuration/var/ipintel_rating_bad]) are kept for
* [/datum/configuration/var/ipintel_save_good] hours; bad results are kept for
* [/datum/configuration/var/ipintel_save_bad] hours. Returns FALSE for error results (intel < 0).
*/
/datum/ipintel/proc/is_valid()
. = FALSE
if (intel < 0)
return
if (intel <= GLOB.config.ipintel_rating_bad)
if (world.realtime < cacherealtime+(GLOB.config.ipintel_save_good*60*60*10))
return TRUE
else
if (world.realtime < cacherealtime+(GLOB.config.ipintel_save_bad*60*60*10))
return TRUE