Chat State Notifications triggers Contact Actions

Bug #270689 reported by naw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Coccinella
Fix Released
Medium
buzzdee

Bug Description

When Contact Actions are active (i.e. a popup on chat messages) and the contact client sends a Chat State Notification (XEP-0085) (i.e. composing/ gone) Coccinella opens a popup. That is not strictly a message, so Coccinella shouldn't show the popup

sander (s-devrieze)
Changed in coccinella:
assignee: nobody → matsben
importance: Undecided → Medium
Revision history for this message
v_2e (v-2e) wrote :

  I may say, that in my case it produces 2 popup windows for every chat message. And when a contact starts to send me a hundred messages per second (they think it is funny, I guess), my screen becomes filled with those messages, Coccinella flies away (somewhere) and the 'wish' process eats a lot of CPU time.

buzzdee (sebastia)
Changed in coccinella:
assignee: Mats (matsben) → buzzdee (sebastia)
milestone: none → 0.96.20
Revision history for this message
buzzdee (sebastia) wrote :

Here a chat state notification that triggers the popup when the other party is composing a reply:
<message <email address hidden>/Coccinella@user' xml:lang='en' type='chat' <email address hidden>/Coccinella@user'>
 <thread>2fab4eb4-2373cb62</thread>
 <x xmlns='jabber:x:event'>
  <composing/>
  <id>1</id>
 </x>
</message>

Here a chat state notification that triggers the popup when the other party is pausing composing a reply:
<message <email address hidden>/Coccinella@user' xml:lang='en' type='chat' <email address hidden>/Coccinella@user'>
 <thread>2fab4eb4-2373cb62</thread>
 <x xmlns='jabber:x:event'>
  <id>1</id>
 </x>
</message>

Here an actual message.
<message <email address hidden>/Coccinella@user' id='6' xml:lang='en' type='chat' <email address hidden>/Coccinella@user'>
 <x xmlns='jabber:x:event'>
  <composing/>
 </x>
 <active xmlns='http://jabber.org/protocol/chatstates'/>
 <thread>2fab4eb4-2373cb62</thread>
 <body>asd dfasdfads sdf sdf</body>
</message>

So I can reproduce the initial problem report. However, I can't reproduce the problem opening two popups. Could you cut n paste the *budprefs_array: lince from your coccinella preferences.rdb file to see how you configured it?

Sebastian

Revision history for this message
v_2e (v-2e) wrote :

Here it is:
*budprefs_array: login@jabber-server {available msgbox chat msgbox}

Revision history for this message
buzzdee (sebastia) wrote :

ah, now I can reproduce the problem too, I'll take a look

Revision history for this message
buzzdee (sebastia) wrote :

we have this in jabber/Chat.tcl:

    # Check for ChatState (XEP-0085) support
    set msgChatState ""
    if {[wrapper::havechildtag $xmldata active]} {
        set chatstate(havecs) true
        set msgChatState active
    } elseif {[wrapper::havechildtag $xmldata composing]} {
        set chatstate(havecs) true
        set msgChatState composing
    } elseif {[wrapper::havechildtag $xmldata paused]} {
        set chatstate(havecs) true
        set msgChatState paused
    } elseif {[wrapper::havechildtag $xmldata inactive]} {
        set chatstate(havecs) true
        set msgChatState inactive
    } elseif {[wrapper::havechildtag $xmldata gone]} {
        set chatstate(havecs) true
        set msgChatState gone
    } else {
        if { $chatstate(havecs) ne "true" } {
            set chatstate(havecs) false
        }
    }

Changed in coccinella:
status: New → In Progress
Revision history for this message
buzzdee (sebastia) wrote :

svn revision 2856 has a fix for the initial problem report. Now chat state messages are not triggering a chat state notification anymore.

Since the text that shows up when a chat message is received, is only true for the first message, I propose to chage the text from:

"%s just started a chat!"

to

"%s just sent you a chat message!"

When receiving a normal message, the actual text is:
"%s just sent you a message!"

Revision history for this message
sander (s-devrieze) wrote :

IMO the following would be more appropriate: "%s just initiated a chat session!". Of course, this text should only be showed once (not for each incoming chat message from the same contact).

Revision history for this message
sander (s-devrieze) wrote :

I changed my mind: "%s just started a chat session!" (reason "starting" is easier English than "initiating").

Revision history for this message
buzzdee (sebastia) wrote :

As the XML snippets above shows, there is a thread tag in the message. When we remember the thread ID somewhere, and compare it each time when a new message comes in, we could make it to only trigger the event on the first incoming chat message of a given thread. I'm not sure whether the thread tag is mandatory, in case clients do not send it, then we still can always trigger an event.

Revision history for this message
buzzdee (sebastia) wrote :

as it states here: http://tools.ietf.org/html/draft-ietf-xmpp-3921bis-08#section-5.2.5

