[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [Konversation] c81f41e: * Only create one instance per server of
From:       Peter Simonsson <peter.simonsson () gmail ! com>
Date:       2010-07-01 13:27:37
Message-ID: 20100701132737.F0EAFBB567D () projects ! kde ! org
[Download RAW message or body]

commit c81f41e3ee7f766b269607c57aee2a22efc7f86d
Author: Peter Simonsson <peter.simonsson@gmail.com>
Date:   Thu Jul 15 17:27:17 2004 +0000

    * Only create one instance per server of outputfilter and scriptlauncher
    * Minor clean up of outputfilter's parse function... Half the amount of ifs now :)
    
    svn path=/trunk/kdeextragear-2/konversation/; revision=329677

diff --git a/konversation/channel.cpp b/konversation/channel.cpp
index 2bdd54e..a431d16 100644
--- a/konversation/channel.cpp
+++ b/konversation/channel.cpp
@@ -650,22 +650,25 @@ void Channel::sendChannelText(const QString& sendLine)
   // create a work copy
   QString output(sendLine);
   // replace aliases and wildcards
-  if(filter.replaceAliases(output)) \
output=server->parseWildcards(output,server->getNickname(),getName(),getKey(),getSelectedNicksList(),QString::null);
 +  if(server->getOutputFilter()->replaceAliases(output)) {
+    output = server->parseWildcards(output,server->getNickname(),getName(),getKey(),
+      getSelectedNicksList(),QString::null);
+  }
 
   // encoding stuff is done in Server()
-  output=filter.parse(server->getNickname(),output,getName());
+  output = server->getOutputFilter()->parse(server->getNickname(),output,getName());
 
   // Is there something we need to display for ourselves?
   if(!output.isEmpty())
   {
-    if(filter.isAction()) appendAction(server->getNickname(),output);
-    else if(filter.isCommand()) appendCommandMessage(filter.getType(),output);
-    else if(filter.isProgram()) appendServerMessage(filter.getType(),output);
-    else if(filter.isQuery()) appendQuery(filter.getType(),output);
+    if(server->getOutputFilter()->isAction()) appendAction(server->getNickname(),output);
+    else if(server->getOutputFilter()->isCommand()) \
appendCommandMessage(server->getOutputFilter()->getType(),output); +    else \
if(server->getOutputFilter()->isProgram()) \
appendServerMessage(server->getOutputFilter()->getType(),output); +    else \
if(server->getOutputFilter()->isQuery()) appendQuery(server->getOutputFilter()->getType(),output);  else \
append(server->getNickname(),output);  }
   // Send anything else to the server
-  server->queueList(filter.getServerOutputList());
+  server->queueList(server->getOutputFilter()->getServerOutputList());
 }
 
 void Channel::newTextInView(const QString& highlightColor,bool important)
diff --git a/konversation/chatwindow.cpp b/konversation/chatwindow.cpp
index d8ba6ef..b819ae2 100644
--- a/konversation/chatwindow.cpp
+++ b/konversation/chatwindow.cpp
@@ -65,9 +65,6 @@ ChatWindow::ChatWindow(QWidget* parent) : QVBox(parent)
   setSpacing(spacing());
 #endif
 
-  connect(&filter,SIGNAL(launchScript(const QString&)),
-    &scriptLauncher,SLOT(launchScript(const QString&)) );
-
 #ifdef USE_MDI
   connect(this,SIGNAL(childWindowCloseRequest(KMdiChildView*)),this,SLOT(closeRequest(KMdiChildView*)));
   connect(&blinkTimer,SIGNAL(timeout()),this,SLOT(blinkTimeout()));
@@ -136,7 +133,6 @@ void ChatWindow::blinkTimeout() // USE_MDI
 void ChatWindow::setName(const QString& newName)
 {
   name=newName;
-  scriptLauncher.setTargetName(newName);
   emit nameChanged(this,newName);
 }
 
@@ -169,48 +165,6 @@ void ChatWindow::setServer(Server* newServer)
     {
       if(textView) textView->setServer(newServer);
       else kdDebug() << "ChatWindow::setServer(): textView==0!" << endl;
-
-      connect(&filter,SIGNAL (openQuery(const QString&,const QString&)),
-               server,SLOT   (addQuery(const QString&,const QString&)) );
-
-      connect(&filter,SIGNAL (openDccPanel()),
-               server,SLOT   (requestDccPanel()) );
-      connect(&filter,SIGNAL (closeDccPanel()),
-               server,SLOT   (requestCloseDccPanel()) );
-      connect(&filter,SIGNAL (openDccSend(const QString &, const QString &)),
-               server,SLOT   (addDccSend(const QString &, const QString &)) );
-      connect(&filter,SIGNAL (requestDccSend()),
-               server,SLOT   (requestDccSend()) );
-      connect(&filter,SIGNAL (requestDccSend(const QString &)),
-               server,SLOT   (requestDccSend(const QString &)) );
-      connect(&filter,SIGNAL (requestDccChat(const QString &)),
-               server,SLOT   (requestDccChat(const QString &)) );
-      connect(&filter,SIGNAL (multiServerCommand(const QString&, const QString&)),
-               server,SLOT   (sendMultiServerCommand(const QString&, const QString&)));
-      connect(&filter,SIGNAL (reconnectServer()),
-               server,SLOT   (reconnect()));
-      connect(&filter,SIGNAL (connectToServer(const QString&, const QString&, const QString&)),
-               server,SLOT   (connectToNewServer(const QString&, const QString&, const QString&)));
-
-      connect(&filter,SIGNAL (openKonsolePanel()),
-               server,SLOT   (requestKonsolePanel()) );
-
-      connect(&filter,SIGNAL (sendToAllChannels(const QString&)),
-               server,SLOT   (sendToAllChannels(const QString&)) );
-      connect(&filter,SIGNAL (banUsers(const QStringList&,const QString&,const QString&)),
-               server,SLOT   (requestBan(const QStringList&,const QString&,const QString&)) );
-      connect(&filter,SIGNAL (unbanUsers(const QString&,const QString&)),
-               server,SLOT   (requestUnban(const QString&,const QString&)) );
-
-      connect(&filter,SIGNAL (openRawLog(bool)), server,SLOT (addRawLog(bool)) );
-      connect(&filter,SIGNAL (closeRawLog()),server,SLOT (closeRawLog()) );
-
-      scriptLauncher.setServerName(server->getServerName());
-
-      connect(&scriptLauncher,SIGNAL (scriptNotFound(const QString&)),
-                         server,SLOT (scriptNotFound(const QString&)) );
-      connect(&scriptLauncher,SIGNAL (scriptExecutionError(const QString&)),
-                         server,SLOT (scriptExecutionError(const QString&)) );
     }
   }
 }
@@ -228,7 +182,6 @@ void ChatWindow::serverOnline(bool state)
 void ChatWindow::setIdentity(const Identity *newIdentity)
 {
   identity=*newIdentity;
-  filter.setIdentity(newIdentity);
 }
 
 void ChatWindow::setTextView(IRCView* newView)
diff --git a/konversation/chatwindow.h b/konversation/chatwindow.h
index 02d5af7..e2d6f30 100644
--- a/konversation/chatwindow.h
+++ b/konversation/chatwindow.h
@@ -24,9 +24,7 @@
 #include <qvbox.h>
 #endif
 
-#include "outputfilter.h"
 #include "identity.h"
-#include "scriptlauncher.h"
 
 #ifdef USE_MDI
 #include "images.h"
@@ -179,9 +177,7 @@ class ChatWindow : public BASE_CLASS
     Server* server;
     Identity identity;
     QFile logfile;
-    OutputFilter filter;
     WindowType type;
-    ScriptLauncher scriptLauncher;
 
     bool m_notificationsEnabled;
 };
diff --git a/konversation/outputfilter.cpp b/konversation/outputfilter.cpp
index 7ab5aca..8f91b46 100644
--- a/konversation/outputfilter.cpp
+++ b/konversation/outputfilter.cpp
@@ -40,1098 +40,1073 @@
 #include "outputfilter.h"
 #include "konversationapplication.h"
 #include "ignore.h"
+#include "server.h"
 
