Mon, 05 Apr 2010 13:18:00 +0100
xmpp_muc.js: Add get_child() function
19
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 | // Wraps a function so that its 'this' is always 'context' when called |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 | var recontext = function (context, f) { return function () { return f.apply(context, arguments); }; }; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 | |
41
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
4 | // Returns a child element given a tag name and xmlns |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
5 | function get_child(stanza, name, xmlns) |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
6 | { |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
7 | var children = stanza.getElementsByTagName(name); |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
8 | for(var i=0;i<=children.length;i++) |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
9 | { |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
10 | if(children[i].getAttribute("xmlns") == xmlns || !xmlns) |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
11 | return children[i]; |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
12 | } |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
13 | return null; |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
14 | } |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
15 | |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
16 | |
d22dee1f3dba
xmpp_muc.js: Add get_child() function
Matthew Wild <mwild1@gmail.com>
parents:
36
diff
changeset
|
17 | |
19
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 | var MUC = function (conn, callbacks) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 | /* Set our properties */ |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 | this.conn = conn; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 | this.callbacks = callbacks; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 | this.occupants = {}; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 | /* Initialize stanza handlers */ |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 | conn.addHandler(recontext(this, this.handle_join), null, "presence", null, null, null); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 | conn.addHandler(recontext(this, this.handle_error), null, "presence", "error", null, null); |
25
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
29 | conn.addHandler(recontext(this, this.handle_message), null, "message", "groupchat", null, null); |
19
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 | /* Return newly-created object */ |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 | return this; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 | } |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 | MUC.prototype = |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 | /** General methods */ |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
39 | join: function (jid, nick, status_text) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
40 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
41 | this.jid = jid; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
42 | this.nick = nick; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
43 | var pres = $pres({to: jid+'/'+nick}); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 | if(status) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
45 | pres.c("status").t(status); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
46 | return this.send_stanza(pres); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
47 | }, |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
48 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
49 | part: function (status_text) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
50 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
51 | var pres = $pres({to: this.jid+'/'+this.nick, type: "unavailable"}); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
52 | if(status) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
53 | pres.c("status").t(status); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
54 | return this.send_stanza(pres); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
55 | }, |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
56 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
57 | send_message: function (message) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
58 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
59 | return this.send_stanza($msg({to: this.jid, type: "groupchat"}) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
60 | .c("body").t(message||"")); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
61 | }, |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
62 | |
20
bd1d350ab61c
Add to the MUC library support for sending private messages
Matthew Wild <mwild1@gmail.com>
parents:
19
diff
changeset
|
63 | send_private_message: function (nick, message) |
bd1d350ab61c
Add to the MUC library support for sending private messages
Matthew Wild <mwild1@gmail.com>
parents:
19
diff
changeset
|
64 | { |
bd1d350ab61c
Add to the MUC library support for sending private messages
Matthew Wild <mwild1@gmail.com>
parents:
19
diff
changeset
|
65 | return this.send_stanza($msg({to: this.jid+"/"+nick, type: "chat"}) |
bd1d350ab61c
Add to the MUC library support for sending private messages
Matthew Wild <mwild1@gmail.com>
parents:
19
diff
changeset
|
66 | .c("body").t(message||"")); |
bd1d350ab61c
Add to the MUC library support for sending private messages
Matthew Wild <mwild1@gmail.com>
parents:
19
diff
changeset
|
67 | }, |
bd1d350ab61c
Add to the MUC library support for sending private messages
Matthew Wild <mwild1@gmail.com>
parents:
19
diff
changeset
|
68 | |
36
562ff07a3968
Large commit - reorganises directory structure, lots of small fixes
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
69 | send_invite: function (jid, message) |
562ff07a3968
Large commit - reorganises directory structure, lots of small fixes
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
70 | { |
562ff07a3968
Large commit - reorganises directory structure, lots of small fixes
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
71 | return this.send_stanza($msg({to: jid}) |
562ff07a3968
Large commit - reorganises directory structure, lots of small fixes
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
72 | .c("x", { xmlns: "http://jabber.org/protocol/muc#user" }) |
562ff07a3968
Large commit - reorganises directory structure, lots of small fixes
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
73 | .c("invite", { to: jid }) |
562ff07a3968
Large commit - reorganises directory structure, lots of small fixes
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
74 | .c("reason").t(message||"")); |
562ff07a3968
Large commit - reorganises directory structure, lots of small fixes
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
75 | }, |
562ff07a3968
Large commit - reorganises directory structure, lots of small fixes
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
76 | |
19
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
77 | send_stanza: function (stanza) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
78 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
79 | return this.conn.send(stanza.tree()); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
80 | }, |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
81 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
82 | /** Incoming stanza handlers */ |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
83 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
84 | handle_join: function (stanza) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
85 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
86 | var nick = Strophe.getResourceFromJid(stanza.getAttribute("from")); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
87 | if(stanza.getAttribute("type") != "unavailable" && stanza.getAttribute("type") != "error" |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
88 | && Strophe.getBareJidFromJid(stanza.getAttribute("from")) == this.jid) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
89 | if(!this.occupants[nick]) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
90 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
91 | var text = stanza.getElementsByTagName("status")[0]; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
92 | if(text) text = Strophe.getText(text); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
93 | this.occupants[nick] = {}; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
94 | if(this.callbacks.joined) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
95 | this.callbacks.joined(stanza, this, nick, text); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
96 | if(this.status_handler) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
97 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
98 | this.status_handler(stanza); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
99 | } |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
100 | } |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
101 | return true; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
102 | }, |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
103 | |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
104 | handle_error: function (stanza) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
105 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
106 | if(this.callbacks.error |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
107 | && Strophe.getBareJidFromJid(stanza.getAttribute("from")) == this.jid) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
108 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
109 | var e = stanza.getElementsByTagName("error"); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
110 | if(e.length > 0) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
111 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
112 | var err = null; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
113 | Strophe.forEachChild(e[0], null, function (child) |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
114 | { |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
115 | if(child.getAttribute("xmlns") == "urn:ietf:params:xml:ns:xmpp-stanzas") |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
116 | err = child.nodeName; |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
117 | }); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
118 | this.callbacks.error(stanza, this, err); |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
119 | } |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
120 | } |
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
121 | return true; |
25
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
122 | }, |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
123 | |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
124 | handle_message: function (stanza) |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
125 | { |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
126 | if(!this.callbacks.message) |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
127 | return true; |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
128 | |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
129 | if(stanza.getAttribute("type") == "groupchat" && Strophe.getBareJidFromJid(stanza.getAttribute("from")) == this.jid) |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
130 | { |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
131 | var body = stanza.getElementsByTagName("body"); |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
132 | if(body.length > 0 && stanza.getElementsByTagName("delay").length == 0) |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
133 | this.callbacks.message(stanza, this, Strophe.getResourceFromJid(stanza.getAttribute("from")), Strophe.getText(body[0])); |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
134 | } |
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
135 | return true; |
19
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
136 | } |
25
2651c3a7e621
Add support for handling incoming messages to the MUC library
Matthew Wild <mwild1@gmail.com>
parents:
20
diff
changeset
|
137 | |
19
41a3c9d41e6a
Add MUC library to be used for conversing with helpers
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
138 | }; |