Software /
code /
prosody
Annotate
core/servermanager.lua @ 224:4b1e30ddd2bb
Add host field to local host sessions
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 08 Nov 2008 20:32:30 +0000 |
parent | 111:0abe771b43c6 |
child | 315:4df26c981728 |
rev | line source |
---|---|
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 send = require "core.sessionmanager".send_to_session; |
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
4 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; |
30 | 5 |
6 require "modulemanager" | |
7 | |
8 -- Handle stanzas that were addressed to the server (whether they came from c2s, s2s, etc.) | |
9 function handle_stanza(origin, stanza) | |
10 -- Use plugins | |
43
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
11 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
|
12 if stanza.name == "iq" then |
111
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
13 if stanza.attr.type ~= "result" and stanza.attr.type ~= "error" then |
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
14 send(origin, st.error_reply(stanza, "cancel", "service-unavailable")); |
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
15 end |
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
16 elseif stanza.name == "message" then |
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
17 send(origin, st.error_reply(stanza, "cancel", "service-unavailable")); |
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
18 elseif stanza.name ~= "presence" then |
0abe771b43c6
Fixed: Unhandled stanza handling
Waqas Hussain <waqas20@gmail.com>
parents:
43
diff
changeset
|
19 error("Unknown stanza"); |
43
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
20 end |
03dc9df59368
Reply to unhandled iq's with service-unavailable
Matthew Wild <mwild1@gmail.com>
parents:
30
diff
changeset
|
21 end |
30 | 22 end |