added configvalue for mininum time at time bans
[srvx.git] / src / chanserv.c
index 0ebed1b8d33504c411a1c85bb506e934fe751337..7a620326a28578406bd18700c63f054a011acb1d 100644 (file)
@@ -43,6 +43,7 @@
 #define KEY_DNR_EXPIRE_FREQ         "dnr_expire_freq"
 #define KEY_MAX_CHAN_USERS          "max_chan_users"
 #define KEY_MAX_CHAN_BANS           "max_chan_bans"
+#define KEY_MIN_TIME_BANS                      "min_time_bans"
 #define KEY_NICK                    "nick"
 #define KEY_OLD_CHANSERV_NAME       "old_chanserv_name"
 #define KEY_8BALL_RESPONSES         "8ball"
@@ -581,6 +582,7 @@ static struct
     unsigned int    max_owned;
     unsigned int    max_chan_users;
     unsigned int    max_chan_bans;
+    unsigned int    min_time_bans;
     unsigned int    max_userinfo_length;
     
     unsigned int    revoke_mode_a;
@@ -2382,7 +2384,7 @@ static CHANSERV_FUNC(cmd_move)
 
     REQUIRE_PARAMS(2);
 
-    if(IsProtected(channel->channel_info) && !IsOper(user))
+    if(IsProtected(channel->channel_info))
     {
         reply("CSMSG_MOVE_NODELETE", channel->name);
         return 0;
@@ -2690,7 +2692,7 @@ static CHANSERV_FUNC(cmd_merge)
         return 0;
     }
 
-    if(IsProtected(channel->channel_info) && !IsOper(user))
+    if(IsProtected(channel->channel_info))
     {
         reply("CSMSG_MERGE_NODELETE");
         return 0;
@@ -3476,7 +3478,7 @@ eject_user(struct userNode *user, struct chanNode *channel, unsigned int argc, c
         {
             duration = ParseInterval(argv[2]);
 
-            if(duration < 15)
+            if(duration < chanserv_conf.min_time_bans)
             {
                 reply("CSMSG_DURATION_TOO_LOW");
                 free(ban);
@@ -4167,6 +4169,8 @@ cmd_list_users(struct userNode *user, struct chanNode *channel, unsigned int arg
         ary[1] = uData->handle->handle;
         if(uData->present)
             ary[2] = "Here";
+        else if(HANDLE_FLAGGED(uData->handle, NETWORK))
+             ary[2] = "Here";
         else if(!uData->seen)
             ary[2] = "Never";
         else
@@ -4174,6 +4178,12 @@ cmd_list_users(struct userNode *user, struct chanNode *channel, unsigned int arg
         ary[2] = strdup(ary[2]);
         if(IsUserSuspended(uData))
             ary[3] = "Suspended";
+        else if(HANDLE_FLAGGED(uData->handle, OPER))
+            ary[3] = "Operator";
+        else if(HANDLE_FLAGGED(uData->handle, HELPING))
+            ary[3] = "Staff";
+        else if(HANDLE_FLAGGED(uData->handle, NETWORK))
+            ary[3] = "Network";
         else if(HANDLE_FLAGGED(uData->handle, FROZEN))
             ary[3] = "Vacation";
         else if(HANDLE_FLAGGED(uData->handle, BOT))
@@ -5409,7 +5419,7 @@ static CHANSERV_FUNC(cmd_csuspend)
 
     REQUIRE_PARAMS(3);
 
-    if(IsProtected(channel->channel_info) && !IsOper(user))
+    if(IsProtected(channel->channel_info))
     {
         reply("CSMSG_SUSPEND_NODELETE", channel->name);
         return 0;
@@ -7849,6 +7859,8 @@ chanserv_conf_read(void)
     chanserv_conf.max_chan_users = str ? atoi(str) : 512;
     str = database_get_data(conf_node, KEY_MAX_CHAN_BANS, RECDB_QSTRING);
     chanserv_conf.max_chan_bans = str ? atoi(str) : 512;
+    str = database_get_data(conf_node, KEY_MIN_TIME_BANS, RECDB_QSTRING);
+    chanserv_conf.min_time_bans = str ? atoi(str) : 5;
     str = database_get_data(conf_node, KEY_MAX_USERINFO_LENGTH, RECDB_QSTRING);
     chanserv_conf.max_userinfo_length = str ? atoi(str) : 400;
     str = database_get_data(conf_node, KEY_NICK, RECDB_QSTRING);