-add_handler("c2s_unauthed", "abort", xmlns_sasl,
- function(session, stanza)
- if not session.sasl_handler then error("Attempt to abort when sasl has not started"); end
- do_sasl(session, stanza);
- end);
-
-add_handler("c2s_unauthed", "response", xmlns_sasl,
- function(session, stanza)
- if not session.sasl_handler then error("Attempt to respond when sasl has not started"); end
- do_sasl(session, stanza);
- end);
-
-add_event_hook("stream-features",
- function (session, features)
- if not session.username then
- t_insert(features, "<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>");
- -- TODO: Provide PLAIN only if TLS is active, this is a SHOULD from the introduction of RFC 4616. This behavior could be overridden via configuration but will issuing a warning or so.
- t_insert(features, "<mechanism>PLAIN</mechanism>");
- -- t_insert(features, "<mechanism>DIGEST-MD5</mechanism>");
- t_insert(features, "</mechanisms>");
- else
- t_insert(features, "<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind>");
- t_insert(features, "<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>");
- end
- --send [[<register xmlns="http://jabber.org/features/iq-register"/> ]]
- end);
-
-add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-bind",