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

kopete/libkopete

  • Kopete
  • ChatSession
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Kopete::ChatSession Class Reference

#include <kopetechatsession.h>

Inheritance diagram for Kopete::ChatSession:
Inheritance graph
[legend]

Public Types

enum  Form { Small, Chatroom }
 

Public Slots

void addContact (const Kopete::Contact *c, bool suppress=false)
 
void addContact (const Kopete::Contact *c, const Kopete::OnlineStatus &initialStatus, bool suppress=false)
 
void appendMessage (Kopete::Message &msg)
 
void deref ()
 
void emitNudgeNotification ()
 
void messageSucceeded ()
 
void raiseView ()
 
void receivedEventNotification (const QString &notificationText)
 
void receivedMessageState (uint messageId, Kopete::Message::MessageState state)
 
void receivedTypingMsg (const Kopete::Contact *contact, bool isTyping=true)
 
void receivedTypingMsg (const QString &contactId, bool isTyping=true)
 
void ref ()
 
void removeContact (const Kopete::Contact *contact, const QString &reason=QString(), Qt::TextFormat format=Qt::PlainText, bool suppressNotification=false)
 
void sendMessage (Kopete::Message &message)
 
void setCanBeDeleted (bool canBeDeleted)
 
void typing (bool t)
 

Signals

void closing (Kopete::ChatSession *kmm)
 
void contactAdded (const Kopete::Contact *contact, bool suppress)
 
void contactRemoved (const Kopete::Contact *contact, const QString &reason, Qt::TextFormat format=Qt::PlainText, bool suppressNotification=false)
 
void displayNameChanged ()
 
void eventNotification (const QString &notificationText)
 
void messageAppended (Kopete::Message &msg, Kopete::ChatSession *kmm=0L)
 
void messageReceived (Kopete::Message &msg, Kopete::ChatSession *kmm=0L)
 
void messageSent (Kopete::Message &msg, Kopete::ChatSession *kmm=0L)
 
void messageStateChanged (uint messageId, Kopete::Message::MessageState state)
 
void messageSuccess ()
 
void myselfTyping (bool isTyping)
 
void nickNameChanged (Kopete::Contact *, const QString &)
 
void onlineStatusChanged (Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus &)
 
void photoChanged ()
 
void remoteTyping (const Kopete::Contact *contact, bool isTyping)
 
void statusMessageChanged (Kopete::Contact *)
 
void toggleGraphicOverride (bool enable)
 
void viewActivated (KopeteView *view)
 

Public Member Functions

 ~ChatSession ()
 
Account * account () const
 
MessageHandlerChain::Ptr chainForDirection (Message::MessageDirection dir)
 
const OnlineStatus contactOnlineStatus (const Contact *contact) const
 
const QString displayName ()
 
QStringList findUrls (const Kopete::Message &msg)
 
Form form () const
 
QString initLastUrl (const Kopete::Contact *c)
 
virtual void inviteContact (const QString &contactId)
 
const QString lastUrl ()
 
bool mayInvite () const
 
const ContactPtrList & members () const
 
const Contact * myself () const
 
Protocol * protocol () const
 
void setContactOnlineStatus (const Contact *contact, const OnlineStatus &newStatus)
 
void setDisplayName (const QString &displayName)
 
void setLastUrl (const QString &verylastUrl)
 
void urlSearch (const Kopete::Message &msg)
 
KopeteView * view (bool canCreate=false, const QString &requestedPlugin=QString())
 
bool warnGroupChat () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Static Public Member Functions

static QString getUrlsFileName (const Kopete::Contact *)
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

 ChatSession (const Contact *user, ContactPtrList others, Protocol *protocol, Form form=Small)
 
void setMayInvite (bool)
 
void setWarnGroupChat (bool)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Author
Duncan Mac-Vicar Prett dunca.nosp@m.n@kd.nosp@m.e.org
Daniel Stone dston.nosp@m.e@kd.nosp@m.e.org
Martijn Klingens kling.nosp@m.ens@.nosp@m.kde.o.nosp@m.rg
Olivier Goffart ogoff.nosp@m.art@.nosp@m.kde.o.nosp@m.rg
Jason Keirstead jason.nosp@m.@kei.nosp@m.rstea.nosp@m.d.or.nosp@m.g

The Kopete::ChatSession manages a single chat. It is an interface between the protocol, and the chatwindow. The protocol can connect to messageSent() signals to send the message, and can append received message with messageReceived()

The KMM inherits from KXMLGUIClient, this client is merged with the chatwindow's ui so plugins can add childClients of this client to add their own actions in the chatwindow.

Definition at line 74 of file kopetechatsession.h.

Member Enumeration Documentation

enum Kopete::ChatSession::Form

Describes the form of this chat session.

Enumerator
Small 

The chat is a small group or 1:1 chat.

Chatroom 

