Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0163.py @ 2643:189e38fb11ff
core: style improvments (90 chars limit)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 29 Jul 2018 18:44:27 +0200 |
parents | 56f94936df1e |
children | 2901e22d1766 |
comparison
equal
deleted
inserted
replaced
2642:755a0b8643bd | 2643:189e38fb11ff |
---|---|
70 return True | 70 return True |
71 | 71 |
72 def addPEPEvent(self, event_type, node, in_callback, out_callback=None, notify=True): | 72 def addPEPEvent(self, event_type, node, in_callback, out_callback=None, notify=True): |
73 """Add a Personal Eventing Protocol event manager | 73 """Add a Personal Eventing Protocol event manager |
74 | 74 |
75 @param event_type(unicode): type of the event (always uppercase), can be MOOD, TUNE, etc | 75 @param event_type(unicode): type of the event (always uppercase), |
76 @param node(unicode): namespace of the node (e.g. http://jabber.org/protocol/mood for User Mood) | 76 can be MOOD, TUNE, etc |
77 @param node(unicode): namespace of the node (e.g. http://jabber.org/protocol/mood | |
78 for User Mood) | |
77 @param in_callback(callable): method to call when this event occur | 79 @param in_callback(callable): method to call when this event occur |
78 the callable will be called with (itemsEvent, profile) as arguments | 80 the callable will be called with (itemsEvent, profile) as arguments |
79 @param out_callback(callable,None): method to call when we want to publish this event (must return a deferred) | 81 @param out_callback(callable,None): method to call when we want to publish this |
82 event (must return a deferred) | |
80 the callable will be called when sendPEPEvent is called | 83 the callable will be called when sendPEPEvent is called |
81 @param notify(bool): add autosubscribe (+notify) if True | 84 @param notify(bool): add autosubscribe (+notify) if True |
82 """ | 85 """ |
83 if out_callback: | 86 if out_callback: |
84 self.pep_out_cb[event_type] = out_callback | 87 self.pep_out_cb[event_type] = out_callback |
114 return self.host.plugins["XEP-0060"].publish(client, None, node, [item]) | 117 return self.host.plugins["XEP-0060"].publish(client, None, node, [item]) |
115 | 118 |
116 def PEPSend(self, event_type, data, profile_key=C.PROF_KEY_NONE): | 119 def PEPSend(self, event_type, data, profile_key=C.PROF_KEY_NONE): |
117 """Send personal event after checking the data is alright | 120 """Send personal event after checking the data is alright |
118 | 121 |
119 @param event_type: type of event (eg: MOOD, TUNE), must be in self.pep_out_cb.keys() | 122 @param event_type: type of event (eg: MOOD, TUNE), |
123 must be in self.pep_out_cb.keys() | |
120 @param data: dict of {string:string} of event_type dependant data | 124 @param data: dict of {string:string} of event_type dependant data |
121 @param profile_key: profile who send the event | 125 @param profile_key: profile who send the event |
122 """ | 126 """ |
123 profile = self.host.memory.getProfileName(profile_key) | 127 profile = self.host.memory.getProfileName(profile_key) |
124 if not profile: | 128 if not profile: |