From 6db9ecab9354b99833ac6657db979f8557b3e615 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Thu, 29 Apr 2004 01:41:37 +0000 Subject: [PATCH] Fix !up for users below GiveVoice level; implement RFE#933634 * If users have access belowGiveVoice, do not let them use UP. * Show channel flags (suspended, autoop, etc) in MYACCESS. git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-54 --- ChangeLog | 15 +++++++++++++++ src/chanserv.c | 32 +++++++++++++++++++++++++++----- src/chanserv.help | 5 +++++ 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d8bc35..ee28b89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,21 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2004-srvx/srvx--devo--1.3 # +2004-04-29 01:41:37 GMT Michael Poole patch-54 + + Summary: + Fix !up for users below GiveVoice level; implement RFE#933634 + Revision: + srvx--devo--1.3--patch-54 + + * If users have access belowGiveVoice, do not let them use UP. + + * Show channel flags (suspended, autoop, etc) in MYACCESS. + + modified files: + ChangeLog src/chanserv.c src/chanserv.help + + 2004-04-29 00:31:22 GMT Michael Poole patch-53 Summary: diff --git a/src/chanserv.c b/src/chanserv.c index 51bcb9f..bceca0d 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -2509,11 +2509,17 @@ static CHANSERV_FUNC(cmd_up) change.args[0].mode = MODE_CHANOP; errmsg = "CSMSG_ALREADY_OPPED"; } - else + else if(uData->access >= channel->channel_info->lvlOpts[lvlGiveVoice]) { change.args[0].mode = MODE_VOICE; errmsg = "CSMSG_ALREADY_VOICED"; } + else + { + if(argc) + reply("CSMSG_NO_ACCESS"); + return 0; + } change.args[0].mode &= ~change.args[0].member->modes; if(!change.args[0].mode) { @@ -3150,9 +3156,9 @@ static CHANSERV_FUNC(cmd_open) static CHANSERV_FUNC(cmd_myaccess) { + static struct string_buffer sbuf; struct handle_info *target_handle; struct userData *uData; - const char *chanName; if(argc < 2) target_handle = user->handle_info; @@ -3181,11 +3187,27 @@ static CHANSERV_FUNC(cmd_myaccess) && (target_handle != user->handle_info) && !GetTrueChannelAccess(cData, user->handle_info)) continue; - chanName = cData->channel->name; + sbuf.used = 0; + string_buffer_append_printf(&sbuf, "[%s (%d", cData->channel->name, uData->access); + if(uData->flags != USER_AUTO_OP) + string_buffer_append(&sbuf, ','); + if(IsUserSuspended(uData)) + string_buffer_append(&sbuf, 's'); + if(IsUserAutoOp(uData)) + { + if(uData->access >= cData->lvlOpts[lvlGiveOps]) + string_buffer_append(&sbuf, 'o'); + else if(uData->access >= cData->lvlOpts[lvlGiveVoice]) + string_buffer_append(&sbuf, 'v'); + } + if(IsUserAutoInvite(uData) && (uData->access >= cData->lvlOpts[lvlInviteMe])) + string_buffer_append(&sbuf, 'i'); if(uData->info) - send_message_type(4, user, cmd->parent->bot, "[%s (%d)] %s", chanName, uData->access, uData->info); + string_buffer_append_printf(&sbuf, ")] %s", uData->info); else - send_message_type(4, user, cmd->parent->bot, "[%s (%d)]", chanName, uData->access); + string_buffer_append_string(&sbuf, ")]"); + string_buffer_append(&sbuf, '\0'); + send_message_type(4, user, cmd->parent->bot, sbuf.list); } return 1; diff --git a/src/chanserv.help b/src/chanserv.help index df5bc01..45f9e1d 100644 --- a/src/chanserv.help +++ b/src/chanserv.help @@ -103,6 +103,11 @@ "MYACCESS" ("/msg $S MYACCESS []", "Lists channels where you have access and infolines in each.", "Network staff may specify a nickname or *account to view the list for another user.", + "Your access level in the channel may be followed by a comma and one of the following characters:", + " s Your access in the channel has been suspended.", + " o AutoOp is active.", + " v AutoVoice is active.", + " i AutoInvite is active.", "$uSee Also:$u access, users"); "ACCESS" ("/msg $S ACCESS <#channel> []", "Reports various pieces of information about a channel user, including channel and network access level, and the user's info line. If no nick or account is provided, $S returns your own information.", -- 2.20.1