xmpp4moz ignores messages without a type attribute

Asked by Alf

I have a channel initialised like this that's working well:
channel.on({event: "message", direction: "in", stanza: check_stanza}, received);

When xmpp4moz (0.6.2.2008042012) receives a message stanza that has the type attribute set to 'chat', it passes it to the 'check_stanza' function fine. However, it seems to ignore messages that don't have a type attribute. Is this the intended behaviour, or a bug?

Question information

Language:
English Edit question
Status:
Answered
For:
SamePlace Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Massimiliano Mirra (bard-hyperstruct) said :
#1

There is nothing in xmpp4moz to pre-filter based on the type
attribute. Could you provide a complete snippet that reproduces the
issue?

Revision history for this message
Massimiliano Mirra (bard-hyperstruct) said :
#2

> There is nothing in xmpp4moz to pre-filter based on the type
> attribute.

Read the above as "there should be nothing". Things can always fall
through the cracks, I'd just be surprised in this case -- it would be
fairly noticeable. :-)

Revision history for this message
Alf (hubbuntu) said :
#3

Extension code:
===
var channel;

var xmpp = {
  account:{
    jid: "****",
    password: "****",
    connectionHost: "talk.google.com",
  },

  // connect to the XMPP account
  connect: function(){
    XMPP.up(xmpp.account, xmpp.connected);
  },

  // set up a channel for incoming messages
  connected: function(){
   alert("connected");
    channel = XMPP.createChannel();
    channel.on({event: "message", direction: "in", stanza: xmpp.check_stanza}, xmpp.received);
  },

  // see if this message should be passed on to the listeners
  check_stanza: function(stanza){
    alert(stanza.@from);
  },

  received: function(stanza){
   alert(stanza.@from);
  },
}

window.addEventListener('load', xmpp.connect, false);
===

Messages:
===
<message from="****" type="chat" to="****" id="5" >
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="http://jabber.org/protocol/tune" >
<item id="272169" >
<tune xmlns="http://jabber.org/protocol/tune"/>
</item>
</items>
</event>
<nos:x xmlns:nos="google:nosave" value="disabled" />
<arc:record xmlns:arc="http://jabber.org/protocol/archive" otr="false" />
</message>
===
^ alerts @from ^

===
<message from="****" to="****" >
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="http://jabber.org/protocol/tune" >
<item id="6513339" >
<tune xmlns="http://jabber.org/protocol/tune"/>
</item>
</items>
</event>
</message>
===
^ no alert ^

(**** = redacted)

It looks like it could be either the 'type' or 'id' attribute that's required - I suspect the Google and OTR elements aren't involved.

Haven't been able to get Psi's XML input to work properly to investigate this completely, sorry.

Revision history for this message
Massimiliano Mirra (bard-hyperstruct) said :
#4

Could you try with a non-Google account? I've just tried with a
@sameplace.cc account and your code works, both with and without type
attribute. Also, you might want to take a look at the devel package
of SamePlace, it contains an XMPP console.

Revision history for this message
Itay (itay-neeman) said :
#5

Alf,

I tried it too with my local ejabberd installation, and it worked just fine. If you want to talk about it more, feel free to get in touch.

Itay

Can you help with this problem?

Provide an answer of your own, or ask Alf for more information if necessary.

To post a message you must log in.