Chat with many members and high traffic.

Definition at line 85 of file kopetechatsession.h.

Constructor & Destructor Documentation

Kopete::ChatSession::~ChatSession ( )

Delete a chat manager instance You shouldn't delete the KMM yourself.

it will be deleted when the chatwindow is closed see also setCanBeDeleted() , deref()

Definition at line 113 of file kopetechatsession.cpp.

Kopete::ChatSession::ChatSession ( const Contact *  user,
Kopete::ContactPtrList  others,
Kopete::Protocol *  protocol,
Form  form = Small 
)
protected

Create a message manager.

This constructor is private, because the static factory method createSession() creates the object. You may not create instances yourself directly!

Definition at line 78 of file kopetechatsession.cpp.

Member Function Documentation

Kopete::Account * Kopete::ChatSession::account ( ) const

get the account

Returns
the account
Note
Can be 0 if account was already deleted

Definition at line 668 of file kopetechatsession.cpp.

void Kopete::ChatSession::addContact ( const Kopete::Contact *  c,
bool  suppress = false 
)
slot

Add a contact to the session.

Parameters
cis the contact
suppressmean the there will be no automatic notifications in the chatwindow. (note that i don't like the param suppress at all. it is used in irc to show a different notification (with an info text) a QStringinfo would be more interesting, but it is also used to don't show the notification when entering in a channel)

Definition at line 439 of file kopetechatsession.cpp.

void Kopete::ChatSession::addContact ( const Kopete::Contact *  c,
const Kopete::OnlineStatus &  initialStatus,
bool  suppress = false 
)
slot

Add a contact to the session with a pre-set initial status.

Parameters
cis the contact
initialStatusThe initial contactOnlineStatus of the contact
suppressmean the there will be no automatic notifications in the chatwindow. (note that i don't like the param suppress at all. it is used in irc to show a different notification (with an info text) a QStringinfo would be more interesting, but it is also used to don't show the notification when entering in a channel)
See also
contactOnlineStatus

Definition at line 432 of file kopetechatsession.cpp.

void Kopete::ChatSession::appendMessage ( Kopete::Message &  msg)
slot

Show a message to the chatwindow, or append it to the queue.

This is the function protocols HAVE TO call for both incoming and outgoing messages if the message must be showed in the chatwindow

Definition at line 310 of file kopetechatsession.cpp.

Kopete::MessageHandlerChain::Ptr Kopete::ChatSession::chainForDirection ( Message::MessageDirection  dir)

Returns the message handler chain for the message direction dir.

Definition at line 269 of file kopetechatsession.cpp.

void Kopete::ChatSession::closing ( Kopete::ChatSession *  kmm)
signal

the KMM will be deleted Used by a Kopete::ChatSession to signal that it is closing.

void Kopete::ChatSession::contactAdded ( const Kopete::Contact *  contact,
bool  suppress 
)
signal

a new contact is now in the chat

const Kopete::OnlineStatus Kopete::ChatSession::contactOnlineStatus ( const Contact *  contact) const

get the status of a contact.

see setContactOnlineStatus()

Definition at line 141 of file kopetechatsession.cpp.

void Kopete::ChatSession::contactRemoved ( const Kopete::Contact *  contact,
const QString &  reason,
Qt::TextFormat  format = Qt::PlainText,
bool  suppressNotification = false 
)
signal

a contact is no longer in this chat

void Kopete::ChatSession::deref ( )
slot

dereference count the chat session if the reference counter reach 0 and there is no chat window open, the chat session will be deleted.

Definition at line 634 of file kopetechatsession.cpp.

const QString Kopete::ChatSession::displayName ( )

The caption of the chat.

Used for named chats

Definition at line 159 of file kopetechatsession.cpp.

void Kopete::ChatSession::displayNameChanged ( )
signal

The name of the chat is changed.

void Kopete::ChatSession::emitNudgeNotification ( )
slot

Protocols have to call this method if they want to emit a notification when a nudge/buzz is received.

Definition at line 304 of file kopetechatsession.cpp.

void Kopete::ChatSession::eventNotification ( const QString &  notificationText)
signal

Signals that a an event has to be displayed in the statusbar.

The chatwindow connects to this signal to update the statusbar.

QStringList Kopete::ChatSession::findUrls ( const Kopete::Message &  msg)

finds all urls in the current message (if there are many) sorts them as they are in the meassage QStringList[0] - is the earliest

Definition at line 362 of file kopetechatsession.cpp.

Kopete::ChatSession::Form Kopete::ChatSession::form ( ) const

Get the form of this chatsession.

This is a hint to the UI so it can present the chat appropriately

Definition at line 720 of file kopetechatsession.cpp.

QString Kopete::ChatSession::getUrlsFileName ( const Kopete::Contact *  c)
static

returns file name where urls for this contact supposed to be

