# HG changeset patch # User Goffi # Date 1351806099 -3600 # Node ID a31abb97310d483b33097e22a7bae59ef568be4f # Parent 790be337cc4134bc8b5d615bc0a01f687e4caea8 core, plugins: fixed bad namespace in stanza creation diff -r 790be337cc41 -r a31abb97310d src/core/sat_main.py --- a/src/core/sat_main.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/core/sat_main.py Thu Nov 01 22:41:39 2012 +0100 @@ -490,13 +490,13 @@ return debug(_("Sending jabber message of type [%(type)s] to %(to)s...") % {"type": mess_data["type"], "to": to}) - message = domish.Element(('jabber:client','message')) + message = domish.Element((None,'message')) message["to"] = mess_data["to"].full() message["from"] = current_jid.full() message["type"] = mess_data["type"] if mess_data["subject"]: - message.addElement("subject", "jabber:client", subject) - message.addElement("body", "jabber:client", mess_data["message"]) + message.addElement("subject", None, subject) + message.addElement("body", None, mess_data["message"]) client.xmlstream.send(message) if mess_data["type"]!="groupchat": self.memory.addToHistory(current_jid, jid.JID(to), unicode(mess_data["message"]), unicode(mess_data["type"]), profile=profile) #we don't add groupchat message to history, as we get them back diff -r 790be337cc41 -r a31abb97310d src/plugins/plugin_misc_quiz.py --- a/src/plugins/plugin_misc_quiz.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/plugins/plugin_misc_quiz.py Thu Nov 01 22:41:39 2012 +0100 @@ -121,7 +121,7 @@ def createGameElt(self, to_jid, type="normal"): type = "normal" if to_jid.resource else "groupchat" - elt = domish.Element(('jabber:client','message')) + elt = domish.Element((None,'message')) elt["to"] = to_jid.full() elt["type"] = type elt.addElement((NS_QG, QG_TAG)) @@ -129,9 +129,9 @@ def __game_data_to_xml(self, game_data): """Convert a game data dict to domish element""" - game_data_elt = domish.Element(('','game_data')) + game_data_elt = domish.Element((None,'game_data')) for data in game_data: - data_elt = domish.Element(('',data)) + data_elt = domish.Element((None,data)) data_elt.addContent(game_data[data]) game_data_elt.addChild(data_elt) return game_data_elt @@ -162,12 +162,12 @@ for player in game_data['players']: score[player] = players_data[player]['score'] - answer_result_elt = domish.Element(('','answer_result')) + answer_result_elt = domish.Element((None,'answer_result')) answer_result_elt['player'] = player_answering answer_result_elt['good_answer'] = str(good_answer) for player in score: - score_elt = domish.Element(('',"score")) + score_elt = domish.Element((None,"score")) score_elt['player'] = player score_elt['score'] = str(score[player]) answer_result_elt.addChild(score_elt) @@ -176,10 +176,10 @@ def __create_started_elt(self, players): """Create a game_started domish element""" - started_elt = domish.Element(('','started')) + started_elt = domish.Element((None,'started')) idx = 0 for player in players: - player_elt = domish.Element(('','player')) + player_elt = domish.Element((None,'player')) player_elt.addContent(player) player_elt['index'] = str(idx) idx+=1 @@ -188,7 +188,7 @@ def __ask_question(self, question_id, question, timer): """Create a element for asking a question""" - question_elt = domish.Element(('','question')) + question_elt = domish.Element((None,'question')) question_elt['id'] = question_id question_elt['timer'] = str(timer) question_elt.addContent(question) diff -r 790be337cc41 -r a31abb97310d src/plugins/plugin_misc_radiocol.py --- a/src/plugins/plugin_misc_radiocol.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/plugins/plugin_misc_radiocol.py Thu Nov 01 22:41:39 2012 +0100 @@ -80,7 +80,7 @@ def createRadiocolElt(self, to_jid, type="normal"): type = "normal" if to_jid.resource else "groupchat" - elt = domish.Element(('jabber:client','message')) + elt = domish.Element((None,'message')) elt["to"] = to_jid.full() elt["type"] = type elt.addElement((NC_RADIOCOL, RADIOC_TAG)) @@ -88,11 +88,11 @@ def __create_started_elt(self): """Create a game_started domish element""" - started_elt = domish.Element(('','started')) + started_elt = domish.Element((None,'started')) return started_elt def __create_preload_elt(self, sender, filename, title, artist, album): - preload_elt = domish.Element(('','preload')) + preload_elt = domish.Element((None,'preload')) preload_elt['sender'] = sender preload_elt['filename'] = filename #XXX: the frontend should know the temporary directory where file is put preload_elt['title'] = title diff -r 790be337cc41 -r a31abb97310d src/plugins/plugin_misc_tarot.py --- a/src/plugins/plugin_misc_tarot.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/plugins/plugin_misc_tarot.py Thu Nov 01 22:41:39 2012 +0100 @@ -88,7 +88,7 @@ def createGameElt(self, to_jid, type="normal"): type = "normal" if to_jid.resource else "groupchat" - elt = domish.Element(('jabber:client','message')) + elt = domish.Element((None,'message')) elt["to"] = to_jid.full() elt["type"] = type elt.addElement((NS_CG, CG_TAG)) @@ -96,9 +96,9 @@ def __card_list_to_xml(self, cards_list, elt_name): """Convert a card list to domish element""" - cards_list_elt = domish.Element(('',elt_name)) + cards_list_elt = domish.Element((None,elt_name)) for card in cards_list: - card_elt = domish.Element(('','card')) + card_elt = domish.Element((None,'card')) card_elt['suit'] = card.suit card_elt['value'] = card.value cards_list_elt.addChild(card_elt) @@ -113,10 +113,10 @@ def __create_started_elt(self, players): """Create a game_started domish element""" - started_elt = domish.Element(('','started')) + started_elt = domish.Element((None,'started')) idx = 0 for player in players: - player_elt = domish.Element(('','player')) + player_elt = domish.Element((None,'player')) player_elt.addContent(player) player_elt['index'] = str(idx) idx+=1 @@ -125,7 +125,7 @@ def __ask_contrat(self): """Create a element for asking contrat""" - contrat_elt = domish.Element(('','contrat')) + contrat_elt = domish.Element((None,'contrat')) form = data_form.Form('form', title=_('contrat selection')) field = data_form.Field('list-single', 'contrat', options=map(data_form.Option, self.contrats), required=True) form.addField(field) @@ -138,18 +138,18 @@ @param winners: list of unicode nicks of winners @param loosers: list of unicode nicks of loosers""" - score_elt = domish.Element(('','score')) + score_elt = domish.Element((None,'score')) form = data_form.Form('form', title=_('scores')) for line in scores.split('\n'): field = data_form.Field('fixed', value = line) form.addField(field) score_elt.addChild(form.toElement()) for winner in winners: - winner_elt = domish.Element(('','winner')) + winner_elt = domish.Element((None,'winner')) winner_elt.addContent(winner) score_elt.addChild(winner_elt) for looser in loosers: - looser_elt = domish.Element(('','looser')) + looser_elt = domish.Element((None,'looser')) looser_elt.addContent(looser) score_elt.addChild(looser_elt) return score_elt @@ -158,7 +158,7 @@ """Create a element for invalid_cards error @param list_cards: list of Card @param game_phase: phase of the game ['ecart', 'play']""" - error_elt = domish.Element(('','error')) + error_elt = domish.Element((None,'error')) played_elt = self.__card_list_to_xml(played_cards, 'played') invalid_elt = self.__card_list_to_xml(invalid_cards, 'invalid') error_elt['type'] = 'invalid_cards' diff -r 790be337cc41 -r a31abb97310d src/plugins/plugin_xep_0047.py --- a/src/plugins/plugin_xep_0047.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/plugins/plugin_xep_0047.py Thu Nov 01 22:41:39 2012 +0100 @@ -163,7 +163,7 @@ xmlstream.addObserver(event_data, observer_cb, profile = profile) xmlstream.addOnetimeObserver(event_close, self.streamClosing, profile = profile) #finally, we send the accept stanza - result = domish.Element(('', 'iq')) + result = domish.Element((None, 'iq')) result['type'] = 'result' result['id'] = IQ['id'] result['to'] = IQ['from'] @@ -174,7 +174,7 @@ debug(_("IBB stream closing")) data_elt = IQ.firstChildElement() sid = data_elt.getAttribute('sid') - result = domish.Element(('', 'iq')) + result = domish.Element((None, 'iq')) result['type'] = 'result' result['id'] = IQ['id'] result['to'] = IQ['from'] @@ -187,7 +187,7 @@ if self._manageDataElt(data_elt, 'iq', IQ['id'], jid.JID(IQ['from'])): #and send a success answer - result = domish.Element(('', 'iq')) + result = domish.Element((None, 'iq')) result['type'] = 'result' result['id'] = IQ['id'] result['to'] = IQ['from'] @@ -244,7 +244,7 @@ @param iq_id: IQ id @param to_jid: addressee @param xmlstream: XML stream to use to send the error""" - result = domish.Element(('', 'iq')) + result = domish.Element((None, 'iq')) result['type'] = 'result' result['id'] = iq_id result['to'] = to_jid diff -r 790be337cc41 -r a31abb97310d src/plugins/plugin_xep_0065.py --- a/src/plugins/plugin_xep_0065.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/plugins/plugin_xep_0065.py Thu Nov 01 22:41:39 2012 +0100 @@ -694,7 +694,7 @@ def activateStream(self, sid, iq_id): debug(_("activating stream")) - result = domish.Element(('', 'iq')) + result = domish.Element((None, 'iq')) data = self.current_stream[sid] result['type'] = 'result' result['id'] = iq_id @@ -711,7 +711,7 @@ @param iq_id: IQ id @param to_jid: addressee @param xmlstream: XML stream to use to send the error""" - result = domish.Element(('', 'iq')) + result = domish.Element((None, 'iq')) result['type'] = 'result' result['id'] = iq_id result['to'] = to_jid @@ -725,7 +725,7 @@ @param iq_id: IQ id @param to_jid: addressee @param xmlstream: XML stream to use to send the error""" - result = domish.Element(('', 'iq')) + result = domish.Element((None, 'iq')) result['type'] = 'result' result['id'] = iq_id result['to'] = to_jid diff -r 790be337cc41 -r a31abb97310d src/plugins/plugin_xep_0095.py --- a/src/plugins/plugin_xep_0095.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/plugins/plugin_xep_0095.py Thu Nov 01 22:41:39 2012 +0100 @@ -124,9 +124,9 @@ @param data: error specific data (dictionary) @param profile: %(doc_profile)s """ - client = self.host.getClient(profile) - assert(client) - result = domish.Element(('', 'iq')) + _client = self.host.getClient(profile) + assert(_client) + result = domish.Element((None, 'iq')) result['type'] = 'result' result['id'] = iq_id result['to'] = to_jid @@ -148,7 +148,7 @@ if data.has_key('custom') and data['custom']=='failed': condition_el.addContent('Stream failed') - client.xmlstream.send(result) + _client.xmlstream.send(result) def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile='@NONE@'): """Send the accept stream initiation answer @@ -156,10 +156,10 @@ @param feature_elt: domish element 'feature' containing stream method to use @param misc_elts: list of domish element to add @param profile: %(doc_profile)s""" - client = self.host.getClient(profile) - assert(client) + _client = self.host.getClient(profile) + assert(_client) info (_("sending stream initiation accept answer")) - result = domish.Element(('', 'iq')) + result = domish.Element((None, 'iq')) result['type'] = 'result' result['id'] = iq_id result['to'] = to_jid @@ -167,7 +167,7 @@ si.addChild(feature_elt) for elt in misc_elts: si.addChild(elt) - client.xmlstream.send(result) + _client.xmlstream.send(result) def proposeStream(self, to_jid, si_profile, feature_elt, misc_elts, mime_type='application/octet-stream', profile_key='@NONE@'): """Propose a stream initiation diff -r 790be337cc41 -r a31abb97310d src/plugins/plugin_xep_0096.py --- a/src/plugins/plugin_xep_0096.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/plugins/plugin_xep_0096.py Thu Nov 01 22:41:39 2012 +0100 @@ -171,7 +171,7 @@ misc_elts = [] misc_elts.append(domish.Element((PROFILE, "file"))) if can_range: - range_elt = domish.Element(('', "range")) + range_elt = domish.Element((None, "range")) range_elt['offset'] = str(range_offset) #TODO: manage range length misc_elts.append(range_elt) diff -r 790be337cc41 -r a31abb97310d src/tools/xml_tools.py --- a/src/tools/xml_tools.py Thu Nov 01 19:52:59 2012 +0100 +++ b/src/tools/xml_tools.py Thu Nov 01 22:41:39 2012 +0100 @@ -322,7 +322,7 @@ parser.DocumentStartEvent = onStart parser.ElementEvent = onElement parser.DocumentEndEvent = onEnd - tmp = domish.Element(("", "s")) + tmp = domish.Element((None, "s")) tmp.addRawXml(s.replace('\n','').replace('\t','')) parser.parse(tmp.toXml().encode('utf-8')) return self.result.firstChildElement()