[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: [kopete-devel] [PATCH] Detect delivery event
From: "Roman Jarosz" <roman.jarosz () gmail ! com>
Date: 2008-11-05 22:29:45
Message-ID: op.uj53fvkhrj95b0 () localhost
[Download RAW message or body]
Hi,
here's the promised patch which detects if Jabber client sends delivery event.
Can I commit?
Roman
["detectdeliverynotification.diff" (detectdeliverynotification.diff)]
Index: jabberresourcepool.cpp
===================================================================
--- jabberresourcepool.cpp (revision 880503)
+++ jabberresourcepool.cpp (working copy)
@@ -87,12 +87,15 @@
}
}
-void JabberResourcePool::notifyRelevantContacts ( const XMPP::Jid &jid )
+void JabberResourcePool::notifyRelevantContacts ( const XMPP::Jid &jid, bool removed \
) {
QList<JabberBaseContact*> list = d->account->contactPool()->findRelevantSources ( \
jid );
foreach(JabberBaseContact *mContact, list)
{
+ if ( removed )
+ mContact->setSendsDeliveredEvent ( false );
+
mContact->reevaluateStatus ();
}
}
@@ -151,7 +154,7 @@
JabberResource *deletedResource = d->pool.takeAt( d->pool.indexOf(mResource) );
delete deletedResource;
- notifyRelevantContacts ( jid );
+ notifyRelevantContacts ( jid, true );
return;
}
}
@@ -209,7 +212,7 @@
*/
for ( QStringList::Iterator it = jidList.begin (); it != jidList.end (); ++it )
{
- notifyRelevantContacts ( XMPP::Jid ( *it ) );
+ notifyRelevantContacts ( XMPP::Jid ( *it ), true );
}
}
Index: jabberbasecontact.h
===================================================================
--- jabberbasecontact.h (revision 880503)
+++ jabberbasecontact.h (working copy)
@@ -141,7 +141,16 @@
*/
void setPropertiesFromVCard ( const XMPP::VCard &vCard );
+ /**
+ * Set contact's client sends delivery event flag.
+ */
+ void setSendsDeliveredEvent( bool sends ) { mSendsDeliveredEvent = sends; }
+ /**
+ * Return true if contact's client sends delivery event.
+ */
+ bool sendsDeliveredEvent() const { return mSendsDeliveredEvent; }
+
public slots:
/**
@@ -172,6 +181,11 @@
*/
XMPP::RosterItem mRosterItem;
+ /**
+ * Flag if contact's client sends delivery event.
+ */
+ bool mSendsDeliveredEvent;
+
private:
bool mDontSync;
JabberAccount *m_account;
Index: jabbercontact.cpp
===================================================================
--- jabbercontact.cpp (revision 880503)
+++ jabbercontact.cpp (working copy)
@@ -325,6 +325,7 @@
{
mManager->receivedEventNotification ( i18n("Message has been delivered") );
mManager->receivedMessageState( message.eventId().toUInt(), \
Kopete::Message::StateSent ); + mSendsDeliveredEvent = true;
}
else if (message.containsEvent ( XMPP::OfflineEvent ) )
{
Index: jabberchatsession.cpp
===================================================================
--- jabberchatsession.cpp (revision 880503)
+++ jabberchatsession.cpp (working copy)
@@ -448,7 +448,8 @@
// send the message
account()->client()->sendMessage ( jabberMessage );
- message.setState( Kopete::Message::StateSending );
+ if ( recipient->sendsDeliveredEvent() )
+ message.setState( Kopete::Message::StateSending );
// append the message to the manager
Kopete::ChatSession::appendMessage ( message );
Index: jabberbasecontact.cpp
===================================================================
--- jabberbasecontact.cpp (revision 880503)
+++ jabberbasecontact.cpp (working copy)
@@ -52,6 +52,7 @@
JabberBaseContact::JabberBaseContact (const XMPP::RosterItem &rosterItem, \
Kopete::Account *account, Kopete::MetaContact * mc, const QString &legacyId) : \
Kopete::Contact (account, legacyId.isEmpty() ? rosterItem.jid().full() : legacyId , \
mc ) {
+ mSendsDeliveredEvent = false;
setDontSync ( false );
JabberTransport *t=transport();
Index: jabberresourcepool.h
===================================================================
--- jabberresourcepool.h (revision 880503)
+++ jabberresourcepool.h (working copy)
@@ -52,7 +52,7 @@
* Notify all relevant contacts in case
* a resource has been added, updated or removed.
*/
- void notifyRelevantContacts ( const XMPP::Jid &jid );
+ void notifyRelevantContacts ( const XMPP::Jid &jid, bool removed = false );
/**
* Add a resource to the pool
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic