X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/dfaa28a4e56e833f042a2e59c206efb6d31acd72..bc06f607a61a8d0c48642bc859998f34346024b8:/src/chanserv.c diff --git a/src/chanserv.c b/src/chanserv.c index 4623769..5fe1455 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -236,7 +236,7 @@ static const struct message_entry msgtab[] = { { "CSMSG_BAN_DONE", "Banned $b%s$b from %s." }, { "CSMSG_REASON_CHANGE", "Reason for LAMER $b%s$b changed." }, { "CSMSG_LAMER_EXTENDED", "Extended LAMER for $b%s$b, now expires in %s." }, - { "CSMSG_BAN_REMOVED", "Matching ban(s) and LAMER(s) in $b%s$b were removed." }, + { "CSMSG_BAN_REMOVED", "Ban(s) and LAMER(s) matching $b%s$b were removed." }, { "CSMSG_TRIMMED_LAMERS", "Trimmed $b%d LAMERs$b from the %s LAMER list that were inactive for at least %s." }, { "CSMSG_REDUNDANT_BAN", "$b%s$b is already banned in %s." }, { "CSMSG_REDUNDANT_LAMER", "$b%s$b is already LAMER'd in %s." }, @@ -2877,12 +2877,13 @@ static CHANSERV_FUNC(cmd_deluser) if(argc > 2) { access = user_level_from_name(argv[1], UL_OWNER); + char *useraccess = user_level_name_from_level(victim->access); if(!access) { reply("CSMSG_INVALID_ACCESS", argv[1]); return 0; } - if(access != victim->access) + if(strcasecmp(argv[1], useraccess)) { reply("CSMSG_INCORRECT_ACCESS", handle->handle, user_level_name_from_level(victim->access), argv[1]); return 0; @@ -6704,8 +6705,8 @@ static CHANSERV_FUNC(cmd_giveownership) giveownership = calloc(1, sizeof(*giveownership)); giveownership->issued = now; - giveownership->old_owner = curr_user->handle->handle; - giveownership->target = new_owner_hi->handle; + giveownership->old_owner = strdup(curr_user->handle->handle); + giveownership->target = strdup(new_owner_hi->handle); giveownership->target_access = new_owner_old_access; if(override) { @@ -7260,6 +7261,31 @@ handle_new_channel(struct chanNode *channel) SetChannelTopic(channel, chanserv, chanserv, channel->channel_info->topic, 1); } +int +trace_check_bans(struct userNode *user, struct chanNode *chan) +{ + struct banData *bData; + struct mod_chanmode *change; + + change = find_matching_bans(&chan->banlist, user, NULL); + if (change) + return 1; + + /* lamer list */ + if (chan->channel_info) { + for(bData = chan->channel_info->bans; bData; bData = bData->next) { + + if(!user_matches_glob(user, bData->mask, MATCH_USENICK)) + continue; + + if(bData) + return 1; + } + } + + return 0; +} + int check_bans(struct userNode *user, const char *channel) { @@ -7317,6 +7343,18 @@ check_bans(struct userNode *user, const char *channel) return 0; } +int +channel_user_is_exempt(struct userNode *user, struct chanNode *channel) +{ + unsigned int ii; + for(ii = 0; ii < channel->exemptlist.used; ii++) + { + if(user_matches_glob(user, channel->exemptlist.list[ii]->exempt, MATCH_USENICK)) + return true; + } + return false; +} + /* Welcome to my worst nightmare. Warning: Read (or modify) the code below at your own risk. */ @@ -7333,7 +7371,7 @@ handle_join(struct modeNode *mNode) unsigned int modes = 0, info = 0; char *greeting; - if(IsLocal(user) || !channel->channel_info || IsSuspended(channel->channel_info)) + if(IsLocal(user) || !channel || !channel->channel_info || IsSuspended(channel->channel_info)) return 0; cData = channel->channel_info; @@ -7381,7 +7419,7 @@ handle_join(struct modeNode *mNode) /* TODO: maybe only people above inviteme level? -Rubin */ /* We don't kick people with access */ - if(!uData) + if(!uData && !channel_user_is_exempt(user, channel)) { if(channel->banlist.used < MAXBANS) {