[Konversation-devel] [Bug 131956] kickban available from context menu, but /kickban returns an error

Eike Hein sho at eikehein.com
Sun Aug 6 21:58:45 CEST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=131956         
sho eikehein com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From sho eikehein com  2006-08-06 21:58 -------
SVN commit 570456 by hein:

Implement /kickban. Same parameters as /ban plus [reason].
BUG:131956


 M  +1 -1      inputfilter.cpp  
 M  +30 -9     outputfilter.cpp  
 M  +1 -1      outputfilter.h  


--- trunk/extragear/network/konversation/src/inputfilter.cpp #570455:570456
 @ -450,7 +450,7  @
                         // Identify command if specified
                         server->registerWithServices();
                     }
-                    if (server->identifyMsg())
+                    else if (server->identifyMsg())
                         trailing = trailing.mid(1);
 
                     if(trailing.lower() == "password accepted - you are now recognized"
--- trunk/extragear/network/konversation/src/outputfilter.cpp #570455:570456
 @ -187,6 +187,7  @
             else if(command == "oper")     result = parseOper(myNick,parameter);
             else if(command == "ban")      result = parseBan(parameter);
             else if(command == "unban")    result = parseUnban(parameter);
+            else if(command == "kickban")      result = parseBan(parameter,true);
             else if(command == "ignore")   result = parseIgnore(parameter);
             else if(command == "unignore") result = parseUnignore(parameter);
             else if(command == "quote")    result = parseQuote(parameter);
 @ -975,7 +976,7  @
         return result;
     }
 
-    OutputFilterResult OutputFilter::parseBan(const QString& parameter)
+    OutputFilterResult OutputFilter::parseBan(const QString& parameter, bool kick)
     {
         OutputFilterResult result;
         // assume incorrect syntax first
 @ -993,34 +994,51  @
             bool udomain = (parameterList[0].lower() == "-userdomain");
 
             // remove possible option
-            if(host || domain || uhost || udomain)
+            if (host || domain || uhost || udomain)
             {
                 option = parameterList[0].mid(1);
                 parameterList.pop_front();
             }
 
             // look for channel / ban mask
-            if(parameterList.count())
+            if (parameterList.count())
             {
                 // user specified channel
-                if(isAChannel(parameterList[0]))
+                if (isAChannel(parameterList[0]))
                 {
                     channel = parameterList[0];
                     parameterList.pop_front();
                 }
                 // no channel, so assume current destination as channel
-                else if(isAChannel(destination))
+                else if (isAChannel(destination))
                     channel = destination;
                 else
                 {
                     // destination is no channel => error
-                    result = error(i18n("%1BAN without channel name works only from inside a channel.").arg(commandChar));
+                    if (!kick)
+                        result = error(i18n("%1BAN without channel name works only from inside a channel.").arg(commandChar));
+                    else
+                        result = error(i18n("%1KICKBAN without channel name works only from inside a channel.").arg(commandChar));
+
                     // no usage information after error
                     showUsage = false;
                 }
                 // signal server to ban this user if all went fine
-                if(!channel.isEmpty())
+                if (!channel.isEmpty())
                 {
+                    if (kick)
+                    {
+                        QString reason;
+
+                        if (parameterList.count()>1)
+                        {
+                            reason = parameterList.last();
+                            parameterList.remove(parameterList.last());
+                        }
+
+                        result.toServer = "KICK " + channel + ' ' + parameterList[0] + " :" + reason;
+                    }
+
                     emit banUsers(parameterList,channel,option);
                     // syntax was correct, so reset flag
                     showUsage = false;
 @ -1028,9 +1046,12  @
             }
         }
 
-        if(showUsage)
+        if (showUsage)
         {
-            result = usage(i18n("Usage: %1BAN [-HOST | -DOMAIN] [channel] <user|mask>").arg(commandChar));
+            if (!kick)
+                result = usage(i18n("Usage: %1BAN [-HOST | -DOMAIN] [channel] <user|mask>").arg(commandChar));
+            else
+                result = usage(i18n("Usage: %1KICKBAN [-HOST | -DOMAIN] [channel] <user|mask> [reason]").arg(commandChar));
         }
 
         return result;
--- trunk/extragear/network/konversation/src/outputfilter.h #570455:570456
 @ -100,7 +100,7  @
             OutputFilterResult parseQuit(const QString& parameter);
             OutputFilterResult parseKick(const QString& parameter);
             OutputFilterResult parseKickBan(const QString& parameter);
-            OutputFilterResult parseBan(const QString& parameter);
+            OutputFilterResult parseBan(const QString& parameter, bool kick = false);
             OutputFilterResult parseUnban(const QString& parameter);
             OutputFilterResult parseNames(const QString& parameter);
             OutputFilterResult parseList(const QString& parameter);


More information about the Konversation-devel mailing list