-#if QT_VERSION < 0x030100
-#include "main.h"
-#endif
-
-OutputFilter::OutputFilter()
-{
-}
-
-OutputFilter::~OutputFilter()
-{
-}
-
-// replace all aliases in the string and return true if anything got replaced at all
-bool OutputFilter::replaceAliases(QString& line)
-{
-  QStringList aliasList=KonversationApplication::preferences.getAliasList();
-  QString cc(KonversationApplication::preferences.getCommandChar());
-
-  // check if the line starts with a defined alias
-  for(unsigned int index=0;index<aliasList.count();index++)
+namespace Konversation {
+  OutputFilter::OutputFilter(Server* server)
+    : QObject(server)
   {
-    // cut alias pattern from definition
-    QString aliasPattern(aliasList[index].section(' ',0,0));
-
-    // pattern found?
-    // TODO: cc may be a regexp character here ... we should escape it then
-    if(line.find(QRegExp("^"+cc+aliasPattern+"\\b"))!=-1)
-    {
-      // cut alias replacement from definition
-      QString aliasReplace(aliasList[index].section(' ',1));
-      // protect "%%"
-      aliasReplace.replace(QRegExp("%%"),"%\x01");
-      // replace %p placeholder with rest of line
-      aliasReplace.replace(QRegExp("%p"),line.section(' ',1));
-      // restore "%<1>" as "%%"
-      aliasReplace.replace(QRegExp("%\x01"),"%%");
-      // modify line
-      line=aliasReplace;
-      // return "replaced"
-      return true;
-    }
-  } // for
-
-  return false;
-}
-
-QString& OutputFilter::parse(const QString& myNick,const QString& originalLine,const QString& name)
-{
-  setCommandChar();
-
-  toServer=QString::null;
-  toServerList=QStringList::QStringList();
-  output=QString::null;
-  type=QString::null;
-  destination=name;
-
-  action=false;
-  program=false;
-  command=false;
-  query=false;
-
-  QString inputLine(originalLine);
-
-  if(!KonversationApplication::preferences.getDisableExpansion())
+    m_server = server;
+  }
+  
+  OutputFilter::~OutputFilter()
   {
-    // replace placeholders
-    inputLine.replace(QRegExp("%%"),"%\x01");  // make sure to protect double %%
-    inputLine.replace(QRegExp("%B"),"\x02");   // replace %B with bold char
-    inputLine.replace(QRegExp("%C"),"\x03");   // replace %C with color char
-    inputLine.replace(QRegExp("%G"),"\x07");   // replace %G with ASCII BEL 0x07
-    inputLine.replace(QRegExp("%I"),"\x09");   // replace %I with italics char
-    inputLine.replace(QRegExp("%O"),"\x0f");   // replace %O with reset to default char
-    inputLine.replace(QRegExp("%S"),"\x13");   // replace %S with strikethru char
-    //  inputLine.replace(QRegExp("%?"),"\x15");
-    inputLine.replace(QRegExp("%R"),"\x16");   // replace %R with reverse char
-    inputLine.replace(QRegExp("%U"),"\x1f");   // replace %U with underline char
-
-    inputLine.replace(QRegExp("%\x01"),"%");   // restore double %% as single %
   }
-
-  QString line=inputLine.lower();
-
-  // Action?
-  if(line.startsWith(commandChar+"me ") && !destination.isEmpty())
+  
+  // replace all aliases in the string and return true if anything got replaced at all
+  bool OutputFilter::replaceAliases(QString& line)
   {
-    toServer="PRIVMSG "+name+" :"+'\x01'+"ACTION "+inputLine.mid(4)+'\x01';
-    output=inputLine.mid(4);
-    action=true;
+    QStringList aliasList=KonversationApplication::preferences.getAliasList();
+    QString cc(KonversationApplication::preferences.getCommandChar());
+  
+    // check if the line starts with a defined alias
+    for(unsigned int index=0;index<aliasList.count();index++)
+    {
+      // cut alias pattern from definition
+      QString aliasPattern(aliasList[index].section(' ',0,0));
+  
+      // pattern found?
+      // TODO: cc may be a regexp character here ... we should escape it then
+      if(line.find(QRegExp("^"+cc+aliasPattern+"\\b"))!=-1)
+      {
+        // cut alias replacement from definition
+        QString aliasReplace(aliasList[index].section(' ',1));
+        // protect "%%"
+        aliasReplace.replace(QRegExp("%%"),"%\x01");
+        // replace %p placeholder with rest of line
+        aliasReplace.replace(QRegExp("%p"),line.section(' ',1));
+        // restore "%<1>" as "%%"
+        aliasReplace.replace(QRegExp("%\x01"),"%%");
+        // modify line
+        line=aliasReplace;
+        // return "replaced"
+        return true;
+      }
+    } // for
+  
+    return false;
   }
-  // Convert double command chars at the beginning to single ones
-  else if(line.startsWith(commandChar+commandChar) && !destination.isEmpty())
+  
+  QString& OutputFilter::parse(const QString& myNick,const QString& originalLine,const QString& name)
   {
-    toServer="PRIVMSG "+name+" :"+inputLine.mid(1);
-    output=inputLine.mid(1);
+    setCommandChar();
+  
+    toServer=QString::null;
+    toServerList=QStringList::QStringList();
+    output=QString::null;
+    type=QString::null;
+    destination=name;
+  
+    action=false;
+    program=false;
+    command=false;
+    query=false;
+  
+    QString inputLine(originalLine);
+  
+    if(!KonversationApplication::preferences.getDisableExpansion())
+    {
+      // replace placeholders
+      inputLine.replace(QRegExp("%%"),"%\x01");  // make sure to protect double %%
+      inputLine.replace(QRegExp("%B"),"\x02");   // replace %B with bold char
+      inputLine.replace(QRegExp("%C"),"\x03");   // replace %C with color char
+      inputLine.replace(QRegExp("%G"),"\x07");   // replace %G with ASCII BEL 0x07
+      inputLine.replace(QRegExp("%I"),"\x09");   // replace %I with italics char
+      inputLine.replace(QRegExp("%O"),"\x0f");   // replace %O with reset to default char
+      inputLine.replace(QRegExp("%S"),"\x13");   // replace %S with strikethru char
+      //  inputLine.replace(QRegExp("%?"),"\x15");
+      inputLine.replace(QRegExp("%R"),"\x16");   // replace %R with reverse char
+      inputLine.replace(QRegExp("%U"),"\x1f");   // replace %U with underline char
+  
+      inputLine.replace(QRegExp("%\x01"),"%");   // restore double %% as single %
+    }
+  
+    QString line=inputLine.lower();
+  
+    // Action?
+    if(line.startsWith(commandChar+"me ") && !destination.isEmpty())
+    {
+      toServer="PRIVMSG "+name+" :"+'\x01'+"ACTION "+inputLine.mid(4)+'\x01';
+      output=inputLine.mid(4);
+      action=true;
+    }
+    // Convert double command chars at the beginning to single ones
+    else if(line.startsWith(commandChar+commandChar) && !destination.isEmpty())
+    {
+      toServer="PRIVMSG "+name+" :"+inputLine.mid(1);
+      output=inputLine.mid(1);
+    }
+    // Server command?
+    else if(line.startsWith(commandChar))
+    {
+      QString command = inputLine.section(' ', 0, 0).mid(1);
+      QString parameter = inputLine.section(' ', 1);
+      parameter = parameter.stripWhiteSpace();
+  
+      if     (command == "join")    parseJoin(parameter);
+      else if(command == "part")    parsePart(parameter);
+      else if(command == "leave")   parsePart(parameter);
+      else if(command == "quit")    parseQuit(parameter);
+      else if(command == "notice")  parseNotice(parameter);
+      else if(command == "j")       parseJoin(parameter);
+      else if(command == "msg")     parseMsg(myNick,parameter);
+      else if(command == "smsg")    parseSMsg(parameter);
+      else if(command == "query")   parseQuery(parameter);
+      else if(command == "op")      parseOp(parameter);
+      else if(command == "deop")    parseDeop(parameter);
+      else if(command == "voice")   parseVoice(parameter);
+      else if(command == "unvoice") parseUnvoice(parameter);
+      else if(command == "ctcp")    parseCtcp(parameter);
+      else if(command == "kick")    parseKick(parameter);
+      else if(command == "topic")   parseTopic(parameter);
+      else if(command == "away")    parseAway(parameter);
+      else if(command == "invite")  parseInvite(parameter);
+      else if(command == "exec")    parseExec(parameter);
+      else if(command == "notify")  parseNotify(parameter);
+      else if(command == "oper")    parseOper(myNick,parameter);
+      else if(command == "ban")     parseBan(parameter);
+      else if(command == "unban")   parseUnban(parameter);
+      else if(command == "ignore")  parseIgnore(parameter);
+      else if(command == "quote")   parseQuote(parameter);
+      else if(command == "say")     parseSay(parameter);
+  
+      else if(command == "raw")     parseRaw(parameter);
+      else if(command == "dcc")     parseDcc(parameter);
+      else if(command == "konsole") parseKonsole();
+      
+      else if(command == "aaway")   parseAaway(parameter);
+      else if(command == "ame")     parseAme(parameter);
+      else if(command == "amsg")    parseAmsg(parameter);
+      
+      else if(command == "server")  parseServer(parameter);
+      
+      else if(command == "prefs")   parsePrefs(parameter);
+      
+      // Forward unknown commands to server
+      else {
+        toServer = inputLine.mid(1);
+        unknownCommand = toServer;
+      }
+    }
+    // Ordinary message to channel/query?
+    else if(!destination.isEmpty())
+    {
+      toServer="PRIVMSG "+destination+" :"+inputLine;
+      output=inputLine;
+    }
+    // Eveything else goes to the server unchanged
+    else
+    {
+      toServer=inputLine;
+      output=inputLine;
+      type=i18n("Raw");
+      program=true;
+    }
+  
+    return output;
   }
-  // Server command?
-  else if(line.at(0)==commandChar.at(0))
+  
+  void OutputFilter::parseOp(const QString &parameter)
   {
-    QString parameter=inputLine.mid(inputLine.find(" ")+1);
-    parameter=parameter.stripWhiteSpace();
-
-    line=line.mid(1);
-
-    if     (line.startsWith("join "))    parseJoin(parameter);
-    else if(line.startsWith("part "))    parsePart(parameter);
-    else if(line.startsWith("leave "))   parsePart(parameter);
-    else if(line.startsWith("quit "))    parseQuit(parameter);
-    else if(line.startsWith("notice "))  parseNotice(parameter);
-    else if(line.startsWith("j "))       parseJoin(parameter);
-    else if(line.startsWith("msg "))     parseMsg(myNick,parameter);
-    else if(line.startsWith("smsg "))    parseSMsg(parameter);
-    else if(line.startsWith("query "))   parseQuery(parameter);
-    else if(line.startsWith("op "))      parseOp(parameter);
-    else if(line.startsWith("deop "))    parseDeop(parameter);
-    else if(line.startsWith("voice "))   parseVoice(parameter);
-    else if(line.startsWith("unvoice ")) parseUnvoice(parameter);
-    else if(line.startsWith("ctcp "))    parseCtcp(parameter);
-    else if(line.startsWith("kick "))    parseKick(parameter);
-    else if(line.startsWith("topic "))   parseTopic(parameter);
-    else if(line.startsWith("away "))    parseAway(parameter);
-    else if(line.startsWith("invite "))  parseInvite(parameter);
-    else if(line.startsWith("exec "))    parseExec(parameter);
-    else if(line.startsWith("notify "))  parseNotify(parameter);
-    else if(line.startsWith("oper "))    parseOper(myNick,parameter);
-    else if(line.startsWith("ban "))     parseBan(parameter);
-    else if(line.startsWith("unban "))   parseUnban(parameter);
-    else if(line.startsWith("ignore "))  parseIgnore(parameter);
-    else if(line.startsWith("quote "))   parseQuote(parameter);
-    else if(line.startsWith("say "))     parseSay(parameter);
-
-    else if(line.startsWith("raw "))     parseRaw(parameter);
-    else if(line.startsWith("dcc "))     parseDcc(parameter);
-    else if(line.startsWith("konsole ")) parseKonsole();
-    
-    else if(line.startsWith("aaway "))   parseAaway(parameter);
-    else if(line.startsWith("ame "))     parseAme(parameter);
-    else if(line.startsWith("amsg "))    parseAmsg(parameter);
-    
-    else if(line.startsWith("server "))  parseServer(parameter);
-    
-    else if(line.startsWith("prefs "))   parsePrefs(parameter);
-
-    else if(line=="join")                parseJoin(QString::null);
-    else if(line=="part")                parsePart(QString::null);
-    else if(line=="leave")               parsePart(QString::null);
-    else if(line=="quit")                parseQuit(QString::null);
-    else if(line=="notice")              parseNotice(QString::null);
-    else if(line=="kick")                parseKick(QString::null);
-    else if(line=="topic")               parseTopic(QString::null);
-    else if(line=="away")                parseAway(QString::null);
-    else if(line=="back")                parseAway(QString::null);
-    else if(line=="unaway")              parseAway(QString::null);
-    else if(line=="invite")              parseInvite(QString::null);
-    else if(line=="exec")                parseExec(QString::null);
-    else if(line=="notify")              parseNotify(QString::null);
-    else if(line=="oper")                parseOper(myNick,QString::null);
-    else if(line=="ban")                 parseBan(QString::null);
-    else if(line=="unban")               parseUnban(QString::null);
-    else if(line=="ignore")              parseIgnore(QString::null);
-    else if(line=="quote")               parseQuote(QString::null);
-    else if(line=="say")                 parseSay(QString::null);
-
-    else if(line=="dcc")                 parseDcc(QString::null);
-    else if(line=="raw")                 parseRaw(QString::null);
-    else if(line=="konsole")             parseKonsole();
-
-    else if(line=="aaway")               parseAaway(QString::null);
-    else if(line=="ame")                 parseAme(QString::null);
-    else if(line=="amsg")                parseAmsg(QString::null);
-    
-    else if(line == "server")            parseServer(QString::null);
-    
-    else if(line == "prefs")             parsePrefs(QString::null);
-    
-    // Forward unknown commands to server
-    else toServer=inputLine.mid(1);
+    changeMode(parameter,'o','+');
   }
-  // Ordinary message to channel/query?
-  else if(!destination.isEmpty())
+  
+  void OutputFilter::parseDeop(const QString &parameter)
   {
-    toServer="PRIVMSG "+destination+" :"+inputLine;
-    output=inputLine;
+    changeMode(parameter,'o','-');
   }
-  // Eveything else goes to the server unchanged
-  else
+  
+  void OutputFilter::parseVoice(const QString &parameter)
   {
-    toServer=inputLine;
-    output=inputLine;
-    type=i18n("Raw");
-    program=true;
+    changeMode(parameter,'v','+');
   }
-
-  return output;
-}
-
-void OutputFilter::parseOp(const QString &parameter)
-{
-  changeMode(parameter,'o','+');
-}
-
-void OutputFilter::parseDeop(const QString &parameter)
-{
-  changeMode(parameter,'o','-');
-}
-
-void OutputFilter::parseVoice(const QString &parameter)
-{
-  changeMode(parameter,'v','+');
-}
-
-void OutputFilter::parseUnvoice(const QString &parameter)
-{
-  changeMode(parameter,'v','-');
-}
-
-void OutputFilter::parseJoin(const QString &channelName)
-{
-  if(channelName.isEmpty())
+  
+  void OutputFilter::parseUnvoice(const QString &parameter)
   {
-    type=i18n("Usage");
-    output=i18n("Usage: %1JOIN <channel> [password]").arg(commandChar);
-    program=true;
+    changeMode(parameter,'v','-');
   }
-  else
-    toServer="JOIN " + channelName;
-}
-
-void OutputFilter::parseKick(const QString &parameter)
-{
-  if(isAChannel(destination))
+  
+  void OutputFilter::parseJoin(const QString &channelName)
   {
-    // get nick to kick
-    QString victim=parameter.left(parameter.find(" "));
-    if(victim.isEmpty())
+    if(channelName.isEmpty())
     {
       type=i18n("Usage");
-      output=i18n("Usage: %1KICK <nick> [reason]").arg(commandChar);
+      output=i18n("Usage: %1JOIN <channel> [password]").arg(commandChar);
       program=true;
     }
     else
-    {
-      // get kick reason (if any)
-      QString reason=parameter.mid(victim.length()+1);
-      // if no reason given, take default reason
-      if(reason.isEmpty()) reason=identity.getKickReason();
-      toServer="KICK "+destination+" "+victim+" :"+reason;
-    }
-  }
-  else
-  {
-    type=i18n("Error");
-    output=i18n("%1KICK only works from within channels.").arg(commandChar);
-    program=true;
+      toServer="JOIN " + channelName;
   }
-}
-
-void OutputFilter::parsePart(const QString &parameter)
-{
-  // No parameter, try default part message
-  if(parameter.isEmpty())
+  
+  void OutputFilter::parseKick(const QString &parameter)
   {
-    // But only if we actually are in a channel
-    if(isAChannel(destination)) toServer="PART "+destination+" :"+identity.getPartReason();
+    if(isAChannel(destination))
+    {
+      // get nick to kick
+      QString victim=parameter.left(parameter.find(" "));
+      if(victim.isEmpty())
+      {
+        type=i18n("Usage");
+        output=i18n("Usage: %1KICK <nick> [reason]").arg(commandChar);
+        program=true;
+      }
+      else
+      {
+        // get kick reason (if any)
+        QString reason=parameter.mid(victim.length()+1);
+        // if no reason given, take default reason
+        if(reason.isEmpty()) reason=identity.getKickReason();
+        toServer="KICK "+destination+" "+victim+" :"+reason;
+      }
+    }
     else
     {
       type=i18n("Error");
-      output=i18n("%1PART without parameters only works from within a channel or a \
query.").arg(commandChar); +      output=i18n("%1KICK only works from within \
channels.").arg(commandChar);  program=true;
     }
   }
-  else
+  
+  void OutputFilter::parsePart(const QString &parameter)
   {
-    // part a given channel
-    if(isAChannel(parameter))
+    // No parameter, try default part message
+    if(parameter.isEmpty())
     {
-      // get channel name
-      QString channel=parameter.left(parameter.find(" "));
-      // get part reason (if any)
-      QString reason=parameter.mid(channel.length()+1);
-      // if no reason given, take default reason
-      if(reason.isEmpty()) reason=identity.getPartReason();
-      toServer="PART "+channel+" :"+reason;
-    }
-    // part this channel with a given reason
-    else
-    {
-      if(isAChannel(destination)) toServer="PART "+destination+" :"+parameter;
+      // But only if we actually are in a channel
+      if(isAChannel(destination)) toServer="PART "+destination+" :"+identity.getPartReason();
       else
       {
         type=i18n("Error");
-        output=i18n("%1PART without channel name only works from within a channel.").arg(commandChar);
+        output=i18n("%1PART without parameters only works from within a channel or a \
query.").arg(commandChar);  program=true;
       }
     }
-  }
-}
-
-void OutputFilter::parseTopic(const QString &parameter)
-{
-  // No parameter, try to get current topic
-  if(parameter.isEmpty())
-  {
-    // But only if we actually are in a channel
-    if(isAChannel(destination)) toServer="TOPIC "+destination;
     else
     {
-      type=i18n("Error");
-      output=i18n("%1TOPIC without parameters only works from within a channel.").arg(commandChar);
-      program=true;
+      // part a given channel
+      if(isAChannel(parameter))
+      {
+        // get channel name
+        QString channel=parameter.left(parameter.find(" "));
+        // get part reason (if any)
+        QString reason=parameter.mid(channel.length()+1);
+        // if no reason given, take default reason
+        if(reason.isEmpty()) reason=identity.getPartReason();
+        toServer="PART "+channel+" :"+reason;
+      }
+      // part this channel with a given reason
+      else
+      {
+        if(isAChannel(destination)) toServer="PART "+destination+" :"+parameter;
+        else
+        {
+          type=i18n("Error");
+          output=i18n("%1PART without channel name only works from within a channel.").arg(commandChar);
+          program=true;
+        }
+      }
     }
   }
-  else
+  
+  void OutputFilter::parseTopic(const QString &parameter)
   {
-    // retrieve or set topic of a given channel
-    if(isAChannel(parameter))
+    // No parameter, try to get current topic
+    if(parameter.isEmpty())
     {
-      // get channel name
-      QString channel=parameter.left(parameter.find(" "));
-      // get topic (if any)
-      QString topic=parameter.mid(channel.length()+1);
-      // if no topic given, retrieve topic
-      if(topic.isEmpty()) toServer="TOPIC "+channel;
-      // otherwise set topic there
-      else toServer="TOPIC "+channel+" :"+topic;
+      // But only if we actually are in a channel
+      if(isAChannel(destination)) toServer="TOPIC "+destination;
+      else
+      {
+        type=i18n("Error");
+        output=i18n("%1TOPIC without parameters only works from within a channel.").arg(commandChar);
+        program=true;
+      }
     }
-    // set this channel's topic
     else
     {
-      if(isAChannel(destination)) toServer="TOPIC "+destination+" :"+parameter;
+      // retrieve or set topic of a given channel
+      if(isAChannel(parameter))
+      {
+        // get channel name
+        QString channel=parameter.left(parameter.find(" "));
+        // get topic (if any)
+        QString topic=parameter.mid(channel.length()+1);
+        // if no topic given, retrieve topic
+        if(topic.isEmpty()) toServer="TOPIC "+channel;
+        // otherwise set topic there
+        else toServer="TOPIC "+channel+" :"+topic;
+      }
+      // set this channel's topic
       else
       {
-        type=i18n("Error");
-        output=i18n("%1TOPIC without channel name only works from within a channel.").arg(commandChar);
-        program=true;
+        if(isAChannel(destination)) toServer="TOPIC "+destination+" :"+parameter;
+        else
+        {
+          type=i18n("Error");
+          output=i18n("%1TOPIC without channel name only works from within a \
channel.").arg(commandChar); +          program=true;
+        }
       }
     }
   }
-}
-
-void OutputFilter::parseAway(const QString &reason)
-{
-  if(reason.isEmpty())
-  {
-    toServer="AWAY";
-  }
-  else
+  
+  void OutputFilter::parseAway(const QString &reason)
   {
-    if(identity.getShowAwayMessage())
+    if(reason.isEmpty())
     {
-      QString message=identity.getAwayMessage();
-      emit sendToAllChannels(message.replace(QRegExp("%s",false),reason));
+      toServer="AWAY";
     }
-
-    toServer="AWAY :"+reason;
-  }
-  // remove lines in output to prevent them sent twice in sending channel
-  output=QString::null;
-  toServerList.clear();
-}
-
-void OutputFilter::parseQuit(const QString &reason)
-{
-  toServer = "QUIT :";
-  // if no reason given, take default reason
-  if(reason.isEmpty())
-    toServer+=identity.getPartReason();
-  else
-    toServer+=reason;
-}
-
-void OutputFilter::parseNotice(const QString &parameter)
-{
-  QString recipient=parameter.left(parameter.find(" "));
-  QString message=parameter.mid(recipient.length()+1);
-
-  if(parameter.isEmpty() || message.isEmpty())
-  {
-    type=i18n("Usage");
-    output=i18n("Usage: %1NOTICE <recipient> <message>").arg(commandChar);
-    program=true;
-  }
-  else
-  {
-    type=i18n("Notice");
-    toServer="NOTICE "+recipient+" :"+message;
-    output=i18n("Sending notice \"%1\" to %2.").arg(message).arg(recipient);
-    program=true;
+    else
+    {
+      if(identity.getShowAwayMessage())
+      {
+        QString message=identity.getAwayMessage();
+        emit sendToAllChannels(message.replace(QRegExp("%s",false),reason));
+      }
+  
+      toServer="AWAY :"+reason;
+    }
+    // remove lines in output to prevent them sent twice in sending channel
+    output=QString::null;
+    toServerList.clear();
   }
-}
-
-void OutputFilter::parseMsg(const QString &myNick, const QString &parameter)
-{
-  QString recipient=parameter.left(parameter.find(" "));
-  QString message=parameter.mid(recipient.length()+1);
-
-  if(message.startsWith(commandChar+"me"))
+  
+  void OutputFilter::parseQuit(const QString &reason)
   {
-    toServer="PRIVMSG "+recipient+" :"+'\x01'+"ACTION "+message.mid(4)+'\x01';
-    output=QString("* %1 %2").arg(myNick).arg(message.mid(4));
+    toServer = "QUIT :";
+    // if no reason given, take default reason
+    if(reason.isEmpty())
+      toServer+=identity.getPartReason();
+    else
+      toServer+=reason;
   }
-  else
+  
+  void OutputFilter::parseNotice(const QString &parameter)
   {
-    toServer="PRIVMSG "+recipient+" :"+message;
-    output=message;
+    QString recipient=parameter.left(parameter.find(" "));
+    QString message=parameter.mid(recipient.length()+1);
+  
+    if(parameter.isEmpty() || message.isEmpty())
+    {
+      type=i18n("Usage");
+      output=i18n("Usage: %1NOTICE <recipient> <message>").arg(commandChar);
+      program=true;
+    }
+    else
+    {
+      type=i18n("Notice");
+      toServer="NOTICE "+recipient+" :"+message;
+      output=i18n("Sending notice \"%1\" to %2.").arg(message).arg(recipient);
+      program=true;
+    }
   }
-  type="-> "+recipient;
-  query=true;
-}
-
-void OutputFilter::parseSMsg(const QString &parameter)
-{
-  QString recipient=parameter.left(parameter.find(" "));
-  QString message=parameter.mid(recipient.length()+1);
-
-  if(message.startsWith(commandChar+"me"))
+  
+  void OutputFilter::parseMsg(const QString &myNick, const QString &parameter)
   {
-    toServer="PRIVMSG "+recipient+" :"+'\x01'+"ACTION "+message.mid(4)+'\x01';
+    QString recipient=parameter.left(parameter.find(" "));
+    QString message=parameter.mid(recipient.length()+1);
+  
+    if(message.startsWith(commandChar+"me"))
+    {
+      toServer="PRIVMSG "+recipient+" :"+'\x01'+"ACTION "+message.mid(4)+'\x01';
+      output=QString("* %1 %2").arg(myNick).arg(message.mid(4));
+    }
+    else
+    {
+      toServer="PRIVMSG "+recipient+" :"+message;
+      output=message;
+    }
+    type="-> "+recipient;
+    query=true;
   }
-  else
+  
+  void OutputFilter::parseSMsg(const QString &parameter)
   {
-    toServer="PRIVMSG "+recipient+" :"+message;
+    QString recipient=parameter.left(parameter.find(" "));
+    QString message=parameter.mid(recipient.length()+1);
+  
+    if(message.startsWith(commandChar+"me"))
+    {
+      toServer="PRIVMSG "+recipient+" :"+'\x01'+"ACTION "+message.mid(4)+'\x01';
+    }
+    else
+    {
+      toServer="PRIVMSG "+recipient+" :"+message;
+    }
   }
-}
-
-void OutputFilter::parseCtcp(const QString &parameter)
-{
-  QString recipient=parameter.section(' ',0,0);  // who is the recipient?
-  QString request=parameter.section(' ',1,1);    // what is the first word of the ctcp?
-  QString message=parameter.section(' ',1);      // what is the complete ctcp command?
-
-  if(request.lower()=="ping")
+  
+  void OutputFilter::parseCtcp(const QString &parameter)
   {
-#if QT_VERSION < 0x030100
-    unsigned int time_t=toTime_t(QDateTime::currentDateTime());
-#else
-    unsigned int time_t=QDateTime::currentDateTime().toTime_t();
-#endif
-    toServer=QString("PRIVMSG %1 :\x01PING %2\x01").arg(recipient).arg(time_t);
-    output=i18n("Sending CTCP-%1 request to %2").arg("PING").arg(recipient);
+    QString recipient=parameter.section(' ',0,0);  // who is the recipient?
+    QString request=parameter.section(' ',1,1);    // what is the first word of the ctcp?
+    QString message=parameter.section(' ',1);      // what is the complete ctcp command?
+  
+    if(request.lower()=="ping")
+    {
+  #if QT_VERSION < 0x030100
+      unsigned int time_t=toTime_t(QDateTime::currentDateTime());
+  #else
+      unsigned int time_t=QDateTime::currentDateTime().toTime_t();
+  #endif
+      toServer=QString("PRIVMSG %1 :\x01PING %2\x01").arg(recipient).arg(time_t);
+      output=i18n("Sending CTCP-%1 request to %2").arg("PING").arg(recipient);
+    }
+    else
+    {
+      toServer=QString("PRIVMSG "+recipient+" :"+'\x01'+message+'\x01');
+      output=i18n("Sending CTCP-%1 request to %2").arg(message).arg(recipient);
+    }
+    type=i18n("CTCP");
+    program=true;
   }
-  else
+  
+  void OutputFilter::parseQuery(const QString &parameter)
   {
-    toServer=QString("PRIVMSG "+recipient+" :"+'\x01'+message+'\x01');
-    output=i18n("Sending CTCP-%1 request to %2").arg(message).arg(recipient);
+    QStringList queryList=QStringList::split(' ',parameter);
+    for(unsigned int index=0;index<queryList.count();index++) emit \
openQuery(queryList[index],QString::null);  }
-  type=i18n("CTCP");
-  program=true;
-}
-
-void OutputFilter::parseQuery(const QString &parameter)
-{
-  QStringList queryList=QStringList::split(' ',parameter);
-  for(unsigned int index=0;index<queryList.count();index++) emit \
                openQuery(queryList[index],QString::null);
-}
-
-void OutputFilter::changeMode(const QString &parameter,char mode,char giveTake)
-{
-  // TODO: Make sure this works with +l <limit> and +k <password> also!
-  QString token=QString::QString();
-  QString tmpToken=QString::null;
-  QStringList nickList=QStringList::split(' ',parameter);
-  if(nickList.count())
+  
+  void OutputFilter::changeMode(const QString &parameter,char mode,char giveTake)
   {
-    // Check if the user specified a channel
-    if(isAChannel(nickList[0]))
-    {
-      token="MODE "+nickList[0];
-      // remove the first element
-      nickList.remove(nickList.begin());
-    }
-    // Add default destination if it is a channel
-    else if(isAChannel(destination)) token="MODE "+destination;
-    // Only continue if there was no error
-    if(token.length())
+    // TODO: Make sure this works with +l <limit> and +k <password> also!
+    QString token=QString::QString();
+    QString tmpToken=QString::null;
+    QStringList nickList=QStringList::split(' ',parameter);
+    if(nickList.count())
     {
-      unsigned int modeCount=nickList.count();
-/*      if(modeCount>3)
+      // Check if the user specified a channel
+      if(isAChannel(nickList[0]))
       {
-        modeCount=3;
-        output=i18n("Modes can only take a certain number of nick names at the same time."
-                    "The server may truncate your mode list.");
-        type=i18n("Warning");
-        program=true;
-      } */
-
-      QString modes;
-      modes.fill(mode,modeCount);
-
-      token+=QString(" ")+giveTake+modes;
-      tmpToken=token;
-
-      for(unsigned int index=0;index<modeCount;index++)
+        token="MODE "+nickList[0];
+        // remove the first element
+        nickList.remove(nickList.begin());
+      }
+      // Add default destination if it is a channel
+      else if(isAChannel(destination)) token="MODE "+destination;
+      // Only continue if there was no error
+      if(token.length())
       {
-        if ((index % 3) == 0)
+        unsigned int modeCount=nickList.count();
+  /*      if(modeCount>3)
         {
-          toServerList.append(token);
-          token=tmpToken;
+          modeCount=3;
+          output=i18n("Modes can only take a certain number of nick names at the same time."
+                      "The server may truncate your mode list.");
+          type=i18n("Warning");
+          program=true;
+        } */
+  
+        QString modes;
+        modes.fill(mode,modeCount);
+  
+        token+=QString(" ")+giveTake+modes;
+        tmpToken=token;
+  
+        for(unsigned int index=0;index<modeCount;index++)
+        {
+          if ((index % 3) == 0)
+          {
+            toServerList.append(token);
+            token=tmpToken;
+          }
+          token+=" "+nickList[index];
         }
-        token+=" "+nickList[index];
+        if (token!=tmpToken) toServerList.append(token);
       }
-      if (token!=tmpToken) toServerList.append(token);
     }
   }
