comparison src/plugins/plugin_misc_room_game.py @ 2129:6a66c8c5a567

core: replaced calls to client.xmlstream.send by client.send which is the right method to use. client.xmlstream should not be used directly
author Goffi <goffi@goffi.org>
date Sat, 04 Feb 2017 17:59:13 +0100
parents 200cd707a46d
children 1d3f73e065e1
comparison
equal deleted inserted replaced
2128:aa94f33fd2ad 2129:6a66c8c5a567
651 - attrs: dictionary of attributes for the new child 651 - attrs: dictionary of attributes for the new child
652 - content: unicode that is appended to the child content 652 - content: unicode that is appended to the child content
653 @param profile: the profile from which the message is sent 653 @param profile: the profile from which the message is sent
654 @return: a Deferred instance 654 @return: a Deferred instance
655 """ 655 """
656 if profile is None: 656 client = self.host.getClient(profile)
657 log.error(_("Message can not be sent without a sender profile"))
658 return defer.fail(None)
659 msg = self._createGameElt(to_jid) 657 msg = self._createGameElt(to_jid)
660 for elem, attrs, content in data: 658 for elem, attrs, content in data:
661 if elem is not None: 659 if elem is not None:
662 if isinstance(elem, domish.Element): 660 if isinstance(elem, domish.Element):
663 msg.firstChildElement().addChild(elem) 661 msg.firstChildElement().addChild(elem)
665 elem = msg.firstChildElement().addElement(elem) 663 elem = msg.firstChildElement().addElement(elem)
666 if attrs is not None: 664 if attrs is not None:
667 elem.attributes.update(attrs) 665 elem.attributes.update(attrs)
668 if content is not None: 666 if content is not None:
669 elem.addContent(content) 667 elem.addContent(content)
670 self.host.profiles[profile].xmlstream.send(msg) 668 client.send(msg)
671 return defer.succeed(None) 669 return defer.succeed(None)
672 670
673 def send(self, to_jid, elem=None, attrs=None, content=None, profile=None): 671 def send(self, to_jid, elem=None, attrs=None, content=None, profile=None):
674 """ TODO 672 """ TODO
675 673