Mercurial > prosody-modules
view mod_jid_prep/mod_jid_prep.lua @ 1321:3fd6579d60cc
mod_sms_clickatell: Get rid of legacy componentmanager usage. Now uses stanza events.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 26 Feb 2014 12:38:57 -0500 |
parents | 767999c39f0a |
children | 99cb06b31ae8 |
line wrap: on
line source
-- Run JIDs through stringprep processing on behalf of clients -- http://xmpp.org/extensions/inbox/jidprep.html local jid_prep = require "util.jid".prep; local st = require "util.stanza"; local xmlns_prep = "urn:xmpp:jidprep:tmp"; function prep_jid(event) local stanza = event.stanza; local jid = jid_prep(stanza:get_child_text("jid", xmlns_prep)); if not jid then return event.origin.send(st.error_reply(stanza, "modify", "jid-malformed")); end return event.origin.send(st.reply(stanza):tag("jid", { xmlns = xmlns_prep }):text(jid)); end module:hook("iq/host/"..xmlns_prep..":jid", prep_jid); module:depends("http"); module:provides("http", { route = { ["GET /*"] = function (event, jid) return jid_prep(jid) or 400; end; } });