Mercurial > libervia-backend
diff src/plugins/plugin_xep_0047.py @ 394:8f3551ceee17
plugin XEP-0065: refactored and misc stuff fixed. Still not finished
plugins XEP-0096: XEP-0065 (Socks5 stream method) managed
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 03 Oct 2011 18:05:15 +0200 |
parents | c34fd9d6242e |
children | c513328ade9d |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0047.py Sun Oct 02 00:29:04 2011 +0200 +++ b/src/plugins/plugin_xep_0047.py Mon Oct 03 18:05:15 2011 +0200 @@ -20,7 +20,6 @@ """ from logging import debug, info, warning, error -from twisted.internet import protocol from twisted.words.protocols.jabber import client, jid from twisted.words.protocols.jabber import error as jab_error from twisted.words.xish import domish @@ -85,7 +84,8 @@ if self.current_stream[sid].has_key("observer_cb"): xmlstream = self.current_stream[sid]["xmlstream"] xmlstream.removeObserver(self.current_stream[sid]["event_data"], self.current_stream[sid]["observer_cb"]) - self.current_stream[sid]['timer'].cancel() + if self.current_stream[sid]['timer'].active(): + self.current_stream[sid]['timer'].cancel() if self.current_stream[sid].has_key("size"): self.host.removeProgressCB(sid) @@ -112,8 +112,11 @@ def prepareToReceive(self, from_jid, sid, file_obj, size, success_cb, failure_cb): """Called when a bytestream is imminent @param from_jid: jid of the sender - @param id: Stream id - @param file_obj: File Object where the data will be written""" + @param sid: Stream id + @param file_obj: File object where data will be written + @param size: full size of the data, or None if unknown + @param success_cb: method to call when successfuly finished + @param failure_cb: method to call when something goes wrong""" data = self.current_stream[sid] = {} data["from"] = from_jid data["file_obj"] = file_obj @@ -288,7 +291,7 @@ def iqResult(self, sid, seq, length, iq_elt): """Called when the result of open iq is received""" data = self.current_stream[sid] - if iq_elt.type == "error": + if iq_elt["type"] == "error": warning(_("Transfer failed")) self.terminateStream(sid, "IQ_ERROR") return