Empty message injected when otrl_message_sending to recipient in finished state
Related to #17.
The OTRL_FRAGMENT_SEND_ALL behavior is somewhat confusing when the recipient is in OTRL_MSGSTATE_FINISHED. In this case, otrl_message_sending:
- calls handle_msg_event callback with OTRL_MSGEVENT_CONNECTION_ENDED,
- calls inject_message callback with empty string (""),
- sets messagep to the empty string, and
- returns successfully.
Setting messagep to non-NULL and returning zero is consistent with the case when libotr sends the message successfully (and thus the caller shouldn't). The user is also notified that the message was actually not sent through the handle_msg_event callback. I would suggest not to call the inject_message callback, though, as it serves no purpose.
Proposed patch:
--- a/src/message.c +++ b/src/message.c @@ -439,7 +439,7 @@ fragment: return err; } else { /* Fragment and send according to policy */ - if (!err && messagep && *messagep) { + if (!err && messagep && *messagep && *messagep[0]) { if (context) { err = fragment_and_send(ops, opdata, context, *messagep, fragPolicy, messagep);
Other possibility is to check the messagep for non-zero length inside fragment_and_send.
(from redmine: created on 2014-04-22)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information