Software /
code /
verse
Comparison
plugins/groupchat.lua @ 380:0891b4e27766
Discard trailing whitespace
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 May 2015 23:27:29 +0200 |
parent | 349:dfcc5a0f5c79 |
child | 418:40b8cc364274 |
comparison
equal
deleted
inserted
replaced
379:d80d27234e38 | 380:0891b4e27766 |
---|---|
9 local xmlns_muc = "http://jabber.org/protocol/muc"; | 9 local xmlns_muc = "http://jabber.org/protocol/muc"; |
10 | 10 |
11 function verse.plugins.groupchat(stream) | 11 function verse.plugins.groupchat(stream) |
12 stream:add_plugin("presence") | 12 stream:add_plugin("presence") |
13 stream.rooms = {}; | 13 stream.rooms = {}; |
14 | 14 |
15 stream:hook("stanza", function (stanza) | 15 stream:hook("stanza", function (stanza) |
16 local room_jid = jid.bare(stanza.attr.from); | 16 local room_jid = jid.bare(stanza.attr.from); |
17 if not room_jid then return end | 17 if not room_jid then return end |
18 local room = stream.rooms[room_jid] | 18 local room = stream.rooms[room_jid] |
19 if not room and stanza.attr.to and room_jid then | 19 if not room and stanza.attr.to and room_jid then |
35 }; | 35 }; |
36 local ret = room:event(stanza.name, event); | 36 local ret = room:event(stanza.name, event); |
37 return ret or (stanza.name == "message") or nil; | 37 return ret or (stanza.name == "message") or nil; |
38 end | 38 end |
39 end, 500); | 39 end, 500); |
40 | 40 |
41 function stream:join_room(jid, nick, opts) | 41 function stream:join_room(jid, nick, opts) |
42 if not nick then | 42 if not nick then |
43 return false, "no nickname supplied" | 43 return false, "no nickname supplied" |
44 end | 44 end |
45 opts = opts or {}; | 45 opts = opts or {}; |