2 * IRC - Internet Relay Chat, include/hash.h
3 * Copyright (C) 1998 by Andrea "Nemesi" Cocito
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 1, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef INCLUDED_hash_h
23 #define INCLUDED_hash_h
32 /** Size of client and channel hash tables.
33 * Both must be of the same size.
35 #define HASHSIZE 32000
42 * Macros for internal use
46 * Externally visible pseudofunctions (macro interface to internal functions)
49 /* Raw calls, expect a core if you pass a NULL or zero-length name */
50 /** Search for a channel by name. */
51 #define SeekChannel(name) hSeekChannel((name))
52 /** Search for any client by name. */
53 #define SeekClient(name) hSeekClient((name), ~0)
54 /** Search for a registered user by name. */
55 #define SeekUser(name) hSeekClient((name), (STAT_USER))
56 /** Search for a server by name. */
57 #define SeekServer(name) hSeekClient((name), (STAT_ME | STAT_SERVER))
59 /* Safer macros with sanity check on name, WARNING: these are _macros_,
60 no side effects allowed on <name> ! */
61 /** Search for a channel by name. */
62 #define FindChannel(name) (BadPtr((name)) ? 0 : SeekChannel(name))
63 /** Search for any client by name. */
64 #define FindClient(name) (BadPtr((name)) ? 0 : SeekClient(name))
65 /** Search for a registered user by name. */
66 #define FindUser(name) (BadPtr((name)) ? 0 : SeekUser(name))
67 /** Search for a server by name. */
68 #define FindServer(name) (BadPtr((name)) ? 0 : SeekServer(name))
74 extern void init_hash(void); /* Call me on startup */
75 extern int hAddClient(struct Client *cptr);
76 extern int hAddChannel(struct Channel *chptr);
77 extern int hRemClient(struct Client *cptr);
78 extern int hChangeClient(struct Client *cptr, const char *newname);
79 extern int hRemChannel(struct Channel *chptr);
80 extern struct Client *hSeekClient(const char *name, int TMask);
81 extern struct Channel *hSeekChannel(const char *name);
83 extern int m_hash(struct Client *cptr, struct Client *sptr, int parc, char *parv[]);
85 extern int isNickJuped(const char *nick);
86 extern int addNickJupes(const char *nicks);
87 extern void clearNickJupes(void);
89 #endif /* INCLUDED_hash_h */