summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authordane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-08-23 18:36:58 +0000
committerdane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-08-23 18:36:58 +0000
commit61a23cd017465cd2bff5f037cf54e051a6318b37 (patch)
tree5827cad42b833c88be5783d457ffb03b00c785bf /src/actions.c
parent26ea4bc11b4e07bbeb95031f2337ff695f83cc16 (diff)
BUILD : 1.7.5 (327) BUGS : none NOTES : Merged anope-capab into main trunk...
git-svn-id: svn://svn.anope.org/anope/trunk@327 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@203 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c163
1 files changed, 125 insertions, 38 deletions
diff --git a/src/actions.c b/src/actions.c
index cb7fd0851..a863eae76 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -38,43 +38,12 @@ void bad_password(User * u)
/*************************************************************************/
-void change_user_mode(User * u, char *modes, char *arg)
-{
-#ifndef IRC_HYBRID
- int ac = 1;
- char *av[2];
-
- av[0] = modes;
- if (arg) {
- av[1] = arg;
- ac++;
- }
-#ifdef IRC_BAHAMUT
- send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, u->timestamp,
- av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : ""));
-#else
- send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0],
- (ac == 2 ? " " : ""), (ac == 2 ? av[1] : ""));
-#endif
- set_umode(u, ac, av);
-#endif
-}
-
-/*************************************************************************/
-
/* Remove a user from the IRC network. `source' is the nick which should
* generate the kill, or NULL for a server-generated kill.
*/
-void kill_user(const char *source, const char *user, const char *reason)
+void kill_user(char *source, char *user, char *reason)
{
-#ifdef IRC_BAHAMUT
- /* Bahamut uses SVSKILL as a better way to kill users. It sends back
- * a QUIT message that Anope uses to clean up after the kill is done.
- */
- send_cmd(NULL, "SVSKILL %s :%s", user, reason);
-#else
- char *av[2];
char buf[BUFSIZE];
if (!user || !*user)
@@ -83,13 +52,131 @@ void kill_user(const char *source, const char *user, const char *reason)
source = ServerName;
if (!reason)
reason = "";
+
snprintf(buf, sizeof(buf), "%s (%s)", source, reason);
- av[0] = sstrdup(user);
- av[1] = buf;
- send_cmd(source, "KILL %s :%s", user, av[1]);
- do_kill(source, 2, av);
- free(av[0]);
-#endif
+
+ anope_cmd_svskill(source, user, buf);
+
+ if (!ircd->quitonkill) {
+ do_kill(user, buf);
+ }
+}
+
+/*************************************************************************/
+
+void sqline(char *mask, char *reason)
+{
+ if (ircd->chansqline) {
+ if (*mask == '#') {
+ int i;
+ Channel *c, *next;
+
+ char *av[3];
+ struct c_userlist *cu, *cunext;
+
+ anope_cmd_sqline(mask, reason);
+
+ for (i = 0; i < 1024; i++) {
+ for (c = chanlist[i]; c; c = next) {
+ next = c->next;
+
+ if (!match_wild_nocase(mask, c->name))
+ continue;
+
+ for (cu = c->users; cu; cu = cunext) {
+ cunext = cu->next;
+
+ if (is_oper(cu->user))
+ continue;
+
+ av[0] = c->name;
+ av[1] = cu->user->nick;
+ av[2] = reason;
+ anope_cmd_kick(s_OperServ, av[0], av[1],
+ "Q-Lined: %s", av[2]);
+ do_kick(s_ChanServ, 3, av);
+ }
+ }
+ }
+ } else {
+ anope_cmd_sqline(mask, reason);
+ }
+ } else {
+ anope_cmd_sqline(mask, reason);
+ }
+}
+
+/*************************************************************************/
+
+void common_unban(ChannelInfo * ci, char *nick)
+{
+ int count, i;
+ char *av[3], **bans;
+ User *u;
+
+ if (!ci || !ci->c || !ci->bi || !nick)
+ return;
+ if (!(u = finduser(nick)))
+ return;
+
+ if (ircd->svsmode_unban) {
+ anope_cmd_unban(ci->name, nick);
+ } else {
+ av[0] = ci->name;
+ av[1] = sstrdup("-b");
+ count = ci->c->bancount;
+ bans = scalloc(sizeof(char *) * count, 1);
+ memcpy(bans, ci->c->bans, sizeof(char *) * count);
+ for (i = 0; i < count; i++) {
+ if (match_usermask(bans[i], u)) {
+ anope_cmd_mode(whosends(ci), ci->name, "-b %s", bans[i]);
+ av[2] = bans[i];
+ do_cmode(ci->bi->nick, 3, av);
+ }
+ }
+ free(bans);
+ free(av[1]);
+ }
+}
+
+/*************************************************************************/
+
+void common_svsmode(User * u, char *modes, char *arg)
+{
+ int ac = 1;
+ char *av[2];
+
+ av[0] = modes;
+ if (arg) {
+ av[1] = arg;
+ ac++;
+ }
+ anope_cmd_svsmode(u, ac, av);
+ anope_set_umode(u, ac, av);
+}
+
+/*************************************************************************/
+
+char *common_get_vhost(User * u)
+{
+ if (u->mode & ircd->vhostmode) {
+ return u->vhost;
+ } else {
+ return u->host;
+ }
}
/*************************************************************************/
+
+char *common_get_vident(User * u)
+{
+ if (u->mode & ircd->vhostmode) {
+ if (u->vident) {
+ return u->vident;
+ } else {
+ return u->username;
+ }
+ } else {
+ return u->username;
+ }
+}