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 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); |
56 |
56 |
|
57 self.curr_id = 0; |
|
58 |
|
59 self.tracked_iqs = {}; |
|
60 self:hook("stanza", function (stanza) |
|
61 local id, type = stanza.attr.id, stanza.attr.type; |
|
62 if id and stanza.name == "iq" and (type == "result" or type == "error") and self.tracked_iqs[id] then |
|
63 self.tracked_iqs[id](stanza); |
|
64 self.tracked_iqs[id] = nil; |
|
65 return true; |
|
66 end |
|
67 end); |
|
68 |
57 -- Initialise connection |
69 -- Initialise connection |
58 self:connect(self.connect_host or self.host, self.connect_port or 5222); |
70 self:connect(self.connect_host or self.host, self.connect_port or 5222); |
59 --reset_stream(self); |
71 --reset_stream(self); |
60 self:reopen(); |
72 self:reopen(); |
61 end |
73 end |