Channel hook changes

This commit is contained in:
codemastr 2003-09-20 19:57:46 +00:00
parent 729689a4cd
commit d051786f5c
4 changed files with 19 additions and 12 deletions

View file

@ -2431,3 +2431,4 @@ seen. gmtime warning still there
- Added beta18 release notes (might be changed)
- Added HOOKTYPE_REHASHFLAG (triggered when /rehash is passed a flag)
- Fix for HOOKTYPE_REMOTE_QUIT (was called for local quits too)
- Redid the join/kick/topic hooks

View file

@ -23,7 +23,7 @@
#define MOD_VERSION "3.2-b5-1"
#define MOD_WE_SUPPORT "3.2-b5*"
#define MAXCUSTOMHOOKS 30
#define MAXHOOKTYPES 60
#define MAXHOOKTYPES 70
typedef void (*vFP)(); /* Void function pointer */
typedef int (*iFP)(); /* Integer function pointer */
typedef char (*cFP)(); /* char * function pointer */
@ -452,7 +452,10 @@ int CommandExists(char *name);
#define HOOKTYPE_UNKUSER_QUIT 24
#define HOOKTYPE_LOCAL_PASS 25
#define HOOKTYPE_REMOTE_CONNECT 26
#define HOOKTYPE_REMOTE_QUIT 26
#define HOOKTYPE_REMOTE_QUIT 27
#define HOOKTYPE_PRE_LOCAL_JOIN 28
#define HOOKTYPE_PRE_LOCAL_KICK 29
#define HOOKTYPE_PRE_LOCAL_TOPIC 30
/* Module flags */
#define MODFLAG_NONE 0x0000

View file

@ -3544,8 +3544,8 @@ CMD_FUNC(do_join)
if (MyConnect(sptr)) {
int breakit = 0;
for (global_i = Hooks[HOOKTYPE_LOCAL_JOIN]; global_i; global_i = global_i->next) {
if((*(global_i->func.intfunc))(cptr,sptr,chptr,parv) > 0) {
for (global_i = Hooks[HOOKTYPE_PRE_LOCAL_JOIN]; global_i; global_i = global_i->next) {
if((*(global_i->func.intfunc))(sptr,chptr,parv) > 0) {
breakit = 1;
break;
}
@ -3557,6 +3557,7 @@ CMD_FUNC(do_join)
sub1_from_channel(chptr);
continue;
}
RunHook4(HOOKTYPE_LOCAL_JOIN, cptr, sptr,chptr,parv);
}
/*
@ -4002,14 +4003,15 @@ CMD_FUNC(m_kick)
attack:
if (MyConnect(sptr)) {
int breakit = 0;
for (global_i = Hooks[HOOKTYPE_LOCAL_KICK]; global_i; global_i = global_i->next) {
if((*(global_i->func.intfunc))(cptr,sptr,who,chptr,comment) > 0) {
for (global_i = Hooks[HOOKTYPE_PRE_LOCAL_KICK]; global_i; global_i = global_i->next) {
if((*(global_i->func.intfunc))(sptr,who,chptr,comment) > 0) {
breakit = 1;
break;
}
}
if (breakit)
continue;
RunHook5(HOOKTYPE_LOCAL_KICK, cptr,sptr,who,chptr,comment);
}
if (lp)
{
@ -4213,12 +4215,13 @@ CMD_FUNC(m_topic)
if (MyClient(sptr))
{
Hook *tmphook;
for (tmphook = Hooks[HOOKTYPE_LOCAL_TOPIC]; tmphook; tmphook = tmphook->next) {
topic = (*(tmphook->func.pcharfunc))(cptr, sptr, chptr, topic);
for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_TOPIC]; tmphook; tmphook = tmphook->next) {
topic = (*(tmphook->func.pcharfunc))(sptr, chptr, topic);
if (!topic)
return 0;
}
}
RunHook4(HOOKTYPE_LOCAL_TOPIC, cptr, sptr, chptr, topic);
}
/* setting a topic */
topiClen = strlen(topic);
#ifndef TOPIC_NICK_IS_NUHOST

View file

@ -856,14 +856,14 @@ Hooktype *HooktypeAdd(Module *module, char *string, int *type) {
}
for (hooktype = Hooktypes, i = 0; hooktype->string; hooktype++, i++) ;
if (i >= 29)
if (i >= 39)
{
if (module)
module->errorcode = MODERR_NOSPACE;
return NULL;
}
Hooktypes[i].id = i+31;
Hooktypes[i].id = i+41;
Hooktypes[i].string = strdup(string);
parent = MyMallocEx(sizeof(ModuleChild));
parent->child = module;
@ -875,7 +875,7 @@ Hooktype *HooktypeAdd(Module *module, char *string, int *type) {
module->errorcode = MODERR_NOERROR;
}
AddListItem(parent,Hooktypes[i].parents);
*type = i+31;
*type = i+41;
return &Hooktypes[i];
}