}
+static CHANSERV_FUNC(cmd_levels)
+{
+ struct helpfile_table tbl;
+ int ii = 0;
+
+ tbl.length = 6 + 1; // 6 levels
+ tbl.width = 4;
+ tbl.flags = 0;
+ tbl.contents = calloc(tbl.length,sizeof(tbl.contents[0]));
+ tbl.contents[0] = calloc(tbl.width,sizeof(tbl.contents[0][0]));
+ tbl.contents[0][0] = "Level";
+ tbl.contents[0][1] = "From";
+ tbl.contents[0][2] = "-";
+ tbl.contents[0][3] = "To";
+
+ tbl.contents[++ii] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
+ tbl.contents[ii][0] = strdup(user_level_name_from_level(UL_OWNER));
+ tbl.contents[ii][1] = msnprintf(4, "%d", UL_OWNER);
+ tbl.contents[ii][2] = msnprintf(2, " ");
+ tbl.contents[ii][3] = msnprintf(1, "");
+
+ tbl.contents[++ii] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
+ tbl.contents[ii][0] = strdup(user_level_name_from_level(UL_COOWNER));
+ tbl.contents[ii][1] = msnprintf(4, "%d", UL_COOWNER);
+ tbl.contents[ii][2] = msnprintf(2, "-");
+ tbl.contents[ii][3] = msnprintf(4, "%d", UL_OWNER-1);
+
+ tbl.contents[++ii] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
+ tbl.contents[ii][0] = strdup(user_level_name_from_level(UL_MANAGER));
+ tbl.contents[ii][1] = msnprintf(4, "%d", UL_MANAGER);
+ tbl.contents[ii][2] = msnprintf(2, "-");
+ tbl.contents[ii][3] = msnprintf(4, "%d", UL_COOWNER-1);
+
+ tbl.contents[++ii] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
+ tbl.contents[ii][0] = strdup(user_level_name_from_level(UL_OP));
+ tbl.contents[ii][1] = msnprintf(4, "%d", UL_OP);
+ tbl.contents[ii][2] = msnprintf(2, "-");
+ tbl.contents[ii][3] = msnprintf(4, "%d", UL_MANAGER-1);
+
+ tbl.contents[++ii] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
+ tbl.contents[ii][0] = strdup(user_level_name_from_level(UL_HALFOP));
+ tbl.contents[ii][1] = msnprintf(4, "%d", UL_HALFOP);
+ tbl.contents[ii][2] = msnprintf(2, "-");
+ tbl.contents[ii][3] = msnprintf(4, "%d", UL_OP-1);
+
+ tbl.contents[++ii] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
+ tbl.contents[ii][0] = strdup(user_level_name_from_level(UL_PEON));
+ tbl.contents[ii][1] = msnprintf(4, "%d", UL_PEON);
+ tbl.contents[ii][2] = msnprintf(2, "-");
+ tbl.contents[ii][3] = msnprintf(4, "%d", UL_HALFOP-1);
+
+ table_send(cmd->parent->bot, user->nick, 0, NULL, tbl);
+ return 0;
+
+/*
+ reply("CSMSG_LEVELS_HEADER");
+ reply("CSMSG_LEVELS", user_level_name_from_level(UL_OWNER), UL_OWNER, UL_OWNER);
+ reply("CSMSG_LEVELS", user_level_name_from_level(UL_COOWNER), UL_COOWNER, UL_OWNER-1);
+ reply("CSMSG_LEVELS", user_level_name_from_level(UL_MANAGER), UL_MANAGER, UL_COOWNER-1);
+ reply("CSMSG_LEVELS", user_level_name_from_level(UL_OP), UL_OP, UL_MANAGER-1);
+ reply("CSMSG_LEVELS", user_level_name_from_level(UL_HALFOP), UL_HALFOP, UL_OP-1);
+ reply("CSMSG_LEVELS", user_level_name_from_level(UL_PEON), UL_PEON, UL_HALFOP-1);
+ reply("CSMSG_BAR");
+ */
+}
+
/* trim_lamers.. */
static int
cmd_trim_bans(struct svccmd *cmd, struct userNode *user, struct chanNode *channel, unsigned long duration)
SetChannelTopic(channel, chanserv, chanserv, channel->channel_info->topic, 1);
}
+int
+check_bans(struct userNode *user, const char *channel)
+{
+ struct chanNode *chan;
+ struct mod_chanmode change;
+ struct chanData *cData;
+ struct banData *bData;
+
+ if (!(chan = GetChannel(channel)))
+ return 0;
+
+ if(!(cData = chan->channel_info))
+ return 0;
+
+ mod_chanmode_init(&change);
+ change.argc = 1;
+
+ if(chan->banlist.used < MAXBANS)
+ {
+ /* Not joining through a ban. */
+ for(bData = cData->bans;
+ bData && !user_matches_glob(user, bData->mask, MATCH_USENICK);
+ bData = bData->next);
+
+ if(bData)
+ {
+ char kick_reason[MAXLEN];
+ sprintf(kick_reason, "(%s) %s", bData->owner, bData->reason);
+
+ bData->triggered = now;
+ if(bData != cData->bans)
+ {
+ /* Shuffle the ban to the head of the list. */
+ if(bData->next)
+ bData->next->prev = bData->prev;
+ if(bData->prev)
+ bData->prev->next = bData->next;
+
+ bData->prev = NULL;
+ bData->next = cData->bans;
+
+ if(cData->bans)
+ cData->bans->prev = bData;
+
+ cData->bans = bData;
+ }
+
+ change.args[0].mode = MODE_BAN;
+ change.args[0].u.hostmask = bData->mask;
+ mod_chanmode_announce(chanserv, chan, &change);
+ KickChannelUser(user, chan, chanserv, kick_reason);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+
/* Welcome to my worst nightmare. Warning: Read (or modify)
the code below at your own risk. */
static int
}
-
mod_chanmode_init(&change);
change.argc = 1;
DEFINE_COMMAND(mdelpeon, 2, MODCMD_REQUIRE_CHANUSER, "access", "manager", NULL);
DEFINE_COMMAND(mdelhalfop, 2, MODCMD_REQUIRE_CHANUSER, "access", "manager", NULL);
+ DEFINE_COMMAND(levels, 1, 0, NULL);
+
DEFINE_COMMAND(trim, 3, MODCMD_REQUIRE_CHANUSER, "access", "manager", NULL);
DEFINE_COMMAND(opchan, 1, MODCMD_REQUIRE_REGCHAN|MODCMD_NEVER_CSUSPEND, "access", "1", NULL);
DEFINE_COMMAND(clvl, 3, MODCMD_REQUIRE_CHANUSER, "access", "manager", NULL);