-}
-
-void OutputFilter::parseDcc(const QString &parameter)
-{
-  // No parameter, just open DCC panel
-  if(parameter.isEmpty()) emit openDccPanel();
-  else
+  
+  void OutputFilter::parseDcc(const QString &parameter)
   {
-    QStringList parameterList=QStringList::split(' ',parameter);
-
-    QString dccType=parameterList[0].lower();
-
-    if(dccType=="close") emit closeDccPanel();
-    else if(dccType=="send")
+    // No parameter, just open DCC panel
+    if(parameter.isEmpty()) emit openDccPanel();
+    else
     {
-      if(parameterList.count()==1)                 // DCC SEND
-        emit requestDccSend();
-      else if(parameterList.count()==2)            // DCC SEND <nickname>
-        emit requestDccSend(parameterList[1]);
-      else if(parameterList.count()>2)             // DCC SEND <nickname> <file> [file] ...
+      QStringList parameterList=QStringList::split(' ',parameter);
+  
+      QString dccType=parameterList[0].lower();
+  
+      if(dccType=="close") emit closeDccPanel();
+      else if(dccType=="send")
       {
-// TODO: make sure this will work:
-//        output=i18n("Usage: %1DCC SEND nickname [fi6lename] [filename] ...").arg(commandChar);
-        QFile file(parameterList[2]);
-        if(file.exists())
-          emit openDccSend(parameterList[1],parameterList[2]);
-        else
+        if(parameterList.count()==1)                 // DCC SEND
+          emit requestDccSend();
+        else if(parameterList.count()==2)            // DCC SEND <nickname>
+          emit requestDccSend(parameterList[1]);
+        else if(parameterList.count()>2)             // DCC SEND <nickname> <file> [file] ...
         {
-          type=i18n("Error");
-          output=i18n("Error: File \"%1\" does not exist.").arg(parameterList[2]);
+  // TODO: make sure this will work:
+  //        output=i18n("Usage: %1DCC SEND nickname [fi6lename] [filename] ...").arg(commandChar);
+          QFile file(parameterList[2]);
+          if(file.exists())
+            emit openDccSend(parameterList[1],parameterList[2]);
+          else
+          {
+            type=i18n("Error");
+            output=i18n("Error: File \"%1\" does not exist.").arg(parameterList[2]);
+            program=true;
+          }
+        }
+        else   // Don't know how this should happen, but ...
+        {
+          type=i18n("Usage");
+          output=i18n("Usage: %1DCC [SEND nickname filename]").arg(commandChar);
           program=true;
         }
       }
-      else   // Don't know how this should happen, but ...
+      // TODO: DCC Chat etc. comes here
+      else if(dccType=="chat")
       {
-        type=i18n("Usage");
-        output=i18n("Usage: %1DCC [SEND nickname filename]").arg(commandChar);
-        program=true;
+        if(parameterList.count()==2)
+          emit requestDccChat(parameterList[1]);
+        else
+        {
+          type=i18n("Usage");
+          output=i18n("Usage: %1DCC [CHAT nickname]").arg(commandChar);
+          program=true;
+        }
       }
-    }
-    // TODO: DCC Chat etc. comes here
-    else if(dccType=="chat")
-    {
-      if(parameterList.count()==2)
-        emit requestDccChat(parameterList[1]);
       else
       {
-        type=i18n("Usage");
-        output=i18n("Usage: %1DCC [CHAT nickname]").arg(commandChar);
+        type=i18n("Error");
+        output=i18n("Error: Unrecognized command DCC %1. Possible commands are SEND, CHAT, \
CLOSE.").arg(parameterList[0]);  program=true;
       }
     }
-    else
-    {
-      type=i18n("Error");
-      output=i18n("Error: Unrecognized command DCC %1. Possible commands are SEND, CHAT, \
                CLOSE.").arg(parameterList[0]);
-      program=true;
-    }
   }
-}
-
-void OutputFilter::sendRequest(const QString &recipient,const QString &fileName,const QString \
                &address,const QString &port,unsigned long size)
-{
-  QFile file(fileName);
-  QFileInfo info(file);
-
-  toServer="PRIVMSG "+recipient+" :"+'\x01'+"DCC SEND "+info.fileName().replace(QRegExp(" "),"_")+" \
                "+address+" "+port+" "+QString::number(size)+'\x01';
-  output=i18n("Offering \"%1\" to %2 for upload.").arg(fileName).arg(recipient);
-  type=i18n("DCC");
-  program=true;
-}
-
-// Accepting Resume Request
-void OutputFilter::acceptRequest(const QString &recipient,const QString &fileName,const QString \
                &port,int startAt)
