comparison src/plugins/plugin_exp_pipe.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
220 file_obj = open(filepath, 'r') # XXX: we have to be sure that filepath is well opened, as reading can block it 221 file_obj = open(filepath, 'r') # XXX: we have to be sure that filepath is well opened, as reading can block it
221 self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, None, self.sendSuccessCb, self.sendFailureCb, None, profile) 222 self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, None, self.sendSuccessCb, self.sendFailureCb, None, profile)
222 else: 223 else:
223 warning(_("Invalid stream method received")) 224 warning(_("Invalid stream method received"))
224 225
225 def pipeOut(self, to_jid, filepath, data={}, profile_key='@DEFAULT@'): 226 def pipeOut(self, to_jid, filepath, data={}, profile_key=C.PROF_KEY_NONE):
226 """send a file using EXP-PIPE 227 """send a file using EXP-PIPE
227 @to_jid: recipient 228 @to_jid: recipient
228 @filepath: absolute path to the named pipe to send 229 @filepath: absolute path to the named pipe to send
229 @data: dictionnary with the optional data 230 @data: dictionnary with the optional data
230 @param profile_key: %(doc_profile_key)s 231 @param profile_key: %(doc_profile_key)s