Comparison

client.lua @ 11:ce349990bd21

verse.client: Add stream:reopen()
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Nov 2009 22:29:09 +0000
parent 10:3a422606a040
child 12:73f466054ead
comparison
equal deleted inserted replaced
10:3a422606a040 11:ce349990bd21
50 50
51 function stream:connect_client(jid, pass) 51 function stream:connect_client(jid, pass)
52 self.jid, self.password = jid, pass; 52 self.jid, self.password = jid, pass;
53 self.username, self.host, self.resource = jid_split(jid); 53 self.username, self.host, self.resource = jid_split(jid);
54 54
55 reset_stream(self);
56 self:hook("incoming-raw", function (data) return self.data(self.conn, data); end); 55 self:hook("incoming-raw", function (data) return self.data(self.conn, data); end);
57 56
58 -- Initialise connection 57 -- Initialise connection
59 self:connect(self.connect_host or self.host, self.connect_port or 5222); 58 self:connect(self.connect_host or self.host, self.connect_port or 5222);
60 self:send(st.stanza("stream:stream", { to = self.host, ["xmlns:stream"]='http://etherx.jabber.org/streams' }):top_tag()); 59 --reset_stream(self);
60 self:reopen();
61 end 61 end
62 62
63 function stream:reopen()
64 reset_stream(self);
65 self:send(st.stanza("stream:stream", { to = self.host, ["xmlns:stream"]='http://etherx.jabber.org/streams', xmlns = "jabber:client" }):top_tag());
66 end
67