X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/c82735893e91d97cbb512a1a0ed68d320aa24ca7..f8f30e75066e4a0b84034e50e392ba713f27732d:/src/chanserv.c diff --git a/src/chanserv.c b/src/chanserv.c index c427ad4..ca5e268 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -129,9 +129,11 @@ static const struct message_entry msgtab[] = { { "CSMSG_REG_SUCCESS", "You now have ownership of $b%s$b." }, { "CSMSG_PROXY_SUCCESS", "%s now has ownership of $b%s$b." }, { "CSMSG_ALREADY_REGGED", "$b%s$b is registered to someone else." }, - { "CSMSG_MUST_BE_OPPED", "You must be a channel operator in $b%s$b to register it." }, + { "CSMSG_MUST_BE_OPPED", "You must be a channel operator (+o) in $b%s$b to register it." }, { "CSMSG_PROXY_FORBIDDEN", "You may not register a channel for someone else." }, - { "CSMSG_OWN_TOO_MANY", "%s already owns enough channels (at least %d); use FORCE to override." }, + { "CSMSG_OWN_TOO_MANY", "%s already owns more than the limit of %d channels. Use FORCE to override." }, + { "CSMSG_YOU_OWN_TOO_MANY", "You already own more than the limit of %d channels. Ask a staff member for help." }, + { "CSMSG_ANOTHER_SERVICE", "Another service bot is in that channel already. Ask a staff member for help." }, /* Do-not-register channels */ { "CSMSG_NOT_DNR", "$b%s$b is not a valid channel name or *account." }, @@ -195,11 +197,13 @@ static const struct message_entry msgtab[] = { { "CSMSG_TRIMMED_USERS", "Trimmed $b%d users$b with access from %d to %d from the %s user list who were inactive for at least %s." }, { "CSMSG_INCORRECT_ACCESS", "%s has access $b%s$b, not %s." }, { "CSMSG_USER_EXISTS", "%s is already on the $b%s$b user list (with %s access)." }, - { "CSMSG_ADDUSER_PENDING", "I have sent him/her a message letting them know, and if they auth or register soon, i will finish adding them automatically." }, + { "CSMSG_ADDUSER_PENDING", "I have sent him/her a message letting them know, and if they auth or register soon, I will finish adding them automatically." }, { "CSMSG_ADDUSER_PENDING_ALREADY", "He or she is already pending addition to %s once he/she auths with $b$N$b." }, - { "CSMSG_ADDUSER_PENDING_LIST", "Channel %s user %s" }, /* Remove after testing */ + { "CSMSG_ADDUSER_PENDING_HEADER", "Users to add to channels pending logins:" }, /* Remove after testing? */ + { "CSMSG_ADDUSER_PENDING_LIST", "Channel %s user %s" }, /* Remove after testing? */ + { "CSMSG_ADDUSER_PENDING_FOOTER", "--------- End of pending list ----------" }, /* Remove after testing? */ /*{ "CSMSG_ADDUSER_PENDING_NOTINCHAN", "That user is not in %s, and is not auth'd." }, */ - { "CSMSG_ADDUSER_PENDING_TARGET", "Channel Services bot here, %s would like to add you to my userlist in channel %s, but you are not auth'd to $b$N$b. Please auth now, and you will be added. If you do not have an accont, type /msg $N help register" }, + { "CSMSG_ADDUSER_PENDING_TARGET", "Channel Services bot here: %s would like to add you to my userlist in channel %s, but you are not authenticated to $b$N$b. Please authenticate now and you will be added. If you do not have an account, type /msg $N help register" }, { "CSMSG_CANNOT_TRIM", "You must include a minimum inactivity duration of at least 60 seconds to trim." }, { "CSMSG_NO_SELF_CLVL", "You cannot change your own access." }, @@ -1309,8 +1313,15 @@ process_adduser_pending(struct userNode *user) while((ap = find_adduser_pending(NULL, user))) { struct userData *actee; - actee = add_channel_user(ap->channel->channel_info, ap->user->handle_info, ap->level, 0, NULL); - scan_user_presence(actee, NULL); + if(GetTrueChannelAccess(ap->channel->channel_info, ap->user->handle_info)) + { + /* Already on the userlist. do nothing*/ + } + else + { + actee = add_channel_user(ap->channel->channel_info, ap->user->handle_info, ap->level, 0, NULL); + scan_user_presence(actee, NULL); + } del_adduser_pending(ap); } } @@ -1878,6 +1889,8 @@ static CHANSERV_FUNC(cmd_register) char *chan_name; unsigned int new_channel, force=0; struct do_not_register *dnr; + unsigned int n; + if(channel) { @@ -1893,8 +1906,7 @@ static CHANSERV_FUNC(cmd_register) return 0; } - if(!IsHelping(user) - && (!(mn = GetUserMode(channel, user)) || !(mn->modes & MODE_CHANOP))) + if(!IsHelping(user) && (!(mn = GetUserMode(channel, user)) || !(mn->modes & MODE_CHANOP))) { reply("CSMSG_MUST_BE_OPPED", channel->name); return 0; @@ -1939,11 +1951,36 @@ static CHANSERV_FUNC(cmd_register) return 0; force = (argc > (new_channel+2)) && !irccasecmp(argv[new_channel+2], "force"); dnr = chanserv_is_dnr(chan_name, handle); + + /* Check if they are over the limit.. */ + if((chanserv_get_owned_count(handle) >= chanserv_conf.max_owned) && !force) + { + reply("CSMSG_OWN_TOO_MANY", handle->handle, chanserv_conf.max_owned); + return 0; + } + } else { - handle = user->handle_info; + handle = user->handle_info; dnr = chanserv_is_dnr(chan_name, handle); + /* Check if they are over the limit.. */ + if((chanserv_get_owned_count(handle) >= chanserv_conf.max_owned) && !force) + { + reply("CSMSG_YOU_OWN_TOO_MANY", chanserv_conf.max_owned); + return 0; + } + /* Check if another service is in the channel */ + if(channel) + for(n = 0; n < channel->members.used; n++) + { + mn = channel->members.list[n]; + if((mn && mn->user && (mn->user->modes & FLAGS_SERVICE)) || IsLocal(mn->user)) + { + reply("CSMSG_ANOTHER_SERVICE"); + return 0; + } + } } if(dnr && !force) { @@ -1954,11 +1991,13 @@ static CHANSERV_FUNC(cmd_register) return 0; } + /* now handled above for message specilization * if((chanserv_get_owned_count(handle) >= chanserv_conf.max_owned) && !force) { reply("CSMSG_OWN_TOO_MANY", handle->handle, chanserv_conf.max_owned); return 0; } + */ if(new_channel) channel = AddChannel(argv[1], now, NULL, NULL, NULL); @@ -3818,11 +3857,16 @@ cmd_list_users(struct userNode *user, struct chanNode *channel, unsigned int arg return 1; } +/* Remove this now that debugging is over? or improve it for + * users? Would it be better tied into USERS somehow? -Rubin */ static CHANSERV_FUNC(cmd_pending) { struct adduserPending *ap; + reply("CSMSG_ADDUSER_PENDING_HEADER"); + reply("CSMSG_BAR"); for(ap = adduser_pendings;ap;ap = ap->next) reply("CSMSG_ADDUSER_PENDING_LIST", ap->channel->name, ap->user->nick); + reply("CSMSG_ADDUSER_PENDING_FOOTER"); return 1; } @@ -4462,32 +4506,34 @@ static CHANSERV_FUNC(cmd_resync) } else if(uData && uData->access >= UL_HALFOP /*cData->lvlOpts[lvlGiveHalfOps]*/) { - if(!(mn->modes & MODE_HALFOP)) + if(mn->modes & MODE_CHANOP) { - changes->args[used].mode = MODE_HALFOP; + changes->args[used].mode = MODE_REMOVE | MODE_CHANOP; changes->args[used++].u.member = mn; } - if(mn->modes & MODE_CHANOP) + if(!(mn->modes & MODE_HALFOP)) { - changes->args[used].mode = MODE_REMOVE | (mn->modes & ~MODE_CHANOP); + changes->args[used].mode = MODE_HALFOP; changes->args[used++].u.member = mn; } + /* why cant halfops keep voice if(mn->modes & MODE_VOICE) { changes->args[used].mode = MODE_REMOVE | (mn->modes & ~MODE_VOICE); changes->args[used++].u.member = mn; } + */ } else if(uData && uData->access >= UL_PEON /* cData->lvlOpts[lvlGiveVoice]*/) { if(mn->modes & MODE_CHANOP) { - changes->args[used].mode = MODE_REMOVE | (mn->modes & ~MODE_VOICE); + changes->args[used].mode = MODE_REMOVE | MODE_CHANOP; changes->args[used++].u.member = mn; } if(mn->modes & MODE_HALFOP) { - changes->args[used].mode = MODE_REMOVE | (mn->modes & ~MODE_VOICE); + changes->args[used].mode = MODE_REMOVE | MODE_HALFOP; changes->args[used++].u.member = mn; } if(!(mn->modes & MODE_VOICE)) @@ -7628,8 +7674,6 @@ init_chanserv(const char *nick) dict_set_free_data(plain_dnrs, free); mask_dnrs = dict_new(); dict_set_free_data(mask_dnrs, free); - //TODO - //adduser_pending reg_svccmd_unbind_func(handle_svccmd_unbind); chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);