kopete/libkopete
kopetechatsession.cpp
Go to the documentation of this file.
100 connect( Kopete::PluginManager::self(), SIGNAL(pluginLoaded(Kopete::Plugin*)), this, SLOT(clearChains()) );
101 connect( Kopete::PluginManager::self(), SIGNAL(pluginUnloaded(QString)), this, SLOT(clearChains()) );
103 connect( user, SIGNAL(contactDestroyed(Kopete::Contact*)), this, SLOT(slotMyselfDestroyed(Kopete::Contact*)) );
104 connect( user, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)), this,
126 void Kopete::ChatSession::slotOnlineStatusChanged( Kopete::Contact *c, const Kopete::OnlineStatus &status, const Kopete::OnlineStatus &oldStatus )
132 void Kopete::ChatSession::setContactOnlineStatus( const Kopete::Contact *contact, const Kopete::OnlineStatus &status )
136 disconnect( contact, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)),
137 this, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) );
141 const Kopete::OnlineStatus Kopete::ChatSession::contactOnlineStatus( const Kopete::Contact *contact ) const
204 d->displayName.append( QString::fromLatin1( " (%1)" ).arg( d->contacts.first()->onlineStatus().description() ) );
252 Kopete::MessageHandler *create( Kopete::ChatSession *manager, Kopete::Message::MessageDirection )
269 Kopete::MessageHandlerChain::Ptr Kopete::ChatSession::chainForDirection( Kopete::Message::MessageDirection dir )
288 if ( ( !account()->isAway() || Kopete::BehaviorSettings::self()->enableEventsWhileAway() ) && !account()->isBusy() )
290 KNotification::event(QString::fromLatin1( "kopete_outgoing" ), i18n( "Outgoing Message Sent" ) );
307 KNotification::event( QString::fromLatin1("buzz_nudge"), i18n("A contact sent you a buzz/nudge.") );
319 const QString nickNameRegExp = QString::fromLatin1( "(^|[\\W])(%1)([\\W]|$)" ).arg( QRegExp::escape( nick ) );
420 QString name = c->protocol()->pluginId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) +
422 c->account()->accountId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) +
424 c->contactId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) +
427 QString filename = KStandardDirs::locateLocal( "data", QString::fromLatin1( "kopete/urls/" ) + name + QString::fromLatin1( ".txt" ) ) ;
432 void Kopete::ChatSession::addContact( const Kopete::Contact *c, const Kopete::OnlineStatus &initialStatus, bool suppress )
458 disconnect( old, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)),
459 this, SLOT(slotOnlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) );
460 disconnect( old, SIGNAL(statusMessageChanged(Kopete::Contact*)), this, SIGNAL(statusMessageChanged(Kopete::Contact*)) );
464 disconnect( old->metaContact(), SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotUpdateDisplayName()) );
468 disconnect( old, SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotUpdateDisplayName()) );
470 disconnect( old, SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotDisplayNameChanged(QString,QString)) );
481 connect( c, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)),
482 this, SLOT(slotOnlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) );
483 connect( c, SIGNAL(statusMessageChanged(Kopete::Contact*)), this, SIGNAL(statusMessageChanged(Kopete::Contact*)) );
487 connect( c->metaContact(), SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotUpdateDisplayName()) );
492 connect( c, SIGNAL(contactDestroyed(Kopete::Contact*)), this, SLOT(slotContactDestroyed(Kopete::Contact*)) );
493 connect( c, SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotDisplayNameChanged(QString,QString)) );
500 void Kopete::ChatSession::removeContact( const Kopete::Contact *c, const QString& reason, Qt::TextFormat format, bool suppressNotification )
515 disconnect( c, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)),
516 this, SLOT(slotOnlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) );
520 disconnect( c->metaContact(), SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotUpdateDisplayName()) );
524 disconnect( c, SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotUpdateDisplayName()) );
525 disconnect( c, SIGNAL(contactDestroyed(Kopete::Contact*)), this, SLOT(slotContactDestroyed(Kopete::Contact*)) );
527 disconnect( c, SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotDisplayNameChanged(QString,QString)) );
541 if ( ( account()->isAway() && ! Kopete::BehaviorSettings::self()->enableEventsWhileAway() ) || account()->isBusy() )
578 notification->addContext( qMakePair( QString::fromLatin1("contact"), mc->metaContactId().toString() ) );
581 notification->addContext( qMakePair( QString::fromLatin1("group") , QString::number( g->groupId() ) ) );
618 void Kopete::ChatSession::receivedMessageState( uint messageId, Kopete::Message::MessageState state )
648 connect( d->view->mainWidget(), SIGNAL(activated(KopeteView*)), this, SIGNAL(viewActivated(KopeteView*)) );
649 connect( d->view->mainWidget(), SIGNAL(closing(KopeteView*)), this, SLOT(slotViewDestroyed()) );
654 i18n( "<qt>An error has occurred while creating a new chat window. The chat window has not been created.</qt>" ),
683 // (remember: the contact may be deleted when the users removes it from the contact list, or when closing kopete )
Definition: kopeteonlinestatus.h:68
void receivedEventNotification(const QString ¬ificationText)
Got an event notification from a user.
Definition: kopetechatsession.cpp:613
Definition: kopetemessageevent.h:41
void setCanBeDeleted(bool canBeDeleted)
Set if the KMM will be deleted when the chatwindow is deleted.
Definition: kopetechatsession.cpp:623
QString cap(int nth) const
QString & append(QChar ch)
void receivedMessageState(uint messageId, Kopete::Message::MessageState state)
Change state of message.
Definition: kopetechatsession.cpp:618
void setImportance(MessageImportance importance)
Set the importance.
Definition: kopetemessage.cpp:281
QString readLine(qint64 maxlen)
KopeteView * createView(Kopete::ChatSession *, const QString &requestedPlugin=QString())
create a new view for the manager.
Definition: kopetechatsessionmanager.cpp:156
QString escape(const QString &str)
const T & at(int i) const
const OnlineStatus contactOnlineStatus(const Contact *contact) const
get the status of a contact.
Definition: kopetechatsession.cpp:141
~ChatSession()
Delete a chat manager instance You shouldn't delete the KMM yourself.
Definition: kopetechatsession.cpp:113
Account * account() const
Get the account that this contact belongs to.
Definition: kopetecontact.cpp:538
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
MessageHandlerChain::Ptr chainForDirection(Message::MessageDirection dir)
Returns the message handler chain for the message direction dir.
Definition: kopetechatsession.cpp:269
QStringList findUrls(const Kopete::Message &msg)
finds all urls in the current message (if there are many) sorts them as they are in the meassage QStr...
Definition: kopetechatsession.cpp:362
bool exists() const
static QString getUrlsFileName(const Kopete::Contact *)
returns file name where urls for this contact supposed to be
Definition: kopetechatsession.cpp:418
void setMayInvite(bool)
Set whether or not contact from this account may be invited in this chat.
Definition: kopetechatsession.cpp:708
Definition: kopetechatsession.h:74
int size() const
void appendMessage(Kopete::Message &msg)
Show a message to the chatwindow, or append it to the queue.
Definition: kopetechatsession.cpp:310
virtual bool event(QEvent *e)
void setPattern(const QString &pattern)
int matchedLength() const
MessageDirection direction() const
Accessor method for the direction of the message.
Definition: kopetemessage.cpp:580
int indexIn(const QString &str, int offset, CaretMode caretMode) const
OnlineStatus onlineStatus() const
Get the online status of the contact.
Definition: kopetecontact.cpp:173
QString number(int n, int base)
Protocol * protocol() const
Get the protocol that the contact belongs to.
Definition: kopetecontact.cpp:533
QString initLastUrl(const Kopete::Contact *c)
finds proper file with lasturls for current contact ChatSession->members().first() then sets lasturl ...
Definition: kopetechatsession.cpp:390
bool atEnd() const
static Ptr create(ChatSession *manager, Message::MessageDirection direction)
Create a new MessageHandlerChain object with the appropriate handlers for processing messages enterin...
Definition: kopetemessagehandlerchain.cpp:55
bool empty() const
Picture & picture() const
Return the correct Kopete::Picture object depending of the metacontact photo source.
Definition: kopetemetacontact.cpp:750
void setLastUrl(const QString &verylastUrl)
sets lastUrl for current ChatSession
Definition: kopetechatsession.cpp:149
Item next()
ChatSession(const Contact *user, ContactPtrList others, Protocol *protocol, Form form=Small)
Create a message manager.
Definition: kopetechatsession.cpp:78
void setManager(ChatSession *manager)
Set the messagemanager for this message.
Definition: kopetemessage.cpp:610
bool isEmpty() const
bool isEmpty() const
void sendMessage(Kopete::Message &message)
Send a message to the user.
Definition: kopetechatsession.cpp:281
void messageSucceeded()
Protocols have to call this method when the last message sent has been correctly sent This will emit ...
Definition: kopetechatsession.cpp:299
void typing(bool t)
Tell the KMM that the user is typing This method should be called only by a chatwindow.
Definition: kopetechatsession.cpp:608
QStringList & replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs)
T & first()
virtual void handleMessage(MessageEvent *event)
Performs any processing necessary on the message.
Definition: kopetemessagehandler.cpp:63
isActiveWindow
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
const T & value() const
Definition: kopetecontact.h:58
void photoChanged()
A contact within the chat session changed his photo.
bool contains(QChar ch, Qt::CaseSensitivity cs) const
bool mayInvite() const
says if you may invite contact from the same account to this chat with inviteContact ...
Definition: kopetechatsession.cpp:698
virtual void close()
KOPETE_EXPORT QWidget * mainWidget()
Returns the main widget - this is the widget that message boxes and KNotify stuff should use as a par...
Definition: kopeteuiglobal.cpp:37
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
static ChatSessionManager * self()
Definition: kopetechatsessionmanager.cpp:39
QString & replace(int position, int n, QChar after)
void setContactOnlineStatus(const Contact *contact, const OnlineStatus &newStatus)
set a specified KOS for specified contact in this KMM
Definition: kopetechatsession.cpp:132
void addContact(const Kopete::Contact *c, bool suppress=false)
Add a contact to the session.
Definition: kopetechatsession.cpp:439
MetaContact * metaContact() const
Get the metacontact for this contact.
Definition: kopetecontact.cpp:523
KSharedPtr< MessageHandlerChain > Ptr
Definition: kopetemessagehandlerchain.h:50
const Contact * myself() const
Get the local user in the session.
Definition: kopetechatsession.cpp:215
QWidget * find(WId id)
static BehaviorSettings * self()
Definition: kopetebehaviorsettings.cpp:23
const ContactPtrList & members() const
Get a list of all contacts in the session.
Definition: kopetechatsession.cpp:210
void onlineStatusChanged(Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus &)
a contact in this chat has changed his status
T & last()
void receivedTypingMsg(const Kopete::Contact *contact, bool isTyping=true)
Got a typing notification from a user.
Definition: kopetechatsession.cpp:537
void deref()
dereference count the chat session if the reference counter reach 0 and there is no chat window open...
Definition: kopetechatsession.cpp:634
Definition: kopetemessagehandler.h:44
void urlSearch(const Kopete::Message &msg)
prosesses every sent/appended message looks for urls, if found: sets current lastUrl and save it to p...
Definition: kopetechatsession.cpp:343
const QString lastUrl()
returns lastUrl for current ChatSession can be empty
Definition: kopetechatsession.cpp:154
Definition: kopetemetacontact.h:54
QString fromLatin1(const char *str, int size)
iterator insert(const Key &key, const T &value)
void setDisplayName(const QString &displayName)
change the displayname
Definition: kopetechatsession.cpp:169
void setWarnGroupChat(bool)
set if kopete show warning message, when you closing window of group chat By default, it is set to true
Definition: kopetechatsession.cpp:729
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
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void removeContact(const Kopete::Contact *contact, const QString &reason=QString(), Qt::TextFormat format=Qt::PlainText, bool suppressNotification=false)
Remove a contact from the session.
Definition: kopetechatsession.cpp:500
void emitNudgeNotification()
Protocols have to call this method if they want to emit a notification when a nudge/buzz is received...
Definition: kopetechatsession.cpp:304
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
static CommandHandler * commandHandler()
Returns a pointer to the command handler.
Definition: kopetecommandhandler.cpp:164
void removeSession(Kopete::ChatSession *session)
Definition: kopetechatsessionmanager.cpp:145
const QStringList regexpPatterns()
returns QStringList with regexp patterns will be used to look for links in the message ...
Definition: kopetemessage.cpp:420
Highlight notification, for most important messages, which require particular attentions.
Definition: kopetemessage.h:113
bool hasNext() const
virtual void inviteContact(const QString &contactId)
this method is called when a contact is dragged to the contact list.
Definition: kopetechatsession.cpp:703
bool warnGroupChat() const
say if kopete show warning message, when you closing window of group chat
Definition: kopetechatsession.cpp:724
void raiseView()
Raise the chat window and give him the focus It's used when the user wanted to activated (by clicking...
Definition: kopetechatsession.cpp:713
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.