-{
-  toServer="PRIVMSG "+recipient+" :"+'\x01'+"DCC ACCEPT "+fileName+" "+port+" \
                "+QString::number(startAt)+'\x01';
-  output=i18n("Accepting DCC Resume request from \"%1\" for file \"%2\".").arg(recipient).arg(fileName);
-  type=i18n("DCC");
-  program=true;
-}
-
-void OutputFilter::resumeRequest(const QString &sender,const QString &fileName,const QString &port,int \
                startAt)
-{
-  QString newFileName(fileName);
-  newFileName.replace(QRegExp(" "),"_");
-  toServer="PRIVMSG "+sender+" :"+'\x01'+"DCC RESUME "+newFileName+" "+port+" \
                "+QString::number(startAt)+'\x01';
-  output=i18n("Sending DCC Resume request to \"%1\" for file \"%2\".").arg(sender).arg(fileName);
-  type=i18n("DCC");
-  program=true;
-}
-
-void OutputFilter::parseInvite(const QString &parameter)
-{
-  if(parameter.isEmpty())
+  
+  void OutputFilter::sendRequest(const QString &recipient,const QString &fileName,const QString \
&address,const QString &port,unsigned long size)  {
-    type=i18n("Usage");
-    output=i18n("Usage: INVITE <nick> [channel]");
+    QFile file(fileName);
+    QFileInfo info(file);
+  
+    toServer="PRIVMSG "+recipient+" :"+'\x01'+"DCC SEND "+info.fileName().replace(QRegExp(" "),"_")+" \
"+address+" "+port+" "+QString::number(size)+'\x01'; +    output=i18n("Offering \"%1\" to %2 for \
upload.").arg(fileName).arg(recipient); +    type=i18n("DCC");
     program=true;
   }
-  else
+  
+  // Accepting Resume Request
+  void OutputFilter::acceptRequest(const QString &recipient,const QString &fileName,const QString \
&port,int startAt)  {
-    QString nick=parameter.section(' ',0,0);
-    QString channel=parameter.section(' ',1,1);
-
-    if(channel.isEmpty())
+    toServer="PRIVMSG "+recipient+" :"+'\x01'+"DCC ACCEPT "+fileName+" "+port+" \
"+QString::number(startAt)+'\x01'; +    output=i18n("Accepting DCC Resume request from \"%1\" for file \
\"%2\".").arg(recipient).arg(fileName); +    type=i18n("DCC");
+    program=true;
+  }
+  
+  void OutputFilter::resumeRequest(const QString &sender,const QString &fileName,const QString &port,int \
startAt) +  {
+    QString newFileName(fileName);
+    newFileName.replace(QRegExp(" "),"_");
+    toServer="PRIVMSG "+sender+" :"+'\x01'+"DCC RESUME "+newFileName+" "+port+" \
"+QString::number(startAt)+'\x01'; +    output=i18n("Sending DCC Resume request to \"%1\" for file \
\"%2\".").arg(sender).arg(fileName); +    type=i18n("DCC");
+    program=true;
+  }
+  
+  void OutputFilter::parseInvite(const QString &parameter)
+  {
+    if(parameter.isEmpty())
     {
-      if(isAChannel(destination)) channel=destination;
-      else
+      type=i18n("Usage");
+      output=i18n("Usage: INVITE <nick> [channel]");
+      program=true;
+    }
+    else
+    {
+      QString nick=parameter.section(' ',0,0);
+      QString channel=parameter.section(' ',1,1);
+  
+      if(channel.isEmpty())
       {
-        type=i18n("Error");
-        output=i18n("Error: INVITE without channel name works only from within channels.");
-        program=true;
+        if(isAChannel(destination)) channel=destination;
+        else
+        {
+          type=i18n("Error");
+          output=i18n("Error: INVITE without channel name works only from within channels.");
+          program=true;
+        }
+      }
+  
+      if(!channel.isEmpty())
+      {
+        if(isAChannel(channel)) toServer="INVITE "+nick+" "+channel;
+        else
+        {
+          type=i18n("Error");
+          output=i18n("Error: %1 is not a channel.").arg(channel);
+          program=true;
+        }
       }
     }
-
-    if(!channel.isEmpty())
+  }
+  
+  void OutputFilter::parseExec(const QString& parameter)
+  {
+    if(parameter.isEmpty())
     {
-      if(isAChannel(channel)) toServer="INVITE "+nick+" "+channel;
+      type=i18n("Usage");
+      output=i18n("Usage: EXEC <script> [parameter list]");
+      program=true;
+    }
+    else
+    {
+      QStringList parameterList=QStringList::split(' ',parameter);
+      if(parameterList[0].find("../")==-1)
+      {
+        emit launchScript(destination, parameter);
+      }
       else
       {
         type=i18n("Error");
-        output=i18n("Error: %1 is not a channel.").arg(channel);
+        output=i18n("Error: Script name may not contain \"../\"!");
         program=true;
       }
     }
   }
-}
-
-void OutputFilter::parseExec(const QString& parameter)
-{
-  if(parameter.isEmpty())
-  {
-    type=i18n("Usage");
-    output=i18n("Usage: EXEC <script> [parameter list]");
-    program=true;
-  }
-  else
+  
+  void OutputFilter::parseRaw(const QString& parameter)
   {
-    QStringList parameterList=QStringList::split(' ',parameter);
-    if(parameterList[0].find("../")==-1) emit launchScript(parameter);
+    if(parameter.isEmpty() || parameter=="open")
+      emit openRawLog(true);
+    else if(parameter=="close")
+      emit closeRawLog();
     else
     {
-      type=i18n("Error");
-      output=i18n("Error: Script name may not contain \"../\"!");
+      type=i18n("Usage");
+      output=i18n("Usage: RAW [OPEN | CLOSE]");
       program=true;
     }
   }
-}
-
-void OutputFilter::parseRaw(const QString& parameter)
-{
-  if(parameter.isEmpty() || parameter=="open")
-    emit openRawLog(true);
-  else if(parameter=="close")
-    emit closeRawLog();
-  else
+  
+  void OutputFilter::parseNotify(const QString& parameter)
   {
-    type=i18n("Usage");
-    output=i18n("Usage: RAW [OPEN | CLOSE]");
+    if(!parameter.isEmpty())
+    {
+      QStringList list=QStringList::split(' ',parameter);
+  
+      for(unsigned int index=0;index<list.count();index++)
+      {
+        // Try to remove current pattern
+        if(!KonversationApplication::preferences.removeNotify(list[index]))
+        {
+          // If remove failed, try to add it instead
+          if(!KonversationApplication::preferences.addNotify(list[index]))
+            kdDebug() << "OutputFilter::parseNotify(): Adding failed!" << endl;
+        }
+      } // endfor
+    }
+  
+    // show (new) notify list to user
+    QString list=KonversationApplication::preferences.getNotifyString();
+    type=i18n("Notify");
+  
+    if(list.isEmpty())
+      output=i18n("Current notify list is empty.");
+    else
+      output=i18n("Current notify list: %1").arg(list);
+  
     program=true;
   }
-}
-
-void OutputFilter::parseNotify(const QString& parameter)
-{
-  if(!parameter.isEmpty())
+  
+  void OutputFilter::parseOper(const QString& myNick,const QString& parameter)
   {
-    QStringList list=QStringList::split(' ',parameter);
-
-    for(unsigned int index=0;index<list.count();index++)
+    QStringList parameterList=QStringList::split(' ',parameter);
+  
+    if(parameter.isEmpty() || parameterList.count()==1)
     {
-      // Try to remove current pattern
-      if(!KonversationApplication::preferences.removeNotify(list[index]))
-      {
-        // If remove failed, try to add it instead
-        if(!KonversationApplication::preferences.addNotify(list[index]))
-          kdDebug() << "OutputFilter::parseNotify(): Adding failed!" << endl;
-      }
-    } // endfor
+      QString nick((parameterList.count()==1) ? parameterList[0] : myNick);
+      QString password;
+      bool keep=false;
+  
+      int result=KIO::PasswordDialog::getNameAndPassword
+                                      (
+                                        nick,
+                                        password,
+                                        &keep,
+                                        i18n("Enter user name and password for IRC operator \
privileges:"), +                                        false,
+                                        i18n("IRC Operator Password")
+                                      );
+  
+      if(result==KIO::PasswordDialog::Accepted) toServer="OPER "+nick+" "+password;
+    }
+    else
+    {
+      toServer="OPER "+parameter;
+    }
   }
-
-  // show (new) notify list to user
-  QString list=KonversationApplication::preferences.getNotifyString();
-  type=i18n("Notify");
-
-  if(list.isEmpty())
-    output=i18n("Current notify list is empty.");
-  else
-    output=i18n("Current notify list: %1").arg(list);
-
-  program=true;
-}
-
-void OutputFilter::parseOper(const QString& myNick,const QString& parameter)
-{
-  QStringList parameterList=QStringList::split(' ',parameter);
-
-  if(parameter.isEmpty() || parameterList.count()==1)
+  
+  void OutputFilter::parseBan(const QString& parameter)
   {
-    QString nick((parameterList.count()==1) ? parameterList[0] : myNick);
-    QString password;
-    bool keep=false;
-
-    int result=KIO::PasswordDialog::getNameAndPassword
-                                    (
-                                      nick,
-                                      password,
-                                      &keep,
-                                      i18n("Enter user name and password for IRC operator privileges:"),
-                                      false,
-                                      i18n("IRC Operator Password")
-                                    );
-
-    if(result==KIO::PasswordDialog::Accepted) toServer="OPER "+nick+" "+password;
+    // assume incorrect syntax first
+    bool showUsage=true;
+  
+    if(!parameter.isEmpty())
+    {
+      QStringList parameterList=QStringList::split(' ',parameter);
+      QString channel=QString::null;
+      QString option=QString::null;
+      // check for option
+      bool host=(parameterList[0].lower()=="-host");
+      bool domain=(parameterList[0].lower()=="-domain");
+      bool uhost=(parameterList[0].lower()=="-userhost");
+      bool udomain=(parameterList[0].lower()=="-userdomain");
+  
+      // remove possible option
+      if(host || domain || uhost || udomain)
+      {
+        option=parameterList[0].mid(1);
+        parameterList.pop_front();
+      }
+  
+      // look for channel / ban mask
+      if(parameterList.count())
+      {
+        // user specified channel
+        if(isAChannel(parameterList[0]))
+        {
+          channel=parameterList[0];
+          parameterList.pop_front();
+        }
+        // no channel, so assume current destination as channel
+        else if(isAChannel(destination))
+          channel=destination;
+        else
+        {
+          // destination is no channel => error
+          error(i18n("BAN without channel name works only from inside a channel."));
+          // no usage information after error
+          showUsage=false;
+        }
+        // signal server to ban this user if all went fine
+        if(!channel.isEmpty())
+        {
+          emit banUsers(parameterList,channel,option);
+          // syntax was correct, so reset flag
+          showUsage=false;
+        }
+      }
+    }
+  
+    if(showUsage) usage(i18n("Usage: BAN [-HOST | -DOMAIN] [channel] <user|mask>"));
   }
-  else
+  
+  // finally set the ban
+  void OutputFilter::execBan(const QString& mask,const QString& channel)
   {
-    toServer="OPER "+parameter;
+    toServer="MODE "+channel+" +b "+mask;
   }
-}
-
-void OutputFilter::parseBan(const QString& parameter)
-{
-  // assume incorrect syntax first
-  bool showUsage=true;
-
-  if(!parameter.isEmpty())
+  
+  void OutputFilter::parseUnban(const QString& parameter)
   {
-    QStringList parameterList=QStringList::split(' ',parameter);
-    QString channel=QString::null;
-    QString option=QString::null;
-    // check for option
-    bool host=(parameterList[0].lower()=="-host");
-    bool domain=(parameterList[0].lower()=="-domain");
-    bool uhost=(parameterList[0].lower()=="-userhost");
-    bool udomain=(parameterList[0].lower()=="-userdomain");
-
-    // remove possible option
-    if(host || domain || uhost || udomain)
-    {
-      option=parameterList[0].mid(1);
-      parameterList.pop_front();
-    }
-
-    // look for channel / ban mask
-    if(parameterList.count())
+    // assume incorrect syntax first
+    bool showUsage=true;
+  
+    if(!parameter.isEmpty())
     {
-      // user specified channel
+      QStringList parameterList=QStringList::split(' ',parameter);
+      QString channel=QString::null;
+      QString mask=QString::null;
+  
+      // if the user specified a channel
       if(isAChannel(parameterList[0]))
       {
+        // get channel
         channel=parameterList[0];
+        // remove channel from parameter list
         parameterList.pop_front();
       }
-      // no channel, so assume current destination as channel
+      // otherwise the current destination must be a channel
       else if(isAChannel(destination))
         channel=destination;
       else
       {
         // destination is no channel => error
-        error(i18n("BAN without channel name works only from inside a channel."));
+        error(i18n("UNBAN without channel name works only from inside a channel."));
         // no usage information after error
         showUsage=false;
       }
-      // signal server to ban this user if all went fine
+      // if all went good, signal server to unban this mask
       if(!channel.isEmpty())
       {
-        emit banUsers(parameterList,channel,option);
+        emit unbanUsers(parameterList[0],channel);
         // syntax was correct, so reset flag
         showUsage=false;
       }
     }
+  
+    if(showUsage) usage(i18n("Usage: UNBAN [channel] pattern"));
   }
-
-  if(showUsage) usage(i18n("Usage: BAN [-HOST | -DOMAIN] [channel] <user|mask>"));
-}
-
-// finally set the ban
-void OutputFilter::execBan(const QString& mask,const QString& channel)
-{
-  toServer="MODE "+channel+" +b "+mask;
-}
-
-void OutputFilter::parseUnban(const QString& parameter)
-{
-  // assume incorrect syntax first
-  bool showUsage=true;
-
-  if(!parameter.isEmpty())
+  
+  void OutputFilter::execUnban(const QString& mask,const QString& channel)
   {
-    QStringList parameterList=QStringList::split(' ',parameter);
-    QString channel=QString::null;
-    QString mask=QString::null;
-
-    // if the user specified a channel
-    if(isAChannel(parameterList[0]))
+    toServer="MODE "+channel+" -b "+mask;
+  }
+  
+  void OutputFilter::parseIgnore(const QString& parameter)
+  {
+    // assume incorrect syntax first
+    bool showUsage=true;
+  
+    // did the user give parameters at all?
+    if(!parameter.isEmpty())
     {
-      // get channel
-      channel=parameterList[0];
-      // remove channel from parameter list
-      parameterList.pop_front();
+      QStringList parameterList=QStringList::split(' ',parameter);
+  
+      // if nothing else said, only ignore channels and queries
+      int value=Ignore::Channel | Ignore::Query;
+  
+      // user specified -all option
+      if(parameterList[0].lower()=="-all")
+      {
+        // ignore everything
+        value=Ignore::All;
+        parameterList.pop_front();
+      }
+  
+      // were there enough parameters?
+      if(parameterList.count()>=1)
+      {
+        for(unsigned int index=0;index<parameterList.count();index++)
+        {
+          if(parameterList[index].contains('!')==0) parameterList[index] += "!*";
+          KonversationApplication::preferences.addIgnore(parameterList[index]+","+QString::number(value));
 +        }
+  
+        output=i18n("Added %1 to your ignore list.").arg(parameterList.join(", "));
+        type=i18n("Ignore");
+        program=true;
+  
+        // all went fine, so show no error message
+        showUsage=false;
+      }
     }
-    // otherwise the current destination must be a channel
-    else if(isAChannel(destination))
-      channel=destination;
+  
+    if(showUsage) usage(i18n("Usage: IGNORE [ -ALL ] user list"));
+  }
+  
+  void OutputFilter::parseQuote(const QString& parameter)
+  {
+    if(parameter.isEmpty())
+      usage(i18n("Usage: QUOTE command list"));
     else
-    {
-      // destination is no channel => error
-      error(i18n("UNBAN without channel name works only from inside a channel."));
-      // no usage information after error
-      showUsage=false;
-    }
-    // if all went good, signal server to unban this mask
-    if(!channel.isEmpty())
-    {
-      emit unbanUsers(parameterList[0],channel);
-      // syntax was correct, so reset flag
-      showUsage=false;
-    }
+      toServer=parameter;
   }
-
-  if(showUsage) usage(i18n("Usage: UNBAN [channel] pattern"));
-}
-
-void OutputFilter::execUnban(const QString& mask,const QString& channel)
-{
-  toServer="MODE "+channel+" -b "+mask;
-}
-
-void OutputFilter::parseIgnore(const QString& parameter)
-{
-  // assume incorrect syntax first
-  bool showUsage=true;
-
-  // did the user give parameters at all?
-  if(!parameter.isEmpty())
+  
+  void OutputFilter::parseSay(const QString& parameter)
   {
-    QStringList parameterList=QStringList::split(' ',parameter);
-
-    // if nothing else said, only ignore channels and queries
-    int value=Ignore::Channel | Ignore::Query;
-
-    // user specified -all option
-    if(parameterList[0].lower()=="-all")
-    {
-      // ignore everything
-      value=Ignore::All;
-      parameterList.pop_front();
-    }
-
-    // were there enough parameters?
-    if(parameterList.count()>=1)
+    if(parameter.isEmpty())
+      usage(i18n("Usage: SAY text"));
+    else
     {
-      for(unsigned int index=0;index<parameterList.count();index++)
-      {
-        if(parameterList[index].contains('!')==0) parameterList[index] += "!*";
-        KonversationApplication::preferences.addIgnore(parameterList[index]+","+QString::number(value));
-      }
-
-      output=i18n("Added %1 to your ignore list.").arg(parameterList.join(", "));
-      type=i18n("Ignore");
-      program=true;
-
-      // all went fine, so show no error message
-      showUsage=false;
+      toServer="PRIVMSG "+destination+" :"+parameter;
+      output=parameter;
     }
   }
-
-  if(showUsage) usage(i18n("Usage: IGNORE [ -ALL ] user list"));
-}
-
-void OutputFilter::parseQuote(const QString& parameter)
-{
-  if(parameter.isEmpty())
-    usage(i18n("Usage: QUOTE command list"));
-  else
-    toServer=parameter;
-}
-
-void OutputFilter::parseSay(const QString& parameter)
-{
-  if(parameter.isEmpty())
-    usage(i18n("Usage: SAY text"));
-  else
+  
+  void OutputFilter::parseKonsole()
   {
-    toServer="PRIVMSG "+destination+" :"+parameter;
-    output=parameter;
+    emit openKonsolePanel();
   }
-}
-
-void OutputFilter::parseKonsole()
-{
-  emit openKonsolePanel();
-}
-
-// Accessors
-
-// Maybe we should switch to values instead of flags
-bool OutputFilter::isAction() { return action; }
-bool OutputFilter::isCommand() { return command; }
-bool OutputFilter::isProgram() { return program; }
-bool OutputFilter::isQuery() { return query; }
-
-void OutputFilter::setCommandChar() { commandChar=KonversationApplication::preferences.getCommandChar(); \
                }
