ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/src/global.C
(Generate patch)

Comparing cvsroot/ermyth/src/global.C (file contents):
Revision 1.3 by pippijn, Sat Jul 21 13:23:21 2007 UTC vs.
Revision 1.4 by pippijn, Tue Aug 28 17:08:12 2007 UTC

3 * Rights to this code are documented in doc/pod/license.pod. 3 * Rights to this code are documented in doc/pod/license.pod.
4 * 4 *
5 * Global objects. 5 * Global objects.
6 */ 6 */
7 7
8static char const rcsid[] = "$Id: global.C,v 1.3 2007/07/21 13:23:21 pippijn Exp $"; 8static char const rcsid[] = "$Id: global.C,v 1.4 2007/08/28 17:08:12 pippijn Exp $";
9 9
10#include "atheme.h" 10#include "atheme.h"
11#include <ermyth/crypto.h>
12#include <ermyth/database.h>
11#include "uplink.h" 13#include "uplink.h"
12#include "pmodule.h" /* pcommand_init */
13#include "internal.h" 14#include "internal.h"
14#include "datastream.h" 15#include "datastream.h"
15#include "authcookie.h" 16#include "authcookie.h"
17
18protocol::handler *phandler;
19database::handler *backend;
20crypto::handler *crypter;
16 21
17chansvs_t chansvs; 22chansvs_t chansvs;
18globsvs_t globsvs; 23globsvs_t globsvs;
19opersvs_t opersvs; 24opersvs_t opersvs;
20memosvs_t memosvs; 25memosvs_t memosvs;
21nicksvs_t nicksvs; 26nicksvs_t nicksvs;
22saslsvs_t saslsvs; 27saslsvs_t saslsvs;
23gamesvs_t gamesvs; 28gamesvs_t gamesvs;
24 29
25me_t me; 30me_t me;
26struct cnt cnt; 31cnt_t cnt;
27 32
28/* XXX */ 33/* XXX */
29ConfOption config_options; 34conf_option_t config_options;
30Database database_options; 35database_t database_options;
31claro_state_t claro_state; 36system_state_t system_state;
32int runflags; 37int runflags;
33 38
34char *config_file; 39char *config_file;
35char *log_path; 40char *log_path;
36bool cold_start = false; 41bool cold_start = false;
42bool database::handler::loaded = false;
37 43
38extern char **environ; 44void
45me_t::init ()
46{
47 if (netname)
48 sfree (netname);
49 if (hidehostsuffix)
50 sfree (hidehostsuffix);
51 if (adminname)
52 sfree (adminname);
53 if (adminemail)
54 sfree (adminemail);
55 if (mta)
56 sfree (mta);
39 57
40void (*db_save) (void *arg) = NULL; 58 netname
41void (*db_load) (void) = NULL; 59 = hidehostsuffix
60 = adminname
61 = adminemail
62 = mta
63 = NULL;
64
65 recontime
66 = restarttime
67 = maxlogins
68 = maxusers
69 = maxnicks
70 = maxchans
71 = emaillimit
72 = emailtime
73 = 0;
74}
75
76void
77me_t::fini ()
78{
79 sfree (netname);
80 sfree (hidehostsuffix);
81 sfree (adminname);
82 sfree (adminemail);
83 if (mta != NULL)
84 sfree (mta);
85}
42 86
43me_t & 87me_t &
44me_t::operator = (const me_t &rhs) 88me_t::operator = (const me_t &rhs)
45{ 89{
46 recontime = rhs.recontime; 90 recontime = rhs.recontime;
59 auth = rhs.auth; 103 auth = rhs.auth;
60 104
61 return *this; 105 return *this;
62} 106}
63 107
64me_t::~me_t () 108static void noop_delete (void *) throw (balloc_exception) __attribute__ ((__noreturn__));
109static void
110noop_delete (void *)
111throw (balloc_exception)
65{ 112{
66 destroy (); 113 // We should never reach here
114 throw balloc_exception (SRCINF, "Balloc has no deallocator");
67} 115}
68 116
69void 117static void noop_delete (void *, size_t) throw (balloc_exception) __attribute__ ((__noreturn__));
70me_t::destroy () 118static void
119noop_delete (void *, size_t)
120throw (balloc_exception)
71{ 121{
72 free (netname); 122 // We should never reach here
73 free (hidehostsuffix); 123 throw balloc_exception (SRCINF, "Balloc has no deallocator");
74 free (adminname);
75 free (adminemail);
76 if (mta != NULL)
77 free (mta);
78} 124}
125
126void (*NullDealloc) (void *) = &noop_delete;
127void (*NullNDealloc) (void *, size_t) = &noop_delete;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines