ejabberd syncing message from mysql archive - erlang

I am working on ejabberd for quite sometime now, I am replacing a third party Chat infra with Ejabberd inhouse. As it was production switch so we need to maintain the previous chat messages while switching to ejabberd.
So I have created all the rosters, migrated users to ejabberd which is all working fine, now main challenge that I am facing is with message migration. I am using mysql for users, rosters and messages. I am running a script which is directly pushing data to ejabberd mysql from previous chat infra.
But when I am connecting to a user, I am able to see new chat messages which were sent through ejabberd, but migrated chats for same user is not visible and not propagated back to client.
Can someone help here ?
Here are the two entries which I had put in mysql, first one is ejabberd entry and other one is manual, client is able to sync first one but not another.
username timestamp peer bare_peer xml txt id kind nick created_at
xyz-customer 1454573488523175 abc-provider#xxx.amazonaws.com abc-provider#xxx.amazonaws.com "<message from='xyz-customer#xxx.amazonaws.com/2131165549e1bc6553-32b9-4ec4-92bd-c9ed80fb5374' to='abc-provider#xxx.amazonaws.com' xml:lang='en' id='oG3Vb-568' type='chat'><body> CnsfjffsjJ</body><thread>90275196-0096-4bb4-a95d-d72ea5238f74</thread><request xmlns='urn:xmpp:receipts'/><delay xmlns='urn:xmpp:delay' stamp='2016-02-04T08:11:27.194+00:00' from='xyz-customer#xxx.amazonaws.com/2131165549e1bc6553-32b9-4ec4-92bd-c9ed80fb5374'/><markable xmlns='urn:xmpp:chat-markers:0'/><request xmlns='urn:urbanclap:request' requestId=''/><active xmlns='http://jabber.org/protocol/chatstates'/></message>" " CnsfjffsjJ" 208044 chat "2016-02-04 08:11:28"
xyz-customer 1454570506606317 abc-provider#xxx.amazonaws.com abc-provider#xxx.amazonaws.com "<message from='xyz-customer#xxx.amazonaws.com' to='abc-provider#xxx.amazonaws.com' xml:lang='en' id='I5sO7-2' type='chat'><body>GB hard</body><request xmlns='urn:xmpp:receipts'/><markable xmlns='urn:xmpp:chat-markers:0'/><active xmlns='http://jabber.org/protocol/chatstates'/></message>" "GB hard" 208045 chat NULL "2016-02-04 07:21:46"

I guess you are trying to fill the message archive table, but are expecting offline messages delivery. Please, make sure you are adding the message in the right table. I guess you are writing in archive table but should write in spool.
Please note that spool table to deliver offline message is only check on new user login. It is not a way to add messages to deliver to the user in a running session. It means you cannot really sync two running platforms by just writing in MySQL message table. You would need to actually route the messages by writing a custom ejabberd plugin.

Related

Is there an event payload when adding ms teams app to org?

If I upload a custom app that has a messaging bot to an MS Teams org (through admin center), is there an event payload that gets sent to the bot messaging payload that lets me know that the app/bot is added to that MS Teams tenant?
Something similar to installationUpdate event: https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/subscribe-to-conversation-events?tabs=dotnet#installation-update-event but for adding app to org (this payload event is sent for when users add app to their own MS Teams space)
No, there is no event for this.
Having it installed in a tenant doesn’t do anything except making it available for users to install. And without a user installing it, you cannot interact with the bot.
There are only two ways the app could be added to the org: either (a) by them adding the package manually, in which case presumably you gave it to them, so you should know about it, or (b) by your app being in the public App Store. In this 2nd case, you'll know it's been installed into the tenant by using the same installationUpdate event you mentioned - you can store an entry somewhere on your infrastructure (e.g. a database or otherwise) that tracks which tenants have installed the bot ever before in any channel, and if nothing is found for the incoming tenant id, it must be new.

"Your unused Realtime Database will be deactivated in 14 day(s)" - how to fix access rules?

I had an email to say that my Firebase database would be de-activated in 14 days unless it receives traffic or I update my security rules. When I login to my Firebase account I don't see any options to maintain my database. The only option I get when I select the "Realtime Database" menu item is "Create Database".
How can I see and maintain an existing database?
firebaser here
This message is sent to owners of databases that:
Have world readable security rules AND
Have not received any traffic in 6 months.
As the message says: to prevent the database from being deactivated you can:
Either change its security rules,
Or for it to start receiving traffic.
Note: your data will not be deleted either way.
I actually quickly checked one of my own projects that got disabled, and I see this in the console:
Clicking the Re-enable buttons seems to have reenabled the database without either of the two actions mentioned in the email. But I do expect the database to be disabled again, based on my lack of addressing the root cause.
If you're not seeing this same screen for your project, I'd:
Reload the Firebase console, and navigate to the database from there.
If that still doesn't show you the same screen, reach out to Firebase support for personalized help in troubleshooting.

