Bug 131956 - kickban available from context menu, but /kickban returns an error
Summary: kickban available from context menu, but /kickban returns an error
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-06 16:18 UTC by Niek Beernink
Modified: 2006-08-06 21:58 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niek Beernink 2006-08-06 16:18:57 UTC
Version:           revision 570312 (using KDE KDE 3.5.4)
Compiler:          gcc (GCC) 4.1.2 20060715 (prerelease) (Ubuntu 4.1.1-9ubuntu1) 

/kickban nick
[Error] kickban: Unknown command.

Right-click nick => Kick/ban => Kickban works

Did it went missing after we lost half the list of quickbuttons?
Comment 1 Eike Hein 2006-08-06 19:02:06 UTC
Change to wishlist.
Comment 2 Eike Hein 2006-08-06 21:58:44 UTC
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);