Bug 121507 - kopete doesnt show the typing notice from people using gtalk, and they can see the ones sent by kopete
Summary: kopete doesnt show the typing notice from people using gtalk, and they can se...
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Unmaintained
Component: Jabber Plugin (other bugs)
Version First Reported In: 0.12
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-06 21:53 UTC by kaouete
Modified: 2006-04-04 10:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kaouete 2006-02-06 21:53:14 UTC
Version:           0.12 (using KDE KDE 3.5.1)
Installed from:    Compiled From Sources
OS:                Linux

Hi,

i asked on #kopete if it was normal that kopete and gtalk cant see each other typing, and someone replied it was working for him, so i guess it is a bug :]

i started a chat with a gtalk user and he couldnt see my typing notices, but in the kopete logs i can clearly see the typyng notice sent :
kopete (jabber): [void JabberChatSession::slotSendTypingNotification(bool)] Sending out typing notification (true) to all chat members.
kopete (jabber): [void JabberChatSession::slotSendTypingNotification(bool)] Sending out typing notification (false) to all chat members.

but when he is typing i cant see anything in the logs.

i am using gtalk 1.0.0.84 (the last at this day)
Comment 1 kaouete 2006-02-10 18:31:27 UTC
i am wondering if it is not because google desactivated this option.

(notice from gtalk to gtalk are not shown in gtalk, but maybe they are sent . ..) 
(it is maybe a problem with jep used .. . )
Comment 2 Olivier Goffart 2006-02-10 18:35:24 UTC
The google talk client simply doesn't support this feature.
Comment 3 kaouete 2006-02-17 14:01:16 UTC
I am sorry to reopen this bug, but i can see that if i am taking to someone using gtalk with gajim, he can see my typing notice (but i did not see its).

and the reason why it doesnt work with kopete is (i think) that they use another jep (newer one i guess, doesnt know the details) to notify typing.

so the new ideo of this bug is more a wish to have this jep supported (http://www.jabber.org/jeps/jep-0085.html if i am not wrong)
Comment 4 kaouete 2006-02-17 14:28:07 UTC
in fact i can see gtalk users typing with gajim, i dont know why i havent seen it before, 
anyway it looks like it works in both way with gajim and if i am not wrong gajim use jep 85.
Comment 5 Olivier Goffart 2006-03-10 17:58:13 UTC
yes, Kopete doesn't support yet JEP 85
Comment 6 Olivier Goffart 2006-03-10 19:10:37 UTC
SVN commit 517351 by ogoffart:

Fix bug 121507: Some users shown offline althought they are online.

We need to send our presence info after having _received_ the roster (and not only asked for it). because some clients like ejabberd can't assure the order of messages.

BUG: 121507



 M  +8 -8      jabberaccount.cpp  


--- branches/kopete/0.12/kopete/protocols/jabber/jabberaccount.cpp #517350:517351
@@ -589,14 +589,6 @@
 
 	kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "Requesting roster..." << endl;
 	m_jabberClient->requestRoster ();
-
-	/* Since we are online now, set initial presence. Don't do this
-	 * before the roster request or we will receive presence
-	 * information before we have updated our roster with actual
-	 * contacts from the server! (Iris won't forward presence
-	 * information in that case either). */
-	kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "Setting initial presence..." << endl;
-	setPresence ( m_initialPresence );
 }
 
 void JabberAccount::slotRosterRequestFinished ( bool success )
@@ -609,6 +601,14 @@
 		contactPool()->cleanUp ();
 	}
 
+	/* Since we are online now, set initial presence. Don't do this
+	* before the roster request or we will receive presence
+	* information before we have updated our roster with actual
+	* contacts from the server! (Iris won't forward presence
+	* information in that case either). */
+	kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "Setting initial presence..." << endl;
+	setPresence ( m_initialPresence );
+
 }
 
 void JabberAccount::slotIncomingFileTransfer ()
Comment 7 Olivier Goffart 2006-03-10 19:12:36 UTC
SVN commit 517353 by ogoffart:

backport fix for bug 121507
CCBUG: 121507





 M  +8 -8      jabberaccount.cpp  


--- branches/KDE/3.5/kdenetwork/kopete/protocols/jabber/jabberaccount.cpp #517352:517353
@@ -498,14 +498,6 @@
 	kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "Requesting roster..." << endl;
 	m_jabberClient->requestRoster ();
 
-	/* Since we are online now, set initial presence. Don't do this
-	 * before the roster request or we will receive presence
-	 * information before we have updated our roster with actual
-	 * contacts from the server! (Iris won't forward presence
-	 * information in that case either). */
-	kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "Setting initial presence..." << endl;
-	setPresence ( m_initialPresence );
-
 }
 
 void JabberAccount::slotRosterRequestFinished ( bool success )