Fetching MUC Message History using MucSub in IOS

Every time when I’m signing into the app or reinstalling app I didn’t receive group message history. I have searched a lot for message archiving in MUC for iOS. Ejabberd doesn’t provide me old messages of the group although I configured setting into the YML file as mentioned in the attached image. I have kept history size of 10. It means at least 10 messages must be fetched every time when I login into the app or reinstall the app but I could not receive 10 messages every-time after reinstalling the app. I’m using Robbiehanson/XMPPFramework for iOS to implement XMPP based chat. I also performed MucSub based MUC to send/receive messages.
The scenario which I have performed:
I’m part of one MUC group. The member of the associated group sent 15 Messages into the group. I have received all those messages when I’m online. Now I am logged out from the group. Deleted the app from the device and reinstalled it into the device with the same login credentials. At this time I could not see the 15 messages which I received earlier. Here I would like to get all 15 Messages even after reinstalling the app into the iOS device.
I have searched on various Stack overflow questions but none of them are helpful to me. Your help will be appreciated.
Maybe you can try joining the room by specifying the history element with the maxstanzas specified.
We have similar case like we need last 3 months history while joining the room, So we mentioned that in history tag, Like below code sample
let historyElement = DDXMLElement(name: "history")
historyElement.addAttribute(withName: "since", stringValue: ((lastDate as NSDate).addingTimeInterval(1).xmppDateTimeString())!)
room.join(usingNickname: userJidString, history: historyElement)

MUCLight Offline message fetch XMPP

Have any one implemented MUC Light that is Beta released in MongooseIM Chat server for XMPP.
How to fetch fetch following messages when
1) User are offline while they were added as participants of group.
2) Users who are members byt offline and get messages on the muc light group.
I have achieved mod_zero push to trigger the offline message to Users, Also able to store the message in mam_muc_message table in my chat server MySQL database. But how the client will fetch these messages and also be notified with all messages.
Any guidance is much appreciated.
http://mongooseim.readthedocs.io/en/latest/open-extensions/muc_light/
Thanks for suggestion and comments here is how i managed with small limitation.
When user is offline while he was added by some group by others, he wont get this create group stanza as muc-light suggest.
When he come online , there have to be someone atleast who send a group message
When he gets this message I fetch the group configuration and create a new group first and keep this message as pending to process.
Once group created then i link this pending message to this group.
Then I call the MUC light MAM messages as given in 6.2 XEP-0313 Message Archive Management
Then I fetch all the previous messages and add in my database and display on the screen.
The only limitation that is there is after he come online he can't go to server and ask ALL muc-light messages, some how coz the server is not available is thrown if I ask for traditional MAM process to give messages for muclight.****.com group ID so I use as they asked to fetch in above link.
Hope MUC Light Beta is improving ahead more taking this into consideration.

Firebase Cloud Messaging - Send message to all users

I'm new using the Firebase Cloud Message. I built an IOS app to receive push notifications. The app works fine. I send messages from the Firebase console and they're displayed correctly.
Now I`m trying to build an web api to allow my customer to send the push messages (without accessing the firebase console). Studying the documentation here I realized that I've always to have a "to", meaning a group, topic or device id.
My question is: can I send a message to all devices (like I can do in the console)? I yes, how so?
Thanks in advance!
You can make use of topics. Given that all of your users are subscribed to a specific one. Just like what I mentioned here (removed some parts, just check them out if you want):
If you are looking for a payload parameter to specify that you intend the message for all your users, unfortunately, it doesn't exist.
Commonly, when sending notifications to multiple users, you can make use of the registration_ids parameter instead of to. However, it only has a maximum of 1000 registration tokens allowed. If you intend to use this, you can make batch requests of 1000 registration tokens each, iterating over all the registration tokens you've stored in your app server.
However, do keep in mind that Diagnostics for messages sent to Topics are not supported.
I found this:
!('TopicA' in topics)
With this expression, any app instances that are not subscribed to
TopicA, including app instances that are not subscribed to any topic,
receive the message.
So you could probably use
condition="!('nonExistingTopic' in topics)"

Resources