summaryrefslogtreecommitdiff
path: root/src
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-03-03 09:06:14 +0000
committerrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-03-03 09:06:14 +0000
commit30f8519717f35c3147294d17f5b86ff60085f758 (patch)
treefd4f86d69b1c2e6dade9978f08c9462a1c5a6ef3 /src
parentbfa12b9fe4588e220ac565383a37f64fc7fec1b3 (diff)
BUILD : 1.7.8 (593) BUGS : 307 NOTES : Fixed admin/owner mode handling
git-svn-id: svn://svn.anope.org/anope/trunk@593 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@442 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/chanserv.c35
-rw-r--r--src/misc.c12
2 files changed, 33 insertions, 14 deletions
diff --git a/src/chanserv.c b/src/chanserv.c
index 3e2a4a1cb..521345057 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -1413,6 +1413,7 @@ int check_valid_admin(User * user, Channel * chan, int servermode)
int check_valid_op(User * user, Channel * chan, int servermode)
{
+ char *tmp;
if (!chan || !chan->ci)
return 1;
@@ -1425,25 +1426,29 @@ int check_valid_op(User * user, Channel * chan, int servermode)
if (ircd->halfop) {
if (ircd->owner && ircd->protect) {
if (check_access(user, chan->ci, CA_AUTOHALFOP)) {
+ tmp = stripModePrefix(ircd->ownerunset);
anope_cmd_mode(whosends(chan->ci), chan->name,
- "-%so%s %s %s %s", ++ircd->adminunset,
- ++ircd->ownerunset, user->nick,
+ "%so%s %s %s %s", ircd->adminunset,
+ tmp, user->nick,
user->nick, user->nick);
+ free(tmp);
} else {
+ tmp = stripModePrefix(ircd->ownerunset);
anope_cmd_mode(whosends(chan->ci), chan->name,
- "-%sho%s %s %s %s %s",
- ++ircd->adminunset, ++ircd->ownerunset,
+ "%sho%s %s %s %s %s",
+ ircd->adminunset, tmp,
user->nick, user->nick, user->nick,
user->nick);
+ free(tmp);
}
} else if (!ircd->owner && ircd->protect) {
if (check_access(user, chan->ci, CA_AUTOHALFOP)) {
anope_cmd_mode(whosends(chan->ci), chan->name,
- "-%so %s %s", ++ircd->adminunset,
+ "%so %s %s", ircd->adminunset,
user->nick, user->nick);
} else {
anope_cmd_mode(whosends(chan->ci), chan->name,
- "-%soh %s %s %s", ++ircd->adminunset,
+ "%soh %s %s %s", ircd->adminunset,
user->nick, user->nick, user->nick);
}
} else {
@@ -1465,10 +1470,12 @@ int check_valid_op(User * user, Channel * chan, int servermode)
if (check_access(user, chan->ci, CA_AUTODEOP)) {
if (ircd->halfop) {
if (ircd->owner && ircd->protect) {
+ tmp = stripModePrefix(ircd->ownerunset);
anope_cmd_mode(whosends(chan->ci), chan->name,
- "-%sho%s %s %s %s %s", ++ircd->adminunset,
- ++ircd->ownerunset, user->nick, user->nick,
+ "%sho%s %s %s %s %s", ircd->adminunset,
+ tmp, user->nick, user->nick,
user->nick, user->nick);
+ free(tmp);
} else {
anope_cmd_mode(whosends(chan->ci), chan->name, "-ho %s %s",
user->nick, user->nick);
@@ -6093,13 +6100,13 @@ static int do_clear(User * u)
if (!chan_has_user_status(c, cu->user, CUS_OWNER)) {
continue;
} else {
- snprintf(tmp, BUFSIZE, "-%so",
- ++ircd->ownerunset);
+ snprintf(tmp, BUFSIZE, "%so",
+ ircd->ownerunset);
av[1] = sstrdup(tmp);
}
} else {
- snprintf(tmp, BUFSIZE, "-%so", ++ircd->adminunset);
+ snprintf(tmp, BUFSIZE, "%so", ircd->adminunset);
av[1] = sstrdup(tmp);
}
} else {
@@ -6120,12 +6127,12 @@ static int do_clear(User * u)
if (!chan_has_user_status(c, cu->user, CUS_OWNER)) {
continue;
} else {
- snprintf(tmp, BUFSIZE, "-%so",
- ++ircd->ownerunset);
+ snprintf(tmp, BUFSIZE, "%so",
+ ircd->ownerunset);
av[1] = sstrdup(tmp);
}
} else {
- snprintf(tmp, BUFSIZE, "-%so", ++ircd->adminunset);
+ snprintf(tmp, BUFSIZE, "%so", ircd->adminunset);
av[1] = sstrdup(tmp);
}
} else {
diff --git a/src/misc.c b/src/misc.c
index 5e5038252..3df45aab5 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1135,4 +1135,16 @@ char *str_signed(unsigned char *str)
return nstr;
}
+/**
+ * Strip the mode prefix from the given string.
+ * Useful for using the modes stored in things like ircd->ownerset etc..
+ **/
+
+char *stripModePrefix(const char *str) {
+ if(str) {
+ return strdup(str+1);
+ }
+ return NULL;
+}
+
/* EOF */