Gajim sends unencrypted message although OpenPGP-encryption is enabled, encryption effectively disabled
Bug description
Gajim sometimes sends unencrypted messages although OpenPGP-encryption is enabled. Gajim gives the following message in the chat window:
[04:43:52 PM] GPG encryption enabled
[04:44:53 PM] error while sending Test message, trying to reproduce Gajim's buggy behaviour. ( Neither the remote presence is signed, nor a key was assigned. )
[04:44:53 PM] me: Test message, trying to reproduce Gajim's buggy behaviour.
XML console:
\<!-- Out -->
\<!-- Out -->
\<message xmlns="jabber:client" to="contact" type="chat" id="29">
\<body>Test message, trying to reproduce Gajim's buggy behaviour.\</body>
\<request xmlns="urn:xmpp:receipts" />
\<thread>eyvVGFTXLrppeyUvBBOOqeZwJyhBYfGf\</thread>
\</message>
\<!-- In -->
\<message from='contact/resource' to='me/resource' xml:lang='de' type='chat' id='29'>
\<received xmlns='urn:xmpp:receipts' id='29'/>
\<thread>eyvVGFTXLrppeyUvBBOOqeZwJyhBYfGf\</thread>
\</message>
#doing my workaround (see below)
\<!-- Out -->
\<message xmlns="jabber:client" to="contact/resource" type="chat" id="35">
\<body>[This message is *encrypted* (See :XEP:`27`] ([This message is *encrypted* (See :XEP:`27`])\</body>
\<x xmlns="jabber:x:encrypted">encrypted text\</x>
\<request xmlns="urn:xmpp:receipts" />
\<thread>eyvVGFTXLrppeyUvBBOOqeZwJyhBYfGf\</thread>
\</message>
\<!-- In -->
\<message from='contact/resource' to='me/resource' xml:lang='de' type='chat' id='35'>
\<received xmlns='urn:xmpp:receipts' id='35'/>
\<thread>eyvVGFTXLrppeyUvBBOOqeZwJyhBYfGf\</thread>
\</message>
A key is assigned to the contact I'm trying to send the message. Most importantly, Gajim sends the message unencrypted. There is no hint that this is happening.
I mark this as high priority and critical severity as information may be leaked without the user even knowing. Gajim should under no circumstances send unencrypted messages when encryption has been enabled.
This behaviour first occured using Gajim 0.15-alpha1.
Steps to reproduce
Start Gajim, try to send a message to a contact that has already been online and to which a key is already assigned. The reproduction is not always possible. The putative bug may occur anytime, not just under the circumstances which sometimes allow reproduction.
Workaround
Right click on contact in contact list -> "Manage Contact" -> "Assign OpenPGP Key" -> "OK" (that's right, just click "OK", no need to change anything). Now encryption for that contact works as desired.
Software versions
OS version: Kubuntu 11.04
GTK version: 2.24.4
PyGTK version: 2.22.0
Gajim version: 0.15-beta2