kopete/libkopete
kopetecommandhandler.cpp
Go to the documentation of this file.
51 KopeteCommandGUIClient( Kopete::ChatSession *manager ) : QObject(manager), KXMLGUIClient(manager)
111 registerCommand( this, QString::fromLatin1("help"), SLOT(slotHelpCommand(QString,Kopete::ChatSession*)),
112 i18n( "USAGE: /help [<command>] - Used to list available commands, or show help for a specified command." ), 0, 1 );
114 registerCommand( this, QString::fromLatin1("url"), SLOT(slotOpenLastUrl(QString,Kopete::ChatSession*)),
117 registerCommand( this, QString::fromLatin1("close"), SLOT(slotCloseCommand(QString,Kopete::ChatSession*)),
121 registerCommand( this, QString::fromLatin1("part"), SLOT(slotPartCommand(QString,Kopete::ChatSession*)),
124 registerCommand( this, QString::fromLatin1("clear"), SLOT(slotClearCommand(QString,Kopete::ChatSession*)),
127 //registerCommand( this, QString::fromLatin1("me"), SLOT(slotMeCommand(QString,Kopete::ChatSession*)),
130 registerCommand( this, QString::fromLatin1("away"), SLOT(slotAwayCommand(QString,Kopete::ChatSession*)),
133 registerCommand( this, QString::fromLatin1("awayall"), SLOT(slotAwayAllCommand(QString,Kopete::ChatSession*)),
136 registerCommand( this, QString::fromLatin1("say"), SLOT(slotSayCommand(QString,Kopete::ChatSession*)),
137 i18n( "USAGE: /say <text> - Say text in this chat. This is the same as just typing a message, but is very "
140 registerCommand( this, QString::fromLatin1("exec"), SLOT(slotExecCommand(QString,Kopete::ChatSession*)),
141 i18n( "USAGE: /exec [-o] <command> - Executes the specified command and displays the output in the chat buffer. "
175 void Kopete::CommandHandler::registerCommand( QObject *parent, const QString &command, const char* handlerSlot,
181 Normal, QString::null, minArgs, maxArgs, cut, pix); //krazy:exclude=nullstrassign for old broken gcc
191 void Kopete::CommandHandler::registerAlias( QObject *parent, const QString &alias, const QString &formatString,
192 const QString &help, CommandType type, uint minArgs, int maxArgs, const KShortcut &cut, const QString &pix )
239 bool Kopete::CommandHandler::processMessage( Kopete::Message &msg, Kopete::ChatSession *manager )
246 void Kopete::CommandHandler::slotHelpCommand( const QString &args, Kopete::ChatSession *manager )
284 void Kopete::CommandHandler::slotSayCommand( const QString &args, Kopete::ChatSession *manager )
294 void Kopete::CommandHandler::slotExecCommand( const QString &args, Kopete::ChatSession *manager )
317 connect(proc, SIGNAL(error(QProcess::ProcessError)), this, SLOT(slotExecError(QProcess::ProcessError)));
330 msg.setPlainBody( i18n( "ERROR: Shell access has been restricted on your system. The /exec command will not function." ) );
348 void Kopete::CommandHandler::slotAwayCommand( const QString &args, Kopete::ChatSession *manager )
353 manager->account()->setOnlineStatus( OnlineStatusManager::self()->onlineStatus(manager->account()->protocol() , goAway ? OnlineStatusManager::Away : OnlineStatusManager::Online) );
355 manager->account()->setOnlineStatus( OnlineStatusManager::self()->onlineStatus(manager->account()->protocol() , goAway ? OnlineStatusManager::Away : OnlineStatusManager::Online) , args);
358 void Kopete::CommandHandler::slotAwayAllCommand( const QString &args, Kopete::ChatSession *manager )
441 const QStringList otherArgs = args.section( quotedArgs, 0 ).split( QRegExp(QString::fromLatin1("\\s+")), QString::SkipEmptyParts);
450 for( PluginCommandMap::Iterator it = p->pluginCommands.begin(); it != p->pluginCommands.end(); ++it )
459 bool Kopete::CommandHandler::commandHandledByProtocol( const QString &command, Kopete::Protocol *protocol )
495 for( PluginCommandMap::Iterator it = p->pluginCommands.begin(); it != p->pluginCommands.end(); ++it )
513 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:239
QString cap(int nth) const
QString & append(QChar ch)
bool commandHandledByProtocol(const QString &command, Protocol *protocol)
Check if a command is already handled by a spesific protocol.
Definition: kopetecommandhandler.cpp:459
Definition: kopetecommand.h:32
QDomNode appendChild(const QDomNode &newChild)
void setMinimal(bool minimal)
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
void reserve(int size)
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:175
QDomElement documentElement() const
int numCaptures() const
Definition: kopetechatsession.h:74
static AccountManager * self()
Retrieve the instance of AccountManager.
Definition: kopeteaccountmanager.cpp:77
static QStringList parseArguments(const QString &args)
Parses a string of command arguments into a QStringList.
Definition: kopetecommandhandler.cpp:429
(Default) Message which are not sent via the network. This is just a notification a plugin can show i...
Definition: kopetemessage.h:92
bool isNull() const
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:46
QDomElement toElement() const
int indexIn(const QString &str, int offset, CaretMode caretMode) const
void setDirection(MessageDirection direction)
Set the message direction.
Definition: kopetemessage.cpp:585
Protocol * protocol() const
Get the protocol that the contact belongs to.
Definition: kopetecontact.cpp:533
void append(const T &value)
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:191
QString fromUtf8(const char *str, int size)
QString & insert(int position, QChar ch)
void setAttribute(const QString &name, const QString &value)
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.
bool isEmpty() const
iterator begin()
void sendMessage(Kopete::Message &message)
Send a message to the user.
Definition: kopetechatsession.cpp:281
T & front()
void setPlainBody(const QString &body)
Sets the body of the message.
Definition: kopetemessage.cpp:234
void unregisterAlias(QObject *parent, const QString &alias)
Unregister an alias.
Definition: kopetecommandhandler.cpp:201
QMap< QObject *, CommandList > PluginCommandMap
Definition: kopetecommandhandler.cpp:44
QString toLower() const
const T value(const Key &key) const
const QString & help() const
Returns the help string for this command.
Definition: kopetecommand.h:86
QMultiHash< QString, Command * > CommandList
Definition: kopetecommandhandler.h:39
bool isNull() const
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
static ChatSessionManager * self()
Definition: kopetechatsessionmanager.cpp:39
QObject(QObject *parent)
QDomNode firstChild() const
QString mid(int position, int n) const
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:448
void setOnlineStatus(uint category, const Kopete::StatusMessage &statusMessage, uint flags, bool forced)
Set all accounts a status in the specified category.
Definition: kopeteaccountmanager.cpp:119
typedef ConstIterator
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
Definition: kopetecommandhandler.h:48
const QString lastUrl()
returns lastUrl for current ChatSession can be empty
Definition: kopetechatsession.cpp:154
QString fromLatin1(const char *str, int size)
static OnlineStatusManager * self()
Definition: kopeteonlinestatusmanager.cpp:49
typedef Iterator
iterator end()
const_iterator constEnd() const
QDomElement createElement(const QString &tagName)
const_iterator constBegin() const
QString plainBody() const
Get the message body back as plain text.
Definition: kopetemessage.cpp:366
KopeteView * view(bool canCreate=false, const QString &requestedPlugin=QString())
the manager's view
Definition: kopetechatsession.cpp:641
Definition: kopeteview.h:40
typedef Iterator
QDomNode insertBefore(const QDomNode &newChild, const QDomNode &refChild)
static CommandHandler * commandHandler()
Returns a pointer to the command handler.
Definition: kopetecommandhandler.cpp:164
void unregisterCommand(QObject *parent, const QString &command)
Unregister a command.
Definition: kopetecommandhandler.cpp:185
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.