MITM attack: gajim automatically enables encryption if remote presence is signed.
If a user has signed their presence, gajim will automatically use the signing key for encryption.
This enables a man-in-the-middle attack.
An attacker which has control of either user's server can intercept and sign the remote user's presence with their own key, and then read messages when they're encrypted to that key (and presumably passing the clear text along to the remote, who never realises they should have been encrypted. If both ends are using gajim, the mitm can attack both sides, leaving both users believing their messages are properly encrypted.
The solution is to only encrypt to keys which have been manually assigned to remote users; use the signing key ID only as a hint for which key should be selected first when manually assigning a key; and use signed presence only as a hint for whether to auto-enable encryption to the manually-assigned key.