msgoffline plugin dosn't save messages without body

Igor Khomenko
Added almost 5 years ago

I realised that msgoffline plugin dosn't save messages without body

For example I have a custom message with no body, but with custom params:

<message id="1402562751.709331" type="chat" to="" from=""><extraParams xmlns="jabber:client"><attachment type="video" id="12312"></attachment></extraParams></message>

It never be saved to Offline storage

I checked class and found this code:

&& ( ( pac.getElemCDataStaticStr( tigase.server.Message.MESSAGE_BODY_PATH ) != null )
                                || ( pac.getElemChildrenStaticStr( MESSAGE_EVENT_PATH ) != null )
                                || ( pac.getElemChildrenStaticStr( MESSAGE_HEADER_PATH ) != null ) )

What is the reason not to store a message without these elements?

Replies (3)

Added by Wojciech Kapcia TigaseTeam almost 5 years ago

To limit number of saved messages to only 'concrete' ones. As it was discussed in separate topic we were weighting options and decided to implement it this way as most users would only care about those messages that actually contains the body and in all likelihood messages without such element are mostly used for signalling and don't posses much information outside of the active session hence it made less sense to store them.

Added by Igor Khomenko almost 5 years ago

Thanks for explanation

but I have another case. For example we have a chat messenger application and user wants to send an attach (like in my previous example).

He doesn't want to send any text background, just a link to some file.

Do you propose anyway to add some text to body in this case?

Added by Wojciech Kapcia TigaseTeam almost 5 years ago

Simplest and quickest option to have such message saved is - yes - adding some element.