processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.01k stars 1.5k forks source link

mod_announce #4082

Closed heelll-boooy closed 9 months ago

heelll-boooy commented 11 months ago

Environment

licaon-kter commented 11 months ago

Gist of config?

Exact commands?

Error logs?

prefiks commented 11 months ago

I believe this works that by design, we send only one motd to a user, only when motd is updated this state will be reset.

heelll-boooy commented 11 months ago

@licaon-kter Gist of config? This is my config in : /usr/local/etc/ejabberd/ejabberd.yml access_rules: announce: allow: admin modules: mod_adhoc: {} mod_announce: access: announce

Exact commands? im set motd from services discover

Error logs? no error logs

heelll-boooy commented 11 months ago

@prefiks no It should be sent on every login

badlop commented 11 months ago

It should be sent on every login

Where did you read that?

https://xmpp.org/extensions/xep-0133.html#set-motd says:

is delivered to any user who logs in to the server that day (e.g., to announce service changes)

It does not imply that it should be sent several times to the same account on every login, only the first time an account logins, right?

In fact, mod_announce takes care to NOT send the MOTD twice to the same user (storing the announced users in the table motd_cache)

heelll-boooy commented 11 months ago

Hello @badlop Thank you for your help I quit the internet a long time ago and now I'm back to working on it I'm sorry I was working on Ejabberd version 2.13 and this was possible Now this is impossible Thank you again

Neustradamus commented 11 months ago

@heelll-boooy: version 2.13?

heelll-boooy commented 10 months ago

@Neustradamus Yes

Neustradamus commented 10 months ago

@heelll-boooy: ejabberd 2.1.3? From 2010?, 13 years old?

heelll-boooy commented 10 months ago

@Neustradamus yes

badlop commented 10 months ago

Let's look at mod_announce.erl source code the first time it was committed to this repository in August 2004. This code is 19 years old:

https://github.com/processone/ejabberd/commit/d77a936b322220a67e703525ff585660ea8da670#diff-7c1b24018ecd77c08239a6c246a397ed87c6bc382fdb3a087444856407e534b6R161-R177

When a client logins to the server, send_motd checks if there is a MOTD to send. In that case, it checks if that user has already received the MOTD, in that case it does nothing. If the user didn't yet receive the MOTD, it sends the message and then takes note that this user has already received this MOTD. All this is only removed when the admin updates the MOTD.

If you found an ejabberd version that didn't behave like this, then it was a bug that got fixed.