ReneVolution / profanity-omemo-plugin

A Python plugin to use (axolotl / Signal Protocol) encryption for the profanity XMPP messenger
GNU General Public License v3.0
64 stars 14 forks source link

Crash with latest profanity dev #45

Closed bretello closed 6 years ago

bretello commented 6 years ago

I was trying to use this plugin with the latest profanity dev (0.6.0dev.master.34aa7a7), but I kept getting unencrypted chats errors.

By going into the logs I saw what was triggering the errors: a ValueError exception on line 86 of xmpp.py (encrypt_stanza() :

account, resource = jid.rsplit('/', 1)

Not sure what changed between the previous versions of this plugin and profanity, but, given how this line is written, if jid does not contain a "/", this will raise a ValueError. I replaced that line with:

try:

    account, resource = jid.rsplit('/', 1)

except ValueError:

    account, resource = jid, ""

So that the ValueError is correctly handled, and I was able to get back the encrypted chats.

I keep getting another error:

 prof: ERR: ProfOmemoPlugin - Could not handle encrypted message.
Traceback (most recent call last):
  File "/Users/me/.local/share/profanity/plugins/prof_omemo_plugin.py", line 441, in 
prof_on_message_stanza_receive
    msg_dict = xmpp.unpack_encrypted_stanza(stanza)
  File "/Users/me/Library/Python/2.7/lib/python/site-packages/profanity_omemo_plugin-0.0.1-py2.7.egg/profanity_omemo_plugin/xmpp.py", line 297, in unpack_encrypted_stanza    
payload = payload_node.text
AttributeError: 'NoneType' object has no attribute 'text'
prof: ERR: ProfOmemoPlugin - Could not handle encrypted message

But I haven't had time to look into this.

Thanks for your awesome work!

bretello commented 6 years ago

Duplicate of #43 and #39