| 1 | local xmlns_muc = "http://jabber.org/protocol/muc"; |
| 2 | local xmlns_muc_user = xmlns_muc .. "#user"; |
| 3 | local xmlns_jxc = "jabber:x:conference"; |
| 4 | |
| 5 | function riddim.plugins.invited(bot) |
| 6 | bot:hook("message", function(event) |
| 7 | local x = event.stanza:get_child("x", xmlns_muc_user); |
| 8 | if x then -- XEP 45 |
| 9 | local invite = x:get_child("invite"); |
| 10 | if invite then |
| 11 | bot:join_room(event.stanza.attr.from); |
| 12 | end |
| 13 | else -- try XEP 249 |
| 14 | x = event.stanza:get_child("x", xmlns_jxc); |
| 15 | if x and x.attr.jid then |
| 16 | bot:join_room(x.attr.jid); |
| 17 | end |
| 18 | end |
| 19 | end); |
| 20 | end |
| 21 | --TODO |
| 22 | -- Passwords |