kopete/libkopete
kopetecommandhandler.cpp
Go to the documentation of this file.
47 virtual bool start (RunMode runmode=NotifyOnExit, Communication comm=NoCommunication) { return true; }
71 KopeteCommandGUIClient( Kopete::ChatSession *manager ) : QObject(manager), KXMLGUIClient(manager)
131 registerCommand( this, QString::fromLatin1("help"), SLOT(slotHelpCommand(QString,Kopete::ChatSession*)),
132 i18n( "USAGE: /help [<command>] - Used to list available commands, or show help for a specified command." ), 0, 1 );
134 registerCommand( this, QString::fromLatin1("url"), SLOT(slotOpenLastUrl(QString,Kopete::ChatSession*)),
137 registerCommand( this, QString::fromLatin1("close"), SLOT(slotCloseCommand(QString,Kopete::ChatSession*)),
141 registerCommand( this, QString::fromLatin1("part"), SLOT(slotPartCommand(QString,Kopete::ChatSession*)),
144 registerCommand( this, QString::fromLatin1("clear"), SLOT(slotClearCommand(QString,Kopete::ChatSession*)),
147 //registerCommand( this, QString::fromLatin1("me"), SLOT(slotMeCommand(QString,Kopete::ChatSession*)),
150 registerCommand( this, QString::fromLatin1("away"), SLOT(slotAwayCommand(QString,Kopete::ChatSession*)),
153 registerCommand( this, QString::fromLatin1("awayall"), SLOT(slotAwayAllCommand(QString,Kopete::ChatSession*)),
156 registerCommand( this, QString::fromLatin1("say"), SLOT(slotSayCommand(QString,Kopete::ChatSession*)),
157 i18n( "USAGE: /say <text> - Say text in this chat. This is the same as just typing a message, but is very "
160 registerCommand( this, QString::fromLatin1("exec"), SLOT(slotExecCommand(QString,Kopete::ChatSession*)),
161 i18n( "USAGE: /exec [-o] <command> - Executes the specified command and displays the output in the chat buffer. "
195 void Kopete::CommandHandler::registerCommand( QObject *parent, const QString &command, const char* handlerSlot,
201 Normal, QString::null, minArgs, maxArgs, cut, pix); //krazy:exclude=nullstrassign for old broken gcc
211 void Kopete::CommandHandler::registerAlias( QObject *parent, const QString &alias, const QString &formatString,
212 const QString &help, CommandType type, uint minArgs, int maxArgs, const KShortcut &cut, const QString &pix )
259 bool Kopete::CommandHandler::processMessage( Kopete::Message &msg, Kopete::ChatSession *manager )
266 void Kopete::CommandHandler::slotHelpCommand( const QString &args, Kopete::ChatSession *manager )
304 void Kopete::CommandHandler::slotSayCommand( const QString &args, Kopete::ChatSession *manager )
314 void Kopete::CommandHandler::slotExecCommand( const QString &args, Kopete::ChatSession *manager )
337 connect(proc, SIGNAL(receivedStdout(K3Process*,char*,int)), this, SLOT(slotExecReturnedData(K3Process*,char*,int)));
338 connect(proc, SIGNAL(receivedStderr(K3Process*,char*,int)), this, SLOT(slotExecReturnedData(K3Process*,char*,int)));
345 msg.setPlainBody( i18n( "ERROR: Shell access has been restricted on your system. The /exec command will not function." ) );
363 void Kopete::CommandHandler::slotAwayCommand( const QString &args, Kopete::ChatSession *manager )
368 manager->account()->setOnlineStatus( OnlineStatusManager::self()->onlineStatus(manager->account()->protocol() , goAway ? OnlineStatusManager::Away : OnlineStatusManager::Online) );
370 manager->account()->setOnlineStatus( OnlineStatusManager::self()->onlineStatus(manager->account()->protocol() , goAway ? OnlineStatusManager::Away : OnlineStatusManager::Online) , args);
373 void Kopete::CommandHandler::slotAwayAllCommand( const QString &args, Kopete::ChatSession *manager )
431 const QStringList otherArgs = args.section( quotedArgs, 0 ).split( QRegExp(QString::fromLatin1("\\s+")), QString::SkipEmptyParts);
440 for( PluginCommandMap::Iterator it = p->pluginCommands.begin(); it != p->pluginCommands.end(); ++it )
449 bool Kopete::CommandHandler::commandHandledByProtocol( const QString &command, Kopete::Protocol *protocol )
485 for( PluginCommandMap::Iterator it = p->pluginCommands.begin(); it != p->pluginCommands.end(); ++it )
503 void Kopete::CommandHandler::addCommands( CommandList &from, CommandList &to, CommandType type )
bool processMessage(Message &msg, ChatSession *manager)
Process a message to see if any commands should be handled.
Definition: kopetecommandhandler.cpp:259
bool commandHandledByProtocol(const QString &command, Protocol *protocol)
Check if a command is already handled by a spesific protocol.
Definition: kopetecommandhandler.cpp:449
Definition: kopetecommand.h:32
void registerCommand(QObject *parent, const QString &command, const char *handlerSlot, const QString &help=QString(), uint minArgs=0, int maxArgs=-1, const KShortcut &cut=KShortcut(), const QString &pix=QString())
Register a command with the command handler.
Definition: kopetecommandhandler.cpp:195
Definition: kopetechatsession.h:74
static AccountManager * self()
Retrieve the instance of AccountManager.
Definition: kopeteaccountmanager.cpp:76
static QStringList parseArguments(const QString &args)
Parses a string of command arguments into a QStringList.
Definition: kopetecommandhandler.cpp:419
(Default) Message which are not sent via the network. This is just a notification a plugin can show i...
Definition: kopetemessage.h:92
void appendMessage(Kopete::Message &msg)
Show a message to the chatwindow, or append it to the queue.
Definition: kopetechatsession.cpp:310
QPair< Kopete::ChatSession *, Kopete::Message::MessageDirection > ManagerPair
Definition: kopetecommandhandler.cpp:66
void setDirection(MessageDirection direction)
Set the message direction.
Definition: kopetemessage.cpp:584
Protocol * protocol() const
Get the protocol that the contact belongs to.
Definition: kopetecontact.cpp:493
void registerAlias(QObject *parent, const QString &alias, const QString &formatString, const QString &help=QString(), CommandType=SystemAlias, uint minArgs=0, int maxArgs=-1, const KShortcut &cut=KShortcut(), const QString &pix=QString())
Register a command alias.
Definition: kopetecommandhandler.cpp:211
virtual void setOnlineStatus(const Kopete::OnlineStatus &status, const Kopete::StatusMessage &reason=Kopete::StatusMessage(), const OnlineStatusOptions &options=None)=0
Reimplement this function to set the online status.
void sendMessage(Kopete::Message &message)
Send a message to the user.
Definition: kopetechatsession.cpp:281
void processCommand(const QString &args, ChatSession *manager, bool gui=false)
Process this command.
Definition: kopetecommand.cpp:99
void setPlainBody(const QString &body)
Sets the body of the message.
Definition: kopetemessage.cpp:233
void unregisterAlias(QObject *parent, const QString &alias)
Unregister an alias.
Definition: kopetecommandhandler.cpp:221
QMap< QObject *, CommandList > PluginCommandMap
Definition: kopetecommandhandler.cpp:64
const QString & help() const
Returns the help string for this command.
Definition: kopetecommand.h:86
QMultiHash< QString, Command * > CommandList
Definition: kopetecommandhandler.h:40
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
static ChatSessionManager * self()
Definition: kopetechatsessionmanager.cpp:39
const Contact * myself() const
Get the local user in the session.
Definition: kopetechatsession.cpp:215
const ContactPtrList & members() const
Get a list of all contacts in the session.
Definition: kopetechatsession.cpp:210
bool commandHandled(const QString &command)
Check if a command is already handled.
Definition: kopetecommandhandler.cpp:438
void setOnlineStatus(uint category, const Kopete::StatusMessage &statusMessage, uint flags, bool forced)
Set all accounts a status in the specified category.
Definition: kopeteaccountmanager.cpp:118
Definition: kopetecommandhandler.h:49
const QString lastUrl()
returns lastUrl for current ChatSession can be empty
Definition: kopetechatsession.cpp:154
static OnlineStatusManager * self()
Definition: kopeteonlinestatusmanager.cpp:49
QString plainBody() const
Get the message body back as plain text.
Definition: kopetemessage.cpp:365
KopeteView * view(bool canCreate=false, const QString &requestedPlugin=QString())
the manager's view
Definition: kopetechatsession.cpp:641
Definition: kopeteview.h:40
static CommandHandler * commandHandler()
Returns a pointer to the command handler.
Definition: kopetecommandhandler.cpp:184
void unregisterCommand(QObject *parent, const QString &command)
Unregister a command.
Definition: kopetecommandhandler.cpp:205
QDataStream & operator<<(QDataStream &s, const NetworkStatus::Properties p)
Definition: networkstatuscommon.cpp:4
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.