aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-08-02 10:21:26 +0100
committerMatthew Wild <mwild1@gmail.com>2010-08-02 10:21:26 +0100
commit48b695c7e528edfde19328c7f8a2a7d39be5b533 (patch)
tree5abb50a1d9eeff6663f7bb0ba3dbde70df090264
parentcec141b21cfd6fba99c1bcc0ba8c34e7844ae2fe (diff)
downloadprosody-48b695c7e528edfde19328c7f8a2a7d39be5b533.tar.gz
prosody-48b695c7e528edfde19328c7f8a2a7d39be5b533.zip
util.xmppstream: Add set_session() method to change the session that a stream is associated with
-rw-r--r--util/xmppstream.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua
index ed5395b5..aa2eb0ed 100644
--- a/util/xmppstream.lua
+++ b/util/xmppstream.lua
@@ -145,7 +145,12 @@ function new_sax_handlers(session, stream_callbacks)
stanza, chardata = nil, {};
end
- return xml_handlers, { reset = reset };
+ local function set_session(stream, new_session)
+ session = new_session;
+ log = new_session.log or default_log;
+ end
+
+ return xml_handlers, { reset = reset, set_session = set_session };
end
function new(session, stream_callbacks)
@@ -161,7 +166,8 @@ function new(session, stream_callbacks)
end,
feed = function (self, data)
return parse(parser, data);
- end
+ end,
+ set_session = meta.set_session;
};
end