Definition at line 418 of file kopetechatsession.cpp.

QString Kopete::ChatSession::initLastUrl ( const Kopete::Contact *  c)

finds proper file with lasturls for current contact ChatSession->members().first() then sets lasturl for current ChatSession if there is no file, lasturl will be set to empty string

Definition at line 390 of file kopetechatsession.cpp.

void Kopete::ChatSession::inviteContact ( const QString &  contactId)
virtual

this method is called when a contact is dragged to the contact list.

contactId is the id of the contact. the contact is supposed to be of the same account as the account() but we can't be sure the Kopete::Contact is really on the contact list

It is possible to drag contact only if mayInvite return true

the default implementaiton do nothing

Definition at line 703 of file kopetechatsession.cpp.

const QString Kopete::ChatSession::lastUrl ( )

returns lastUrl for current ChatSession can be empty

Definition at line 154 of file kopetechatsession.cpp.

bool Kopete::ChatSession::mayInvite ( ) const

says if you may invite contact from the same account to this chat with inviteContact

See also
setMayInvite
Returns
true if it is possible to invite contact to this chat.

Definition at line 698 of file kopetechatsession.cpp.

const Kopete::ContactPtrList & Kopete::ChatSession::members ( ) const

Get a list of all contacts in the session.

Definition at line 210 of file kopetechatsession.cpp.

void Kopete::ChatSession::messageAppended ( Kopete::Message &  msg,
Kopete::ChatSession *  kmm = 0L 
)
signal

a message will be soon shown in the chatwindow.

See Kopete::ChatSessionManager::aboutToDisplay() signal

void Kopete::ChatSession::messageReceived ( Kopete::Message &  msg,
Kopete::ChatSession *  kmm = 0L 
)
signal

a message will be soon received See Kopete::ChatSessionManager::aboutToReceive() signal

void Kopete::ChatSession::messageSent ( Kopete::Message &  msg,
Kopete::ChatSession *  kmm = 0L 
)
signal

a message is going to be sent

The message is going to be sent. protocols can connect to this signal to send the message ro the network. the protocol have also to call appendMessage() and messageSucceeded() See also Kopete::ChatSessionManager::aboutToSend() signal

void Kopete::ChatSession::messageStateChanged ( uint  messageId,
Kopete::Message::MessageState  state 
)
signal

Signals that a message has changed its state.

The chat window connects to this signal to update the message in chat view.

void Kopete::ChatSession::messageSucceeded ( )
slot

Protocols have to call this method when the last message sent has been correctly sent This will emit messageSuccess signal.

and allow the email window to get closed

Definition at line 299 of file kopetechatsession.cpp.

void Kopete::ChatSession::messageSuccess ( )
signal

The last message has finaly successfully been sent.

const Kopete::Contact * Kopete::ChatSession::myself ( ) const

Get the local user in the session.

Returns
the local user in the session, same as account()->myself()
Note
Can be 0 if local user was already deleted during account destruction

Definition at line 215 of file kopetechatsession.cpp.

void Kopete::ChatSession::myselfTyping ( bool  isTyping)
signal

emitting a typing notification

The user is typing a message, or just stopped typing the protocol should connect to this signal to signal to others that the user is typing if the protocol supports this

Parameters
isTypingsay if the user is typing or not
void Kopete::ChatSession::nickNameChanged ( Kopete::Contact *  ,
const QString &   
)
signal

a contact in this chat has changed his display name (previously nickname)

void Kopete::ChatSession::onlineStatusChanged ( Kopete::Contact *  ,
const Kopete::OnlineStatus &  ,
const Kopete::OnlineStatus &   
)
signal

a contact in this chat has changed his status

void Kopete::ChatSession::photoChanged ( )
signal

A contact within the chat session changed his photo.

Used to update the contacts photo in chat window.

Kopete::Protocol * Kopete::ChatSession::protocol ( ) const

Get the protocol being used.

Returns
the protocol

Definition at line 220 of file kopetechatsession.cpp.

void Kopete::ChatSession::raiseView ( )
slot

Raise the chat window and give him the focus It's used when the user wanted to activated (by clicking on the "view" button of a popup)

Definition at line 713 of file kopetechatsession.cpp.

void Kopete::ChatSession::receivedEventNotification ( const QString &  notificationText)
slot

Got an event notification from a user.

It will emit the signal eventNotification(). Use this slot in your protocols and plugins to change chatwindow statusBar text.

Definition at line 613 of file kopetechatsession.cpp.

void Kopete::ChatSession::receivedMessageState ( uint  messageId,
Kopete::Message::MessageState  state 
)
slot

Change state of message.

It will emit the signal messageStateChanged(). Use this slot in your protocols and plugins to change message state.

Definition at line 618 of file kopetechatsession.cpp.

void Kopete::ChatSession::receivedTypingMsg ( const Kopete::Contact *  contact,
bool  isTyping = true 
)
slot

