Bug 88533 - Allow defining multiple commands
Summary: Allow defining multiple commands
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Slackware Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-31 15:00 UTC by Marco Gulino
Modified: 2006-01-14 02: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 Marco Gulino 2004-08-31 15:00:38 UTC
Version:           0.15 (using KDE KDE 3.3.0)
Installed from:    Slackware Packages

It should be allowed to define multiple commands, like defining "kickban $1" == "/ban $1", "/kick $1".
Maybe it would be easy to do in XChat way (define two "kickban", first with "ban" and later with "kick", so "kickban" will execute both).
Comment 1 argonel 2004-09-24 21:07:19 UTC
Are you talking about aliases or quickbuttons?
Comment 2 Dario Abatianni 2006-01-14 02:58:44 UTC
SVN commit 497864 by abatianni:

BUG:88533 - make multi line aliases work, use %n as separator

 M  +34 -32    channel.cpp  
 M  +21 -14    query.cpp  
 M  +16 -10    statuspanel.cpp  


--- trunk/extragear/network/konversation/src/channel.cpp #497863:497864
@@ -821,35 +821,42 @@
 void Channel::sendChannelText(const QString& sendLine)
 {
     // create a work copy
-    QString output(sendLine);
+    QString outputAll(sendLine);
     // replace aliases and wildcards
-    if(m_server->getOutputFilter()->replaceAliases(output))
+    if(m_server->getOutputFilter()->replaceAliases(outputAll))
     {
-        output = m_server->parseWildcards(output,m_server->getNickname(),getName(),getKey(),
+        outputAll = m_server->parseWildcards(outputAll,m_server->getNickname(),getName(),getKey(),
             getSelectedNickList(),QString::null);
     }
 
-    // encoding stuff is done in Server()
-    Konversation::OutputFilterResult result = m_server->getOutputFilter()->parse(m_server->getNickname(),output,getName());
+    // Send all strings, one after another
+    QStringList outList=QStringList::split('\n',outputAll);
+    for(unsigned int index=0;index<outList.count();index++)
+    {
+        QString output(outList[index]);
 
-    // Is there something we need to display for ourselves?
-    if(!result.output.isEmpty())
-    {
-        if(result.type == Konversation::Action) appendAction(m_server->getNickname(), result.output);
-        else if(result.type == Konversation::Command) appendCommandMessage(result.typeString, result.output);
-        else if(result.type == Konversation::Program) appendServerMessage(result.typeString, result.output);
-        else if(result.type == Konversation::Query) appendQuery(result.typeString, result.output);
-        else append(m_server->getNickname(), result.output);
-    }
-    // Send anything else to the server
-    if(!result.toServer.isEmpty())
-    {
-        m_server->queue(result.toServer);
-    }
-    else
-    {
-        m_server->queueList(result.toServerList);
-    }
+        // encoding stuff is done in Server()
+        Konversation::OutputFilterResult result = m_server->getOutputFilter()->parse(m_server->getNickname(),output,getName());
+
+        // Is there something we need to display for ourselves?
+        if(!result.output.isEmpty())
+        {
+            if(result.type == Konversation::Action) appendAction(m_server->getNickname(), result.output);
+            else if(result.type == Konversation::Command) appendCommandMessage(result.typeString, result.output);
+            else if(result.type == Konversation::Program) appendServerMessage(result.typeString, result.output);
+            else if(result.type == Konversation::Query) appendQuery(result.typeString, result.output);
+            else append(m_server->getNickname(), result.output);
+        }
+        // Send anything else to the server
+        if(!result.toServer.isEmpty())
+        {
+            m_server->queue(result.toServer);
+        }
+        else
+        {
+            m_server->queueList(result.toServerList);
+        }
+    } // for
 }
 
 void Channel::setNickname(const QString& newNickname)
@@ -948,18 +955,13 @@
 {
     // parse wildcards (toParse,nickname,channelName,nickList,queryName,parameter)
     QString out=m_server->parseWildcards(buttonText,m_server->getNickname(),getName(),getKey(),getSelectedNickList(),QString::null);
+
     // are there any newlines in the definition?
     if(out.find('\n')!=-1)
-    {
-        // Send all strings, one after another
-        QStringList outList=QStringList::split('\n',out);
-        for(unsigned int index=0;index<outList.count();index++)
-        {
-            sendChannelText(outList[index]);
-        }
-    }
+        sendChannelText(out);
     // single line without newline needs to be copied into input line
-    else channelInput->setText(out);
+    else
+        channelInput->setText(out);
 }
 
 void Channel::addNickname(ChannelNickPtr channelnick)
--- trunk/extragear/network/konversation/src/query.cpp #497863:497864
@@ -179,26 +179,33 @@
 void Query::sendQueryText(const QString& sendLine)
 {
     // create a work copy
-    QString output(sendLine);
+    QString outputAll(sendLine);
     // replace aliases and wildcards
-    if(m_server->getOutputFilter()->replaceAliases(output))
+    if(m_server->getOutputFilter()->replaceAliases(outputAll))
     {
-        output = m_server->parseWildcards(output, m_server->getNickname(), getName(), QString::null, QString::null, QString::null);
+        outputAll = m_server->parseWildcards(outputAll, m_server->getNickname(), getName(), QString::null, QString::null, QString::null);
     }
 
-    // encoding stuff is done in Server()
-    Konversation::OutputFilterResult result = m_server->getOutputFilter()->parse(m_server->getNickname(), output, getName());
-
-    if(!result.output.isEmpty())
+    // Send all strings, one after another
+    QStringList outList=QStringList::split('\n',outputAll);
+    for(unsigned int index=0;index<outList.count();index++)
     {
-        if(result.type == Konversation::Action) appendAction(m_server->getNickname(), result.output);
-        else if(result.type == Konversation::Command) appendCommandMessage(result.typeString, result.output);
-        else if(result.type == Konversation::Program) appendServerMessage(result.typeString, result.output);
-        else if(!result.typeString.isEmpty()) appendQuery(result.typeString, result.output);
-        else appendQuery(m_server->getNickname(), result.output);
-    }
+        QString output(outList[index]);
 
-    m_server->queue(result.toServer);
+        // encoding stuff is done in Server()
+        Konversation::OutputFilterResult result = m_server->getOutputFilter()->parse(m_server->getNickname(), output, getName());
+
+        if(!result.output.isEmpty())
+        {
+            if(result.type == Konversation::Action) appendAction(m_server->getNickname(), result.output);
+            else if(result.type == Konversation::Command) appendCommandMessage(result.typeString, result.output);
+            else if(result.type == Konversation::Program) appendServerMessage(result.typeString, result.output);
+            else if(!result.typeString.isEmpty()) appendQuery(result.typeString, result.output);
+            else appendQuery(m_server->getNickname(), result.output);
+        }
+
+        m_server->queue(result.toServer);
+    } // for
 }
 
 void Query::updateAppearance()
