Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0047.py @ 391:c34fd9d6242e
spelling
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 29 Sep 2011 14:59:14 +0200 |
parents | 6ff50d609b16 |
children | 8f3551ceee17 |
comparison
equal
deleted
inserted
replaced
390:8e87af2e2d1f | 391:c34fd9d6242e |
---|---|
99 success_cb(sid, file_obj, NS_IBB) | 99 success_cb(sid, file_obj, NS_IBB) |
100 else: | 100 else: |
101 failure_cb(sid, file_obj, NS_IBB, failure_reason) | 101 failure_cb(sid, file_obj, NS_IBB, failure_reason) |
102 | 102 |
103 def getProgress(self, sid, data): | 103 def getProgress(self, sid, data): |
104 """Fill data with position of current transfert""" | 104 """Fill data with position of current transfer""" |
105 try: | 105 try: |
106 file_obj = self.current_stream[sid]["file_obj"] | 106 file_obj = self.current_stream[sid]["file_obj"] |
107 data["position"] = str(file_obj.tell()) | 107 data["position"] = str(file_obj.tell()) |
108 data["size"] = str(self.current_stream[sid]["size"]) | 108 data["size"] = str(self.current_stream[sid]["size"]) |
109 except: | 109 except: |
132 open_elt = IQ.firstChildElement() | 132 open_elt = IQ.firstChildElement() |
133 block_size = open_elt.getAttribute('block-size') | 133 block_size = open_elt.getAttribute('block-size') |
134 sid = open_elt.getAttribute('sid') | 134 sid = open_elt.getAttribute('sid') |
135 stanza = open_elt.getAttribute('stanza', 'iq') | 135 stanza = open_elt.getAttribute('stanza', 'iq') |
136 if not sid or not block_size or int(block_size)>65535: | 136 if not sid or not block_size or int(block_size)>65535: |
137 warning(_("malformed IBB transfert: %s" % IQ['id'])) | 137 warning(_("malformed IBB transfer: %s" % IQ['id'])) |
138 self.sendNotAcceptableError(IQ['id'], IQ['from'], xmlstream) | 138 self.sendNotAcceptableError(IQ['id'], IQ['from'], xmlstream) |
139 return | 139 return |
140 if not sid in self.current_stream: | 140 if not sid in self.current_stream: |
141 warning(_("Ignoring unexpected IBB transfert: %s" % sid)) | 141 warning(_("Ignoring unexpected IBB transfer: %s" % sid)) |
142 self.sendNotAcceptableError(IQ['id'], IQ['from'], xmlstream) | 142 self.sendNotAcceptableError(IQ['id'], IQ['from'], xmlstream) |
143 return | 143 return |
144 if self.current_stream[sid]["from"] != jid.JID(IQ['from']): | 144 if self.current_stream[sid]["from"] != jid.JID(IQ['from']): |
145 warning(_("sended jid inconsistency (man in the middle attack attempt ?)")) | 145 warning(_("sended jid inconsistency (man in the middle attack attempt ?)")) |
146 self.sendNotAcceptableError(IQ['id'], IQ['from'], xmlstream) | 146 self.sendNotAcceptableError(IQ['id'], IQ['from'], xmlstream) |