@@ -518,6 +510,14 @@
 		contactPool()->cleanUp ();
 	}
 
+	/* Since we are online now, set initial presence. Don't do this
+	* before the roster request or we will receive presence
+	* information before we have updated our roster with actual
+	* contacts from the server! (Iris won't forward presence
+	* information in that case either). */
+	kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "Setting initial presence..." << endl;
+	setPresence ( m_initialPresence );
+
 }
 
 void JabberAccount::slotIncomingFileTransfer ()
Comment 8 Olivier Goffart 2006-03-10 19:14:17 UTC
Ooops, mistake, i closed the wrong bug.
sorry, reopening this one
Comment 9 Olivier Goffart 2006-04-02 22:30:37 UTC
SVN commit 525779 by ogoffart:

support of the new chatstate protocol (JEP-0085) 
BUG: 121507

 A             007_chatstates.patch  
 M  +1 -1      iris/include/im.h  
 M  +1 -0      iris/xmpp-core/protocol.h  
 M  +52 -4     iris/xmpp-im/types.cpp   [UTF-8 ENCODING PROBLEMS]


--- branches/kopete/0.12/kopete/protocols/jabber/libiris/iris/include/im.h #525778:525779
@@ -49,7 +49,7 @@
 	typedef QValueList<Url> UrlList;
 	typedef QMap<QString, QString> StringMap;
 	typedef enum { OfflineEvent, DeliveredEvent, DisplayedEvent,
-			ComposingEvent, CancelEvent } MsgEvent;
+			ComposingEvent, CancelEvent, InactiveEvent, GoneEvent } MsgEvent;
                                            
 	class Message
 	{
--- branches/kopete/0.12/kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.h #525778:525779
@@ -37,6 +37,7 @@
 #define NS_BIND     "urn:ietf:params:xml:ns:xmpp-bind"
 #define NS_XHTML_IM "http://jabber.org/protocol/xhtml-im"
 #define NS_XHTML "http://www.w3.org/1999/xhtml"
+#define NS_CHATSTATES "http://jabber.org/protocol/chatstates"
 
 namespace XMPP
 {
--- branches/kopete/0.12/kopete/protocols/jabber/libiris/iris/xmpp-im/types.cpp #525778:525779
@@ -544,28 +544,49 @@
 			else
 				x.appendChild(s.createTextElement("jabber:x:event","id",d->eventId));
 		}
+		else
+			s.appendChild(  s.createElement(NS_CHATSTATES , "active" ) );
 
+		bool need_x_event=false;
 		for(QValueList<MsgEvent>::ConstIterator ev = d->eventList.begin(); ev != d->eventList.end(); ++ev) {
 			switch (*ev) {
 				case OfflineEvent:
 					x.appendChild(s.createElement("jabber:x:event", "offline"));
+					need_x_event=true;
 					break;
 				case DeliveredEvent:
 					x.appendChild(s.createElement("jabber:x:event", "delivered"));
+					need_x_event=true;
 					break;
 				case DisplayedEvent:
 					x.appendChild(s.createElement("jabber:x:event", "displayed"));
+					need_x_event=true;
 					break;
 				case ComposingEvent: 
 					x.appendChild(s.createElement("jabber:x:event", "composing"));
+					need_x_event=true;
+					if (d->body.isEmpty())
+						s.appendChild(  s.createElement(NS_CHATSTATES , "composing" ) ); 
 					break;
 				case CancelEvent:
-					// Add nothing
+					need_x_event=true;
+					if (d->body.isEmpty())
+						s.appendChild(  s.createElement(NS_CHATSTATES , "paused" ) ); 
 					break;
+				case InactiveEvent:
+					if (d->body.isEmpty())
+						s.appendChild(  s.createElement(NS_CHATSTATES , "inactive" ) ); 
+					break;
+				case GoneEvent:
+					if (d->body.isEmpty())
+						s.appendChild(  s.createElement(NS_CHATSTATES , "gone" ) ); 
+					break;
 			}
 		}
-		s.appendChild(x);
-	} 
+		if(need_x_event)  //we don't need to have the (empty) x:event element if this is only <gone> or <inactive>
+			s.appendChild(x);
+	}
+		
 
 	// xencrypted
 	if(!d->xencrypted.isEmpty())
@@ -595,6 +616,7 @@
 	d->subject.clear();
 	d->body.clear();
 	d->thread = QString();
+	d->eventList.clear();
 
 	QDomElement root = s.element();
 
@@ -631,6 +653,33 @@
 					}
 				}
 			}
