unsigned int old_flag;
unsigned short flag_value;
} levelOptions[] = {
- { "CSMSG_SET_ENFOPS", "enfops", 300, 1, 0, 0 },
- { "CSMSG_SET_ENFHALFOPS", "enfhalfops", 300, 1, 0, 0 },
- { "CSMSG_SET_ENFMODES", "enfmodes", 200, 3, 0, 0 },
- { "CSMSG_SET_ENFTOPIC", "enftopic", 200, 4, 0, 0 },
- { "CSMSG_SET_PUBCMD", "pubcmd", 0, 5, 0, 0 },
- { "CSMSG_SET_SETTERS", "setters", 400, 7, 0, 0 },
- { "CSMSG_SET_USERINFO", "userinfo", 1, ~0, CHANNEL_INFO_LINES, 1 },
- { "CSMSG_SET_INVITEME", "inviteme", 1, ~0, CHANNEL_PEON_INVITE, 200 },
+ { "CSMSG_SET_ENFOPS", "enfops", 300, 1, 0, 0 },
+ { "CSMSG_SET_ENFHALFOPS", "enfhalfops", 300, 1, 0, 0 },
+ { "CSMSG_SET_ENFMODES", "enfmodes", 200, 3, 0, 0 },
+ { "CSMSG_SET_ENFTOPIC", "enftopic", 200, 4, 0, 0 },
+ { "CSMSG_SET_PUBCMD", "pubcmd", 0, 5, 0, 0 },
+ { "CSMSG_SET_SETTERS", "setters", 400, 7, 0, 0 },
+ { "CSMSG_SET_USERINFO", "userinfo", 1, ~0, CHANNEL_INFO_LINES, 1 },
+ { "CSMSG_SET_INVITEME", "inviteme", 1, ~0, CHANNEL_PEON_INVITE, 200 },
{ "CSMSG_SET_TOPICSNARF", "topicsnarf", 501, ~0, CHANNEL_TOPIC_SNARF, 1 }
};
struct chanData *cData = channel->channel_info;
unsigned int ii, used;
- changes = mod_chanmode_alloc(channel->members.used * 2);
+ /* 6 = worst case -ovh+ovh on everyone */
+ changes = mod_chanmode_alloc(channel->members.used * 6);
for(ii = used = 0; ii < channel->members.used; ++ii)
{
struct modeNode *mn = channel->members.list[ii];
if(IsService(mn->user))
continue;
+
uData = GetChannelAccess(cData, mn->user->handle_info);
- if(uData && uData->access >= UL_OP )
- {
- if(!(mn->modes & MODE_CHANOP))
- {
- changes->args[used].mode = MODE_CHANOP;
- changes->args[used++].u.member = mn;
- }
- }
- else if(uData && uData->access >= UL_HALFOP)
+
+ /* If the channel is in no-mode mode, de-mode EVERYONE */
+ if(cData->chOpts[chAutomode] == 'n')
{
- if(mn->modes & MODE_CHANOP)
- {
- changes->args[used].mode = MODE_REMOVE | MODE_CHANOP;
- changes->args[used++].u.member = mn;
- }
- if(!(mn->modes & MODE_HALFOP))
- {
- changes->args[used].mode = MODE_HALFOP;
- changes->args[used++].u.member = mn;
- }
+ if(mn->modes)
+ {
+ changes->args[used].mode = MODE_REMOVE | mn->modes;
+ changes->args[used++].u.member = mn;
+ }
}
- else if(uData && uData->access >= UL_PEON )
+ else /* Give various userlevels their modes.. */
{
- if(mn->modes & MODE_CHANOP)
+ if(uData && uData->access >= UL_OP )
{
- changes->args[used].mode = MODE_REMOVE | MODE_CHANOP;
- changes->args[used++].u.member = mn;
+ if(!(mn->modes & MODE_CHANOP))
+ {
+ changes->args[used].mode = MODE_CHANOP;
+ changes->args[used++].u.member = mn;
+ }
}
- if(mn->modes & MODE_HALFOP)
+ else if(uData && uData->access >= UL_HALFOP)
{
- changes->args[used].mode = MODE_REMOVE | MODE_HALFOP;
- changes->args[used++].u.member = mn;
+ if(mn->modes & MODE_CHANOP)
+ {
+ changes->args[used].mode = MODE_REMOVE | MODE_CHANOP;
+ changes->args[used++].u.member = mn;
+ }
+ if(!(mn->modes & MODE_HALFOP))
+ {
+ changes->args[used].mode = MODE_HALFOP;
+ changes->args[used++].u.member = mn;
+ }
}
- /* Don't voice peons if were in mode m */
- if(!(mn->modes & MODE_VOICE) && cData->chOpts[chAutomode] != 'm')
+ else if(uData && uData->access >= UL_PEON )
{
- changes->args[used].mode = MODE_VOICE;
- changes->args[used++].u.member = mn;
+ if(mn->modes & MODE_CHANOP)
+ {
+ changes->args[used].mode = MODE_REMOVE | MODE_CHANOP;
+ changes->args[used++].u.member = mn;
+ }
+ if(mn->modes & MODE_HALFOP)
+ {
+ changes->args[used].mode = MODE_REMOVE | MODE_HALFOP;
+ changes->args[used++].u.member = mn;
+ }
+ /* Don't voice peons if were in mode m */
+ if( cData->chOpts[chAutomode] == 'm')
+ {
+ if(mn->modes & MODE_VOICE)
+ {
+ changes->args[used].mode = MODE_REMOVE | MODE_VOICE;
+ changes->args[used++].u.member = mn;
+ }
+ }
+ /* otherwise, make user they do have voice */
+ else if(!(mn->modes & MODE_VOICE))
+ {
+ changes->args[used].mode = MODE_VOICE;
+ changes->args[used++].u.member = mn;
+ }
}
- }
- else
- {
- if(mn->modes)
+ else /* They arnt on the userlist.. */
{
- changes->args[used].mode = MODE_REMOVE | mn->modes;
- changes->args[used++].u.member = mn;
+ /* If we voice everyone, but they dont.. */
+ if(cData->chOpts[chAutomode] == 'v')
+ {
+ /* Remove anything except v */
+ if(mn->modes & ~MODE_VOICE)
+ {
+ changes->args[used].mode = MODE_REMOVE | (mn->modes & ~MODE_VOICE);
+ changes->args[used++].u.member = mn;
+ }
+ /* Add v */
+ if(!(mn->modes & MODE_VOICE))
+ {
+ changes->args[used].mode = MODE_VOICE;
+ changes->args[used++].u.member = mn;
+ }
+ }
+ /* If we hop everyone, but they dont.. */
+ else if(cData->chOpts[chAutomode] == 'h')
+ {
+ /* Remove anything except h */
+ if(mn->modes & ~MODE_HALFOP)
+ {
+ changes->args[used].mode = MODE_REMOVE | (mn->modes & ~MODE_HALFOP);
+ changes->args[used++].u.member = mn;
+ }
+ /* Add h */
+ if(!(mn->modes & MODE_HALFOP))
+ {
+ changes->args[used].mode = MODE_HALFOP;
+ changes->args[used++].u.member = mn;
+ }
+ }
+ /* If we op everyone, but they dont.. */
+ else if(cData->chOpts[chAutomode] == 'o')
+ {
+ /* Remove anything except h */
+ if(mn->modes & ~MODE_CHANOP)
+ {
+ changes->args[used].mode = MODE_REMOVE | (mn->modes & ~MODE_CHANOP);
+ changes->args[used++].u.member = mn;
+ }
+ /* Add h */
+ if(!(mn->modes & MODE_CHANOP))
+ {
+ changes->args[used].mode = MODE_CHANOP;
+ changes->args[used++].u.member = mn;
+ }
+ }
+ /* they have no excuse for having modes, de-everything them */
+ else
+ {
+ if(mn->modes)
+ {
+ changes->args[used].mode = MODE_REMOVE | mn->modes;
+ changes->args[used++].u.member = mn;
+ }
+ }
}
}
}
" $bDEHOP$b Remove halfops from the specified user.",
" $bVOICE$b Give voice to the specified user.",
" $bDEVOICE$b Remove voice from the specified user.",
- " $bRESYNC$b Synchronize ops and voice with the channel userlist.",
+ " $bRESYNC$b Synchronize (half)ops and voice with the channel userlist.",
"$b$b",
" $bKICK$b Kick a user from a channel.",
" $bBAN$b Ban a user from a channel.",
"REMOVENOTE" ("/msg $S REMOVENOTE <typename> [FORCE]",
"Permanently deletes a note type. Without the argument $bFORCE$b, it will only delete an unused note type. With the argument $bFORCE$b, it will delete the note from all channels and then delete the note type.",
"$uSee Also:$u createnote");
+
"RESYNC" ("/msg $S RESYNC <#channel>",
- "Synchronizes users in the channel with the userlist. This means that if the user can normally get ops, $S makes sure the user has ops. Otherwise, if the user normally gets voice, $S makes sure the user has voice but not ops. Otherwise, $S makes sure the user has neither voice nor ops.");
+ "Synchronizes users in the channel with the userlist, according to the SET AUTOMODE setting.",
+ "It will give and take ops, halfops, and voice modes to users to make the channel match the userlist and automode setting.",
+ "$uSee Also:$u set automode, up, op, hop, voice");
+
"SAY" ("/msg $C SAY <#channel> <text>",
"Makes $b$C$b send a message to the specified channel.",
"$uSee Also:$u emote");
"$uSee Also:$u set, set topic, set topicmask");
"SET AUTOMODE" ("/msg $C SET <#channel> AUTOMODE <value>",
- "This setting configures who $C auto-voices. Valid settings are:",
- "$b0$b Noone will be automatically oped, half-oped, or voiced.",
- "$b1$b Give voice to peons, half-op to halfops, and op to ops.",
- "$b2$b #1 Plus Give voice to strangers.",
- "$b3$b #1 Plus give halfops to strangers.",
- "$b4$b #1 Plus give ops to strangers (not advised.)",
- "$b5$b Give half-op to halfops, and op to ops only, peons do not get voice. ",
- "Option #5 also affects RESYNC and UP commands. Other options do not.",
- "$uSee Also:$u set, uset autoop, up, resync");
+ "This setting configures who $C gives different channel modes to on join or RESYNC. ",
+ "Valid settings are:",
+ " $b0$b Noone will be automatically oped, half-oped, or voiced.",
+ " $b1$b Give voice to peons, half-op to halfops, and op to ops.",
+ " $b2$b #1 Plus Give voice to everyone.",
+ " $b3$b #1 Plus give halfops to everyone.",
+ " $b4$b #1 Plus give ops to everyone (not advised.)",
+ " $b5$b Give half-op to halfops, and op to ops only, but peons do not get voice. ",
+ "$uSee Also:$u set, up, uset autoop, resync");
"SET PROTECT" ("/msg $C SET <#channel> PROTECT <value>",
"This setting restricts the protection that $C enforces. Valid settings are:",