Mercurial > prosody-hg
comparison plugins/mod_muc_unique.lua @ 6609:d2faaaca695d
Merge 0.10->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 27 Mar 2015 22:24:57 +0000 |
| parents | 5fd6c739e9bf |
| children | 7c3e16fdaf1d |
comparison
equal
deleted
inserted
replaced
| 6608:b6e558febb7a | 6609:d2faaaca695d |
|---|---|
| 1 -- XEP-0307: Unique Room Names for Multi-User Chat | |
| 2 local st = require "util.stanza"; | |
| 3 local uuid_gen = require "util.uuid".generate; | |
| 4 module:add_feature "http://jabber.org/protocol/muc#unique" | |
| 5 module:hook("iq-get/host/http://jabber.org/protocol/muc#unique:unique", function(event) | |
| 6 local origin, stanza = event.origin, event.stanza; | |
| 7 origin.send(st.reply(stanza) | |
| 8 :tag("unique", {xmlns = "http://jabber.org/protocol/muc#unique"}) | |
| 9 :text(uuid_gen()) -- FIXME Random UUIDs can theoretically have collisions | |
| 10 ); | |
| 11 return true; | |
| 12 end,-1); |
