Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
jonnyrim #1
Member since Oct 2005 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: how do i track conversation threads with Google Talk?
First of all, great job with the library!

I'm using it to interface with Google Talk. No problems with logging in and sending and receiving messages.

What I'm having problems with is trying to track if a reply I get from another Google Talk user is part of an existing conversation Thread.

I am following simple sample code to send out a message to a user:

// Send message to user joeblow
agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message("joeblow@gmail.com", agsXMPP.protocol.client.MessageType.chat, sentence);
msg.Thread = "mythread";
xmpp.Send(msg);


Later on when I get a reply in my handler:

       
private void xmpp_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
{
    MyClass.eLog.WriteEntry("message body: " + msg.Body);
    MyClass.eLog.WriteEntry("message thread: " + msg.Thread);
}


...the msg.Body contains the response from the GoogleTalk user.  However, the msg.Thread element value is NULL. 

Am I doing something wrong when i first send out the message?  Or is the GoogleTalk implementation not doing something?

Or am I approaching this the wrong way?  All I want to do is to be able to identify which unique conversations I am having.

Thank you in advance.
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Subject: Re: how do i track conversation threads with Google Talk?
Quote by "jonnyrim":
...the msg.Body contains the response from the GoogleTalk user.  However, the msg.Thread element value is NULL. 

Am I doing something wrong when i first send out the message?  Or is the GoogleTalk implementation not doing something?

Or am I approaching this the wrong way?  All I want to do is to be able to identify which unique conversations I am having.

Your code is correct.
Could you subscribe to the OnReadXml and OnWriteXml Events and post the Debug Xml here. If you use the latest library you can also subscribe to the Socket OnRead for making sure that the Xml parser doesnt eat the <thread> tag ;-). But when the msg.Thread element is null then it doesnt exist which is a bit confusing for me. A Xmpp server shouldn't remove tags in a message or any other stanza. It should just route the message from one user to another user without changing the Xml.

Alex
Alexander Gnauck
AG-Software
Avatar
jonnyrim #3
Member since Oct 2005 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: SHould i be seeing THread ID here?
Hi Alex,

Thanks for the response!

In my xmpp_OnReadXml() handler, the XML value is:
   

"<message xmlns=\"jabber:client\" to=\"nycihufs@gmail.com/nycihufs2F1FD702\" type=\"chat\" from=\"joeblow@gmail.com/Talk.v722F41238B\"><body>my place</body><active xmlns=\"http://jabber.org/protocol/chatstates\" /></message>"

Should I be seeing Thread ID in here?

Thanks!
Avatar
jonnyrim #4
Member since Oct 2005 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: however, i do see the Thread ID
if i log my recipient off and send a message with my code, i get this response in xmpp_OnReadXml() regarding his unavailability:   

"<message xmlns=\"jabber:client\" to=\"mytest@gmail.com/nycihufs2F1FD702\" type=\"error\" from=\"joeblow@gmail.com\"><body>la la la this is my test message body</body><thread>1</thread><error code=\"503\" type=\"cancel\"><service-unavailable xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\" /><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">Recipient joeblow@gmail.com is unavailable</text></error></message>"

Note that now, the Thread ID is there.  Contrast this to when JoeBlow@gmail.com is logged on and i send the message to him.  When he replies in the conversation window, the incoming message i see in xmpp_OnReadXml() is like what i see in the previous post: no <Thread/> element.

what's going on?
Avatar
Alex #5
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi jonnyrim,

The Thread Element is optional in messages.

When you dont set it in the message class then the other client will also reply without it. Most current clients dont use the thread element.

Thread in messages is like threads her in the forum. So could chat with the same person in 2 different threads (About 2 different topics). A client that supports threads would open 2 different chat windows for the same person then. One window for each topic.

So when you want to use threads in your software, then you must generate a thread id and add it to your first initial message. You can use numbers for your threads, or generate unique Ids (GUIDs).

When a client sends a message to you which contains a thread element, then you have to fetch the thread ID and add this ID to your response.

Alex
Alexander Gnauck
AG-Software
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP SDK Support RSS