--- trunk/extragear/network/konversation/src/statuspanel.cpp #497863:497864
@@ -103,22 +103,28 @@
 void StatusPanel::sendStatusText(const QString& sendLine)
 {
     // create a work copy
-    QString output(sendLine);
+    QString outputAll(sendLine);
     // replace aliases and wildcards
-    if(m_server->getOutputFilter()->replaceAliases(output))
+    if(m_server->getOutputFilter()->replaceAliases(outputAll))
     {
-        output = m_server->parseWildcards(output, m_server->getNickname(), QString::null, QString::null, QString::null, QString::null);
+        outputAll = m_server->parseWildcards(outputAll, m_server->getNickname(), QString::null, QString::null, QString::null, QString::null);
     }
 
-    // encoding stuff is done in Server()
-    Konversation::OutputFilterResult result = m_server->getOutputFilter()->parse(m_server->getNickname(), output, QString::null);
-
-    if(!result.output.isEmpty())
+    // Send all strings, one after another
+    QStringList outList=QStringList::split('\n',outputAll);
+    for(unsigned int index=0;index<outList.count();index++)
     {
-        appendServerMessage(result.typeString, result.output);
-    }
+        QString output(outList[index]);
 
-    m_server->queue(result.toServer);
+        // encoding stuff is done in Server()
+        Konversation::OutputFilterResult result = m_server->getOutputFilter()->parse(m_server->getNickname(), output, QString::null);
+
+        if(!result.output.isEmpty())
+        {
+            appendServerMessage(result.typeString, result.output);
+        }
+        m_server->queue(result.toServer);
+    } // for
 }
 
 void StatusPanel::statusTextEntered()