Chat message to not registered user


I am new to openfire and i have set up a openfire server 3.7.0 and i came across a point where i could not find anything out there.

I would like to implement xmpp into one of my projects. And in this projects it could happen that a message is sent to a user that does not exist on the openfire server.

I have noticed that openfire currently drops them silently. So the user does not know about it. What i need is the following.

-When the user is registered and offline, the chat message is delivered normally.

-When the user is offline OR unknown, the message should be offline stored (including sent file) and passed on to an external … system/script/… whatever.

-When the user is registering/going online, the messages and files should be delivered to the user.

Any idea how to do that? Or is it something that is impossible with openfire?