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.
23 #include "s_serv.h" /* For STAT_* values and StatusMask() macro */
25 /*=============================================================================
29 /* Now client and channel hash table must be of the same size */
30 #define HASHSIZE 32000
32 /*=============================================================================
36 /*=============================================================================
37 * Macros for internal use
40 /*=============================================================================
41 * Externally visible pseudofunctions (macro interface to internal functions)
44 /* Raw calls, expect a core if you pass a NULL or zero-length name */
45 #define SeekChannel(name) hSeekChannel((name))
46 #define SeekClient(name) hSeekClient((name), ~StatusMask(STAT_PING))
47 #define SeekUser(name) hSeekClient((name), StatusMask(STAT_USER))
48 #define SeekServer(name) hSeekClient((name), StatusMask(STAT_ME) | \
49 StatusMask(STAT_SERVER) )
51 /* Safer macros with sanity check on name, WARNING: these are _macros_,
52 no side effects allowed on <name> ! */
53 #define FindChannel(name) (BadPtr((name))?NULL:SeekChannel(name))
54 #define FindClient(name) (BadPtr((name))?NULL:SeekClient(name))
55 #define FindUser(name) (BadPtr((name))?NULL:SeekUser(name))
56 #define FindServer(name) (BadPtr((name))?NULL:SeekServer(name))
58 /*=============================================================================
62 extern void hash_init(void); /* Call me on startup */
63 extern int hAddClient(aClient *cptr);
64 extern int hAddChannel(aChannel *chptr);
65 extern int hRemClient(aClient *cptr);
66 extern int hChangeClient(aClient *cptr, char *newname);
67 extern int hRemChannel(aChannel *chptr);
68 extern aClient *hSeekClient(char *name, int TMask);
69 extern aChannel *hSeekChannel(char *name);
71 extern int m_hash(aClient *cptr, aClient *sptr, int parc, char *parv[]);
73 extern int isNickJuped(char *nick);
74 extern int addNickJupes(char *nicks);
75 extern void clearNickJupes(void);