Search code examples
iosobjective-cswiftejabberd

ejabberd mod_pubsub offline message


I want to intercept the offline message of mod_pubsub, if I send a normal message in ejabberd to offline user, I see that message in offline odbc table, if user reconnect the message arrive.

If I publish to a node, and some user are offline, I see nothing in offline message table, but if the user reconnect the item node is sent correctly so the message is saved somewhere.

Can I send the item offline to offline message odbc table? or can I intercept the offline item of mod_pubsub like for message, in fact for message from plugin I can do this:

 start(_Host, _Opt) ->
    inets:start(),
    ejabberd_hooks:add(offline_message_hook, _Host, ?MODULE, create_message, 50).

 stop (_Host) ->
    ejabberd_hooks:delete(offline_message_hook, _Host, ?MODULE, create_message, 50).

this is my ejabberd.yml config for mod_pubsub:

mod_pubsub:
  access_createnode: pubsub_createnode
  ## reduces resource comsumption, but XEP incompliant
  ignore_pep_from_offline: true
  ## XEP compliant, but increases resource comsumption
  ## ignore_pep_from_offline: false
  last_item_cache: false
  db_type: odbc
  plugins:
    - "flat"
    - "hometree"
    - "pep" # pep requires mod_caps

Solution

  • As default, pubsub message type are headline. As per XMPP specifications, headline messages should not stored in offline message store.

    However, there is a mod_pubsub option to change default notification type. You can for example set mod_pubsub notification_type option to normal. Normal messages are store in offline store.