added some nodelete overrides
[srvx.git] / src / chanserv.c
index d50c9147fbe56909b65f776179f763e99bb2ca8d..0ebed1b8d33504c411a1c85bb506e934fe751337 100644 (file)
@@ -2382,7 +2382,7 @@ static CHANSERV_FUNC(cmd_move)
 
     REQUIRE_PARAMS(2);
 
-    if(IsProtected(channel->channel_info))
+    if(IsProtected(channel->channel_info) && !IsOper(user))
     {
         reply("CSMSG_MOVE_NODELETE", channel->name);
         return 0;
@@ -2690,7 +2690,7 @@ static CHANSERV_FUNC(cmd_merge)
         return 0;
     }
 
-    if(IsProtected(channel->channel_info))
+    if(IsProtected(channel->channel_info) && !IsOper(user))
     {
         reply("CSMSG_MERGE_NODELETE");
         return 0;
@@ -4421,10 +4421,10 @@ static CHANSERV_FUNC(cmd_topic)
                     if(!isdigit(topic[pos]))
                         break;
                 }
-                if(advtopic_index < 0 || advtopic_index > MAXADVTOPICENTRIES)
+                if(advtopic_index < 0 || advtopic_index >= MAXADVTOPICENTRIES)
                 {
                     //invalid id!
-                    reply("CSMSG_ADVTOPIC_INVALID_ID", advtopic_index);
+                    reply("CSMSG_ADVTOPIC_INVALID_ID", advtopic_index+1);
                     return 0;
                 }
                 if(cData->advtopic[advtopic_index])
@@ -4446,7 +4446,6 @@ static CHANSERV_FUNC(cmd_topic)
                             new_topic[dpos++] = *ptr; //is % again
                             break;
                         }
-                        ptr--;
                         advtopic_index--; //no zero base
                         if(!cData->advtopic[advtopic_index])
                             break; //just leave it empty
@@ -4458,11 +4457,12 @@ static CHANSERV_FUNC(cmd_topic)
                         break;
                     case '\\': 
                         ptr++; /* and fall through */
+                        if(!*ptr) break;
                     default:
                         new_topic[dpos++] = *ptr;
+                        ptr++;
                         break;
                     }
-                    ptr++;
                 }
             } else {
                 while((tchar = topic_mask[pos++]) && (dpos <= TOPICLEN))
@@ -5409,7 +5409,7 @@ static CHANSERV_FUNC(cmd_csuspend)
 
     REQUIRE_PARAMS(3);
 
-    if(IsProtected(channel->channel_info))
+    if(IsProtected(channel->channel_info) && !IsOper(user))
     {
         reply("CSMSG_SUSPEND_NODELETE", channel->name);
         return 0;