}
int
-get_channel_access(struct Client *source_p, struct membership *msptr, int dir, const char *modestr)
+get_channel_access(struct Client *source_p, struct Channel *chptr, struct membership *msptr, int dir, const char *modestr)
{
hook_data_channel_approval moduledata;
if(!MyClient(source_p))
return CHFL_CHANOP;
- if (msptr == NULL)
- return CHFL_PEON;
-
moduledata.client = source_p;
- moduledata.chptr = msptr->chptr;
+ moduledata.chptr = chptr;
moduledata.msptr = msptr;
moduledata.target = NULL;
- moduledata.approved = is_chanop(msptr) ? CHFL_CHANOP : CHFL_PEON;
+ moduledata.approved = (msptr != NULL && is_chanop(msptr)) ? CHFL_CHANOP : CHFL_PEON;
moduledata.dir = dir;
moduledata.modestr = modestr;
if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET))
{
if((msptr = find_channel_membership(targptr, source_p)) == NULL ||
- get_channel_access(source_p, msptr, MODE_QUERY, NULL) != CHFL_CHANOP)
+ get_channel_access(source_p, targptr, msptr, MODE_QUERY, NULL) != CHFL_CHANOP)
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, targptr->chname);
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
- mode_changes[mode_count].caps = 0;
- mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count].mems = ONLY_OPERS;
- mode_changes[mode_count].override = 0;
mode_changes[mode_count++].arg = NULL;
}
else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type))
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
- mode_changes[mode_count].caps = 0;
- mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ONLY_OPERS;
mode_changes[mode_count].id = NULL;
- mode_changes[mode_count].override = 0;
mode_changes[mode_count++].arg = NULL;
}
}
else
fakesource_p = source_p;
- alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
+ alevel = get_channel_access(source_p, chptr, msptr, dir, reconstruct_parv(parc, parv));
for(; (c = *ml) != 0; ml++)
{
dir = MODE_ADD;
if (!reauthorized)
{
- alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
+ alevel = get_channel_access(source_p, chptr, msptr, dir, reconstruct_parv(parc, parv));
reauthorized = 1;
}
break;
dir = MODE_DEL;
if (!reauthorized)
{
- alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
+ alevel = get_channel_access(source_p, chptr, msptr, dir, reconstruct_parv(parc, parv));
reauthorized = 1;
}
break;