summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-12-13 19:32:19 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-12-13 19:32:19 +0000
commita7ac6a0ac712892652da6dd8696b94d4c6d3ea84 (patch)
tree9bbcf49157cfda0577c34515cb44d4462818c1da /src/core
parent3a956c51be22f1b6f3b6808c9f56fb6b26c7dd1a (diff)
Added in a modestacker and rewrote almost all of the remaining old mode code
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2696 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
-rw-r--r--src/core/cs_ban.c6
-rw-r--r--src/core/cs_clear.c151
-rw-r--r--src/core/cs_drop.c3
-rw-r--r--src/core/cs_modes.c14
-rw-r--r--src/core/cs_register.c6
-rw-r--r--src/core/cs_set.c6
-rw-r--r--src/core/ns_logout.c4
-rw-r--r--src/core/os_clearmodes.c100
-rw-r--r--src/core/os_defcon.c30
-rw-r--r--src/core/os_mode.c8
-rw-r--r--src/core/os_oline.c2
-rw-r--r--src/core/os_umode.c4
12 files changed, 98 insertions, 236 deletions
diff --git a/src/core/cs_ban.c b/src/core/cs_ban.c
index 86ed13332..c154064ca 100644
--- a/src/core/cs_ban.c
+++ b/src/core/cs_ban.c
@@ -66,14 +66,10 @@ class CommandCSBan : public Command
} else if (is_protected(u2)) {
notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
} else {
- const char *av[3];
char mask[BUFSIZE];
- av[0] = "+b";
get_idealban(ci, u2, mask, sizeof(mask));
- av[1] = mask;
- ircdproto->SendMode(whosends(ci), c->name, "+b %s", av[1]);
- chan_set_modes(Config.s_ChanServ, c, 2, av, 1);
+ c->SetMode(NULL, CMODE_BAN, mask);
/* We still allow host banning while not allowing to kick */
if (!is_on_chan(c, u2))
diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c
index ea01eb90e..fa82c9f11 100644
--- a/src/core/cs_clear.c
+++ b/src/core/cs_clear.c
@@ -63,8 +63,7 @@ class CommandCSClear : public Command
notice_lang(Config.s_ChanServ, u, CHAN_CLEARED_MODES, chan);
} else if (what == "ops") {
const char *av[6]; /* The max we have to hold: chan, ts, modes(max3), nick, nick, nick */
- int ac, isop, isadmin, isown, count, i;
- char buf[BUFSIZE], tmp[BUFSIZE], tmp2[BUFSIZE];
+ int isop, isadmin, isown;
struct c_userlist *cu, *bnext;
if (ircd->svsmode_ucmode) {
@@ -82,167 +81,71 @@ class CommandCSClear : public Command
ircdproto->SendSVSModeChan(av[0], modebuf.c_str(), NULL);
}
- for (cu = c->users; cu; cu = bnext) {
+ for (cu = c->users; cu; cu = bnext)
+ {
bnext = cu->next;
isop = chan_has_user_status(c, cu->user, CUS_OP);
isadmin = chan_has_user_status(c, cu->user, CUS_PROTECT);
isown = chan_has_user_status(c, cu->user, CUS_OWNER);
- count = (isop ? 1 : 0) + (isadmin ? 1 : 0) + (isown ? 1 : 0);
if (!isop && !isadmin && !isown)
continue;
- snprintf(tmp, BUFSIZE, "-%s%s%s", (isop ? "o" : ""), (isadmin ?
- &admin->ModeChar : ""), (isown ? &owner->ModeChar : ""));
-
- if (ircdcap->tsmode) {
- snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long>(time(NULL)));
- av[1] = buf;
- av[2] = tmp;
- /* We have to give as much nicks as modes.. - Viper */
- for (i = 0; i < count; i++)
- av[i+3] = cu->user->nick;
- ac = 3 + i;
- } else {
- av[1] = tmp;
- /* We have to give as much nicks as modes.. - Viper */
- for (i = 0; i < count; i++)
- av[i+2] = cu->user->nick;
- ac = 2 + i;
- }
-
- do_cmode(Config.s_ChanServ, ac, av);
+ if (isown)
+ c->RemoveMode(NULL, CMODE_OWNER, cu->user->nick);
+ if (admin)
+ c->RemoveMode(NULL, CMODE_PROTECT, cu->user->nick);
+ if (isop)
+ c->RemoveMode(NULL, CMODE_OP, cu->user->nick);
}
} else {
av[0] = chan;
- for (cu = c->users; cu; cu = bnext) {
+ for (cu = c->users; cu; cu = bnext)
+ {
bnext = cu->next;
isop = chan_has_user_status(c, cu->user, CUS_OP);
isadmin = chan_has_user_status(c, cu->user, CUS_PROTECT);
isown = chan_has_user_status(c, cu->user, CUS_OWNER);
- count = (isop ? 1 : 0) + (isadmin ? 1 : 0) + (isown ? 1 : 0);
if (!isop && !isadmin && !isown)
continue;
- snprintf(tmp, BUFSIZE, "-%s%s%s", (isop ? "o" : ""), (isadmin ?
- &admin->ModeChar : ""), (isown ? &owner->ModeChar : ""));
- /* We need to send the IRCd a nick for every mode.. - Viper */
- snprintf(tmp2, BUFSIZE, "%s %s %s", (isop ? cu->user->nick : ""),
- (isadmin ? cu->user->nick : ""), (isown ? cu->user->nick : ""));
-
- if (ircdcap->tsmode) {
- snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long>(time(NULL)));
- av[1] = buf;
- av[2] = tmp;
- /* We have to give as much nicks as modes.. - Viper */
- for (i = 0; i < count; i++)
- av[i+3] = cu->user->nick;
- ac = 3 + i;
-
- ircdproto->SendMode(whosends(ci), av[0], "%s %s", av[2], tmp2);
- } else {
- av[1] = tmp;
- /* We have to give as much nicks as modes.. - Viper */
- for (i = 0; i < count; i++)
- av[i+2] = cu->user->nick;
- ac = 2 + i;
-
- ircdproto->SendMode(whosends(ci), av[0], "%s %s", av[1], tmp2);
- }
-
- do_cmode(Config.s_ChanServ, ac, av);
+ if (isown)
+ c->RemoveMode(NULL, CMODE_OWNER, cu->user->nick);
+ if (isadmin)
+ c->RemoveMode(NULL, CMODE_PROTECT, cu->user->nick);
+ if (isop)
+ c->RemoveMode(NULL, CMODE_OP, cu->user->nick);
}
}
notice_lang(Config.s_ChanServ, u, CHAN_CLEARED_OPS, chan);
} else if (ModeManager::FindChannelModeByName(CMODE_HALFOP) && what == "hops") {
- const char *av[4];
- int ac;
- char buf[BUFSIZE];
struct c_userlist *cu, *bnext;
- for (cu = c->users; cu; cu = bnext) {
+ for (cu = c->users; cu; cu = bnext)
+ {
bnext = cu->next;
+
if (!chan_has_user_status(c, cu->user, CUS_HALFOP))
continue;
- if (ircdcap->tsmode) {
- snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long>(time(NULL)));
- av[0] = chan;
- av[1] = buf;
- av[2] = "-h";
- av[3] = cu->user->nick;
- ac = 4;
- } else {
- av[0] = chan;
- av[1] = "-h";
- av[2] = cu->user->nick;
- ac = 3;
- }
-
- if (ircd->svsmode_ucmode) {
- if (ircdcap->tsmode)
- ircdproto->SendSVSModeChan(av[0], av[2], NULL);
- else
- ircdproto->SendSVSModeChan(av[0], av[1], NULL);
-
- do_cmode(Config.s_ChanServ, ac, av);
- break;
- } else {
- if (ircdcap->tsmode)
- ircdproto->SendMode(whosends(ci), av[0], "%s %s", av[2],
- av[3]);
- else
- ircdproto->SendMode(whosends(ci), av[0], "%s %s", av[1],
- av[2]);
- }
- do_cmode(Config.s_ChanServ, ac, av);
+ c->RemoveMode(NULL, CMODE_HALFOP, cu->user->nick);
}
+
notice_lang(Config.s_ChanServ, u, CHAN_CLEARED_HOPS, chan);
} else if (what == "voices") {
- const char *av[4];
- int ac;
- char buf[BUFSIZE];
struct c_userlist *cu, *bnext;
- for (cu = c->users; cu; cu = bnext) {
+ for (cu = c->users; cu; cu = bnext)
+ {
bnext = cu->next;
+
if (!chan_has_user_status(c, cu->user, CUS_VOICE))
continue;
- if (ircdcap->tsmode) {
- snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long int>(time(NULL)));
- av[0] = chan;
- av[1] = buf;
- av[2] = "-v";
- av[3] = cu->user->nick;
- ac = 4;
- } else {
- av[0] = chan;
- av[1] = "-v";
- av[2] = cu->user->nick;
- ac = 3;
- }
-
- if (ircd->svsmode_ucmode) {
- if (ircdcap->tsmode)
- ircdproto->SendSVSModeChan(av[0], av[2], NULL);
- else
- ircdproto->SendSVSModeChan(av[0], av[1], NULL);
-
- do_cmode(Config.s_ChanServ, ac, av);
- break;
- } else {
- if (ircdcap->tsmode) {
- ircdproto->SendMode(whosends(ci), av[0], "%s %s", av[2],
- av[3]);
- } else {
- ircdproto->SendMode(whosends(ci), av[0], "%s %s", av[1],
- av[2]);
- }
- }
- do_cmode(Config.s_ChanServ, ac, av);
+ c->RemoveMode(NULL, CMODE_VOICE, cu->user->nick);
}
+
notice_lang(Config.s_ChanServ, u, CHAN_CLEARED_VOICES, chan);
} else if (what == "users") {
const char *av[3];
diff --git a/src/core/cs_drop.c b/src/core/cs_drop.c
index 1999ef02e..561f79e6f 100644
--- a/src/core/cs_drop.c
+++ b/src/core/cs_drop.c
@@ -61,8 +61,7 @@ class CommandCSDrop : public Command
{
if (ModeManager::FindChannelModeByName(CMODE_REGISTERED))
{
- ci->c->RemoveMode(CMODE_REGISTERED);
- ircdproto->SendMode(whosends(ci), ci->name, "-r");
+ ci->c->RemoveMode(NULL, CMODE_REGISTERED);
}
}
diff --git a/src/core/cs_modes.c b/src/core/cs_modes.c
index f1ad758d0..9dc76e10f 100644
--- a/src/core/cs_modes.c
+++ b/src/core/cs_modes.c
@@ -28,11 +28,9 @@
*/
static CommandReturn do_util(User *u, ChannelMode *cm, const char *chan, const char *nick, bool set, int level, int levelself, const std::string &name, ChannelInfoFlag notice)
{
- const char *av[2];
Channel *c = findchan(chan);
ChannelInfo *ci;
User *u2;
- char modebuf[3];
int is_same;
@@ -58,14 +56,10 @@ static CommandReturn do_util(User *u, ChannelMode *cm, const char *chan, const c
notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
else
{
- snprintf(modebuf, sizeof(modebuf), "%c%c", (set ? '+' : '-'), cm->ModeChar);
-
- ircdproto->SendMode(whosends(ci), c->name, "%s %s", modebuf, u2->nick);
-
- av[0] = modebuf;
- av[1] = u2->nick;
-
- chan_set_modes(Config.s_ChanServ, c, 2, av, 3);
+ if (set)
+ c->SetMode(NULL, cm, u2->nick);
+ else
+ c->RemoveMode(NULL, cm, u2->nick);
if (notice && ci->HasFlag(notice))
ircdproto->SendMessage(whosends(ci), c->name, "%s command used for %s by %s",
diff --git a/src/core/cs_register.c b/src/core/cs_register.c
index 6a258a684..364fed989 100644
--- a/src/core/cs_register.c
+++ b/src/core/cs_register.c
@@ -82,9 +82,9 @@ class CommandCSRegister : public Command
check_modes(c);
/* On most ircds you do not receive the admin/owner mode till its registered */
if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER)))
- ircdproto->SendMode(findbot(Config.s_ChanServ), chan, "+%c %s", cm->ModeChar, u->nick);
+ c->SetMode(NULL, cm, u->nick);
else if ((cm = ModeManager::FindChannelModeByName(CMODE_PROTECT)))
- ircdproto->SendMode(findbot(Config.s_ChanServ), chan, "+%c %s", cm->ModeChar, u->nick);
+ c->RemoveMode(NULL, cm, u->nick);
/* Mark the channel as persistant */
if (c->HasMode(CMODE_PERM))
@@ -92,7 +92,7 @@ class CommandCSRegister : public Command
/* Persist may be in def cflags, set it here */
else if (ci->HasFlag(CI_PERSIST) && (cm = ModeManager::FindChannelModeByName(CMODE_PERM)))
{
- ircdproto->SendMode(whosends(ci), chan, "+%c", cm->ModeChar);
+ c->SetMode(NULL, CMODE_PERM);
ci->SetFlag(CI_PERSIST);
}
diff --git a/src/core/cs_set.c b/src/core/cs_set.c
index c7cb6bc2b..fa0a21d68 100644
--- a/src/core/cs_set.c
+++ b/src/core/cs_set.c
@@ -568,8 +568,7 @@ class CommandCSSet : public Command
/* Set the perm mode */
if (cm && ci->c && !ci->c->HasMode(CMODE_PERM))
{
- ci->c->SetMode(CMODE_PERM);
- ircdproto->SendMode(whosends(ci), ci->c->name, "+%c", cm->ModeChar);
+ ci->c->SetMode(NULL, CMODE_PERM);
}
}
@@ -584,8 +583,7 @@ class CommandCSSet : public Command
/* Unset perm mode */
if (ci->c && ci->c->HasMode(CMODE_PERM))
{
- ircdproto->SendMode(whosends(ci), ci->c->name, "-%c", cm->ModeChar);
- ci->c->RemoveMode(CMODE_PERM);
+ ci->c->RemoveMode(NULL, CMODE_PERM);
}
/* Persist is set off... remove the bot and delete the channel if its empty */
else if (ci->c)
diff --git a/src/core/ns_logout.c b/src/core/ns_logout.c
index 4304d7b18..ed85370a5 100644
--- a/src/core/ns_logout.c
+++ b/src/core/ns_logout.c
@@ -48,9 +48,6 @@ class CommandNSLogout : public Command
validate_user(u2);
}
- if (ircd->modeonunreg)
- common_svsmode(u2, ircd->modeonunreg, "1");
-
u2->isSuperAdmin = 0; /* Dont let people logout and remain a SuperAdmin */
alog("%s: %s!%s@%s logged out nickname %s", Config.s_NickServ, u->nick, u->GetIdent().c_str(), u->host, u2->nick);
@@ -65,6 +62,7 @@ class CommandNSLogout : public Command
del_ns_timeout(na, TO_COLLIDE);
ircdproto->SendAccountLogout(u2, u2->nc);
+ ircdproto->SendUnregisteredNick(u2);
u2->nc = NULL;
diff --git a/src/core/os_clearmodes.c b/src/core/os_clearmodes.c
index 2c3658570..d2e136983 100644
--- a/src/core/os_clearmodes.c
+++ b/src/core/os_clearmodes.c
@@ -24,7 +24,6 @@ class CommandOSClearModes : public Command
CommandReturn Execute(User *u, const std::vector<ci::string> &params)
{
- const char *argv[2];
const char *chan = params[0].c_str();
Channel *c;
int all = 0;
@@ -61,31 +60,31 @@ class CommandOSClearModes : public Command
/* Clear mode +o */
if (ircd->svsmode_ucmode)
ircdproto->SendSVSModeChan(c->name, "-o", NULL);
- for (cu = c->users; cu; cu = next)
+ else
{
- next = cu->next;
- if (!chan_has_user_status(c, cu->user, CUS_OP))
- continue;
- argv[0] = "-o";
- argv[1] = cu->user->nick;
- if (!ircd->svsmode_ucmode)
- ircdproto->SendMode(findbot(Config.s_OperServ), c->name, "-o %s", cu->user->nick);
- chan_set_modes(Config.s_OperServ, c, 2, argv, 0);
+ for (cu = c->users; cu; cu = next)
+ {
+ next = cu->next;
+ if (!chan_has_user_status(c, cu->user, CUS_OP))
+ continue;
+
+ c->RemoveMode(NULL, CMODE_OP, cu->user->nick);
+ }
}
/* Clear mode +v */
if (ircd->svsmode_ucmode)
ircdproto->SendSVSModeChan(c->name, "-v", NULL);
- for (cu = c->users; cu; cu = next)
+ else
{
- next = cu->next;
- if (!chan_has_user_status(c, cu->user, CUS_VOICE))
- continue;
- argv[0] = "-v";
- argv[1] = cu->user->nick;
- if (!ircd->svsmode_ucmode)
- ircdproto->SendMode(findbot(Config.s_OperServ), c->name, "-v %s", cu->user->nick);
- chan_set_modes(Config.s_OperServ, c, 2, argv, 0);
+ for (cu = c->users; cu; cu = next)
+ {
+ next = cu->next;
+ if (!chan_has_user_status(c, cu->user, CUS_VOICE))
+ continue;
+
+ c->RemoveMode(NULL, CMODE_VOICE, cu->user->nick);
+ }
}
/* Clear mode +h */
@@ -93,16 +92,16 @@ class CommandOSClearModes : public Command
{
if (ircd->svsmode_ucmode)
ircdproto->SendSVSModeChan(c->name, "-h", NULL);
- for (cu = c->users; cu; cu = next)
+ else
{
- next = cu->next;
- if (!chan_has_user_status(c, cu->user, CUS_HALFOP))
- continue;
- argv[0] = "-h";
- argv[1] = cu->user->nick;
- if (!ircd->svsmode_ucmode)
- ircdproto->SendMode(findbot(Config.s_OperServ), c->name, "-h %s", cu->user->nick);
- chan_set_modes(Config.s_OperServ, c, 2, argv, 0);
+ for (cu = c->users; cu; cu = next)
+ {
+ next = cu->next;
+ if (!chan_has_user_status(c, cu->user, CUS_HALFOP))
+ continue;
+
+ c->RemoveMode(NULL, CMODE_HALFOP, cu->user->nick);
+ }
}
}
@@ -114,16 +113,16 @@ class CommandOSClearModes : public Command
if (ircd->svsmode_ucmode)
ircdproto->SendSVSModeChan(c->name, buf.c_str(), NULL);
- for (cu = c->users; cu; cu = next)
+ else
{
- next = cu->next;
- if (!chan_has_user_status(c, cu->user, CUS_OWNER))
- continue;
- argv[0] = buf.c_str();
- argv[1] = cu->user->nick;
- if (!ircd->svsmode_ucmode)
- ircdproto->SendMode(findbot(Config.s_OperServ), c->name, "%s %s", buf.c_str(), cu->user->nick);
- chan_set_modes(Config.s_OperServ, c, 2, argv, 0);
+ for (cu = c->users; cu; cu = next)
+ {
+ next = cu->next;
+ if (!chan_has_user_status(c, cu->user, CUS_OWNER))
+ continue;
+
+ c->RemoveMode(NULL, CMODE_OWNER, cu->user->nick);
+ }
}
}
@@ -135,26 +134,25 @@ class CommandOSClearModes : public Command
if (ircd->svsmode_ucmode)
ircdproto->SendSVSModeChan(c->name, buf.c_str(), NULL);
- for (cu = c->users; cu; cu = next)
+ else
{
- next = cu->next;
- if (!chan_has_user_status(c, cu->user, CUS_PROTECT))
- continue;
- argv[0] = buf.c_str();
- argv[1] = cu->user->nick;
- if (!ircd->svsmode_ucmode)
- ircdproto->SendMode(findbot(Config.s_OperServ), c->name, "%s %s", buf.c_str(), cu->user->nick);
- chan_set_modes(Config.s_OperServ, c, 2, argv, 0);
+ for (cu = c->users; cu; cu = next)
+ {
+ next = cu->next;
+ if (!chan_has_user_status(c, cu->user, CUS_PROTECT))
+ continue;
+
+ c->RemoveMode(NULL, CMODE_PROTECT, cu->user->nick);
+ }
}
}
}
- c->ClearModes(Config.s_OperServ);
-
- c->ClearBans(Config.s_OperServ);
- c->ClearExcepts(Config.s_OperServ);
- c->ClearInvites(Config.s_OperServ);
+ c->ClearModes();
+ c->ClearBans();
+ c->ClearExcepts();
+ c->ClearInvites();
}
if (all)
diff --git a/src/core/os_defcon.c b/src/core/os_defcon.c
index 2ab97058a..5cdb38b9b 100644
--- a/src/core/os_defcon.c
+++ b/src/core/os_defcon.c
@@ -186,8 +186,7 @@ class OSDEFCON : public Module
if (CheckDefCon(DEFCON_FORCE_CHAN_MODES) && cm && DefConModesOff.HasFlag(Name))
{
- c->RemoveMode(Name);
- ircdproto->SendMode(findbot(Config.s_OperServ), c->name, "-%c", cm->ModeChar);
+ c->RemoveMode(NULL, Name);
}
}
@@ -198,18 +197,14 @@ class OSDEFCON : public Module
if (CheckDefCon(DEFCON_FORCE_CHAN_MODES) && cm && DefConModesOn.HasFlag(Name))
{
std::string param;
- GetDefConParam(Name, &param);
- std::string buf = "+" + std::string(&cm->ModeChar);
- if (!param.empty())
+ if (GetDefConParam(Name, &param))
{
- buf += " " + param;
- c->SetMode(Name, param);
+ c->SetMode(NULL, Name, param);
}
else
- c->SetMode(Name);
+ c->SetMode(NULL, Name);
- ircdproto->SendMode(findbot(Config.s_OperServ), c->name, buf.c_str());
}
}
@@ -328,20 +323,9 @@ class OSDEFCON : public Module
void OnChannelCreate(Channel *c)
{
- char *myModes;
- int ac;
- const char **av;
-
if (CheckDefCon(DEFCON_FORCE_CHAN_MODES))
{
- myModes = sstrdup(Config.DefConChanModes);
- ac = split_buf(myModes, &av, 1);
-
- ircdproto->SendMode(findbot(Config.s_OperServ), c->name, "%s", Config.DefConChanModes);
- chan_set_modes(Config.s_OperServ, c, ac, av, 1);
-
- free(av);
- delete [] myModes;
+ c->SetModes(findbot(Config.s_OperServ), false, Config.DefConChanModes);
}
}
};
@@ -385,7 +369,7 @@ void runDefCon()
{
alog("DEFCON: setting %s on all chan's", Config.DefConChanModes);
DefConModesSet = 1;
- do_mass_mode(Config.DefConChanModes);
+ MassChannelModes(findbot(Config.s_OperServ), Config.DefConChanModes);
}
}
}
@@ -399,7 +383,7 @@ void runDefCon()
if ((newmodes = defconReverseModes(Config.DefConChanModes)))
{
alog("DEFCON: setting %s on all chan's", newmodes);
- do_mass_mode(newmodes);
+ MassChannelModes(findbot(Config.s_OperServ), newmodes);
delete [] newmodes;
}
}
diff --git a/src/core/os_mode.c b/src/core/os_mode.c
index 6984c73f7..af19bb6d5 100644
--- a/src/core/os_mode.c
+++ b/src/core/os_mode.c
@@ -24,8 +24,6 @@ class CommandOSMode : public Command
CommandReturn Execute(User *u, const std::vector<ci::string> &params)
{
- int ac;
- const char **av;
const char *chan = params[0].c_str(), *modes = params[1].c_str();
Channel *c;
@@ -35,11 +33,7 @@ class CommandOSMode : public Command
notice_lang(Config.s_OperServ, u, OPER_BOUNCY_MODES_U_LINE);
else
{
- ircdproto->SendMode(findbot(Config.s_OperServ), chan, "%s", modes);
-
- ac = split_buf(const_cast<char *>(modes), /* XXX */ &av, 1);
- chan_set_modes(Config.s_OperServ, c, ac, av, -1);
- free(av);
+ c->SetModes(findbot(Config.s_OperServ), false, modes);
if (Config.WallOSMode)
ircdproto->SendGlobops(Config.s_OperServ, "%s used MODE %s on %s", u->nick, modes, chan);
diff --git a/src/core/os_oline.c b/src/core/os_oline.c
index b96f1451f..883f9344e 100644
--- a/src/core/os_oline.c
+++ b/src/core/os_oline.c
@@ -34,7 +34,7 @@ class CommandOSOLine : public Command
else if (u2 && flag[0] == '+')
{
ircdproto->SendSVSO(Config.s_OperServ, nick, flag);
- common_svsmode(u2, "+o", NULL);
+ u2->SetMode(UMODE_OPER);
notice_lang(Config.s_OperServ, u2, OPER_OLINE_IRCOP);
notice_lang(Config.s_OperServ, u, OPER_OLINE_SUCCESS, flag, nick);
ircdproto->SendGlobops(Config.s_OperServ, "\2%s\2 used OLINE for %s", u->nick, nick);
diff --git a/src/core/os_umode.c b/src/core/os_umode.c
index 34e3502e2..6f86dbd44 100644
--- a/src/core/os_umode.c
+++ b/src/core/os_umode.c
@@ -42,9 +42,7 @@ class CommandOSUMode : public Command
notice_lang(Config.s_OperServ, u, NICK_X_NOT_IN_USE, nick);
else
{
- ircdproto->SendMode(findbot(Config.s_OperServ), nick, "%s", modes);
-
- common_svsmode(u2, modes, NULL);
+ u2->SetModes(modes);
notice_lang(Config.s_OperServ, u, OPER_UMODE_SUCCESS, nick);
notice_lang(Config.s_OperServ, u2, OPER_UMODE_CHANGED, u->nick);