[imp] 'attach_body_check' hook prevents IMP smartmobile view to send message with 'attachment' word when there's no attachment

Leonardo Bruno Lopes leonardo at cefetmg.br
Thu Apr 13 15:46:20 UTC 2017


Hi everyone!

I have the following situation:

Scenario: User is composing a message on the IMP smartmobile view. The  
'attach_body_check' IMP hook is enabled and configured with a set of  
'attachments' keywords. Horde/IMP is installed using Debian 8 official  
packages, 'php-horde' is 5.2.1 and 'php-horde-imp' is 6.2.2-3.

It's well know that Debian ships a jQuery version which is not IMP  
compatible. So, to be able to use even the very basic mail features in  
smartmobile view, I needed to update jQuery / jQuery-mobile libs to  
versions 1.12.4 / 1.3.2. I did this just by sym-linking default files  
to the updated ones and the Horde smartmobile view worked correctly  
(not only IMP, but Turba, Kronolith and Ingo also).

Symptoms: When using the IMP smartmobile view, it will not be possible  
to send a message without attachments if in the message body text  
there is any of the keywords defined in the 'attach_body_check' IMP  
hook.

The first attempt to send will show -- as it is expected -- a warning  
message informing that none attachments are indeed present. However,  
the next attempts present the same behavior: a message warns about the  
absence of attachments and the message is not sent. It will only be  
sent if: 1) you remove the keyword(s) from the message, or 2) add some  
attachment, or 3) disable the hook.

What I could see, by now: after a little debugging I detected that, in  
some way, the 'IMP_Factory_Compose' class constructor is called as  
many times as the user clicks 'Send' button while composing messages  
on the smartmobile, according to the above described scenario.

This behavior seems to be incorrect, as this constructor is called  
just once when using the Dynamic view which works correctly.

I could also see that each time the 'IMP_Factory_Compose' constructor  
is called, a new 'object' is generated with the  
'_metadata["attach_body_check"]' attribute unset/empty. A different  
value for the '_cacheid' attribute is generated every time the user  
clicks 'Send'.

This -- I suppose -- is causing the attach body verification code to  
always detect the currently being composed message as a  
'new-still-no-verified' message, which is consistent with the endless  
loop behavior while trying to send the message.

As the smartmobile view is primarily driven by jQuery / jQuery-mobile,  
this can be either related the the Horde JS code or to the library  
itself.

Remarks:
1. Only the smartmobile view is affected. Dynamic view on both desktop  
and mobile main browsers sends the messages at the 2nd attempt.
2. The tests where performed with the default Horde and IMP prefs. The  
only hook enabled was 'attach_body_check'.
3. This issue also affects the IMP version 6.2.17-1 which is to be  
shipped in the 'php-horde-imp' Debian stretch package.

Can anyone cast some light on this? Is this a Debian package related  
bug or Horde/IMP bug?

Best regards,
Leonardo



-- 
Esta mensagem foi verificada pelo sistema de antivírus e
 acredita-se estar livre de perigo.



More information about the imp mailing list