plugin room_game, radiocol: RoomGame.send returns a Deferred.
This commit is contained in:
parent
3de25fd781
commit
7c29b8c566
1 changed files with 16 additions and 13 deletions
|
|
@ -21,6 +21,7 @@ from sat.core.i18n import _
|
|||
from logging import debug, warning, error
|
||||
from twisted.words.protocols.jabber.jid import JID
|
||||
from twisted.words.xish import domish
|
||||
from twisted.internet import defer
|
||||
from time import time
|
||||
from wokkel import disco, iwokkel
|
||||
from zope.interface import implements
|
||||
|
|
@ -617,10 +618,11 @@ class RoomGame(object):
|
|||
- attrs: dictionary of attributes for the new child
|
||||
- content: unicode that is appended to the child content
|
||||
@param profile: the profile from which the message is sent
|
||||
@return: a Deferred instance
|
||||
"""
|
||||
if profile is None:
|
||||
error(_("Message can not be sent without a sender profile"))
|
||||
return
|
||||
return defer.fail(None)
|
||||
msg = self._createGameElt(to_jid)
|
||||
for elem, attrs, content in data:
|
||||
if elem is not None:
|
||||
|
|
@ -633,6 +635,7 @@ class RoomGame(object):
|
|||
if content is not None:
|
||||
elem.addContent(content)
|
||||
self.host.profiles[profile].xmlstream.send(msg)
|
||||
return defer.succeed(None)
|
||||
|
||||
def send(self, to_jid, elem=None, attrs=None, content=None, profile=None):
|
||||
"""
|
||||
|
|
@ -644,8 +647,9 @@ class RoomGame(object):
|
|||
@param attrs: dictionary of attributes for the new child
|
||||
@param content: unicode that is appended to the child content
|
||||
@param profile: the profile from which the message is sent
|
||||
@return: a Deferred instance
|
||||
"""
|
||||
self._sendElements(to_jid, [(elem, attrs, content)], profile)
|
||||
return self._sendElements(to_jid, [(elem, attrs, content)], profile)
|
||||
|
||||
def getHandler(self, profile):
|
||||
return RoomGameHandler(self)
|
||||
|
|
|
|||
Loading…
Reference in a new issue