• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/libkopete

  • sources
  • kde-4.12
  • kdenetwork
  • kopete
  • libkopete
kopetecommandhandler.cpp
Go to the documentation of this file.
1 /*
2  kopetecommandhandler.cpp - Command Handler
3 
4  Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>
5  Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
6 
7  *************************************************************************
8  * *
9  * This library is free software; you can redistribute it and/or *
10  * modify it under the terms of the GNU Lesser General Public *
11  * License as published by the Free Software Foundation; either *
12  * version 2 of the License, or (at your option) any later version. *
13  * *
14  *************************************************************************
15 */
16 
17 #include <qregexp.h>
18 #include <QList>
19 #include <QApplication>
20 #include <kdebug.h>
21 #include <klocale.h>
22 #include <kdeversion.h>
23 #include <kxmlguiclient.h>
24 #include <kaction.h>
25 #include <qdom.h>
26 #include <kauthorized.h>
27 #include <kactioncollection.h>
28 #include <ktoolinvocation.h>
29 #ifndef Q_OS_WIN
30 #include <k3process.h>
31 #else
32 class K3Process : public QObject {
33 public:
34  enum RunMode {
35  NotifyOnExit,
36  };
37  enum Communication {
38  NoCommunication,
39  AllOutput,
40  };
41  K3Process(QObject *) {}
42 
43  K3Process &operator<< (const QString &arg) { return *this; }
44  K3Process &operator<< (const char *arg) { return *this; }
45  K3Process &operator<< (const QByteArray &arg) { return *this; }
46  K3Process &operator<< (const QStringList &args) { return *this; }
47  virtual bool start (RunMode runmode=NotifyOnExit, Communication comm=NoCommunication) { return true; }
48 };
49 #endif
50 
51 #include "kopetechatsessionmanager.h"
52 #include "kopeteprotocol.h"
53 #include "kopetepluginmanager.h"
54 #include "kopeteview.h"
55 #include "kopeteaccountmanager.h"
56 #include "kopeteaccount.h"
57 #include "kopetecommandhandler.h"
58 #include "kopetecontact.h"
59 #include "kopetecommand.h"
60 #include "kopeteonlinestatusmanager.h"
61 
62 using Kopete::CommandList;
63 
64 typedef QMap<QObject*, CommandList> PluginCommandMap;
65 typedef QMap<QString,QString> CommandMap;
66 typedef QPair<Kopete::ChatSession*, Kopete::Message::MessageDirection> ManagerPair;
67 
68 class KopeteCommandGUIClient : public QObject, public KXMLGUIClient
69 {
70  public:
71  KopeteCommandGUIClient( Kopete::ChatSession *manager ) : QObject(manager), KXMLGUIClient(manager)
72  {
73  setXMLFile( QString::fromLatin1("kopetecommandui.rc") );
74 
75  QDomDocument doc = domDocument();
76  QDomNode menu = doc.documentElement().firstChild().firstChild().firstChild();
77  CommandList mCommands = Kopete::CommandHandler::commandHandler()->commands(
78  manager->protocol()
79  );
80 
81  CommandList::Iterator it, itEnd = mCommands.end();
82  for( it = mCommands.begin(); it != itEnd; ++it )
83  {
84  KAction *a = static_cast<KAction*>( it.value() );
85  actionCollection()->addAction( a->objectName(), a );
86  QDomElement newNode = doc.createElement( QString::fromLatin1("Action") );
87  newNode.setAttribute( QString::fromLatin1("name"), a->objectName() );
88 
89  bool added = false;
90  for( QDomElement n = menu.firstChild().toElement();
91  !n.isNull(); n = n.nextSibling().toElement() )
92  {
93  if( a->objectName() < n.attribute(QString::fromLatin1("name")))
94  {
95  menu.insertBefore( newNode, n );
96  added = true;
97  break;
98  }
99  }
100 
101  if( !added )
102  {
103  menu.appendChild( newNode );
104  }
105  }
106 
107  setDOMDocument( doc );
108  }
109 };
110 
111 struct CommandHandlerPrivate
112 {
113  PluginCommandMap pluginCommands;
114  Kopete::CommandHandler *s_handler;
115  QMap<K3Process*,ManagerPair> processMap;
116  bool inCommand;
117  QList<KAction *> m_commands;
118 };
119 
120 CommandHandlerPrivate *Kopete::CommandHandler::p = 0L;
121 
122 Kopete::CommandHandler::CommandHandler() : QObject( qApp )
123 {
124  p->s_handler = this;
125  p->inCommand = false;
126 
127  CommandList mCommands;
128  mCommands.reserve(31);
129  p->pluginCommands.insert( this, mCommands );
130 
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 );
133 
134  registerCommand( this, QString::fromLatin1("url"), SLOT(slotOpenLastUrl(QString,Kopete::ChatSession*)),
135  i18n( "USAGE: /url - Opens last URL for current chat in default browser." ) );
136 
137  registerCommand( this, QString::fromLatin1("close"), SLOT(slotCloseCommand(QString,Kopete::ChatSession*)),
138  i18n( "USAGE: /close - Closes the current view." ) );
139 
140  // FIXME: What's the difference with /close? The help doesn't explain it - Martijn
141  registerCommand( this, QString::fromLatin1("part"), SLOT(slotPartCommand(QString,Kopete::ChatSession*)),
142  i18n( "USAGE: /part - Closes the current view." ) );
143 
144  registerCommand( this, QString::fromLatin1("clear"), SLOT(slotClearCommand(QString,Kopete::ChatSession*)),
145  i18n( "USAGE: /clear - Clears the active view's chat buffer." ) );
146 
147  //registerCommand( this, QString::fromLatin1("me"), SLOT(slotMeCommand(QString,Kopete::ChatSession*)),
148  // i18n( "USAGE: /me <text> - Formats message as in '<nickname> went to the store'." ) );
149 
150  registerCommand( this, QString::fromLatin1("away"), SLOT(slotAwayCommand(QString,Kopete::ChatSession*)),
151  i18n( "USAGE: /away [<reason>] - Marks you as away/back for the current account only." ) );
152 
153  registerCommand( this, QString::fromLatin1("awayall"), SLOT(slotAwayAllCommand(QString,Kopete::ChatSession*)),
154  i18n( "USAGE: /awayall [<reason>] - Marks you as away/back for all accounts." ) );
155 
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 "
158  "useful for scripts." ), 1 );
159 
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. "
162  "If -o is specified, the output is sent to all members of the chat."), 1 );
163 
164  connect( Kopete::PluginManager::self(), SIGNAL(pluginLoaded(Kopete::Plugin*)),
165  this, SLOT(slotPluginLoaded(Kopete::Plugin*)) );
166 
167  connect( Kopete::ChatSessionManager::self(), SIGNAL(viewCreated(KopeteView*)),
168  this, SLOT(slotViewCreated(KopeteView*)) );
169 }
170 
171 Kopete::CommandHandler::~CommandHandler()
172 {
173  CommandList commandList = p->pluginCommands[this];
174  while (!commandList.isEmpty())
175  {
176  Kopete::Command *value = *commandList.begin();
177  commandList.erase(commandList.begin());
178  delete value;
179  }
180 
181  delete p;
182 }
183 
184 Kopete::CommandHandler *Kopete::CommandHandler::commandHandler()
185 {
186  if( !p )
187  {
188  p = new CommandHandlerPrivate;
189  p->s_handler = new Kopete::CommandHandler();
190  }
191 
192  return p->s_handler;
193 }
194 
195 void Kopete::CommandHandler::registerCommand( QObject *parent, const QString &command, const char* handlerSlot,
196  const QString &help, uint minArgs, int maxArgs, const KShortcut &cut, const QString &pix )
197 {
198  const QString lowerCommand = command.toLower();
199 
200  Kopete::Command *mCommand = new Kopete::Command( parent, lowerCommand, handlerSlot, help,
201  Normal, QString::null, minArgs, maxArgs, cut, pix); //krazy:exclude=nullstrassign for old broken gcc
202  p->pluginCommands[ parent ].insert( lowerCommand, mCommand );
203 }
204 
205 void Kopete::CommandHandler::unregisterCommand( QObject *parent, const QString &command )
206 {
207  if( p->pluginCommands[ parent ].contains(command) )
208  p->pluginCommands[ parent ].remove( command );
209 }
210 
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 )
213 {
214  const QString lowerAlias = alias.toLower();
215 
216  Kopete::Command *mCommand = new Kopete::Command( parent, lowerAlias, 0L, help, type,
217  formatString, minArgs, maxArgs, cut, pix );
218  p->pluginCommands[ parent ].insert( lowerAlias, mCommand );
219 }
220 
221 void Kopete::CommandHandler::unregisterAlias( QObject *parent, const QString &alias )
222 {
223  if( p->pluginCommands[ parent ].contains(alias) )
224  p->pluginCommands[ parent ].remove( alias );
225 }
226 
227 bool Kopete::CommandHandler::processMessage( const QString &msg, Kopete::ChatSession *manager )
228 {
229  if( p->inCommand )
230  return false;
231  QRegExp splitRx( QString::fromLatin1("^/([\\S]+)(.*)") );
232  QString command;
233  QString args;
234  if(splitRx.indexIn(msg) != -1)
235  {
236  command = splitRx.cap(1);
237  args = splitRx.cap(2).mid(1);
238  }
239  else
240  return false;
241 
242  CommandList mCommands = commands( manager->protocol() );
243  Kopete::Command *c = mCommands.value(command);
244  if(c)
245  {
246  kDebug(14010) << "Handled Command";
247  if( c->type() != SystemAlias && c->type() != UserAlias )
248  p->inCommand = true;
249 
250  c->processCommand( args, manager );
251  p->inCommand = false;
252 
253  return true;
254  }
255 
256  return false;
257 }
258 
259 bool Kopete::CommandHandler::processMessage( Kopete::Message &msg, Kopete::ChatSession *manager )
260 {
261  const QString messageBody = msg.plainBody();
262 
263  return processMessage( messageBody, manager );
264 }
265 
266 void Kopete::CommandHandler::slotHelpCommand( const QString &args, Kopete::ChatSession *manager )
267 {
268  QString output;
269  if( args.isEmpty() )
270  {
271  int commandCount = 0;
272  output = i18n( "Available Commands:\n" );
273 
274  CommandList mCommands = commands( manager->myself()->protocol() );
275  CommandList::Iterator it, itEnd = mCommands.end();
276  for( it = mCommands.begin(); it != itEnd; ++it )
277  {
278  output.append( it.value()->command().toUpper() + '\t' );
279  if( commandCount++ == 5 )
280  {
281  commandCount = 0;
282  output.append( '\n' );
283  }
284  }
285  output.append( i18n( "\nType /help <command> for more information." ) );
286  }
287  else
288  {
289  const QString command = parseArguments( args ).front().toLower();
290  Kopete::Command *c = commands( manager->myself()->protocol() ).value( command );
291  if( c && !c->help().isNull() )
292  output = c->help();
293  else
294  output = i18n("There is no help available for '%1'.", command );
295  }
296 
297  Kopete::Message msg(manager->myself(), manager->members());
298  msg.setDirection( Kopete::Message::Internal );
299  msg.setPlainBody( output );
300 
301  manager->appendMessage(msg);
302 }
303 
304 void Kopete::CommandHandler::slotSayCommand( const QString &args, Kopete::ChatSession *manager )
305 {
306  //Just say whatever is passed
307  Kopete::Message msg(manager->myself(), manager->members());
308  msg.setPlainBody( args );
309  msg.setDirection( Kopete::Message::Outbound );
310 
311  manager->sendMessage(msg);
312 }
313 
314 void Kopete::CommandHandler::slotExecCommand( const QString &args, Kopete::ChatSession *manager )
315 {
316  if( !args.isEmpty() )
317  {
318  K3Process *proc = 0L;
319  if ( KAuthorized::authorizeKAction( "shell_access" ) )
320  proc = new K3Process(manager);
321  if( proc )
322  {
323  *proc << QString::fromLatin1("sh") << QString::fromLatin1("-c");
324 
325  QStringList argsList = parseArguments( args );
326  if( argsList.front() == QString::fromLatin1("-o") )
327  {
328  p->processMap.insert( proc, ManagerPair(manager, Kopete::Message::Outbound) );
329  *proc << args.section(QRegExp(QString::fromLatin1("\\s+")), 1);
330  }
331  else
332  {
333  p->processMap.insert( proc, ManagerPair(manager, Kopete::Message::Internal) );
334  *proc << args;
335  }
336 
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)));
339  proc->start( K3Process::NotifyOnExit, K3Process::AllOutput );
340  }
341  else
342  {
343  Kopete::Message msg(manager->myself(), manager->members() );
344  msg.setDirection( Kopete::Message::Internal );
345  msg.setPlainBody( i18n( "ERROR: Shell access has been restricted on your system. The /exec command will not function." ) );
346  manager->sendMessage( msg );
347  }
348  }
349 }
350 
351 void Kopete::CommandHandler::slotClearCommand( const QString &, Kopete::ChatSession *manager )
352 {
353  if( manager->view() )
354  manager->view()->clear();
355 }
356 
357 void Kopete::CommandHandler::slotPartCommand( const QString &, Kopete::ChatSession *manager )
358 {
359  if( manager->view() )
360  manager->view()->closeView();
361 }
362 
363 void Kopete::CommandHandler::slotAwayCommand( const QString &args, Kopete::ChatSession *manager )
364 {
365  const bool goAway = !manager->account()->isAway();
366 
367  if( args.isEmpty() )
368  manager->account()->setOnlineStatus( OnlineStatusManager::self()->onlineStatus(manager->account()->protocol() , goAway ? OnlineStatusManager::Away : OnlineStatusManager::Online) );
369  else
370  manager->account()->setOnlineStatus( OnlineStatusManager::self()->onlineStatus(manager->account()->protocol() , goAway ? OnlineStatusManager::Away : OnlineStatusManager::Online) , args);
371 }
372 
373 void Kopete::CommandHandler::slotAwayAllCommand( const QString &args, Kopete::ChatSession *manager )
374 {
375  if( manager->account()->isAway() ) {
376  Kopete::AccountManager::self()->setOnlineStatus( Kopete::OnlineStatusManager::Online );
377  }
378  else {
379  Kopete::AccountManager::self()->setOnlineStatus( Kopete::OnlineStatusManager::Away, args );
380  }
381 }
382 
383 void Kopete::CommandHandler::slotOpenLastUrl( const QString &, Kopete::ChatSession *manager )
384 {
385  QString tempstr = manager->lastUrl();
386  if ( !tempstr.isEmpty() ) {
387  //now there is no difference whether it is a brwserUrl or a mailtoUrl
388  KToolInvocation::invokeBrowser( tempstr );
389  }
390 }
391 
392 void Kopete::CommandHandler::slotCloseCommand( const QString &, Kopete::ChatSession *manager )
393 {
394  if( manager->view() )
395  manager->view()->closeView();
396 }
397 
398 void Kopete::CommandHandler::slotExecReturnedData(K3Process *proc, char *buff, int bufflen )
399 {
400  kDebug(14010) ;
401  QString buffer = QString::fromLocal8Bit( buff, bufflen );
402  ManagerPair mgrPair = p->processMap[ proc ];
403  Kopete::Message msg( mgrPair.first->myself(), mgrPair.first->members() );
404  msg.setDirection( mgrPair.second );
405  msg.setPlainBody( buffer );
406 
407  if( mgrPair.second == Kopete::Message::Outbound )
408  mgrPair.first->sendMessage( msg );
409  else
410  mgrPair.first->appendMessage( msg );
411 }
412 
413 void Kopete::CommandHandler::slotExecFinished(K3Process *proc)
414 {
415  delete proc;
416  p->processMap.remove( proc );
417 }
418 
419 QStringList Kopete::CommandHandler::parseArguments( const QString &args )
420 {
421  QStringList arguments;
422  QRegExp quotedArgs( QString::fromLatin1("\"(.*)\"") );
423  quotedArgs.setMinimal( true );
424 
425  if ( quotedArgs.indexIn( args ) != -1 )
426  {
427  for( int i = 0; i< quotedArgs.numCaptures(); i++ )
428  arguments.append( quotedArgs.cap(i) );
429  }
430 
431  const QStringList otherArgs = args.section( quotedArgs, 0 ).split( QRegExp(QString::fromLatin1("\\s+")), QString::SkipEmptyParts);
432  for( QStringList::ConstIterator it = otherArgs.constBegin(); it != otherArgs.constEnd(); ++it )
433  arguments.append( *it );
434 
435  return arguments;
436 }
437 
438 bool Kopete::CommandHandler::commandHandled( const QString &command )
439 {
440  for( PluginCommandMap::Iterator it = p->pluginCommands.begin(); it != p->pluginCommands.end(); ++it )
441  {
442  if( it.value().value( command ) )
443  return true;
444  }
445 
446  return false;
447 }
448 
449 bool Kopete::CommandHandler::commandHandledByProtocol( const QString &command, Kopete::Protocol *protocol )
450 {
451  // Make sure the protocol is not NULL
452  if(!protocol)
453  return false;
454 
455  // Fetch the commands for the protocol
456  CommandList commandList = commands( protocol );
457  CommandList::Iterator it, itEnd = commandList.end();
458 
459  // Loop through commands and check if they match the supplied command
460  for( it = commandList.begin(); it != itEnd; ++it )
461  {
462  if( it.value()->command().toLower() == command )
463  return true;
464  }
465 
466  // No commands found
467  return false;
468 }
469 
470 CommandList Kopete::CommandHandler::commands( Kopete::Protocol *protocol )
471 {
472  CommandList commandList;
473  commandList.reserve(63);
474 
475  //Add plugin user aliases first
476  addCommands( p->pluginCommands[protocol], commandList, UserAlias );
477 
478  //Add plugin system aliases next
479  addCommands( p->pluginCommands[protocol], commandList, SystemAlias );
480 
481  //Add the commands for this protocol next
482  addCommands( p->pluginCommands[protocol], commandList );
483 
484  //Add plugin commands
485  for( PluginCommandMap::Iterator it = p->pluginCommands.begin(); it != p->pluginCommands.end(); ++it )
486  {
487  if( !it.key()->inherits("Kopete::Protocol") && it.key()->inherits("Kopete::Plugin") )
488  addCommands( it.value(), commandList );
489  }
490 
491  //Add global user aliases first
492  addCommands( p->pluginCommands[this], commandList, UserAlias );
493 
494  //Add global system aliases next
495  addCommands( p->pluginCommands[this], commandList, SystemAlias );
496 
497  //Add the internal commands *last*
498  addCommands( p->pluginCommands[this], commandList );
499 
500  return commandList;
501 }
502 
503 void Kopete::CommandHandler::addCommands( CommandList &from, CommandList &to, CommandType type )
504 {
505  CommandList::Iterator itDict, itDictEnd = from.end();
506  for( itDict = from.begin(); itDict != itDictEnd; ++itDict )
507  {
508  if( !to.value( itDict.key() ) &&
509  ( type == Undefined || itDict.value()->type() == type ) )
510  to.insert( itDict.key(), itDict.value() );
511  }
512 }
513 
514 void Kopete::CommandHandler::slotViewCreated( KopeteView *view )
515 {
516  new KopeteCommandGUIClient( view->msgManager() );
517 }
518 
519 void Kopete::CommandHandler::slotPluginLoaded( Kopete::Plugin *plugin )
520 {
521  connect( plugin, SIGNAL(destroyed(QObject*)), this, SLOT(slotPluginDestroyed(QObject*)) );
522  if( !p->pluginCommands.contains( plugin ) )
523  {
524  //Create a QDict optomized for a larger # of commands, and case insensitive
525  CommandList mCommands;
526  mCommands.reserve(31);
527  p->pluginCommands.insert( plugin, mCommands );
528  }
529 }
530 
531 void Kopete::CommandHandler::slotPluginDestroyed( QObject *plugin )
532 {
533  p->pluginCommands.remove( static_cast<Kopete::Plugin*>(plugin) );
534 }
535 
536 #include "kopetecommandhandler.moc"
537 
538 // vim: set noet ts=4 sts=4 sw=4:
539 
Kopete::CommandHandler::processMessage
bool processMessage(Message &msg, ChatSession *manager)
Process a message to see if any commands should be handled.
Definition: kopetecommandhandler.cpp:259
Kopete::CommandHandler::CommandType
CommandType
an enum defining the type of a command
Definition: kopetecommandhandler.h:59
Kopete::Account::protocol
Protocol * protocol() const
Definition: kopeteaccount.cpp:214
KopeteView::clear
virtual void clear()
Clear the buffer.
Definition: kopeteview.cpp:31
kopetechatsessionmanager.h
KopeteView::closeView
virtual bool closeView(bool force=false)=0
Close this view.
Kopete::CommandHandler::commandHandledByProtocol
bool commandHandledByProtocol(const QString &command, Protocol *protocol)
Check if a command is already handled by a spesific protocol.
Definition: kopetecommandhandler.cpp:449
KopeteView::msgManager
Kopete::ChatSession * msgManager() const
Get the message manager.
Definition: kopeteview.cpp:26
Kopete::Command
Definition: kopetecommand.h:32
kopeteaccount.h
Kopete::Protocol
base class of every protocol.
Definition: kopeteprotocol.h:62
kopetecommandhandler.h
Kopete::CommandHandler::registerCommand
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
CommandMap
QMap< QString, QString > CommandMap
Definition: kopetecommandhandler.cpp:65
QObject
Kopete::ChatSession
Definition: kopetechatsession.h:74
Kopete::Message::Outbound
Message sent by the user.
Definition: kopetemessage.h:91
Kopete::AccountManager::self
static AccountManager * self()
Retrieve the instance of AccountManager.
Definition: kopeteaccountmanager.cpp:76
Kopete::CommandHandler::parseArguments
static QStringList parseArguments(const QString &args)
Parses a string of command arguments into a QStringList.
Definition: kopetecommandhandler.cpp:419
Kopete::Message::Internal
(Default) Message which are not sent via the network. This is just a notification a plugin can show i...
Definition: kopetemessage.h:92
Kopete::ChatSession::appendMessage
void appendMessage(Kopete::Message &msg)
Show a message to the chatwindow, or append it to the queue.
Definition: kopetechatsession.cpp:310
ManagerPair
QPair< Kopete::ChatSession *, Kopete::Message::MessageDirection > ManagerPair
Definition: kopetecommandhandler.cpp:66
Kopete::Message::setDirection
void setDirection(MessageDirection direction)
Set the message direction.
Definition: kopetemessage.cpp:584
Kopete::Contact::protocol
Protocol * protocol() const
Get the protocol that the contact belongs to.
Definition: kopetecontact.cpp:493
Kopete::CommandHandler::registerAlias
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
Kopete::Account::setOnlineStatus
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.
kopeteprotocol.h
Kopete::ChatSession::sendMessage
void sendMessage(Kopete::Message &message)
Send a message to the user.
Definition: kopetechatsession.cpp:281
Kopete::Command::processCommand
void processCommand(const QString &args, ChatSession *manager, bool gui=false)
Process this command.
Definition: kopetecommand.cpp:99
Kopete::Message::setPlainBody
void setPlainBody(const QString &body)
Sets the body of the message.
Definition: kopetemessage.cpp:233
Kopete::Account::isAway
bool isAway
Definition: kopeteaccount.h:82
Kopete::CommandHandler::unregisterAlias
void unregisterAlias(QObject *parent, const QString &alias)
Unregister an alias.
Definition: kopetecommandhandler.cpp:221
PluginCommandMap
QMap< QObject *, CommandList > PluginCommandMap
Definition: kopetecommandhandler.cpp:64
Kopete::Plugin
Base class for all plugins or protocols.
Definition: kopeteplugin.h:84
Kopete::Command::help
const QString & help() const
Returns the help string for this command.
Definition: kopetecommand.h:86
Kopete::CommandList
QMultiHash< QString, Command * > CommandList
Definition: kopetecommandhandler.h:40
Kopete::PluginManager::self
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
Kopete::ChatSessionManager::self
static ChatSessionManager * self()
Definition: kopetechatsessionmanager.cpp:39
Kopete::ChatSession::account
Account * account() const
get the account
Definition: kopetechatsession.cpp:668
Kopete::OnlineStatusManager::Online
Definition: kopeteonlinestatusmanager.h:67
Kopete::ChatSession::myself
const Contact * myself() const
Get the local user in the session.
Definition: kopetechatsession.cpp:215
Kopete::OnlineStatusManager::Away
Definition: kopeteonlinestatusmanager.h:65
Kopete::ChatSession::members
const ContactPtrList & members() const
Get a list of all contacts in the session.
Definition: kopetechatsession.cpp:210
kopeteaccountmanager.h
KAction
Kopete::CommandHandler::commandHandled
bool commandHandled(const QString &command)
Check if a command is already handled.
Definition: kopetecommandhandler.cpp:438
Kopete::AccountManager::setOnlineStatus
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
Kopete::CommandHandler
Definition: kopetecommandhandler.h:49
Kopete::ChatSession::lastUrl
const QString lastUrl()
returns lastUrl for current ChatSession can be empty
Definition: kopetechatsession.cpp:154
kopeteview.h
Kopete::OnlineStatusManager::self
static OnlineStatusManager * self()
Definition: kopeteonlinestatusmanager.cpp:49
Kopete::ChatSession::protocol
Protocol * protocol() const
Get the protocol being used.
Definition: kopetechatsession.cpp:220
Kopete::Message::plainBody
QString plainBody() const
Get the message body back as plain text.
Definition: kopetemessage.cpp:365
Kopete::ChatSession::view
KopeteView * view(bool canCreate=false, const QString &requestedPlugin=QString())
the manager's view
Definition: kopetechatsession.cpp:641
KopeteView
Definition: kopeteview.h:40
Kopete::CommandHandler::commandHandler
static CommandHandler * commandHandler()
Returns a pointer to the command handler.
Definition: kopetecommandhandler.cpp:184
Kopete::Message
Representation of a message in Kopete.
Definition: kopetemessage.h:82
kopetepluginmanager.h
kopetecontact.h
kopeteonlinestatusmanager.h
Kopete::CommandHandler::unregisterCommand
void unregisterCommand(QObject *parent, const QString &command)
Unregister a command.
Definition: kopetecommandhandler.cpp:205
kopetecommand.h
operator<<
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

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal