#906 headline messages not delivered on resource-bind

Reporter rafaeli
Owner Nobody
Created
Updated
Stars ★ (1)  
Tags
  • Status-New
  • Priority-Medium
  • Type-Defect
  1. rafaeli on

    What steps will reproduce the problem? 1. Create and enable a module with this contents (mod_xxx.lua): local stanzaM = require 'util.stanza' module:hook('resource-bind', function () local s = stanzaM.stanza('message', {type = 'headline', to = 'admin@localhost'}):body('a head') module:send(s) local s = stanzaM.stanza('message', {type = 'chat', to = 'admin@localhost'}):body('a chat') module:send(s) end) 2. Log in as admin@localhost 3. Observe only the second message received (chat) What is the expected output? What do you see instead? According to the XML console, the client never receives the headline message which is the normal case for offline messages. But the client is not offline. If this behavior cannot be fixed for some reason, then I believe Prosody must introduce an event fired after presence and all other preparatory work finished, suitable for sending any kind of online messages. What version of the product are you using? On what operating system? Prosody 0.9.12 / Gajim / Ubuntu Note: the event documentation says that: After authentication a client binds a resource, which is a unique identifier for that connection. This is the best way to know when a user has logged in or out (but they won't have sent presence or anything else yet). Several plugins are using this event to send messages to the user (e.g. mod_motd_sequential). As I would expect, at this point user is already considered online. However, messages sent at this point seem to be routed as if he was offline.

  2. rafaeli on

    Now that I check mod_motd.lua it uses presence/bare for this purpose. It's a workaround at best because there's a clear distinction between having a handler triggered when a user logs in and a handler triggered any time a user changes his presence, including the first presence he sends when he logs in.

  3. rafaelism on

    Found presence/initial (0.10+), I believe that's the event I need. Problem solved. https://prosody.im/doc/developers/events#initial_presence

New comment