support for Message Of The Day (MOTD)
|Assignee:||Andrzej Wójcik||% Done:|
|Database:||n/a||Source Code Disclaimer:||No|
Ability to set/modify/remove message of the day as described in XEP-0133: Service Administration
%kobit We have our custom
message broadcast feature which delivers messages in specified time frame to every logged in user only once. I wonder if we could use it here and just add adhoc command which will use this
message broadcast feature. If so, then it should be easy to implement.
I thought for a while about this approach too. However, this is completely different use-case. MOTD is not sent to all online users like a broadcast. It is a message which is sent to each user right away after he logins into the system and it is sent only no more than once a day. So the ad-hoc command would be only used to set the current MOTD on the server (ideally on all cluster nodes from a single command).
Therefore, I think it should/could/might be implemented in a completely different way. Maybe like kind of a processor which is executed somehow just after a user logins/binds resource/sends initial presence. However, I am not sure if processor would be the most efficient solution in this case. I think SM has some hooks for events like resource bind, initial presence, etc... which are used by the clustering strategy. Maybe MOTD could be executed from such a method or maybe from the presence plugin.
Ok, so for now I think that use of
custom message broadcast is not a good idea and may be an overkill in this case.
But we could use
UserRepository to store date of last time motd was delivered for each user and add separate processor handling initial presence to send message to user. (We should use new presence processor as we need to send message to user after it sets priority as XMPP server should not send messages to clients with priority lower than 0).
And then separate adhoc script which would set MOTD in UserRepository to store for server between restarts. Additionally processor would keep this value in memory for faster access and in 7.2.0 we should have access from adhoc commands of SM to SM processors and could use this MOTD processor method to update this value. This should be good and "simple" solution from MOTD.
A similar approach we can do for JabberIqRegister processor. It can always send message to offline user which got created and this will be delivered to user after first connection and will work as a welcome message.
%kobit What do you think about this approach?