Mercurial > libervia-backend
diff src/plugins/plugin_xep_0033.py @ 787:dd656d745d6a
test: added tests for XEP-0033
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 05 Jan 2014 13:05:31 +0100 |
parents | ff9a52077b36 |
children | 1fe00f0c9a91 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0033.py Sun Jan 05 13:04:54 2014 +0100 +++ b/src/plugins/plugin_xep_0033.py Sun Jan 05 13:05:31 2014 +0100 @@ -96,7 +96,7 @@ element.addChild(domish.Element((None, 'address'), None, {'type': type_, 'jid': jid_})) # when the prosody plugin is completed, we can immediately return mess_data from here self.sendAndStoreMessage(mess_data, entries, profile) - return Failure(MessageSentAndStored("XEP-0033 took over")) + return Failure(MessageSentAndStored("XEP-0033 took over", mess_data)) d = self.host.requestServerDisco(NS_ADDRESS, profile_key=profile) d.addCallbacks(discoCallback, lambda dummy: discoCallback(None)) return d @@ -151,7 +151,10 @@ def post_treat_addr(data, addresses): data['extra']['addresses'] = "" for address in addresses: - data['extra']['addresses'] += '%s:%s\n' % (address['type'], address['jid']) + # Depending how message has been constructed, we could get here + # some noise like "\n " instead of an address element. + if isinstance(address, domish.Element): + data['extra']['addresses'] += '%s:%s\n' % (address['type'], address['jid']) return data try: