Software /
code /
prosody
Comparison
net/xmppclient_listener.lua @ 3332:c941d1191709
xmpp{client,server}_listener: Put stanzas/in filtering code in the correct place to make it actually work :)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 08 Jul 2010 14:28:42 +0100 |
parent | 3144:9e16012c2155 |
child | 3345:8520cd88b84c |
comparison
equal
deleted
inserted
replaced
3331:57a9cf5f4259 | 3332:c941d1191709 |
---|---|
61 session:close(nil, text); | 61 session:close(nil, text); |
62 end | 62 end |
63 end | 63 end |
64 | 64 |
65 local function handleerr(err) log("error", "Traceback[c2s]: %s: %s", tostring(err), debug.traceback()); end | 65 local function handleerr(err) log("error", "Traceback[c2s]: %s: %s", tostring(err), debug.traceback()); end |
66 function stream_callbacks.handlestanza(a, b) | 66 function stream_callbacks.handlestanza(session, stanza) |
67 xpcall(function () core_process_stanza(a, b) end, handleerr); | 67 stanza = session.filter("stanzas/in", stanza); |
68 if stanza then | |
69 xpcall(function () core_process_stanza(session, stanza) end, handleerr); | |
70 end | |
68 end | 71 end |
69 | 72 |
70 local sessions = {}; | 73 local sessions = {}; |
71 local xmppclient = { default_port = 5222, default_mode = "*a" }; | 74 local xmppclient = { default_port = 5222, default_mode = "*a" }; |
72 | 75 |
149 end | 152 end |
150 end | 153 end |
151 | 154 |
152 local handlestanza = stream_callbacks.handlestanza; | 155 local handlestanza = stream_callbacks.handlestanza; |
153 function session.dispatch_stanza(session, stanza) | 156 function session.dispatch_stanza(session, stanza) |
154 stanza = filter("stanzas/in", stanza); | 157 return handlestanza(session, stanza); |
155 if stanza then | |
156 return handlestanza(session, stanza); | |
157 end | |
158 end | 158 end |
159 end | 159 end |
160 | 160 |
161 function xmppclient.onincoming(conn, data) | 161 function xmppclient.onincoming(conn, data) |
162 local session = sessions[conn]; | 162 local session = sessions[conn]; |