How do we store chat conversations on MySQL database? XMPP Openfire - mysql

I am building a web chat application. I want to store the messages or conversations between two parties after every press of "Enter" button. I am using Openfire Server, and MySQL database. I don't see any tables from the database that stores the conversations.
Is there a plugins for that? thanks. I am using strophe js library to send messages. Thanks.

Conversations are only stored if the 'Conversation State Archiving' is enabled under Server-->Archiving-->Archiving Settings in your Openfire Admin Console, and 'Message Archiving' is enabled for either 'Archive one-to-one chats' and/or 'Archive group chats'. Thereafter, the messages are stored in the MySQL database table 'ofMessageArchive'.
This table contains an incrementally updated 'conversationID', UNIX timestamp, and JIDs of conversation participants.
Hope this helps!

You need a plug n for that "Monitoring Services" available under Plugin tab in your admin console. Install that plugin and boom, you are ready to go!

Related

React/Javascript/MySQL App - Authenticated User Data from DB?

I have a simple ToDo app written in ReactJS with Express backend and MySQL. I've recently implemented Auth0 authentication, and the app successfully requires authentication before allowing a user to view or add tasks. Any user can see all the tasks (stored in DB), but at least authentication is required first.
Next, I want ensure that users can see only their OWN tasks. Can anyone either describe how this works, or share any decent resources on the subject? Any examples I can review somewhere? I imagine there is probably an ID value I can fetch from Auth0 user DB and silently include that as a column in the DB, then allow users to only fetch tasks matching their own ID.
Any resources appreciated.

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...

Users chat using Rails + Nodejs (Redis, Socket.io, Mysql)

I want to implement chat between users (like live Personal Messages) into my RoR application. So, after reading a lot of manuals and recommendations, i've decided to use nodejs + socket.io to handle socket connections and send\receive messages. How i imagine it:
After user successfully signed in, rails adding session key to the redis db with associated user id. When user is opend PM's page, starts new connection through socket. When user presses button "Send", all data including receiver id and message sent to the server (nodejs). After that, nodejs extracting session key from cookie and checking redis db for existance. If exists -> check if user is subscribed to the specific channel ("channel-id1-id2" for example, where id1 and id2 - sender and recepient id), if true -> save message to db and send this message to channel subscribers (redis?), else -> create channel, save message to db and send this message to channel subscribers.
So, from what i have written, we use rails only for user authentication (if to take only PM module of my site). Questions:
Is logic of my application ok?
Is it safe to use channels for
private messages? I mean if i be able to create channels and
subscribe\unsubscribe users from it ONLY by nodejs server?
Any suggestions\corrections and etc. are Welcomed!
Thank you and remember that before posting this i have read different tutorials\manuals on this topic.

How does WhatsApp syn up contacts with ejabberd

I am creating ejabberd xmpp client for charting similar to WhatsApp. Want to understand, how does WhatsApp sync contacts with server? How does WhatsApp find out all registered users with server and synchronise it with your address book?
This feature is not related to XMPP or ejabberd. If you want to detect contact of your user you need to implement that feature in a custom way.
You need to upload an anonymised version of the user address book with hash of phone number and email and store that on your server.
When another user with a phone number or email address matching that hashes join the service you can find who knows it and do operations to notify each parties that they are both using the service (and/or add them in roster for example).
So, this is a purely custom extension to ejabberd you will have to implement.

WHMCS API-- provisioning mySQL

I'm trying to use the WHMCS API / provisioning module to auto-create a mysql database for a new WHM / cPanel client after their order for hosting goes through.
It seems like it should be simple enough to do, but I can't find anything about it in the docs. The WHMCS module is connected to the WHMCS mysql instance, but I would want to be connecting the "main" local mysql instance where the client's data is held.
Would I simply connect to localhost in the provisioning module, and create a new database and user? Or is there a more robust way to handle this without going outside the WHMCS / WHM system.
Please provide examples if possible!
Thanks for any help
I would use whmcs's hooks. A hook is function that is fired as a result of an internal action.
You should look for the invoice items after the invoice is paid but before the email in case you want to send database information if not then after paid should be fine
This would go in billing dir / includes / hooks
and it would look like
function init_InvoicePaidPreEmail($vars) {
// create your db code here be sure to look for the specific invoice item "order for hosting"
}
add_hook("InvoicePaidPreEmail",1,"init_InvoicePaidPreEmail","");