comparison src/plugins/plugin_xep_0096.py @ 916:1a759096ccbd

core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'
author Goffi <goffi@goffi.org>
date Fri, 21 Mar 2014 16:27:09 +0100
parents 1fe00f0c9a91
children c6d8fc63b1db
comparison
equal deleted inserted replaced
915:6f96ee4d8cc0 916:1a759096ccbd
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from sat.core.i18n import _ 20 from sat.core.i18n import _
21 from sat.core.constants import Const as C
21 from logging import debug, info, warning, error 22 from logging import debug, info, warning, error
22 from twisted.words.xish import domish 23 from twisted.words.xish import domish
23 from twisted.words.protocols.jabber import jid 24 from twisted.words.protocols.jabber import jid
24 from twisted.words.protocols.jabber import error as jab_error 25 from twisted.words.protocols.jabber import error as jab_error
25 import os 26 import os
264 file_obj.seek(range_offset) 265 file_obj.seek(range_offset)
265 self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, range_length, self.sendSuccessCb, self.sendFailureCb, size, profile) 266 self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, range_length, self.sendSuccessCb, self.sendFailureCb, size, profile)
266 else: 267 else:
267 warning(_("Invalid stream method received")) 268 warning(_("Invalid stream method received"))
268 269
269 def sendFile(self, to_jid, filepath, data={}, profile_key='@NONE@'): 270 def sendFile(self, to_jid, filepath, data={}, profile_key=C.PROF_KEY_NONE):
270 """send a file using XEP-0096 271 """send a file using XEP-0096
271 @to_jid: recipient 272 @to_jid: recipient
272 @filepath: absolute path to the file to send 273 @filepath: absolute path to the file to send
273 @data: dictionnary with the optional following keys: 274 @data: dictionnary with the optional following keys:
274 - "description": description of the file 275 - "description": description of the file