-void OutputFilter::setIdentity(const Identity *newIdentity)
-{
-  identity=*newIdentity;
-  // TODO: move this into copy constructor! THis does not work yet!
-  identity.setNicknameList(newIdentity->getNicknameList());
-}
-
-QString& OutputFilter::getOutput() { return output; }
-QString& OutputFilter::getServerOutput() { return toServer; }
-
-QStringList& OutputFilter::getServerOutputList()
-{
-  if (!toServer.isEmpty()) toServerList.append(toServer);
-
-  return toServerList;
-}
-
-QString& OutputFilter::getType() { return type; }
-
-//     # & + and ! are Channel identifiers
-bool OutputFilter::isAChannel(const QString &check)
-{
-  QChar initial=check.at(0);
-
-  return (initial=='#' || initial=='&' || initial=='+' || initial=='!');
-}
-
-void OutputFilter::usage(const QString& string)
-{
-  type=i18n("Usage");
-  output=string;
-  program=true;
-}
-
-void OutputFilter::error(const QString& string)
-{
-  type=i18n("Error");
-  output=string;
-  program=true;
-}
-
-void OutputFilter::parseAaway(const QString& parameter)
-{
-  emit multiServerCommand("away", parameter);
-  output=QString::null;
-}
-
-void OutputFilter::parseAme(const QString& parameter)
-{
-  if(parameter.isEmpty()) {
+  
+  // Accessors
+  
+  // Maybe we should switch to values instead of flags
+  bool OutputFilter::isAction() { return action; }
+  bool OutputFilter::isCommand() { return command; }
+  bool OutputFilter::isProgram() { return program; }
+  bool OutputFilter::isQuery() { return query; }
+  
+  void OutputFilter::setCommandChar() { \
commandChar=KonversationApplication::preferences.getCommandChar(); } +  void \
OutputFilter::setIdentity(const Identity *newIdentity) +  {
+    identity=*newIdentity;
+    // TODO: move this into copy constructor! THis does not work yet!
+    identity.setNicknameList(newIdentity->getNicknameList());
+  }
+  
+  QString& OutputFilter::getOutput() { return output; }
+  QString& OutputFilter::getServerOutput() { return toServer; }
+  
+  QStringList& OutputFilter::getServerOutputList()
+  {
+    if (!toServer.isEmpty()) toServerList.append(toServer);
+  
+    return toServerList;
+  }
+  
+  QString& OutputFilter::getType() { return type; }
+  
+  QString& OutputFilter::getUnknownCommand() { return unknownCommand; }
+  
+  //     # & + and ! are Channel identifiers
+  bool OutputFilter::isAChannel(const QString &check)
+  {
+    QChar initial=check.at(0);
+  
+    return (initial=='#' || initial=='&' || initial=='+' || initial=='!');
+  }
+  
+  void OutputFilter::usage(const QString& string)
+  {
     type=i18n("Usage");
-    output=i18n("Usage: %1AME text").arg(commandChar);
+    output=string;
     program=true;
-    return;
   }
   
-  emit multiServerCommand("me", parameter);
-  output=QString::null;
-}
-
-void OutputFilter::parseAmsg(const QString& parameter)
-{
-  if(parameter.isEmpty()) {
-    type=i18n("Usage");
-    output=i18n("Usage: %1AMSG text").arg(commandChar);
+  void OutputFilter::error(const QString& string)
+  {
+    type=i18n("Error");
+    output=string;
     program=true;
-    return;
   }
   
-  emit multiServerCommand("msg", parameter);
-  output=QString::null;
-}
-
-void OutputFilter::parseServer(const QString& parameter)
-{
-  if(parameter.isEmpty()) {
-    emit reconnectServer();
-  } else {
-    QStringList splitted = QStringList::split(" ", parameter);
-    QString password;
-    
-    if(splitted.count() > 1) {
-      password = splitted[1];
+  void OutputFilter::parseAaway(const QString& parameter)
+  {
+    emit multiServerCommand("away", parameter);
+    output=QString::null;
+  }
+  
+  void OutputFilter::parseAme(const QString& parameter)
+  {
+    if(parameter.isEmpty()) {
+      type=i18n("Usage");
+      output=i18n("Usage: %1AME text").arg(commandChar);
+      program=true;
+      return;
     }
     
-    splitted = QStringList::split(":", splitted[0]);
-    QString port = "6667";
-    
-    if(splitted.count() > 1) {
-      port = splitted[1];
+    emit multiServerCommand("me", parameter);
+    output=QString::null;
+  }
+  
+  void OutputFilter::parseAmsg(const QString& parameter)
+  {
+    if(parameter.isEmpty()) {
+      type=i18n("Usage");
+      output=i18n("Usage: %1AMSG text").arg(commandChar);
+      program=true;
+      return;
     }
-
-    emit connectToServer(splitted[0], port, password);
+    
+    emit multiServerCommand("msg", parameter);
+    output=QString::null;
   }
   
-  output=QString::null;
-}
-
-void OutputFilter::parsePrefs(const QString& parameter)
-{
-  bool showUsage = false;
-  if (parameter.isEmpty())
-    showUsage = true;
-  else
+  void OutputFilter::parseServer(const QString& parameter)
   {
-    KConfig* config=KApplication::kApplication()->config();
+    if(parameter.isEmpty()) {
+      emit reconnectServer();
+    } else {
+      QStringList splitted = QStringList::split(" ", parameter);
+      QString password;
+      
+      if(splitted.count() > 1) {
+        password = splitted[1];
+      }
+      
+      splitted = QStringList::split(":", splitted[0]);
+      QString port = "6667";
+      
+      if(splitted.count() > 1) {
+        port = splitted[1];
+      }
   
-#if KDE_IS_VERSION(3,1,94)
-    QStringList splitted = KShell::splitArgs(parameter);
-#else
-    QStringList splitted = QStringList::split(' ',parameter);
-#endif
-    if (splitted.count() > 0)
+      emit connectToServer(splitted[0], port, password);
+    }
+    
+    output=QString::null;
+  }
+  
+  void OutputFilter::parsePrefs(const QString& parameter)
+  {
+    bool showUsage = false;
+    if (parameter.isEmpty())
+      showUsage = true;
+    else
     {
-      QString group = splitted[0];
-      QStringList groupList(config->groupList());
-      uint i;
-      if (group.lower() == "list")
-      {
-        // List available groups.
-        usage(i18n("Available Preference Groups: ") + groupList.join("|"));
-      }
-      else
+      KConfig* config=KApplication::kApplication()->config();
+    
+  #if KDE_IS_VERSION(3,1,94)
+      QStringList splitted = KShell::splitArgs(parameter);
+  #else
+      QStringList splitted = QStringList::split(' ',parameter);
+  #endif
+      if (splitted.count() > 0)
       {
-        // Validate group.
-        bool validGroup = false;
-        for (i = 0; i < groupList.count(); ++i)
+        QString group = splitted[0];
+        QStringList groupList(config->groupList());
+        uint i;
+        if (group.lower() == "list")
         {
-          if (group.lower() == groupList[i].lower())
-          {
-            validGroup = true;
-            group = groupList[i];
-            break;
-          }
+          // List available groups.
+          usage(i18n("Available Preference Groups: ") + groupList.join("|"));
         }
-        if (validGroup and splitted.count() > 1)
+        else
         {
-          QString option = splitted[1];
-          QMap<QString,QString> options = config->entryMap(group);
-          QValueList<QString> optionList = options.keys();
-          QValueList<QString> optionValueList = options.values();
-          if (option.lower() == "list")
+          // Validate group.
+          bool validGroup = false;
+          for (i = 0; i < groupList.count(); ++i)
           {
-            // List available options in group.
-            output=i18n("Available Options in Group ") + group + ": ";
-            for (i = 0; i < optionList.count(); ++i)
+            if (group.lower() == groupList[i].lower())
             {
-              output = output + optionList[i] + "(" + optionValueList[i] + ")|";
+              validGroup = true;
+              group = groupList[i];
+              break;
             }
-            usage(output);
           }
-          else
+          if (validGroup and splitted.count() > 1)
           {
-            // Validate option.
-            bool validOption = false;
-            for (i = 0; i < optionList.count(); ++i)
+            QString option = splitted[1];
+            QMap<QString,QString> options = config->entryMap(group);
+            QValueList<QString> optionList = options.keys();
+            QValueList<QString> optionValueList = options.values();
+            if (option.lower() == "list")
             {
-              if (option.lower() == optionList[i].lower())
+              // List available options in group.
+              output=i18n("Available Options in Group ") + group + ": ";
+              for (i = 0; i < optionList.count(); ++i)
               {
-                validOption = true;
-                option = optionList[i];
-                break;
+                output = output + optionList[i] + "(" + optionValueList[i] + ")|";
               }
+              usage(output);
             }
-            if (validOption)
+            else
             {
-              if (splitted.count() > 2)
+              // Validate option.
+              bool validOption = false;
+              for (i = 0; i < optionList.count(); ++i)
               {
-                // Set the desired option.
-                config->setGroup(group);
-                config->writeEntry(option, splitted[2]);
-                config->sync();
-                // Reload preferences object.
-                dynamic_cast<KonversationApplication*>(kapp)->readOptions();
+                if (option.lower() == optionList[i].lower())
+                {
+                  validOption = true;
+                  option = optionList[i];
+                  break;
+                }
               }
-              // If no value given, just display current value.
-              else usage(group + "/" + option + " = " + options[option]);
-            } else showUsage = true;
-          }
-        } else showUsage = true;
-      }
-    } else showUsage = true;
+              if (validOption)
+              {
+                if (splitted.count() > 2)
+                {
+                  // Set the desired option.
+                  config->setGroup(group);
+                  config->writeEntry(option, splitted[2]);
+                  config->sync();
+                  // Reload preferences object.
+                  dynamic_cast<KonversationApplication*>(kapp)->readOptions();
+                }
+                // If no value given, just display current value.
+                else usage(group + "/" + option + " = " + options[option]);
+              } else showUsage = true;
+            }
+          } else showUsage = true;
+        }
+      } else showUsage = true;
+    }
+    if (showUsage)
+      usage(i18n("Usage: %1PREFS group option value or %2PREFS LIST to list groups or %3PREFS group LIST \
to list options in group.  Quote parameters if they contain spaces.").arg(commandChar, commandChar, \
commandChar));  }
-  if (showUsage)
-    usage(i18n("Usage: %1PREFS group option value or %2PREFS LIST to list groups or %3PREFS group LIST \
to list options in group.  Quote parameters if they contain spaces.").arg(commandChar, commandChar, \
commandChar));  }
-
 #include "outputfilter.moc"
diff --git a/konversation/outputfilter.h b/konversation/outputfilter.h
index bd3b315..5b82bcf 100644
--- a/konversation/outputfilter.h
+++ b/konversation/outputfilter.h
@@ -25,116 +25,126 @@
 */
 
 class Identity;
