Tue, 18 Nov 2008 17:52:33 +0000
Quite some changes, to:
- Small logging fix for s2smanager
- Send a stream error if an incoming s2s connection is to an unrecognised hostname (fixes #11)
- init_xmlhandlers now takes a table of callbacks (includes changes to net/xmpp*_listener for this)
- Move sending of unavailable presence to where it should be, sessionmanager.destroy_session
- Fix sending of stream errors to wrong connection
43
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
1 | |
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
2 | local st = require "util.stanza"; |
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
3 | local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; |
30 | 4 | |
5 | require "modulemanager" | |
6 | ||
7 | -- Handle stanzas that were addressed to the server (whether they came from c2s, s2s, etc.) | |
8 | function handle_stanza(origin, stanza) | |
9 | -- Use plugins | |
43
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
10 | if not modulemanager.handle_stanza(origin, stanza) then |
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
11 | if stanza.name == "iq" then |
111
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
12 | if stanza.attr.type ~= "result" and stanza.attr.type ~= "error" then |
315
4df26c981728
Fixed servermanager to use session.send for sending stanzas
Waqas Hussain <waqas20@gmail.com>
parents:
111
diff
changeset
|
13 | origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
111
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
14 | end |
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
15 | elseif stanza.name == "message" then |
315
4df26c981728
Fixed servermanager to use session.send for sending stanzas
Waqas Hussain <waqas20@gmail.com>
parents:
111
diff
changeset
|
16 | origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
111
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
17 | elseif stanza.name ~= "presence" then |
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
18 | error("Unknown stanza"); |
43
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
19 | end |
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
20 | end |
30 | 21 | end |