comparison src/plugins/plugin_xep_0163.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 301b342c697a
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, error 22 from logging import debug, info, error
22 from twisted.internet import protocol 23 from twisted.internet import protocol
23 from twisted.words.protocols.jabber import client, jid 24 from twisted.words.protocols.jabber import client, 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 twisted.internet.error 26 import twisted.internet.error
84 @param profile: profile which send the data""" 85 @param profile: profile which send the data"""
85 86
86 item = pubsub.Item(payload=data) 87 item = pubsub.Item(payload=data)
87 return self.host.plugins["XEP-0060"].publish(None, namespace, [item], profile_key=profile) 88 return self.host.plugins["XEP-0060"].publish(None, namespace, [item], profile_key=profile)
88 89
89 def sendPersonalEvent(self, event_type, data, profile_key='@DEFAULT@'): 90 def sendPersonalEvent(self, event_type, data, profile_key=C.PROF_KEY_NONE):
90 """Send personal event after checking the data is alright 91 """Send personal event after checking the data is alright
91 @param event_type: type of event (eg: MOOD, TUNE), must be in self.pep_out_cb.keys() 92 @param event_type: type of event (eg: MOOD, TUNE), must be in self.pep_out_cb.keys()
92 @param data: dict of {string:string} of event_type dependant data 93 @param data: dict of {string:string} of event_type dependant data
93 @param profile_key: profile who send the event 94 @param profile_key: profile who send the event
94 """ 95 """