/** * global.C: global objects * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. */ static char const rcsid[] = "$Id: global.C,v 1.7 2007/09/22 14:27:30 pippijn Exp $"; #include "atheme.h" #include #include #include #include "uplink.h" #include "internal.h" #include "datastream.h" #include "authcookie.h" protocol::handler *phandler; database::handler *backend; crypto::handler *crypter; garbage_collector gc; chansvs_t chansvs; globsvs_t globsvs; opersvs_t opersvs; memosvs_t memosvs; nicksvs_t nicksvs; saslsvs_t saslsvs; gamesvs_t gamesvs; me_t me; cnt_t cnt; /* XXX */ conf_option_t config_options; database_t database_options; system_state_t system_state; int runflags; char *config_file; char *log_path; bool cold_start = false; bool database::handler::loaded = false; void me_t::init () { if (netname) sfree (netname); if (hidehostsuffix) sfree (hidehostsuffix); if (adminname) sfree (adminname); if (adminemail) sfree (adminemail); if (mta) sfree (mta); netname = hidehostsuffix = adminname = adminemail = mta = NULL; recontime = restarttime = maxlogins = maxusers = maxnicks = maxchans = emaillimit = emailtime = 0; } void me_t::cleanup () { sfree (netname); sfree (hidehostsuffix); sfree (adminname); sfree (adminemail); sfree (desc); sfree (name); sfree (numeric); if (mta != NULL) sfree (mta); netname = hidehostsuffix = adminemail = adminname = desc = name = numeric = mta = 0; } me_t & me_t::operator = (const me_t &rhs) { recontime = rhs.recontime; restarttime = rhs.restarttime; netname = sstrdup (rhs.netname); hidehostsuffix = sstrdup (rhs.hidehostsuffix); adminname = sstrdup (rhs.adminname); adminemail = sstrdup (rhs.adminemail); desc = sstrdup (rhs.desc); name = sstrdup (rhs.name); numeric = sstrdup (rhs.numeric); mta = rhs.mta ? sstrdup (rhs.mta) : NULL; maxlogins = rhs.maxlogins; maxusers = rhs.maxusers; maxnicks = rhs.maxnicks; maxchans = rhs.maxchans; emaillimit = rhs.emaillimit; emailtime = rhs.emailtime; auth = rhs.auth; return *this; } static void noop_delete (void *) throw (balloc_exception) __attribute__ ((__noreturn__)); static void noop_delete (void *) throw (balloc_exception) { // We should never reach here throw balloc_exception (SRCINF, "Balloc has no deallocator"); } static void noop_delete (void *, size_t) throw (balloc_exception) __attribute__ ((__noreturn__)); static void noop_delete (void *, size_t) throw (balloc_exception) { // We should never reach here throw balloc_exception (SRCINF, "Balloc has no deallocator"); } void (*NullDealloc) (void *) = &noop_delete; void (*NullNDealloc) (void *, size_t) = &noop_delete;