summaryrefslogtreecommitdiff
path: root/src/plexus.c
diff options
context:
space:
mode:
authorrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-01-13 11:00:30 +0000
committerrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-01-13 11:00:30 +0000
commit30c7604d7f4ecb74259d8339ea8ec539fb9ab25e (patch)
tree74091f72a6a4b3366adafb04be2b9a1c822ee154 /src/plexus.c
parent81351ff93b606e9f05d5b1022b50114aee823de6 (diff)
BUILD : 1.7.7 (535) BUGS : N/A NOTES : Added +h halfop support for plexus - plexus is now fully supported according to ThaPrince (plexus coder) :)
git-svn-id: svn://svn.anope.org/anope/trunk@535 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@389 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/plexus.c')
-rw-r--r--src/plexus.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/src/plexus.c b/src/plexus.c
index 53b512df3..d140c8dd9 100644
--- a/src/plexus.c
+++ b/src/plexus.c
@@ -193,6 +193,69 @@ void anope_set_umode(User * user, int ac, char **av)
}
}
+/*
+ * Local valid_op, and valid_halfop overrides.
+ * These are nessecary due to the way hybrid-based ircds handle halfops.
+ * hybrid-based ircds treat a -o as a -h as well. So if a user is set -o,
+ * the ircd will also set them -h if they have that mode. This breaks
+ * is_valid_op, as it always sends a -o. Breaking up the routines corrects this problem. - ThaPrince
+ */
+
+int plexus_check_valid_halfop(User * user, Channel * chan, int servermode)
+{
+ if (!chan || !chan->ci)
+ return 1;
+
+ /* They will be kicked; no need to deop, no need to update our internal struct too */
+ if (chan->ci->flags & CI_VERBOTEN)
+ return 0;
+
+ if (servermode && !check_access(user, chan->ci, CA_AUTOHALFOP)) {
+ notice_lang(s_ChanServ, user, CHAN_IS_REGISTERED, s_ChanServ);
+ anope_cmd_mode(whosends(chan->ci), chan->name, "-h %s",
+ user->nick);
+ return 0;
+ }
+
+ if (check_access(user, chan->ci, CA_AUTODEOP)) {
+ anope_cmd_mode(whosends(chan->ci), chan->name, "-h %s",
+ user->nick);
+ return 0;
+ }
+
+ return 1;
+}
+
+int plexus_check_valid_op(User * user, Channel * chan, int servermode)
+{
+ if (!chan || !chan->ci)
+ return 1;
+
+ /* They will be kicked; no need to deop, no need to update our internal struct too */
+ if (chan->ci->flags & CI_VERBOTEN)
+ return 0;
+
+ if (servermode && !check_access(user, chan->ci, CA_AUTOOP)) {
+ notice_lang(s_ChanServ, user, CHAN_IS_REGISTERED, s_ChanServ);
+ if (check_access(user, chan->ci, CA_AUTOHALFOP)) {
+ anope_cmd_mode(whosends(chan->ci), chan->name,
+ "-o+h %s %s", user->nick, user->nick);
+ } else {
+ anope_cmd_mode(whosends(chan->ci), chan->name, "-o %s",
+ user->nick);
+ }
+ return 0;
+ }
+
+ if (check_access(user, chan->ci, CA_AUTODEOP)) {
+ anope_cmd_mode(whosends(chan->ci), chan->name, "-o %s",
+ user->nick);
+ return 0;
+ }
+
+ return 1;
+}
+
unsigned long umodes[128] = {
0, 0, 0, /* Unused */
0, 0, 0, /* Unused */
@@ -426,14 +489,14 @@ CUMode cumodes[128] = {
{0}, /* e */
{0}, /* f */
{0}, /* g */
- {CUS_HALFOP, 0, check_valid_op},
+ {CUS_HALFOP, 0, plexus_check_valid_halfop},
{0}, /* i */
{0}, /* j */
{0}, /* k */
{0}, /* l */
{0}, /* m */
{0}, /* n */
- {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
+ {CUS_OP, CUF_PROTECT_BOTSERV, plexus_check_valid_op},
{0}, /* p */
{0}, /* q */
{0}, /* r */