}
static void
-chanserv_ctcp_check(struct userNode *user, struct chanNode *channel, const char *text, UNUSED_ARG(struct userNode *bot), UNUSED_ARG(unsigned int is_notice))
+chanserv_ctcp_check(struct userNode *user, struct chanNode *channel, const char *text, UNUSED_ARG(struct userNode *bot), UNUSED_ARG(unsigned int is_notice), UNUSED_ARG(void *extra))
{
unsigned int eflags, argc;
char *argv[4];
continue;
sbuf.used = 0;
string_buffer_append_printf(&sbuf, "[%s (%d", cData->channel->name, uData->access);
- if(uData->flags == USER_AUTO_OP)
+ if(uData->flags != 0)
string_buffer_append(&sbuf, ',');
if(IsUserSuspended(uData))
string_buffer_append(&sbuf, 's');
static MODCMD_FUNC(chan_opt_automode)
{
- if(check_user_level(channel, user, lvlInviteMe, 1, 0))
- {
- reply("CSMSG_LOW_CHANNEL_ACCESS", channel->name);
- }
return channel_multiple_option(chAutomode, CSFUNC_ARGS);
}
static struct svccmd_list set_shows_list;
static void
-handle_svccmd_unbind(struct svccmd *target) {
+handle_svccmd_unbind(struct svccmd *target, UNUSED_ARG(void *extra)) {
unsigned int ii;
for(ii=0; ii<set_shows_list.used; ++ii)
if(target == set_shows_list.list[ii])
REQUIRE_PARAMS(2);
if(!(hi = modcmd_get_handle_info(user, argv[1]))) return 0;
+ actor = GetChannelUser(channel->channel_info, user->handle_info);
real_actor = GetChannelAccess(channel->channel_info, user->handle_info);
if(!(target = GetTrueChannelAccess(channel->channel_info, hi)))
{
}
/* random time gline */
else if (!strcasecmp(wheel, "gline")) {
- char target[IRC_NTOP_MAX_SIZE + 3];
+ char target[HOSTLEN + 3];
int wtime = 120 + rand() % 600;
strcpy(target, "*@");
strcat(target, user->hostname);
send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_GLINE");
- gline_add(chanserv->nick, target, wtime, "Reward for spinning the wheel of misfortune!", now, now, 1, 0);
+ gline_add(chanserv->nick, target, wtime, "Reward for spinning the wheel of misfortune!", now, 1, 0);
// irc_kill(chanserv, user, "Reward for spinning the wheel of misfortune!");
}
/* random shun */
else if (!strcasecmp(wheel, "shun")) {
- char target[IRC_NTOP_MAX_SIZE + 3];
+ char target[HOSTLEN + 3];
int wtime = 120 + rand() % 600;
strcpy(target, "*@");
strcat(target, user->hostname);
send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_SHUN");
- shun_add(chanserv->nick, target, wtime, "Reward for spinning the wheel of misfortune!", now, now, 1);
+ shun_add(chanserv->nick, target, wtime, "Reward for spinning the wheel of misfortune!", now, 1);
}
/* absolutely nothing */
else if (!strcasecmp(wheel, "nothing")) {
/* service ignore */
else if (!strcasecmp(wheel, "svsignore")) {
int gagged, ignoretime = 0;
- char target[IRC_NTOP_MAX_SIZE + 13];
+ char target[HOSTLEN + 13];
if(IsOper(user)) {
/* we cant gag opers, so just verbally abuse them */
else if (!strcasecmp(wheel, "kickbanall")) {
unsigned int count, n;
struct modeNode *mn;
- //char ban[IRC_NTOP_MAX_SIZE + 1];
+ //char ban[HOSTLEN + 1];
send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_KICKBANALL");
word3 = argc>3?argv[3]:"";
/*** COLOR *****/
- if((word2) && strcasecmp(word1, "what") == 0 && strcasecmp(word2, "color") == 0)
+ if((word2) && strcasecmp(word1, "what") == 0 && ((strcasecmp(word2, "color") == 0) || (strcasecmp(word2, "colour") == 0)))
eightball(eb, 1, accum);
- else if((word3) && strcasecmp(word1, "what's") == 0 && strcasecmp(word2, "the") == 0 && strcasecmp(word3, "color") == 0)
+ else if((word3) && strcasecmp(word1, "what's") == 0 && strcasecmp(word2, "the") == 0 && ((strcasecmp(word2, "color") == 0) || (strcasecmp(word2, "colour") == 0)))
eightball(eb, 1, accum);
- else if((word3) && strcasecmp(word1, "whats") == 0 && strcasecmp(word2, "the") == 0 && strcasecmp(word3, "color") == 0)
+ else if((word3) && strcasecmp(word1, "whats") == 0 && strcasecmp(word2, "the") == 0 && ((strcasecmp(word2, "color") == 0) || (strcasecmp(word2, "colour") == 0)))
eightball(eb, 1, accum);
/*** LOCATION *****/
else if(
}
static void
-handle_new_channel(struct chanNode *channel)
+handle_new_channel(struct chanNode *channel, UNUSED_ARG(void *extra))
{
struct chanData *cData;
/* Welcome to my worst nightmare. Warning: Read (or modify)
the code below at your own risk. */
static int
-handle_join(struct modeNode *mNode)
+handle_join(struct modeNode *mNode, UNUSED_ARG(void *extra))
{
struct mod_chanmode change;
struct userNode *user = mNode->user;
}
static void
-handle_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle))
+handle_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle), UNUSED_ARG(void *extra))
{
struct mod_chanmode change;
struct userData *channel;
}
static void
-handle_part(struct modeNode *mn, UNUSED_ARG(const char *reason))
+handle_part(struct modeNode *mn, UNUSED_ARG(const char *reason), UNUSED_ARG(void *extra))
{
struct chanData *cData;
struct userData *uData;
if(IsHelping(mn->user) && IsSupportHelper(mn->user))
{
unsigned int ii;
- for(ii = 0; ii < chanserv_conf.support_channels.used; ++ii)
- if(find_handle_in_channel(chanserv_conf.support_channels.list[ii], mn->user->handle_info, mn->user))
+ for(ii = 0; ii < chanserv_conf.support_channels.used; ++ii) {
+ struct chanNode *channel;
+ struct userNode *exclude;
+ /* When looking at the channel that is being /part'ed, we
+ * have to skip over the client that is leaving. For
+ * other channels, we must not do that.
+ */
+ channel = chanserv_conf.support_channels.list[ii];
+ exclude = (channel == mn->channel) ? mn->user : NULL;
+ if(find_handle_in_channel(channel, mn->user->handle_info, exclude))
break;
- if(ii == chanserv_conf.support_channels.used)
+ }
+ if(ii == chanserv_conf.support_channels.used)
HANDLE_CLEAR_FLAG(mn->user->handle_info, HELPING);
}
}
static void
-handle_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *channel)
+handle_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *channel, UNUSED_ARG(void *extra))
{
struct userData *uData;
}
static int
-handle_topic(struct userNode *user, struct chanNode *channel, const char *old_topic)
+handle_topic(struct userNode *user, struct chanNode *channel, const char *old_topic, UNUSED_ARG(void *extra))
{
struct chanData *cData;
}
static void
-handle_mode(struct chanNode *channel, struct userNode *user, const struct mod_chanmode *change)
+handle_mode(struct chanNode *channel, struct userNode *user, const struct mod_chanmode *change, UNUSED_ARG(void *extra))
{
struct mod_chanmode *bounce = NULL;
unsigned int bnc, ii;
}
static void
-handle_nick_change(struct userNode *user, UNUSED_ARG(const char *old_nick))
+handle_nick_change(struct userNode *user, UNUSED_ARG(const char *old_nick), UNUSED_ARG(void *extra))
{
struct chanNode *channel;
struct banData *bData;
}
}
-static void handle_rename(struct handle_info *handle, const char *old_handle)
+static void handle_rename(struct handle_info *handle, const char *old_handle, UNUSED_ARG(void *extra))
{
struct do_not_register *dnr = dict_find(handle_dnrs, old_handle, NULL);
}
static void
-handle_unreg(UNUSED_ARG(struct userNode *user), struct handle_info *handle)
+handle_unreg(UNUSED_ARG(struct userNode *user), struct handle_info *handle, UNUSED_ARG(void *extra))
{
struct userNode *h_user;
}
static int
-handle_server_link(UNUSED_ARG(struct server *server))
+handle_server_link(UNUSED_ARG(struct server *server), UNUSED_ARG(void *extra))
{
struct chanData *cData;
}
static void
-chanserv_db_cleanup(void) {
+chanserv_db_cleanup(UNUSED_ARG(void *extra)) {
unsigned int ii;
- unreg_part_func(handle_part);
+ unreg_part_func(handle_part, NULL);
while(channelList)
unregister_channel(channelList, "terminating.");
for(ii = 0; ii < chanserv_conf.support_channels.used; ++ii)
conf_register_reload(chanserv_conf_read);
if (nick) {
- reg_server_link_func(handle_server_link);
- reg_new_channel_func(handle_new_channel);
- reg_join_func(handle_join);
- reg_part_func(handle_part);
- reg_kick_func(handle_kick);
- reg_topic_func(handle_topic);
- reg_mode_change_func(handle_mode);
- reg_nick_change_func(handle_nick_change);
- reg_auth_func(handle_auth);
+ reg_server_link_func(handle_server_link, NULL);
+ reg_new_channel_func(handle_new_channel, NULL);
+ reg_join_func(handle_join, NULL);
+ reg_part_func(handle_part, NULL);
+ reg_kick_func(handle_kick, NULL);
+ reg_topic_func(handle_topic, NULL);
+ reg_mode_change_func(handle_mode, NULL);
+ reg_nick_change_func(handle_nick_change, NULL);
+ reg_auth_func(handle_auth, NULL);
}
- reg_handle_rename_func(handle_rename);
- reg_unreg_func(handle_unreg);
+ reg_handle_rename_func(handle_rename, NULL);
+ reg_unreg_func(handle_unreg, NULL);
handle_dnrs = dict_new();
dict_set_free_data(handle_dnrs, free);
mask_dnrs = dict_new();
dict_set_free_data(mask_dnrs, free);
- reg_svccmd_unbind_func(handle_svccmd_unbind);
+ reg_svccmd_unbind_func(handle_svccmd_unbind, NULL);
chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);
DEFINE_COMMAND(register, 1, MODCMD_REQUIRE_AUTHED, "flags", "+acceptchan,+channel", NULL);
DEFINE_COMMAND(noregister, 1, MODCMD_REQUIRE_AUTHED, "flags", "+helping", NULL);
const char *modes = conf_get_data("services/chanserv/modes", RECDB_QSTRING);
chanserv = AddLocalUser(nick, nick, NULL, "Channel Services", modes);
service_register(chanserv)->trigger = '!';
- reg_chanmsg_func('\001', chanserv, chanserv_ctcp_check);
+ reg_chanmsg_func('\001', chanserv, chanserv_ctcp_check, NULL);
}
saxdb_register("ChanServ", chanserv_saxdb_read, chanserv_saxdb_write);
}
}
- reg_exit_func(chanserv_db_cleanup);
+ reg_exit_func(chanserv_db_cleanup, NULL);
message_register_table(msgtab);
}