[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kopete-devel
Subject:    [kopete-devel] [PATCH] Jabber message state notification
From:       "Roman Jarosz" <roman.jarosz () gmail ! com>
Date:       2008-08-31 10:52:51
Message-ID: op.ugqy5l2lrj95b0 () localhost
[Download RAW message or body]

Hi,

this patch adds message state notification for Jabber.

I didn't want to commit it because I don't know much
about Jabber but IMHO the patch should be ok.

So can I commit?

Regards,
Roman

["jabberchatmessagestate.diff" (jabberchatmessagestate.diff)]

Index: jabbercontact.cpp
===================================================================
--- jabbercontact.cpp	(revision 854728)
+++ jabbercontact.cpp	(working copy)
@@ -306,10 +306,14 @@
 			if (message.containsEvent ( XMPP::DisplayedEvent ) )
 				mManager->receivedEventNotification ( i18n("Message has been displayed") );
 			else if (message.containsEvent ( XMPP::DeliveredEvent ) )
+			{
 				mManager->receivedEventNotification ( i18n("Message has been delivered") );
+				mManager->receivedMessageState( message.eventId().toUInt(), Kopete::Message::StateSent );
+			}
 			else if (message.containsEvent ( XMPP::OfflineEvent ) )
 			{
-	        	mManager->receivedEventNotification( i18n("Message stored on the server, contact offline") );
+				mManager->receivedEventNotification( i18n("Message stored on the server, contact offline") );
+				mManager->receivedMessageState( message.eventId().toUInt(), Kopete::Message::StateSent );
 			}
 			else if (message.chatState() == XMPP::StateGone )
 			{
@@ -352,6 +356,8 @@
 	// check for errors
 	if ( message.type () == "error" )
 	{
+		mManager->receivedMessageState( message.eventId().toUInt(), Kopete::Message::StateError );
+
 		newMessage = new Kopete::Message( this, contactList );
 		newMessage->setTimestamp( message.timeStamp() );
 		newMessage->setPlainBody( i18n("Your message could not be delivered: \"%1\", Reason: \"%2\"", 
Index: jabberchatsession.cpp
===================================================================
--- jabberchatsession.cpp	(revision 854728)
+++ jabberchatsession.cpp	(working copy)
@@ -329,6 +329,7 @@
 
 		jabberMessage.setTo ( toJid );
 
+		jabberMessage.setId( QString::number( message.id() ) );
 		jabberMessage.setSubject ( message.subject () );
 		jabberMessage.setTimeStamp ( message.timestamp () );
 
@@ -412,6 +413,8 @@
         // send the message
 		account()->client()->sendMessage ( jabberMessage );
 
+		message.setState( Kopete::Message::StateSending );
+
 		// append the message to the manager
 		Kopete::ChatSession::appendMessage ( message );
 


_______________________________________________
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