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 /* Now client and channel hash table must be of the same size */
33 #define HASHSIZE 32000
40 * Macros for internal use
44 * Externally visible pseudofunctions (macro interface to internal functions)
47 /* Raw calls, expect a core if you pass a NULL or zero-length name */
48 #define SeekChannel(name) hSeekChannel((name))
49 #define SeekClient(name) hSeekClient((name), ~0)
50 #define SeekUser(name) hSeekClient((name), (STAT_USER))
51 #define SeekServer(name) hSeekClient((name), (STAT_ME | STAT_SERVER))
53 /* Safer macros with sanity check on name, WARNING: these are _macros_,
54 no side effects allowed on <name> ! */
55 #define FindChannel(name) (BadPtr((name)) ? 0 : SeekChannel(name))
56 #define FindClient(name) (BadPtr((name)) ? 0 : SeekClient(name))
57 #define FindUser(name) (BadPtr((name)) ? 0 : SeekUser(name))
58 #define FindServer(name) (BadPtr((name)) ? 0 : SeekServer(name))
64 extern void init_hash(void); /* Call me on startup */
65 extern int hAddClient(struct Client *cptr);
66 extern int hAddChannel(struct Channel *chptr);
67 extern int hRemClient(struct Client *cptr);
68 extern int hChangeClient(struct Client *cptr, const char *newname);
69 extern int hRemChannel(struct Channel *chptr);
70 extern struct Client *hSeekClient(const char *name, int TMask);
71 extern struct Channel *hSeekChannel(const char *name);
73 extern int m_hash(struct Client *cptr, struct Client *sptr, int parc, char *parv[]);
75 extern int isNickJuped(const char *nick);
76 extern int addNickJupes(const char *nicks);
77 extern void clearNickJupes(void);
79 #endif /* INCLUDED_hash_h */