Fix !up for users below GiveVoice level; implement RFE#933634
authorMichael Poole <mdpoole@troilus.org>
Thu, 29 Apr 2004 01:41:37 +0000 (01:41 +0000)
committerMichael Poole <mdpoole@troilus.org>
Thu, 29 Apr 2004 01:41:37 +0000 (01:41 +0000)
* 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
src/chanserv.c
src/chanserv.help

index 1d8bc3557baba7e6f26a8338ce07f68724e12599..ee28b89f6487993938c174083ed453b8618fffbb 100644 (file)
--- 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 <mdpoole@troilus.org>     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 <mdpoole@troilus.org>     patch-53
 
     Summary:
index 51bcb9ff042847738a75fa54f53016847bce6eb2..bceca0d6e25c3cdaae31d927b4ebb0d4dbfdd0e7 100644 (file)
@@ -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;
index df5bc01d465b8a68d5c69e9d9fc10db3fb546e94..45f9e1de5432f309137b8987ccb1840abca41cbe 100644 (file)
 "MYACCESS" ("/msg $S MYACCESS [<nick|*account>]",
         "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> [<nick|*account>]",
         "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.",