+class Server;
 
-class OutputFilter : public QObject
+namespace Konversation
 {
-  Q_OBJECT
-
-  public:
-    OutputFilter();
-    ~OutputFilter();
-
-    QString& parse(const QString& myNick,const QString& line,const QString& name);
-    void sendRequest(const QString &recipient,const QString &fileName,const QString &address,const \
                QString &port,unsigned long size);
-    void resumeRequest(const QString &sender,const QString &fileName,const QString &port,int startAt);
-    void acceptRequest(const QString &recipient,const QString &fileName,const QString &port,int \
                startAt);
-    bool replaceAliases(QString& line);
-
-    bool isAction();
-    bool isCommand();
-    bool isProgram();
-    bool isQuery();
-
-    QString& getOutput();
-    QString& getServerOutput();
-    QStringList& getServerOutputList();
-    QString& getType();
-
-  signals:
-    void openQuery(const QString& nick,const QString& hostmask); // hostmask currently unused
-    void openDccSend(const QString &recipient, const QString &fileName);
-    void requestDccSend();                        // Choose Recipient and File from requester
-    void requestDccSend(const QString& recipient);       // Choose File from requester
-    void requestDccChat(const QString& nick);
-    void openDccPanel();
-    void closeDccPanel();
-    void openRawLog(bool show);
-    void closeRawLog();
-    void openKonsolePanel();
-    void sendToAllChannels(const QString& text);
-    void launchScript(const QString& parameter);
-    void banUsers(const QStringList& userList,const QString& channel,const QString& option);
-    void unbanUsers(const QString& mask,const QString& channel);
-    void multiServerCommand(const QString& command, const QString& parameter);
-    void reconnectServer();
-    void connectToServer(const QString& server, const QString& port, const QString& password);
-
-  public slots:
-    void setCommandChar();
-    void setIdentity(const Identity *newIdentity);
-    void execBan(const QString& mask,const QString& channels);
-    void execUnban(const QString& mask,const QString& channels);
-
-  protected:
-    QString output;
-    QString toServer;
-    QStringList toServerList;
-    QString type;
-    QString destination;
-
-    QString commandChar;
-    Identity identity;
-
-    // message types
-    bool action;
-    bool command;
-    bool program;
-    bool query;
-
-    void parseMsg(const QString& myNick,const QString& parameter);      // works
-    void parseSMsg(const QString& parameter);     // works
-    void parseQuery(const QString& parameter);    // works
-    void parseDescribe(const QString& parameter);
-    void parseNotice(const QString& parameter);   // works
-    void parseJoin(const QString& parameter);     // works
-    void parsePart(const QString& parameter);     // works
-    void parseQuit(const QString& parameter);     // works
-    void parseKick(const QString& parameter);     // works
-    void parseKickBan(const QString& parameter);
-    void parseBan(const QString& parameter);
-    void parseUnban(const QString& parameter);
-    void parseNames(const QString& parameter);
-    void parseList(const QString& parameter);     // works
-    void parseOp(const QString& parameter);       // works
-    void parseDeop(const QString& parameter);     // works
-    void parseVoice(const QString& parameter);    // works
-    void parseUnvoice(const QString& parameter);  // works
-    void parseTopic(const QString& parameter);    // works
-    void parseAway(const QString& parameter);     // works
-    void parseCtcp(const QString& parameter);     // works
-    void parsePing(const QString& parameter);
-    void parseVersion(const QString& parameter);
-    void parseServer(const QString& parameter);
-    void parseConnect(const QString& parameter);
-    void parseInvite(const QString& parameter);   // works
-    void parseExec(const QString& parameter);
-    void parseNotify(const QString& parameter);   // works
-    void parseOper(const QString& myNick,const QString& parameter);
-    void parseDcc(const QString& parameter);
-    void parseRaw(const QString& parameter);      // works
-    void parseIgnore(const QString& parameter);
-    void parseQuote(const QString& parameter);    // works
-    void parseSay(const QString& parameter);      // works
-    void parseKonsole();                          // works
-    void parseAaway(const QString& parameter);
-    void parseAme(const QString& parameter);
-    void parseAmsg(const QString& parameter);
-    void parsePrefs(const QString& parameter);
-
-    void changeMode(const QString& parameter,char mode,char giveTake);
-    bool isAChannel(const QString& check);
-    void usage(const QString& check);
-    void error(const QString& check);
+  class OutputFilter : public QObject
+  {
+    Q_OBJECT
+    
+    public:
+      OutputFilter(Server* server);
+      ~OutputFilter();
+  
+      QString& parse(const QString& myNick,const QString& line,const QString& name);
+      void sendRequest(const QString &recipient,const QString &fileName,const QString &address,
+        const QString &port,unsigned long size);
+      void resumeRequest(const QString &sender,const QString &fileName,const QString &port,int startAt);
+      void acceptRequest(const QString &recipient,const QString &fileName,const QString &port,int \
startAt); +      bool replaceAliases(QString& line);
+  
+      bool isAction();
+      bool isCommand();
+      bool isProgram();
+      bool isQuery();
+  
+      QString& getOutput();
+      QString& getServerOutput();
+      QStringList& getServerOutputList();
+      QString& getType();
+      QString& getUnknownCommand();
+  
+    signals:
+      void openQuery(const QString& nick,const QString& hostmask); // hostmask currently unused
+      void openDccSend(const QString &recipient, const QString &fileName);
+      void requestDccSend();                        // Choose Recipient and File from requester
+      void requestDccSend(const QString& recipient);       // Choose File from requester
+      void requestDccChat(const QString& nick);
+      void openDccPanel();
+      void closeDccPanel();
+      void openRawLog(bool show);
+      void closeRawLog();
+      void openKonsolePanel();
+      void sendToAllChannels(const QString& text);
+      void launchScript(const QString& target, const QString& parameter);
+      void banUsers(const QStringList& userList,const QString& channel,const QString& option);
+      void unbanUsers(const QString& mask,const QString& channel);
+      void multiServerCommand(const QString& command, const QString& parameter);
+      void reconnectServer();
+      void connectToServer(const QString& server, const QString& port, const QString& password);
+  
+    public slots:
+      void setCommandChar();
+      void setIdentity(const Identity *newIdentity);
+      void execBan(const QString& mask,const QString& channels);
+      void execUnban(const QString& mask,const QString& channels);
+  
+    protected:
+      QString output;
+      QString toServer;
+      QStringList toServerList;
+      QString type;
+      QString destination;
+      QString unknownCommand;
+  
+      QString commandChar;
+      Identity identity;
+  
+      // message types
+      bool action;
+      bool command;
+      bool program;
+      bool query;
+  
+      void parseMsg(const QString& myNick,const QString& parameter);      // works
+      void parseSMsg(const QString& parameter);     // works
+      void parseQuery(const QString& parameter);    // works
+      void parseDescribe(const QString& parameter);
+      void parseNotice(const QString& parameter);   // works
+      void parseJoin(const QString& parameter);     // works
+      void parsePart(const QString& parameter);     // works
+      void parseQuit(const QString& parameter);     // works
+      void parseKick(const QString& parameter);     // works
+      void parseKickBan(const QString& parameter);
+      void parseBan(const QString& parameter);
+      void parseUnban(const QString& parameter);
+      void parseNames(const QString& parameter);
+      void parseList(const QString& parameter);     // works
+      void parseOp(const QString& parameter);       // works
+      void parseDeop(const QString& parameter);     // works
+      void parseVoice(const QString& parameter);    // works
+      void parseUnvoice(const QString& parameter);  // works
+      void parseTopic(const QString& parameter);    // works
+      void parseAway(const QString& parameter);     // works
+      void parseCtcp(const QString& parameter);     // works
+      void parsePing(const QString& parameter);
+      void parseVersion(const QString& parameter);
+      void parseServer(const QString& parameter);
+      void parseConnect(const QString& parameter);
+      void parseInvite(const QString& parameter);   // works
+      void parseExec(const QString& parameter);
+      void parseNotify(const QString& parameter);   // works
+      void parseOper(const QString& myNick,const QString& parameter);
+      void parseDcc(const QString& parameter);
+      void parseRaw(const QString& parameter);      // works
+      void parseIgnore(const QString& parameter);
+      void parseQuote(const QString& parameter);    // works
+      void parseSay(const QString& parameter);      // works
+      void parseKonsole();                          // works
+      void parseAaway(const QString& parameter);
+      void parseAme(const QString& parameter);
+      void parseAmsg(const QString& parameter);
+      void parsePrefs(const QString& parameter);
+  
+      void changeMode(const QString& parameter,char mode,char giveTake);
+      bool isAChannel(const QString& check);
+      void usage(const QString& check);
+      void error(const QString& check);
+    
+    private:
+      Server* m_server;
+  };
 };
 
 #endif
diff --git a/konversation/query.cpp b/konversation/query.cpp
index 740392d..9c4d4de 100644
--- a/konversation/query.cpp
+++ b/konversation/query.cpp
@@ -120,20 +120,20 @@ void Query::sendQueryText(const QString& sendLine)
   // create a work copy
   QString output(sendLine);
   // replace aliases and wildcards
-  if(filter.replaceAliases(output)) \
output=server->parseWildcards(output,server->getNickname(),getName(),QString::null,QString::null,QString::null);
 +  if(server->getOutputFilter()->replaceAliases(output)) \
output=server->parseWildcards(output,server->getNickname(),getName(),QString::null,QString::null,QString::null);
  
   // encoding stuff is done in Server()
-  output=filter.parse(server->getNickname(),output,getName());
+  output=server->getOutputFilter()->parse(server->getNickname(),output,getName());
 
   if(!output.isEmpty())
   {
-    if(filter.isAction()) appendAction(server->getNickname(),output);
-    else if(filter.isCommand()) appendCommandMessage(filter.getType(),output);
-    else if(filter.isProgram()) appendServerMessage(filter.getType(),output);
-    else if(!filter.getType().isEmpty()) appendQuery(filter.getType(),output);
+    if(server->getOutputFilter()->isAction()) appendAction(server->getNickname(),output);
+    else if(server->getOutputFilter()->isCommand()) \
appendCommandMessage(server->getOutputFilter()->getType(),output); +    else \
if(server->getOutputFilter()->isProgram()) \
appendServerMessage(server->getOutputFilter()->getType(),output); +    else \
if(!server->getOutputFilter()->getType().isEmpty()) \
appendQuery(server->getOutputFilter()->getType(),output);  else \
appendQuery(server->getNickname(),output);  }
-  server->queue(filter.getServerOutput());
+  server->queue(server->getOutputFilter()->getServerOutput());
 }
 
 void Query::newTextInView(const QString& highlightColor,bool important)
diff --git a/konversation/scriptlauncher.cpp b/konversation/scriptlauncher.cpp
index b2fabf8..41596f8 100644
--- a/konversation/scriptlauncher.cpp
+++ b/konversation/scriptlauncher.cpp
@@ -9,6 +9,7 @@
   scriptlauncher.cpp  -  Launches shell scripts
   begin:     Mit Mär 12 2003
   copyright: (C) 2003 by Dario Abatianni
+             (C) 2004 by Peter Simonsson
   email:     eisfuchs@tigress.com
 */
 
@@ -23,28 +24,19 @@
 
 #include "scriptlauncher.h"
 #include "konversationapplication.h"
+#include "server.h"
 
-ScriptLauncher::ScriptLauncher()
+ScriptLauncher::ScriptLauncher(Server* server)
+  : QObject(server)
 {
-  server=QString::null;
-  target=QString::null;
+  m_server = server;
 }
 
 ScriptLauncher::~ScriptLauncher()
 {
 }
 