Got a typing notification from a user.

Definition at line 537 of file kopetechatsession.cpp.

void Kopete::ChatSession::receivedTypingMsg ( const QString &  contactId,
bool  isTyping = true 
)
slot

Got a typing notification from a user.

This is a convenience version of the above method that takes a QString contactId instead of a full Kopete::Contact

Definition at line 592 of file kopetechatsession.cpp.

void Kopete::ChatSession::ref ( )
slot

reference count the chat session.

the chat session may be deleted only if the count reach 0 if you ref, don't forget to deref

See also
deref()

Definition at line 630 of file kopetechatsession.cpp.

void Kopete::ChatSession::remoteTyping ( const Kopete::Contact *  contact,
bool  isTyping 
)
signal

Signals that a remote user is typing a message.

the chatwindow connects to this signal to update the statusbar

void Kopete::ChatSession::removeContact ( const Kopete::Contact *  contact,
const QString &  reason = QString(),
Qt::TextFormat  format = Qt::PlainText,
bool  suppressNotification = false 
)
slot

Remove a contact from the session.

Parameters
contactis the contact
reasonis the optional raison message showed in the chatwindow
formatThe format of the message
suppressNotificationprevents a notification of the removal in the chat view. See note in addContact

Definition at line 500 of file kopetechatsession.cpp.

void Kopete::ChatSession::sendMessage ( Kopete::Message &  message)
slot

Send a message to the user.

Definition at line 281 of file kopetechatsession.cpp.

void Kopete::ChatSession::setCanBeDeleted ( bool  canBeDeleted)
slot

Set if the KMM will be deleted when the chatwindow is deleted.

It is useful if you want to keep the KMM alive even if the chatwindow is closed. Warning: if you set it to false, please keep in mind that you have to reset it to true later to delete it. In many case, you should never delete yourself the KMM, just call this this method. default is true. If there are no chatwindow when setting it to true, the kmm will be deleted.

Deprecated:
use ref and deref

Definition at line 623 of file kopetechatsession.cpp.

void Kopete::ChatSession::setContactOnlineStatus ( const Contact *  contact,
const OnlineStatus &  newStatus 
)

set a specified KOS for specified contact in this KMM

Set a special icon for a contact in this kmm only. by default, all contact have their own status

Definition at line 132 of file kopetechatsession.cpp.

void Kopete::ChatSession::setDisplayName ( const QString &  displayName)

change the displayname

change the display name of the chat

Definition at line 169 of file kopetechatsession.cpp.

void Kopete::ChatSession::setLastUrl ( const QString &  verylastUrl)

sets lastUrl for current ChatSession

Definition at line 149 of file kopetechatsession.cpp.

void Kopete::ChatSession::setMayInvite ( bool  b)
protected

Set whether or not contact from this account may be invited in this chat.

By default, it is set to false

See also
inviteContact()
mayInvite()

Definition at line 708 of file kopetechatsession.cpp.

void Kopete::ChatSession::setWarnGroupChat ( bool  b)
protected

set if kopete show warning message, when you closing window of group chat By default, it is set to true

See also
warnGroupChat()

Definition at line 729 of file kopetechatsession.cpp.

void Kopete::ChatSession::statusMessageChanged ( Kopete::Contact *  )
signal

a contact in this chat has changed his status message

void Kopete::ChatSession::toggleGraphicOverride ( bool  enable)
signal

does nothing

void Kopete::ChatSession::typing ( bool  t)
slot

Tell the KMM that the user is typing This method should be called only by a chatwindow.

It emits myselfTyping signal

Definition at line 608 of file kopetechatsession.cpp.

void Kopete::ChatSession::urlSearch ( const Kopete::Message &  msg)

prosesses every sent/appended message looks for urls, if found: sets current lastUrl and save it to proper file

Definition at line 343 of file kopetechatsession.cpp.

KopeteView * Kopete::ChatSession::view ( bool  canCreate = false,
const QString &  requestedPlugin = QString() 
)

the manager's view

Return the view for the supplied Kopete::ChatSession. If it already exists, it will be returned, otherwise, 0L will be returned or a new one if canCreate=true

Parameters
canCreatecreate a new one if it does not exist
requestedPluginSpecifies the view plugin to use if we have to create one.

Definition at line 641 of file kopetechatsession.cpp.

void Kopete::ChatSession::viewActivated ( KopeteView *  view)
signal

Signals that view for that chat session was activated.

bool Kopete::ChatSession::warnGroupChat ( ) const

say if kopete show warning message, when you closing window of group chat

See also
setWarnGroupChat()
Returns
true if kopete show warning message

Definition at line 724 of file kopetechatsession.cpp.


The documentation for this class was generated from the following files:
  • kopetechatsession.h
  • kopetechatsession.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:20 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