Hello.
I’'d like to know is someone knows a good JID migration tool (to “migrate” to jabber.org to another server for example).
Regards.
Hello.
I’'d like to know is someone knows a good JID migration tool (to “migrate” to jabber.org to another server for example).
Regards.
There is indeed.
You can use the User Import/Export wildfire plugin.
Here is the readme:
http://www.jivesoftware.org/wildfire/plugins/userimportexport/readme.html
Hello.
I was thinking about a more user-centric solution with almost no complicated intervention.
It’'s just to migrate one JID to another, not a bunch of users.
Rgds.
I’‘ve done this really ugly piece of code. It might be full of mistakes, I’'m not really a java dev. I think it would be fine to have this possibility in the Registration plugin for example.
public static void doMigration(String user1, String password1, String server1, String user2, String password2, String server2) {
try {
// Create a connection to the server.
XMPPConnection con = new SSLXMPPConnection(server1);
con.login(user1,password1);
// Create a connection to the second server.
XMPPConnection con2 = new SSLXMPPConnection(server2);
try {
con2.login(user2, password2);
} catch (XMPPException xe) {
//if first login failed, try to create an account and then login
//connection.loginAnonymously(); //tried with and without this line
System.out.println("Création compte de test");
AccountManager accountMgr2 = con2.getAccountManager();
accountMgr2.createAccount(user2, password2);
con2.login(user2, password2);
}
Roster roster = con.getRoster();
Roster roster2 = con2.getRoster();
for (Iterator i=roster.getEntries(); i.hasNext(); ) {
RosterEntry machin = (RosterEntry) i.next();
if (roster2.getEntry(machin.getUser()) == null) roster2.createEntry(machin.getUser(), machin.getName(), new String[0]);
System.out.println("Migration JID: " + machin.getUser());
}
// AccountManager accountMgr = con.getAccountManager();
// accountMgr.deleteAccount();
con.close();
con2.close();
} catch (XMPPException e) {
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
System.out.println("well done");
}
}