Strophe js how to get last message of all user in rostered users - ejabberd

I am using Strophe js for ejabberd chat application.
how to
get last message of all user who all rostered with logged in user.

If you have mod_mam enabled and properly configured, it can store all the messages of all the users, and later you can request them, following https://xmpp.org/extensions/xep-0313.html

Related

Firebase Chat Application with Social Media on Flutter

I have a social media app written in Flutter. Users can see the profiles each other and block/unblock them. I'm using MySQL to keep that data. Now I want to implement chat feature using Firebase Firestore (or maybe MongoDB). When a user sends a message to another user, should I check if user blocked another user from MySQL every time, so user can't send new message. Is this a good practice in chat application, or should I store the "blocked" data at Firebase also.
I researched this subject deeply but didn't find any solution.
Like when user is trying to send a message to another user so in the list of the recipients you are also retrieving the value for (is particular user is blocked by the current user), if it's so you are checking this on that time.
Secondly, if you want this to check when sending to server. So, you can manage this using firestore transaction in which you might get the object of the sender and check to whom the sender has blocked and you may throw an exception. The other thing you might manage it using Firestore Security Rules as well.
So you can code like most of the current social media works.
Simply let the user send a message but put a condition on the receiver
user side so if the user is blocked by the receiver then it should not show
the chat in the user chat list also should not send a notification if the user
is blocked by the receiver.

Can eJabberd call an API if a roster contact does not exist?

Ejabberd newbie here. I hope this question makes sense.
We had a need to setup our own XMPP server so that customers on web and a Bria client can utilize it. I was able to get the basics up and running using ejabberd.
All users will be in the 'xmpp.exampledomain.com'
We also have a custom SMS gateway we built (which is really a server which can accept json APIs).
So what I am trying to accomplish:
Our platform would create a 'normal' xmpp user so the user can login to ejabberd.
This user can add roster contacts of other 'normal' xmpp users.
If this user wants to send messages via SMS, we would instruct them to add roster contacts (i assume) with the format 12125551234#sms.exampledomain.com. (adding the contact works currently)
If a user sends a message to this "SMS" contact, have ejabberd call our custom SMS gateway via a json API instead of attempting to deliver via normal xmpp.
Is this even possible?
For inbound from the SMS Gateway server, can call the ejabberd API send message function, so inbound is fairly easy.
I appreciate any suggestions
thanks
What you want was called a "transport" in the old days of IRC, ICQ, AIM and MSN. They were programs that you installed next to ejabberd (or other Jabber servers). Example usage:
you download a transport for ICQ
configure it to have access to ICQ,
and then configure ejabberd to connect to that transport, and allow users to contact it at address icq.example.com.
There are very old tutorials for your curiosity:
https://www.ejabberd.im/tutorials-transports/index.html
I don't know if the old "SMS-Jabber transports" will work nowadays. Searching revelaed few results:
https://www.jethrocarr.com/2013/06/03/smstoxmpp/
https://sourceforge.net/projects/jabbersms/
https://www.jabber.cz/wiki/SMS_transport
Alternatively, as you mentioned you already have a SMS program, if you can get your hands on Erlang or Elixir, you can write an ejabberd module that registers at sms.example.com, and forwards XMPP messages as json API...

How to Get offline message count for muc room using Stophe js

I am developing a chat application using
ejabberd and Strophe.js .
my question is how to get offline message of muc room.or give some example to how to implement message delivery receipts in strophe js plugin.
The concept of offline messages is applicable to conversations between a user and another user. I don't understand how it can be applied to MUC rooms, and most probably it cannot be done.

CAS number of currently logged users

I'm trying to monitor the number of logged in users into CAS. Ideally I would like to read that number from a log file or web service and send it to our service monitoring system (zabbix).
How can I get the number of current valid sessions?
See this link for more info please: http://jasig.github.io/cas/4.2.x/installation/Monitoring-Statistics.html

ejabberd block messages from users that don't stay in my friend list

After the installation of ejabberd, and configure to the domain. I add the mod_blocking to block users, and it works.
The problem is that when one user open a chat with another user (from the same domain), can send message. In my case, only will be valid that the user receive messages from his friend list. The user could accept request from other users, before receive texts.
Any idea of how can I configure ejabberd to this functionality? (I think that is normal, but I can't find anything similar)
Thanks a lot!!
There is not default feature in XMPP to block message only from friend list. Even if you do that to avoid spam, a user can probably still spam by sending contact request with message.
Anyway, you will have to develop a custom module for that.