-void ScriptLauncher::setServerName(const QString& newName)
-{
-  server=newName;
-}
-
-void ScriptLauncher::setTargetName(const QString& newName)
-{
-  target=newName;
-}
-
-void ScriptLauncher::launchScript(const QString &parameter)
+void ScriptLauncher::launchScript(const QString& target, const QString &parameter)
 {
   KStandardDirs kstddir;
 //  QString scriptPath(kstddir.saveLocation("data",QString("konversation/scripts")));
@@ -59,7 +51,7 @@ void ScriptLauncher::launchScript(const QString &parameter)
 
   process << scriptPath                    // script path and name
           << kapp->dcopClient()->appId()   // our dcop port
-          << server                        // the server we are connected to
+          << m_server->getServerName()     // the server we are connected to
           << target;                       // the target where the call came from
 
   // send remaining parameters to the script
diff --git a/konversation/scriptlauncher.h b/konversation/scriptlauncher.h
index 801fcd9..163bf1f 100644
--- a/konversation/scriptlauncher.h
+++ b/konversation/scriptlauncher.h
@@ -9,6 +9,7 @@
   scriptlauncher.h  -  Launches shell scripts
   begin:     Mit Mär 12 2003
   copyright: (C) 2003 by Dario Abatianni
+             (C) 2004 by Peter Simonsson
   email:     eisfuchs@tigress.com
 */
 
@@ -21,27 +22,25 @@
   @author Dario Abatianni
 */
 
+class Server;
+
 class ScriptLauncher : public QObject
 {
   Q_OBJECT
 
   public:
-    ScriptLauncher();
+    ScriptLauncher(Server* server);
     ~ScriptLauncher();
 
-    void setServerName(const QString& newServerName);
-    void setTargetName(const QString& newName);
-
   signals:
     void scriptNotFound(const QString& name);
     void scriptExecutionError(const QString& name);
 
   public slots:
-    void launchScript(const QString& parameter);
+    void launchScript(const QString& target, const QString& parameter);
 
   protected:
-    QString server;
-    QString target;
+    Server* m_server;
 };
 
 #endif
diff --git a/konversation/server.cpp b/konversation/server.cpp
index 5f76255..5dc3515 100644
--- a/konversation/server.cpp
+++ b/konversation/server.cpp
@@ -50,6 +50,7 @@ typedef unsigned long long __u64;
 #include "statuspanel.h"
 #include "rawlog.h"
 #include "channellistpanel.h"
+#include "scriptlauncher.h"
 
 #ifdef KDE_IS_VERSION
 #if KDE_IS_VERSION(3,1,1)
@@ -124,7 +125,8 @@ Server::Server(KonversationMainWindow* newMainWindow,int id)
   completeQueryPosition=0;
 
   inputFilter.setServer(this);
-  outputFilter.setIdentity(getIdentity());
+  outputFilter = new Konversation::OutputFilter(this);
+  outputFilter->setIdentity(getIdentity());
 
   notifyTimer.setName("notify_timer");
   incomingTimer.setName("incoming_timer");
@@ -132,71 +134,10 @@ Server::Server(KonversationMainWindow* newMainWindow,int id)
 
   outgoingTimer.setName("outgoing_timer");
   outgoingTimer.start(timerInterval);
-
-  connect(&incomingTimer,SIGNAL(timeout()),
-                    this,SLOT  (processIncomingData()) );
-
-  connect(&outgoingTimer,SIGNAL(timeout()),
-                    this,SLOT  (send()) );
-
-  connect(&unlockTimer,SIGNAL(timeout()),
-                  this,SLOT  (unlockSending()) );
-
-  connect(&outputFilter,SIGNAL (openQuery(const QString&,const QString&)),
-                   this,SLOT   (addQuery(const QString&,const QString&)) );
-  connect(&outputFilter,SIGNAL (requestDccSend()),
-                   this,SLOT   (requestDccSend()) );
-  connect(&outputFilter,SIGNAL (requestDccSend(const QString&)),
-                   this,SLOT   (requestDccSend(const QString&)) );
-  connect(&outputFilter, SIGNAL(multiServerCommand(const QString&, const QString&)),
-    this, SLOT(sendMultiServerCommand(const QString&, const QString&)));
-  connect(&outputFilter, SIGNAL(reconnectServer()), this, SLOT(reconnect()));
-
-  connect(&notifyTimer,SIGNAL(timeout()),
-                  this,SLOT  (notifyTimeout()) );
-  connect(&notifyCheckTimer,SIGNAL(timeout()),
-                  this,SLOT  (notifyCheckTimeout()) );
-
-  connect(&inputFilter,SIGNAL(welcome()),
-                  this,SLOT  (connectionEstablished()) );
-  connect(&inputFilter,SIGNAL(notifyResponse(const QString&)),
-                  this,SLOT  (notifyResponse(const QString&)) );
-  connect(&inputFilter,SIGNAL(addDccGet(const QString&, const QStringList&)),
-                  this,SLOT  (addDccGet(const QString&, const QStringList&)) );
-  connect(&inputFilter,SIGNAL(resumeDccGetTransfer(const QString&, const QStringList&)),
-                  this,SLOT  (resumeDccGetTransfer(const QString&, const QStringList&)) );
-  connect(&inputFilter,SIGNAL(resumeDccSendTransfer(const QString&, const QStringList&)),
-                  this,SLOT  (resumeDccSendTransfer(const QString&, const QStringList&)) );
-  connect(&inputFilter,SIGNAL(userhost(const QString&,const QString&,bool,bool)),
-                  this,SLOT  (userhost(const QString&,const QString&,bool,bool)) );
-  connect(&inputFilter,SIGNAL(topicAuthor(const QString&,const QString&)),
-                  this,SLOT  (setTopicAuthor(const QString&,const QString&)) );
-  connect(&inputFilter,SIGNAL(addChannelListPanel()),
-                  this,SLOT  (addChannelListPanel()) );
-  connect(&inputFilter,SIGNAL(invitation(const QString&,const QString&)),
-                  this,SLOT  (invitation(const QString&,const QString&)) );
-
-  connect(&inputFilter,SIGNAL (away()),this,SLOT (away()) );
-  connect(&inputFilter,SIGNAL (unAway()),this,SLOT (unAway()) );
-  connect(&inputFilter,SIGNAL (addDccChat(const QString&,const QString&,const QString&,const \
                QStringList&,bool)),
-         getMainWindow(),SLOT (addDccChat(const QString&,const QString&,const QString&,const \
                QStringList&,bool)) );
-
-  connect(this,SIGNAL(serverLag(Server*,int)),getMainWindow(),SLOT(updateLag(Server*,int)) );
-  connect(this,SIGNAL(tooLongLag(Server*,int)),getMainWindow(),SLOT(tooLongLag(Server*,int)) );
-  connect(this,SIGNAL(resetLag()),getMainWindow(),SLOT(resetLag()) );
-  connect(this,SIGNAL(addDccPanel()),getMainWindow(),SLOT(addDccPanel()) );
-  connect(this,SIGNAL(addKonsolePanel()),getMainWindow(),SLOT(addKonsolePanel()) );
-
-  connect(&serverSocket,SIGNAL (connectionSuccess())  ,this,SLOT (ircServerConnectionSuccess()) );
-  connect(&serverSocket,SIGNAL (connectionFailed(int)),this,SLOT (broken(int)) );
-  connect(&serverSocket,SIGNAL (readyRead()),this,SLOT (incoming()) );
-  connect(&serverSocket,SIGNAL (readyWrite()),this,SLOT (send()) );
-  connect(&serverSocket,SIGNAL (closed(int)),this,SLOT (broken(int)) );
-
-  connect(getMainWindow(),SIGNAL(prefsChanged()),KonversationApplication::kApplication(),SLOT(saveOptions()));
                
-  connect(getMainWindow(),SIGNAL(openPrefsDialog()),KonversationApplication::kApplication(),SLOT(openPrefsDialog()));
                
-
-  connect(this,SIGNAL (serverOnline(bool)),statusView,SLOT (serverOnline(bool)) );
+  
+  m_scriptLauncher = new ScriptLauncher(this);
+  
+  connectSignals();
 
   emit serverOnline(false);
 }
@@ -244,7 +185,8 @@ Server::Server(KonversationMainWindow* mainWindow,const QString& hostName,const
   completeQueryPosition=0;
 
   inputFilter.setServer(this);
-  outputFilter.setIdentity(getIdentity());
+  outputFilter = new Konversation::OutputFilter(this);
+  outputFilter->setIdentity(getIdentity());
 
   notifyTimer.setName("notify_timer");
   incomingTimer.setName("incoming_timer");
@@ -252,73 +194,8 @@ Server::Server(KonversationMainWindow* mainWindow,const QString& hostName,const
 
   outgoingTimer.setName("outgoing_timer");
   outgoingTimer.start(timerInterval);
-
-  connect(&incomingTimer,SIGNAL(timeout()),
-                    this,SLOT  (processIncomingData()) );
-
-  connect(&outgoingTimer,SIGNAL(timeout()),
-                    this,SLOT  (send()) );
-
-  connect(&unlockTimer,SIGNAL(timeout()),
-                  this,SLOT  (unlockSending()) );
-
-  connect(&outputFilter,SIGNAL (openQuery(const QString&,const QString&)),
-                   this,SLOT   (addQuery(const QString&,const QString&)) );
-  connect(&outputFilter,SIGNAL (requestDccSend()),
-                   this,SLOT   (requestDccSend()) );
-  connect(&outputFilter,SIGNAL (requestDccSend(const QString&)),
-                   this,SLOT   (requestDccSend(const QString&)) );
-  connect(&outputFilter, SIGNAL(multiServerCommand(const QString&, const QString&)),
-    this, SLOT(sendMultiServerCommand(const QString&, const QString&)));
-  connect(&outputFilter, SIGNAL(reconnectServer()), this, SLOT(reconnect()));
-  connect(&outputFilter, SIGNAL(connectToServer(const QString&, const QString&, const QString&)),
-    this, SLOT(connectToNewServer(const QString&, const QString&, const QString&)));
-
-  connect(&notifyTimer,SIGNAL(timeout()),
-                  this,SLOT  (notifyTimeout()) );
-  connect(&notifyCheckTimer,SIGNAL(timeout()),
-                  this,SLOT  (notifyCheckTimeout()) );
-
-  connect(&inputFilter,SIGNAL(welcome()),
-                  this,SLOT  (connectionEstablished()) );
-  connect(&inputFilter,SIGNAL(notifyResponse(const QString&)),
-                  this,SLOT  (notifyResponse(const QString&)) );
-  connect(&inputFilter,SIGNAL(addDccGet(const QString&, const QStringList&)),
-                  this,SLOT  (addDccGet(const QString&, const QStringList&)) );
-  connect(&inputFilter,SIGNAL(resumeDccGetTransfer(const QString&, const QStringList&)),
-                  this,SLOT  (resumeDccGetTransfer(const QString&, const QStringList&)) );
-  connect(&inputFilter,SIGNAL(resumeDccSendTransfer(const QString&, const QStringList&)),
-                  this,SLOT  (resumeDccSendTransfer(const QString&, const QStringList&)) );
-  connect(&inputFilter,SIGNAL(userhost(const QString&,const QString&,bool,bool)),
-                  this,SLOT  (userhost(const QString&,const QString&,bool,bool)) );
-  connect(&inputFilter,SIGNAL(topicAuthor(const QString&,const QString&)),
-                  this,SLOT  (setTopicAuthor(const QString&,const QString&)) );
-  connect(&inputFilter,SIGNAL(addChannelListPanel()),
-                  this,SLOT  (addChannelListPanel()) );
-  connect(&inputFilter,SIGNAL(invitation(const QString&,const QString&)),
-                  this,SLOT  (invitation(const QString&,const QString&)) );
-
-  connect(&inputFilter,SIGNAL (away()),this,SLOT (away()) );
-  connect(&inputFilter,SIGNAL (unAway()),this,SLOT (unAway()) );
-  connect(&inputFilter,SIGNAL (addDccChat(const QString&,const QString&,const QString&,const \
                QStringList&,bool)),
-         getMainWindow(),SLOT (addDccChat(const QString&,const QString&,const QString&,const \
                QStringList&,bool)) );
-
-  connect(this,SIGNAL(serverLag(Server*,int)),getMainWindow(),SLOT(updateLag(Server*,int)) );
-  connect(this,SIGNAL(tooLongLag(Server*,int)),getMainWindow(),SLOT(tooLongLag(Server*,int)) );
-  connect(this,SIGNAL(resetLag()),getMainWindow(),SLOT(resetLag()) );
-  connect(this,SIGNAL(addDccPanel()),getMainWindow(),SLOT(addDccPanel()) );
-  connect(this,SIGNAL(addKonsolePanel()),getMainWindow(),SLOT(addKonsolePanel()) );
-
-  connect(&serverSocket,SIGNAL (connectionSuccess())  ,this,SLOT (ircServerConnectionSuccess()) );
-  connect(&serverSocket,SIGNAL (connectionFailed(int)),this,SLOT (broken(int)) );
-  connect(&serverSocket,SIGNAL (readyRead()),this,SLOT (incoming()) );
-  connect(&serverSocket,SIGNAL (readyWrite()),this,SLOT (send()) );
-  connect(&serverSocket,SIGNAL (closed(int)),this,SLOT (broken(int)) );
-
-  connect(getMainWindow(),SIGNAL(prefsChanged()),KonversationApplication::kApplication(),SLOT(saveOptions()));
                
-  connect(getMainWindow(),SIGNAL(openPrefsDialog()),KonversationApplication::kApplication(),SLOT(openPrefsDialog()));
                
-
-  connect(this,SIGNAL (serverOnline(bool)),statusView,SLOT (serverOnline(bool)) );
+    
+  connectSignals();
 
   emit serverOnline(false);
 }
@@ -383,6 +260,106 @@ Server::~Server()
   emit deleted(this);
 }
 
+void Server::connectSignals()
+{
+  connect(&incomingTimer,SIGNAL(timeout()),
+                    this,SLOT  (processIncomingData()) );
+
+  connect(&outgoingTimer,SIGNAL(timeout()),
+                    this,SLOT  (send()) );
+
+  connect(&unlockTimer,SIGNAL(timeout()),
+                  this,SLOT  (unlockSending()) );
+
+  connect(outputFilter,SIGNAL (openQuery(const QString&,const QString&)),
+                   this,SLOT   (addQuery(const QString&,const QString&)) );
+  connect(outputFilter,SIGNAL (requestDccSend()),
+                   this,SLOT   (requestDccSend()) );
+  connect(outputFilter,SIGNAL (requestDccSend(const QString&)),
+                   this,SLOT   (requestDccSend(const QString&)) );
+  connect(outputFilter, SIGNAL(multiServerCommand(const QString&, const QString&)),
+    this, SLOT(sendMultiServerCommand(const QString&, const QString&)));
+  connect(outputFilter, SIGNAL(reconnectServer()), this, SLOT(reconnect()));
+
+  connect(outputFilter,SIGNAL (openDccPanel()),
+            this,SLOT   (requestDccPanel()) );
+  connect(outputFilter,SIGNAL (closeDccPanel()),
+            this,SLOT   (requestCloseDccPanel()) );
+  connect(outputFilter,SIGNAL (openDccSend(const QString &, const QString &)),
+            this,SLOT   (addDccSend(const QString &, const QString &)) );
+  connect(outputFilter,SIGNAL (requestDccChat(const QString &)),
+            this,SLOT   (requestDccChat(const QString &)) );
+  connect(outputFilter,SIGNAL (connectToServer(const QString&, const QString&, const QString&)),
+            this,SLOT   (connectToNewServer(const QString&, const QString&, const QString&)));
+
+  connect(outputFilter,SIGNAL (openKonsolePanel()),
+            this,SLOT   (requestKonsolePanel()) );
+
+  connect(outputFilter,SIGNAL (sendToAllChannels(const QString&)),
+            this,SLOT   (sendToAllChannels(const QString&)) );
+  connect(outputFilter,SIGNAL (banUsers(const QStringList&,const QString&,const QString&)),
+            this,SLOT   (requestBan(const QStringList&,const QString&,const QString&)) );
+  connect(outputFilter,SIGNAL (unbanUsers(const QString&,const QString&)),
+            this,SLOT   (requestUnban(const QString&,const QString&)) );
+
+  connect(outputFilter,SIGNAL (openRawLog(bool)), this,SLOT (addRawLog(bool)) );
+  connect(outputFilter,SIGNAL (closeRawLog()),this,SLOT (closeRawLog()) );
+
+  connect(&notifyTimer,SIGNAL(timeout()),
+                  this,SLOT  (notifyTimeout()) );
+  connect(&notifyCheckTimer,SIGNAL(timeout()),
+                  this,SLOT  (notifyCheckTimeout()) );
+
+  connect(&inputFilter,SIGNAL(welcome()),
+                  this,SLOT  (connectionEstablished()) );
+  connect(&inputFilter,SIGNAL(notifyResponse(const QString&)),
+                  this,SLOT  (notifyResponse(const QString&)) );
+  connect(&inputFilter,SIGNAL(addDccGet(const QString&, const QStringList&)),
+                  this,SLOT  (addDccGet(const QString&, const QStringList&)) );
+  connect(&inputFilter,SIGNAL(resumeDccGetTransfer(const QString&, const QStringList&)),
+                  this,SLOT  (resumeDccGetTransfer(const QString&, const QStringList&)) );
+  connect(&inputFilter,SIGNAL(resumeDccSendTransfer(const QString&, const QStringList&)),
+                  this,SLOT  (resumeDccSendTransfer(const QString&, const QStringList&)) );
+  connect(&inputFilter,SIGNAL(userhost(const QString&,const QString&,bool,bool)),
+                  this,SLOT  (userhost(const QString&,const QString&,bool,bool)) );
+  connect(&inputFilter,SIGNAL(topicAuthor(const QString&,const QString&)),
+                  this,SLOT  (setTopicAuthor(const QString&,const QString&)) );
+  connect(&inputFilter,SIGNAL(addChannelListPanel()),
+                  this,SLOT  (addChannelListPanel()) );
+  connect(&inputFilter,SIGNAL(invitation(const QString&,const QString&)),
+                  this,SLOT  (invitation(const QString&,const QString&)) );
+
+  connect(&inputFilter,SIGNAL (away()),this,SLOT (away()) );
+  connect(&inputFilter,SIGNAL (unAway()),this,SLOT (unAway()) );
+  connect(&inputFilter,SIGNAL (addDccChat(const QString&,const QString&,const QString&,const \
QStringList&,bool)), +         getMainWindow(),SLOT (addDccChat(const QString&,const QString&,const \
QString&,const QStringList&,bool)) ); +
+  connect(this,SIGNAL(serverLag(Server*,int)),getMainWindow(),SLOT(updateLag(Server*,int)) );
+  connect(this,SIGNAL(tooLongLag(Server*,int)),getMainWindow(),SLOT(tooLongLag(Server*,int)) );
+  connect(this,SIGNAL(resetLag()),getMainWindow(),SLOT(resetLag()) );
+  connect(this,SIGNAL(addDccPanel()),getMainWindow(),SLOT(addDccPanel()) );
+  connect(this,SIGNAL(addKonsolePanel()),getMainWindow(),SLOT(addKonsolePanel()) );
+
+  connect(&serverSocket,SIGNAL (connectionSuccess())  ,this,SLOT (ircServerConnectionSuccess()) );
+  connect(&serverSocket,SIGNAL (connectionFailed(int)),this,SLOT (broken(int)) );
+  connect(&serverSocket,SIGNAL (readyRead()),this,SLOT (incoming()) );
+  connect(&serverSocket,SIGNAL (readyWrite()),this,SLOT (send()) );
+  connect(&serverSocket,SIGNAL (closed(int)),this,SLOT (broken(int)) );
+
+  connect(getMainWindow(),SIGNAL(prefsChanged()),KonversationApplication::kApplication(),SLOT(saveOptions()));
 +  connect(getMainWindow(),SIGNAL(openPrefsDialog()),KonversationApplication::kApplication(),SLOT(openPrefsDialog()));
 +
+  connect(this,SIGNAL (serverOnline(bool)),statusView,SLOT (serverOnline(bool)) );
+
+  connect(outputFilter, SIGNAL(launchScript(const QString&, const QString&)),
+    m_scriptLauncher, SLOT(launchScript(const QString&, const QString&)));
+  
+  connect(m_scriptLauncher, SIGNAL(scriptNotFound(const QString&)),
+                      this, SLOT(scriptNotFound(const QString&)));
+  connect(m_scriptLauncher, SIGNAL(scriptExecutionError(const QString&)),
+                      this, SLOT(scriptExecutionError(const QString&)));
+}
+
 QString Server::getServerName()  const { return serverName; }
 int Server::getPort() const { return serverPort; }
 
