Hi Oibaf,
sorry i take it wrong way now i can understand your situation better i think.
I think you want to store the offline message but when user logins openfire delivers those message and it will delete from ofoffline table but you want to pretend them right?
you can do it after changes src code of openfire and rebuild it.
when you will look at openfire src code you wil find servermanager.java(src/java/org/jivesoftware/openfire) the code snippet i have attached below.
if (session.canFloodOfflineMessages()) {
OfflineMessageStore messageStore = server.getOfflineMessageStore();
Collection messages = messageStore.getMessages(session.getAuthToken().getUsername(), true);
for (Message message : messages) {
session.process(message);
}
}
this code will run when you are login and it will featch all offline message using “getMessages(session.getAuthToken().getUsername(), true)” and it will process after you successfully logged in.
when you look at “getMessages(session.getAuthToken().getUsername(), true)” method it is resides in (offlinemessagestore) under same directory i have mentioned above.
you will find method as below :
public Collection getMessages(String username, boolean delete) {
List messages = new ArrayList<>();
SAXReader xmlReader = null;
Connection con = null;
PreparedStatement pstmt = null;
.
.
.
}
here you can see second parameter which is passed in openfire method is true which indicates you want to delete those message after processing it if you don’t then you should pass false as second parameter so if you want those messages after processing you need to change second parameter as “false” and it will stop deleting messages from ofoffline table and you can retrive this messages second time when you logged in.
for your ref i am attaching src link from github of both classses please visit you will get clear your doubts.
Openfire/SessionManager.java at master · igniterealtime/Openfire · GitHub
Openfire/OfflineMessageStore.java at master · igniterealtime/Openfire · GitHub
There are also other way to manage those message please ping you want to know any more way to get this message.
Hope this time i got you right…