The inclusion of the <thread/> element is OPTIONAL. Because the
   <thread/> element identifies the particular conversation thread to
   which a message belongs, a message stanza MUST NOT contain more than
   one <thread/> element.

Coccinella sends the thread element, but other clients may not. In case no thread element exists, we will always trigger an event, otherwise we will only trigger an event when we do not know the thread already.

Revision history for this message
buzzdee (sebastia) wrote :

OK, svn revision 2857 contains what I proposed to do. I remember the chat thread ID. Only when a unknown thread ID arrives, an event is triggered. Arriving chat messages without a thread subelement will always trigger such an event.
To not let the array grow too much, the array is reset on logout.

See the svn diff, ideas for better solutions how to store/garbage collect the thread ids are welcome.

I also updated the string as suggested.

please test and report back.

Revision history for this message
buzzdee (sebastia) wrote :

I also do not get those events triggered twice anymore.
v_2e: Could you please test and report back whether you still get those messages twice, or whether you see other problems.

thanks

Revision history for this message
v_2e (v-2e) wrote :

  Hello!
  I have tested the latest daily build today, and I do not receive the messages twice any more.
  But I receive the message "... just started a chat session!" with EVERY incoming chat message. I know you are discussing this problem right now (and I regularly read through those discussions) and just wanted to give some feedback about that issue too.

Revision history for this message
buzzdee (sebastia) wrote :

Do you can enable the XML console (with CTRL-SHIFT-D), and see whether the sending party sends the thread element in the chat message? I guess not. Do you know what client the other party uses?

I tested between two Coccinella clients, which actually sends the thread element, and it worked fine for me.

We could also change the text in the popup to "... just sent you a chat message!" ;)

Otherwise we could try the following:
1. On the first incoming chat message from someone remember from whom and when we got a message and trigger the event.
 2. On subsequent incoming chat messages within a given time interval, compare with the saved time of the first message do not trigger the event
 3. Repeat with Step one, update the timestamp in the array, and trigger the event again

What would be a "reasonable" default time interval? 10 minutes? Maybe the time interval should be configurable in the "Chat" contact actions for the user?

Revision history for this message
sander (s-devrieze) wrote :

"Otherwise we could try the following: <snip>"

I don't think that's the way to go because the same user may start separate concurrent chat sessions with the same user. If I am not mistaken, Coccinella changes the chat session changes when the subject line is changed. If a time interval is used, you are not notified about the second chat session that has a different topic. (Note that it would be nice if the subject line of a message or chat session is shown in the event message.)

PS: I just forwarded you a related (not much) feature request. ( https://wiki.ubuntu.com/directed-answers )

Revision history for this message
buzzdee (sebastia) wrote :

I'll recheck if the thread-id really changes if the subject changes, I was not aware of that fact.
However, when coccinella changes the thread id when the subject line is changed, then, with what I have implemented right now, a new event would trigger. That would still fine with me.

I've seen at least that the thread-id changes when the chat window was closed and reopened.
Showing the subject line, if set at all, shouldn't be a problem.

When the user starts concurrent chat sessions, would that really matter?
I think we could save the state depending on the jid3, so including the resource part, in case the user is connected with different clients, and starts a chat session from different clients we could distinguish.

Also with the subject, I for myself do only use the subject in very rare cases. For me a subject line is more interesting in group chats than for a single short chat session. But others may see it different.

Revision history for this message
sander (s-devrieze) wrote :

"When the user starts concurrent chat sessions, would that really matter?"

Maybe not, but in same cases it may be a useful notification that gets lost by such a timer feature.

The subject line may become more interesting with a revamped user interface: Bug #605899

Revision history for this message
v_2e (v-2e) wrote :

  Hello guys!
  Isn't it possible to check whether the chat window for the certain contact is already opened and decide if it is necessary to show a notification basing on this?
  I mean, if the chat window is already opened for the current contact, than it couldn't be that "... has just started a chat". Otherwise, if there had been no opened chat window for the current contact, and we get a chat message from this contact, it is definitely "...has just started a chat", I guess.
  Or am I wrong?

Revision history for this message
buzzdee (sebastia) wrote :

checking for an existing chat window shouldn't be too hard I think.

But however, assume the following:
 * you are chatting with some other party
 * the other party disconnects, and you keep the chat window or tab open
 * the other party reappears after some hours, and starts a new chat
 * you would miss the chat state notification, because the chat window is still open

so also would not be perfect.

Revision history for this message
v_2e (v-2e) wrote :

  Hmm... Yes, that's right. But I remember that my client sometimes shows me something like "... has closed chat" in a chat window, when my contact closes the chat window on his/her side.
  But I'm not sure whether this is a STANDARD behaviour.

Revision history for this message
buzzdee (sebastia) wrote :

can this here considered to be closed for now? At least the initial problem seems to be fixed.

sander (s-devrieze)
Changed in coccinella:
status: In Progress → Fix Committed
sander (s-devrieze)
Changed in coccinella:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.