2015-12-07 02:40:13 +01:00
|
|
|
"""
|
2016-03-12 08:09:07 +01:00
|
|
|
world.py: Stores global variables for PyLink, including lists of active IRC objects and plugins.
|
2015-12-07 02:40:13 +01:00
|
|
|
"""
|
2015-08-29 04:27:38 +02:00
|
|
|
|
2017-03-16 06:59:48 +01:00
|
|
|
from collections import defaultdict, deque
|
2015-08-29 18:39:33 +02:00
|
|
|
import threading
|
2017-01-12 08:35:10 +01:00
|
|
|
import time
|
2015-08-29 18:39:33 +02:00
|
|
|
|
2016-07-30 05:15:31 +02:00
|
|
|
# This indicates whether we're running in tests mode. What it actually does
|
2016-06-24 07:51:40 +02:00
|
|
|
# though is control whether IRC connections should be threaded or not.
|
|
|
|
testing = False
|
2015-12-25 03:24:42 +01:00
|
|
|
|
2016-05-22 08:01:09 +02:00
|
|
|
# Statekeeping for our hooks list, IRC objects, loaded plugins, and initialized
|
|
|
|
# service bots.
|
2015-09-27 19:53:25 +02:00
|
|
|
hooks = defaultdict(list)
|
2015-08-29 18:39:33 +02:00
|
|
|
networkobjects = {}
|
2015-09-27 19:27:32 +02:00
|
|
|
plugins = {}
|
2016-05-14 18:55:46 +02:00
|
|
|
services = {}
|
|
|
|
|
2016-07-07 09:25:50 +02:00
|
|
|
# Registered extarget handlers. This maps exttarget names (strings) to handling functions.
|
|
|
|
exttarget_handlers = {}
|
|
|
|
|
2016-07-30 05:15:31 +02:00
|
|
|
# Trigger to be set when all IRC objects are initially created.
|
2015-08-29 18:39:33 +02:00
|
|
|
started = threading.Event()
|
2017-08-31 22:36:46 +02:00
|
|
|
|
|
|
|
# Global daemon starting time.
|
2017-01-12 08:35:10 +01:00
|
|
|
start_ts = time.time()
|
2015-09-19 20:51:56 +02:00
|
|
|
|
2017-08-31 22:36:46 +02:00
|
|
|
# Trigger to set on shutdown.
|
|
|
|
shutting_down = threading.Event()
|
|
|
|
|
2016-07-30 05:15:31 +02:00
|
|
|
# Source address.
|
2018-07-08 21:53:59 +02:00
|
|
|
source = "https://github.com/jlu5/PyLink" # CHANGE THIS IF YOU'RE FORKING!!
|
2016-07-29 07:22:47 +02:00
|
|
|
|
|
|
|
# Fallback hostname used in various places internally when hostname isn't configured.
|
|
|
|
fallback_hostname = 'pylink.int'
|
2017-03-16 06:59:48 +01:00
|
|
|
|
|
|
|
# Defines messages to be logged as soon as the log system is set up, for modules like conf that are
|
|
|
|
# initialized before log. This is processed (and then not used again) when the log module loads.
|
2017-07-20 15:16:44 +02:00
|
|
|
_log_queue = deque()
|
2017-07-20 15:13:01 +02:00
|
|
|
|
|
|
|
# Determines whether we have a PID file that needs to be removed.
|
|
|
|
_should_remove_pid = False
|
2018-02-20 06:05:15 +01:00
|
|
|
|
|
|
|
# Determines whether we're daemonized.
|
|
|
|
daemon = False
|