+			else if (e.namespaceURI() == NS_CHATSTATES)
+			{
+				if(e.tagName() == "active")
+				{
+					//like in JEP-0022  we let the client know that we can receive ComposingEvent
+					// (we can do that according to  
Comment 10 kaouete 2006-04-03 23:06:21 UTC
you are going to laugh but i am talking with someone who use gtalk and he says to me that it can see me typing (but using gajim he can).
i can see him typing since this jep was added to kopete.
i can see that kopete is sending typing notice :

kopete (jabber - raw protocol): [void 
JabberAccount::slotClientDebugMessage(const QString&)] XML OUT: <message from="me@jabber.org/Kopete" id="ac0ea" to="him@gmail.com/Talk.v86B871A8B3" >
<composing xmlns="http://jabber.org/protocol/chatstates"/>
<x xmlns="jabber:x:event">
<id/>
<composing/>
</x>
</message>
kopete (jabber - raw protocol): 
kopete (jabber): [void JabberChatSession::slotSendTypingNotification(bool)] Sending out typing notification (true) to all chat members.
kopete (jabber - raw protocol): [void JabberAccount::slotClientDebugMessage(const QString&)] XML OUT: <message from="me@jabber.org/Kopete" id="ac0fa" to="him@gmail.com/Talk.v86B871A8B3" >
<composing xmlns="http://jabber.org/protocol/chatstates"/>
<x xmlns="jabber:x:event">
<id/>
<composing/>
</x>
</message>

and, something to take carefully :
he says that before he was able to see me typing but i think he talks about the few times i used gajim :]
Comment 11 Olivier Goffart 2006-04-03 23:26:29 UTC
that's why the bug is now marked as resolved :-)
Comment 12 kaouete 2006-04-03 23:36:20 UTC
the problem is that it is not resolved since the person who i am talking to doesnt see typing notice from kopete but see the ones from gajim :
is this jep implemented only in one way ? (him to me, and not me to him)
Comment 13 kaouete 2006-04-04 00:14:03 UTC
i understand my mistake :]
i wrote can instead of cant :>
Comment 14 Olivier Goffart 2006-04-04 10:28:31 UTC
SVN commit 526247 by ogoffart:

JEP-0085 seems require the type of the chat to be set.
(tested with gajim)
CCBUG: 121507

 M  +13 -1     jabberchatsession.cpp  
 A             libiris/008_chatstatesfix.patch  
 M  +5 -5      libiris/iris/xmpp-im/types.cpp  


--- branches/kopete/0.12/kopete/protocols/jabber/jabberchatsession.cpp #526246:526247
@@ -76,7 +76,9 @@
 
 JabberChatSession::~JabberChatSession( )
 {
-	sendNotification( XMPP::GoneEvent );
+	if ( account()->configGroup()->readBoolEntry ("SendEvents", true) &&
+			 account()->configGroup()->readBoolEntry ("SendGoneEvent", true) )
+		sendNotification( XMPP::GoneEvent );
 }
 
 
@@ -182,6 +184,16 @@
 			message.setEventId ( contact->lastReceivedMessageId () );
 			// store composing event depending on state
 			message.addEvent ( event );
+			
+			if (view() && view()->plugin()->pluginId() == "kopete_emailwindow" )
+			{	
+				message.setType ( "normal" );
+			}
+			else
+			{	
+				message.setType ( "chat" );
+			}
+
 	
 			// send message
 			account()->client()->sendMessage ( message );
--- branches/kopete/0.12/kopete/protocols/jabber/libiris/iris/xmpp-im/types.cpp #526246:526247
@@ -544,7 +544,7 @@
 			else
 				x.appendChild(s.createTextElement("jabber:x:event","id",d->eventId));
 		}
-		else
+		else if (d->type=="chat" || d->type=="groupchat")
 			s.appendChild(  s.createElement(NS_CHATSTATES , "active" ) );
 
 		bool need_x_event=false;
@@ -565,20 +565,20 @@
 				case ComposingEvent: 
 					x.appendChild(s.createElement("jabber:x:event", "composing"));
 					need_x_event=true;
-					if (d->body.isEmpty())
+					if (d->body.isEmpty() && (d->type=="chat" || d->type=="groupchat") )
 						s.appendChild(  s.createElement(NS_CHATSTATES , "composing" ) ); 
 					break;
 				case CancelEvent:
 					need_x_event=true;
-					if (d->body.isEmpty())
+					if (d->body.isEmpty() && (d->type=="chat" || d->type=="groupchat") )
 						s.appendChild(  s.createElement(NS_CHATSTATES , "paused" ) ); 
 					break;
 				case InactiveEvent:
-					if (d->body.isEmpty())
+					if (d->body.isEmpty() && (d->type=="chat" || d->type=="groupchat") )
 						s.appendChild(  s.createElement(NS_CHATSTATES , "inactive" ) ); 
 					break;
 				case GoneEvent:
-					if (d->body.isEmpty())
+					if (d->body.isEmpty() && (d->type=="chat" || d->type=="groupchat") )
 						s.appendChild(  s.createElement(NS_CHATSTATES , "gone" ) ); 
 					break;
 			}