@@ -571,8 +548,8 @@ void Server::ircServerConnectionSuccess()
     {
       output.remove(0, 1);
     }*/
-    outputFilter.parse(getNickname(),output,QString::null);
-    output = outputFilter.getServerOutput();
+    outputFilter->parse(getNickname(),output,QString::null);
+    output = outputFilter->getServerOutput();
     queue(output);
   }
 
@@ -659,8 +636,8 @@ void Server::connectionEstablished()
 void Server::quitServer()
 {
   QString command(KonversationApplication::preferences.getCommandChar()+"QUIT");
-  outputFilter.parse(getNickname(),command,QString::null);
-  queue(outputFilter.getServerOutput());
+  outputFilter->parse(getNickname(),command,QString::null);
+  queue(outputFilter->getServerOutput());
 }
 
 void Server::notifyAction(const QString& nick)
@@ -676,8 +653,8 @@ void Server::notifyAction(const QString& nick)
   QStringList outList=QStringList::split('\n',out);
   for(unsigned int index=0;index<outList.count();index++)
   {
-    outputFilter.parse(getNickname(),outList[index],QString::null);
-    queue(outputFilter.getServerOutput());
+    outputFilter->parse(getNickname(),outList[index],QString::null);
+    queue(outputFilter->getServerOutput());
   } // endfor
 }
 
@@ -1275,8 +1252,8 @@ void Server::closeChannel(const QString& name)
   Channel* channelToClose=getChannelByName(name);
   if(channelToClose)
   {
-    outputFilter.parse(getNickname(),KonversationApplication::preferences.getCommandChar()+"PART",name);
-    queue(outputFilter.getServerOutput());
+    outputFilter->parse(getNickname(),KonversationApplication::preferences.getCommandChar()+"PART",name);
 +    queue(outputFilter->getServerOutput());
   }
 }
 
@@ -1337,9 +1314,9 @@ void Server::requestBan(const QStringList& users,const QString& channel,const QS
       }
     }
 
-    outputFilter.execBan(mask,channel);
+    outputFilter->execBan(mask,channel);
 
-    banCommand=outputFilter.getServerOutput();
+    banCommand=outputFilter->getServerOutput();
 
     queue(banCommand);
   }
@@ -1347,8 +1324,8 @@ void Server::requestBan(const QStringList& users,const QString& channel,const QS
 
 void Server::requestUnban(const QString& mask,const QString& channel)
 {
-  outputFilter.execUnban(mask,channel);
-  queue(outputFilter.getServerOutput());
+  outputFilter->execUnban(mask,channel);
+  queue(outputFilter->getServerOutput());
 }
 
 void Server::requestDccSend()
@@ -1494,16 +1471,16 @@ void Server::requestDccChat(const QString& nickname)
 
 void Server::dccSendRequest(const QString &partner, const QString &fileName, const QString &address, \
const QString &port, unsigned long size)  {
-  outputFilter.sendRequest(partner,fileName,address,port,size);
-  queue(outputFilter.getServerOutput());
-  appendStatusMessage(outputFilter.getType(),outputFilter.getOutput());
+  outputFilter->sendRequest(partner,fileName,address,port,size);
+  queue(outputFilter->getServerOutput());
+  appendStatusMessage(outputFilter->getType(),outputFilter->getOutput());
 }
 
 void Server::dccResumeGetRequest(const QString &sender, const QString &fileName, const QString &port, \
int startAt)  {
-  outputFilter.resumeRequest(sender,fileName,port,startAt);
-  queue(outputFilter.getServerOutput());
-  appendStatusMessage(outputFilter.getType(),outputFilter.getOutput());
+  outputFilter->resumeRequest(sender,fileName,port,startAt);
+  queue(outputFilter->getServerOutput());
+  appendStatusMessage(outputFilter->getType(),outputFilter->getOutput());
 }
 
 void Server::resumeDccGetTransfer(const QString &sourceNick, const QStringList &dccArguments)
@@ -1544,9 +1521,9 @@ void Server::resumeDccSendTransfer(const QString &recipient, const QStringList &
     QString fileName=dccTransfer->getFile();
     appendStatusMessage(i18n("DCC"),i18n("Resuming file \"%1\", offered by %2 from position \
%3.").arg(fileName).arg(recipient).arg(dccArguments[2]));  dccTransfer->startResumeSend(dccArguments[2]);
-    outputFilter.acceptRequest(recipient,fileName,dccArguments[1],dccArguments[2].toUInt());
-    queue(outputFilter.getServerOutput());
-    appendStatusMessage(outputFilter.getType(),outputFilter.getOutput());
+    outputFilter->acceptRequest(recipient,fileName,dccArguments[1],dccArguments[2].toUInt());
+    queue(outputFilter->getServerOutput());
+    appendStatusMessage(outputFilter->getType(),outputFilter->getOutput());
   }
   else
   {
@@ -1604,8 +1581,8 @@ void Server::removeQuery(Query* query)
 
 void Server::sendJoinCommand(const QString& name)
 {
-  outputFilter.parse(getNickname(),KonversationApplication::preferences.getCommandChar()+"JOIN \
                "+name,QString::null);
-  queue(outputFilter.getServerOutput());
+  outputFilter->parse(getNickname(),KonversationApplication::preferences.getCommandChar()+"JOIN \
"+name,QString::null); +  queue(outputFilter->getServerOutput());
 }
 
 void Server::joinChannel(const QString &name, const QString &hostmask, const QString &/*key*/)
@@ -2517,7 +2494,7 @@ QString Server::getIrcName() const
   return ircName;
 }
 
-OutputFilter& Server::getOutputFilter()
+Konversation::OutputFilter* Server::getOutputFilter()
 {
   return outputFilter;
 }
@@ -2683,8 +2660,8 @@ void Server::executeMultiServerCommand(const QString& command, const QString& pa
       str += " " + parameter;
     }
 
-    outputFilter.parse(getNickname(), str,QString::null);
-    queue(outputFilter.getServerOutput());
+    outputFilter->parse(getNickname(), str,QString::null);
+    queue(outputFilter->getServerOutput());
   } else if(command == "msg") {
     sendToAllChannelsAndQueries(parameter);
   } else {
diff --git a/konversation/server.h b/konversation/server.h
index 607cd78..130e2e9 100644
--- a/konversation/server.h
+++ b/konversation/server.h
@@ -44,6 +44,7 @@ class Identity;
 class KonversationMainWindow;
 class RawLog;
 class ChannelListPanel;
+class ScriptLauncher;
 
 // A LocaleString is used as a key to a QMap.  Unlike QString, it sorts the QMap
 // in localeAware order.
@@ -142,7 +143,7 @@ class Server : public QObject
 
     bool isNickname(const QString& compare);
     QString getNickname() const;
-    OutputFilter& getOutputFilter();
+    Konversation::OutputFilter* getOutputFilter();
 
     void joinChannel(const QString& name, const QString& hostmask, const QString& key);
     void removeChannel(Channel* channel);
@@ -328,6 +329,9 @@ class Server : public QObject
   protected:
     // constants
     static const int BUFFER_LEN=513;
+    
+    /// Connect to the signals used in this class.
+    void connectSignals();
 
     KonversationMainWindow* getMainWindow() const;
     void setMainWindow(KonversationMainWindow* newMainWindow);
@@ -341,37 +345,37 @@ class Server : public QObject
 
     void autoRejoinChannels();
 
-    // Adds a nickname to the joinedChannels list.
-    // Creates new NickInfo if necessary.
-    // If needed, moves the channel from the unjoined list to the joined list.
-    // If needed, moves the nickname from the Offline to Online lists.
-    // If mode != 99 sets the mode for this nick in this channel.
-    // Returns the NickInfo for the nickname.
+    /// Adds a nickname to the joinedChannels list.
+    /// Creates new NickInfo if necessary.
+    /// If needed, moves the channel from the unjoined list to the joined list.
+    /// If needed, moves the nickname from the Offline to Online lists.
+    /// If mode != 99 sets the mode for this nick in this channel.
+    /// Returns the NickInfo for the nickname.
     NickInfoPtr addNickToJoinedChannelsList(const QString& channelName, const QString& nickname, \
                unsigned int mode = 99);
-    // Adds a nickname to the unjoinedChannels list.
-    // Creates new NickInfo if necessary.
-    // If needed, moves the channel from the joined list to the unjoined list.
-    // If needed, moves the nickname from the Offline to the Online list.
-    // If mode != 99 sets the mode for this nick in this channel.
-    // Returns the NickInfo for the nickname.
+    /// Adds a nickname to the unjoinedChannels list.
+    /// Creates new NickInfo if necessary.
+    /// If needed, moves the channel from the joined list to the unjoined list.
+    /// If needed, moves the nickname from the Offline to the Online list.
+    /// If mode != 99 sets the mode for this nick in this channel.
+    /// Returns the NickInfo for the nickname.
     NickInfoPtr addNickToUnjoinedChannelsList(const QString& channelName, const QString& nickname, \
                unsigned int mode = 99);
-    // Adds a nickname to the Online list, removing it from the Offline list, if present.
-    // Returns the NickInfo of the nickname.
-    // Creates new NickInfo if necessary.
+    /// Adds a nickname to the Online list, removing it from the Offline list, if present.
+    /// Returns the NickInfo of the nickname.
+    /// Creates new NickInfo if necessary.
     NickInfoPtr addNickToOnlineList(const QString& nickname);
-    // Adds a nickname to the Offline list provided it is on the watch list,
-    // removing it from the Online list, if present.
-    // Returns the NickInfo of the nickname or 0 if deleted altogether.
-    // Creates new NickInfo if necessary.
+    /// Adds a nickname to the Offline list provided it is on the watch list,
+    /// removing it from the Online list, if present.
+    /// Returns the NickInfo of the nickname or 0 if deleted altogether.
+    /// Creates new NickInfo if necessary.
     NickInfoPtr addNickToOfflineList(const QString& nickname, const QStringList& watchList);
-    // Remove nickname from a channel (on joined or unjoined lists).
-    // Delete the nickname altogether if no longer on any lists.
+    /// Remove nickname from a channel (on joined or unjoined lists).
+    /// Delete the nickname altogether if no longer on any lists.
     void removeChannelNick(const QString& channelName, const QString& nickname);
-    // Remove channel from the joined list.
-    // Nicknames in the channel are added to the unjoined list if they are in the watch list.
+    /// Remove channel from the joined list.
+    /// Nicknames in the channel are added to the unjoined list if they are in the watch list.
     void removeJoinedChannel(const QString& channelName);
-    // Renames a nickname in all NickInfo lists.
-    // Returns pointer to the NickInfo object or 0 if nick not found.
+    /// Renames a nickname in all NickInfo lists.
+    /// Returns pointer to the NickInfo object or 0 if nick not found.
     NickInfoPtr renameNickInfo(const QString& nickname, const QString& newname);
 
     unsigned int completeQueryPosition;
@@ -428,7 +432,7 @@ class Server : public QObject
     QPtrList<Query> queryList;
 
     InputFilter inputFilter;
-    OutputFilter outputFilter;
+    Konversation::OutputFilter* outputFilter;
 
     StatusPanel* statusView;
     RawLog* rawLog;
@@ -458,6 +462,8 @@ class Server : public QObject
     NickInfoMap queryNicks;
 
     int m_awayTime;
+    
+    ScriptLauncher* m_scriptLauncher;
 };
 
 #endif
diff --git a/konversation/statuspanel.cpp b/konversation/statuspanel.cpp
index 1e08b82..cfad2eb 100644
--- a/konversation/statuspanel.cpp
+++ b/konversation/statuspanel.cpp
@@ -92,14 +92,14 @@ void StatusPanel::sendStatusText(const QString& sendLine)
   // create a work copy
   QString output(sendLine);
   // replace aliases and wildcards
-  if(filter.replaceAliases(output)) \
output=server->parseWildcards(output,server->getNickname(),QString::null,QString::null,QString::null,QString::null);
 +  if(server->getOutputFilter()->replaceAliases(output)) \
output=server->parseWildcards(output,server->getNickname(),QString::null,QString::null,QString::null,QString::null);
  
   // encoding stuff is done in Server()
-  output=filter.parse(server->getNickname(),output,QString::null);
+  output=server->getOutputFilter()->parse(server->getNickname(),output,QString::null);
 
-  if(!output.isEmpty()) appendServerMessage(filter.getType(),output);
+  if(!output.isEmpty()) appendServerMessage(server->getOutputFilter()->getType(),output);
 
-  server->queue(filter.getServerOutput());
+  server->queue(server->getOutputFilter()->getServerOutput());
 }
 
 void StatusPanel::statusTextEntered()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic