X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fopserv.c;h=0ce488403e0aea6300dee479518a57841e31f92e;hb=df0167a7589aae5bba7c966843fc006da17050c9;hp=e81b7840c2d821945f44d762df0513b17d480a21;hpb=a1607b87da7b66314f864f272b9806f4b0fe8169;p=srvx.git diff --git a/src/opserv.c b/src/opserv.c index e81b784..0ce4884 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -268,6 +268,8 @@ static const struct message_entry msgtab[] = { { "OSMSG_SVSNICKUSED", "$b%s$b is an already used nickname." }, { "OSMSG_SVSNICK", "You have renamed $b%s$b to $b%s$b." }, { "OSMSG_SVSJOIN", "$b%s$b joined $b%s$b." }, + { "OSMSG_SVSPART", "$b%s$b parted $b%s$b." }, + { "OSMSG_SVSKILL", "$b%s$b killed: $b%s$b." }, { "OSMSG_SVSMODE", "You have set mode $b%s$b for $b%s$b." }, { "OSMSG_SIMUL", "You have simuled $b%s$b: %s" }, { "OSMSG_DEVNULL_USER" , "[%s] %s %s" }, @@ -433,13 +435,13 @@ opserv_free_user_alert(void *data) } #if defined(GCC_VARMACROS) -# define opserv_debug(ARGS...) do { if (opserv_conf.debug_channel) send_channel_notice(opserv_conf.debug_channel, opserv, ARGS); } while (0) -# define opserv_alert(ARGS...) do { if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel, opserv, ARGS); } while (0) -# define opserv_custom_alert(CHAN, ARGS...) do { if (CHAN) send_target_message(4, (CHAN), opserv, ARGS); else if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel, opserv, ARGS); } while (0) +# define opserv_debug(ARGS...) do { if (opserv_conf.debug_channel) send_channel_message(opserv_conf.debug_channel, opserv, ARGS); } while (0) +# define opserv_alert(ARGS...) do { if (opserv_conf.alert_channel) send_channel_message(opserv_conf.alert_channel, opserv, ARGS); } while (0) +# define opserv_custom_alert(CHAN, ARGS...) do { if (CHAN) send_target_message(5, (CHAN), opserv, ARGS); else if (opserv_conf.alert_channel) send_channel_message(opserv_conf.alert_channel, opserv, ARGS); } while (0) #elif defined(C99_VARMACROS) -# define opserv_debug(...) do { if (opserv_conf.debug_channel) send_channel_notice(opserv_conf.debug_channel, opserv, __VA_ARGS__); } while (0) -# define opserv_alert(...) do { if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel, opserv, __VA_ARGS__); } while (0) -# define opserv_custom_alert(chan, ...) do { if (chan) send_target_message(4, chan, opserv, __VA_ARGS__); else if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel, opserv, __VA_ARGS__); } while (0) +# define opserv_debug(...) do { if (opserv_conf.debug_channel) send_channel_message(opserv_conf.debug_channel, opserv, __VA_ARGS__); } while (0) +# define opserv_alert(...) do { if (opserv_conf.alert_channel) send_channel_message(opserv_conf.alert_channel, opserv, __VA_ARGS__); } while (0) +# define opserv_custom_alert(chan, ...) do { if (chan) send_target_message(5, chan, opserv, __VA_ARGS__); else if (opserv_conf.alert_channel) send_channel_message(opserv_conf.alert_channel, opserv, __VA_ARGS__); } while (0) #endif /* A lot of these commands are very similar to what ChanServ can do, @@ -4094,6 +4096,8 @@ opserv_staff_alert(struct userNode *user, UNUSED_ARG(struct handle_info *old_han || user->uplink->burst || !user->handle_info) return; + else if (IsBot(user)) + return; else if (user->handle_info->opserv_level) type = "OPER"; else if (IsNetworkHelper(user)) @@ -4104,9 +4108,9 @@ opserv_staff_alert(struct userNode *user, UNUSED_ARG(struct handle_info *old_han return; if (irc_in_addr_is_valid(user->ip)) - send_channel_notice(opserv_conf.staff_auth_channel, opserv, IDENT_FORMAT" authed to %s account %s", IDENT_DATA(user), type, user->handle_info->handle); + send_channel_message(opserv_conf.staff_auth_channel, opserv, IDENT_FORMAT" authed to %s account %s", IDENT_DATA(user), type, user->handle_info->handle); else - send_channel_notice(opserv_conf.staff_auth_channel, opserv, "%s [%s@%s] authed to %s account %s", user->nick, user->ident, user->hostname, type, user->handle_info->handle); + send_channel_message(opserv_conf.staff_auth_channel, opserv, "%s [%s@%s] authed to %s account %s", user->nick, user->ident, user->hostname, type, user->handle_info->handle); } static void @@ -4770,6 +4774,34 @@ static MODCMD_FUNC(cmd_svsjoin) return 1; } +static MODCMD_FUNC(cmd_svspart) +{ + struct userNode *target; + if(!(target=GetUserH(argv[1]))) { + reply("OSMSG_SVSNONICK", argv[1]); + return 0; + } + if(!IsChannelName(argv[2])) + { + reply("MSG_NOT_CHANNEL_NAME"); + return 0; + } + irc_svspartchan(opserv,target,argv[2]); + reply("OSMSG_SVSPART",target->nick,argv[2]); + return 1; +} + +static MODCMD_FUNC(cmd_svskill) +{ + struct userNode *target; + if(!(target=GetUserH(argv[1]))) { + reply("OSMSG_SVSNONICK", argv[1]); + return 0; + } + DelUser(target, opserv, 1, argv[2]); + reply("OSMSG_SVSKILL",target->nick,argv[2]); + return 1; +} static MODCMD_FUNC(cmd_svsnick) { struct userNode *target; @@ -4805,14 +4837,17 @@ static MODCMD_FUNC(cmd_simul) { struct userNode *target; char *line; - if(!(target=GetUserH(argv[1]))) { - reply("OSMSG_SVSNONICK", argv[1]); - return 0; + if(argc > 2) { + if(!(target=GetUserH(argv[1]))) { + reply("OSMSG_SVSNONICK", argv[1]); + return 0; + } + line = unsplit_string(argv + 2, argc - 2, NULL); + irc_simul(target,line); + reply("OSMSG_SIMUL",target->nick,line); + return 1; } - line = unsplit_string(argv + 2, argc - 2, NULL); - irc_simul(target,line); - reply("OSMSG_SIMUL",target->nick,line); - return 1; + return 0; } static MODCMD_FUNC(cmd_relay) @@ -5080,10 +5115,12 @@ init_opserv(const char *nick) opserv_define_func("DEVNULL SET", cmd_setdevnull, 200, 0, 2); opserv_define_func("DEVNULL LIST", cmd_listdevnull, 200, 0, 0); opserv_define_func("SVSJOIN", cmd_svsjoin, 800, 0, 3); + opserv_define_func("SVSPART", cmd_svspart, 800, 0, 3); + opserv_define_func("SVSKILL", cmd_svskill, 800, 0, 3); opserv_define_func("SVSMODE", cmd_svsmode, 800, 0, 3); opserv_define_func("SVSNICK", cmd_svsnick, 800, 0, 3); opserv_define_func("RELAY", cmd_relay, 800, 0, 0); - opserv_define_func("SIMUL", cmd_simul, 999, 0, 2); + opserv_define_func("SIMUL", cmd_simul, 999, 0, 3); opserv_define_func("TRACE", cmd_trace, 100, 0, 3); opserv_define_func("TRACE PRINT", NULL, 0, 0, 0); opserv_define_func("TRACE COUNT", NULL, 0, 0, 0);