This tutorial will help you to migrate an Openfire database to ejabberd. Since there is no direct way to migrate from Openfire to ejabberd, you first need to migrate from Openfire to jabberd 1.4 XML spool files with a PHP script. Afterwards you can complete the migration process by pointing ejabberd to the directory containing the jabberd 1.4 compatible XML spool files.
Original conversion script and tutorial were written by: T. Ephraim
Install the Import/Export Plugin via the Openfire Webinterface.
Export your database to a file named like your realm. So for a jabber server named firstname.lastname@example.org the file name should be "jabber.example.org.xml".
Execute the script with two parameters: the first parameter is the path to the file which you have currently exported. The second parameter is the path to an empty directory in which a jabberd spool directory will be created.
After you created successfully the spool directory, you can have a look at the user xdb-files, to check if all seems to be correct.
I had some problems with special chars in the nicknames of the contacts of my user. Just edit the user xdb-file (it's just a xml) and call ejabberdctl multiple times. It doesn't import, just imported users, multiple times. But it mentions the user xdbfiles which it has had probs with ;)