1 |
simple |
1.1 |
/* |
2 |
|
|
* tclhash.h |
3 |
|
|
* |
4 |
pseudo |
1.2 |
* $Id: tclhash.h,v 1.1.1.1 2010/07/26 21:11:06 simple Exp $ |
5 |
simple |
1.1 |
*/ |
6 |
|
|
/* |
7 |
|
|
* Copyright (C) 1997 Robey Pointer |
8 |
|
|
* Copyright (C) 1999 - 2010 Eggheads Development Team |
9 |
|
|
* |
10 |
|
|
* This program is free software; you can redistribute it and/or |
11 |
|
|
* modify it under the terms of the GNU General Public License |
12 |
|
|
* as published by the Free Software Foundation; either version 2 |
13 |
|
|
* of the License, or (at your option) any later version. |
14 |
|
|
* |
15 |
|
|
* This program is distributed in the hope that it will be useful, |
16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
|
|
* GNU General Public License for more details. |
19 |
|
|
* |
20 |
|
|
* You should have received a copy of the GNU General Public License |
21 |
|
|
* along with this program; if not, write to the Free Software |
22 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
|
|
*/ |
24 |
|
|
|
25 |
|
|
#ifndef _EGG_TCLHASH_H |
26 |
|
|
#define _EGG_TCLHASH_H |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
#define TC_DELETED 0x0001 /* This command/trigger was deleted. */ |
30 |
|
|
|
31 |
|
|
typedef struct tcl_cmd_b { |
32 |
|
|
struct tcl_cmd_b *next; |
33 |
|
|
|
34 |
|
|
struct flag_record flags; |
35 |
|
|
char *func_name; /* Proc name. */ |
36 |
|
|
/* FIXME: 'hits' could overflow if a bind is triggered enough. */ |
37 |
|
|
int hits; /* Number of times this proc was triggered. */ |
38 |
|
|
u_8bit_t attributes; /* Flags for this entry. TC_* */ |
39 |
|
|
} tcl_cmd_t; |
40 |
|
|
|
41 |
|
|
struct threaddata { |
42 |
|
|
int (*mainloopfunc)(int); /* main loop function */ |
43 |
|
|
sock_list *socklist; /* tcl socket list for threads, else NULL */ |
44 |
|
|
struct timeval blocktime; /* maximum time to block in select() */ |
45 |
|
|
int mainthread; /* Is this the main thread? */ |
46 |
|
|
int MAXSOCKS; |
47 |
|
|
}; |
48 |
|
|
|
49 |
|
|
#define TBM_DELETED 0x0001 /* This mask was deleted. */ |
50 |
|
|
|
51 |
|
|
typedef struct tcl_bind_mask_b { |
52 |
|
|
struct tcl_bind_mask_b *next; |
53 |
|
|
|
54 |
|
|
tcl_cmd_t *first; /* List of commands registered for this bind. */ |
55 |
|
|
char *mask; |
56 |
|
|
u_8bit_t flags; /* Flags for this entry. TBM_* */ |
57 |
|
|
} tcl_bind_mask_t; |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
#define HT_STACKABLE 0x0001 /* Triggers in this bind list may be stacked. */ |
61 |
|
|
#define HT_DELETED 0x0002 /* This bind list was already deleted. Do not |
62 |
|
|
* use it anymore. */ |
63 |
|
|
|
64 |
|
|
typedef struct tcl_bind_list_b { |
65 |
|
|
struct tcl_bind_list_b *next; |
66 |
|
|
|
67 |
|
|
tcl_bind_mask_t *first; /* Pointer to registered binds for this list. */ |
68 |
|
|
char name[5]; /* Name of the bind. */ |
69 |
|
|
u_8bit_t flags; /* Flags for this element. HT_* */ |
70 |
|
|
IntFunc func; /* Function used as the Tcl calling interface |
71 |
|
|
* for procs actually representing C functions. */ |
72 |
|
|
} tcl_bind_list_t, *p_tcl_bind_list; |
73 |
|
|
|
74 |
|
|
|
75 |
|
|
#ifndef MAKING_MODS |
76 |
|
|
|
77 |
|
|
inline void garbage_collect_tclhash(void); |
78 |
|
|
|
79 |
|
|
void init_bind(void); |
80 |
|
|
void kill_bind(void); |
81 |
|
|
int expmem_tclhash(void); |
82 |
|
|
|
83 |
|
|
tcl_bind_list_t *add_bind_table(const char *nme, int flg, IntFunc func); |
84 |
|
|
void del_bind_table(tcl_bind_list_t *tl_which); |
85 |
|
|
|
86 |
|
|
tcl_bind_list_t *find_bind_table(const char *nme); |
87 |
|
|
|
88 |
|
|
int check_tcl_bind(tcl_bind_list_t *, const char *, struct flag_record *, |
89 |
|
|
const char *, int); |
90 |
|
|
int check_tcl_dcc(const char *, int, const char *); |
91 |
|
|
void check_tcl_chjn(const char *, const char *, int, char, int, const char *); |
92 |
|
|
void check_tcl_chpt(const char *, const char *, int, int); |
93 |
|
|
void check_tcl_bot(const char *, const char *, const char *); |
94 |
|
|
void check_tcl_link(const char *, const char *); |
95 |
|
|
void check_tcl_disc(const char *); |
96 |
|
|
const char *check_tcl_filt(int, const char *); |
97 |
|
|
int check_tcl_note(const char *, const char *, const char *); |
98 |
|
|
void check_tcl_listen(const char *, int); |
99 |
|
|
void check_tcl_time(struct tm *); |
100 |
|
|
void check_tcl_cron(struct tm *); |
101 |
|
|
void tell_binds(int, char *); |
102 |
|
|
void check_tcl_nkch(const char *, const char *); |
103 |
|
|
void check_tcl_away(const char *, int, const char *); |
104 |
|
|
void check_tcl_chatactbcst(const char *, int, const char *, tcl_bind_list_t *); |
105 |
|
|
void check_tcl_event(const char *); |
106 |
|
|
void check_tcl_log(int, char *, char *); |
107 |
pseudo |
1.2 |
#ifdef TLS |
108 |
|
|
int check_tcl_tls(int); |
109 |
|
|
#endif |
110 |
simple |
1.1 |
|
111 |
|
|
#define check_tcl_chat(a, b, c) check_tcl_chatactbcst(a ,b, c, H_chat) |
112 |
|
|
#define check_tcl_act(a, b, c) check_tcl_chatactbcst(a, b, c, H_act) |
113 |
|
|
#define check_tcl_bcst(a, b, c) check_tcl_chatactbcst(a, b, c, H_bcst) |
114 |
|
|
void check_tcl_chonof(char *, int, tcl_bind_list_t *); |
115 |
|
|
|
116 |
|
|
#define check_tcl_chon(a, b) check_tcl_chonof(a, b, H_chon) |
117 |
|
|
#define check_tcl_chof(a, b) check_tcl_chonof(a, b, H_chof) |
118 |
|
|
void check_tcl_loadunld(const char *, tcl_bind_list_t *); |
119 |
|
|
|
120 |
|
|
#define check_tcl_load(a) check_tcl_loadunld(a, H_load) |
121 |
|
|
#define check_tcl_unld(a) check_tcl_loadunld(a, H_unld) |
122 |
|
|
|
123 |
|
|
void rem_builtins(tcl_bind_list_t *, cmd_t *); |
124 |
|
|
void add_builtins(tcl_bind_list_t *, cmd_t *); |
125 |
|
|
|
126 |
|
|
int check_validity(char *, IntFunc); |
127 |
|
|
extern p_tcl_bind_list H_chat, H_act, H_bcst, H_chon, H_chof; |
128 |
|
|
extern p_tcl_bind_list H_load, H_unld, H_dcc, H_bot, H_link; |
129 |
|
|
extern p_tcl_bind_list H_away, H_nkch, H_filt, H_disc, H_event, H_log; |
130 |
|
|
|
131 |
|
|
#endif /* MAKING_MODS */ |
132 |
|
|
|
133 |
|
|
#endif /* _EGG_TCLHASH_H */ |