Pre-populate Buddy List

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
dieffe
Posts: 29
Joined: 27 Nov 2008, 09:08

Pre-populate Buddy List

Post by dieffe »

Hello,
is it possible to pre populate the buddy list without to user to be online?
I mean i have a pre owned buddy list ( mysql based ) and i wish to import it into SmartFox actual Buddy list ( Buddylist 2.0 ) so that when the user comes online he/she will find his/her buddylist already filled with the record from the html version buddy list.

Is it doable?

Thanks
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Hi,
at the moment we don't have a generic import utility capable of doing this.
Lapo
--
gotoAndPlay()
...addicted to flash games
dieffe
Posts: 29
Joined: 27 Nov 2008, 09:08

Post by dieffe »

after a lot of thinking i came up with something like this:

Code: Select all

   a=_server.getCurrentZone();
   var sql = "SELECT * FROM amici";
   var queryRes = dbase.executeQuery(sql);  
   n=0;
   for (var i = 0; i < queryRes.size(); i++)
   {
                var tempRow = queryRes.get(i)
                utente=tempRow.getItem("utente");
                buddy=tempRow.getItem("buddy");
                a.addBuddy(utente, buddy);
                n++;
    }
   trace("Buddy Importata per " + n + " utenti");
I run this inside a init() of an extension. I infact menaged to get the buddy list loaded but the first time i relog into the server all the buddy are empty.

Does this make any sense?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Sure, you can parse your previous data and create a small script that does the translation
Lapo
--
gotoAndPlay()
...addicted to flash games
dieffe
Posts: 29
Joined: 27 Nov 2008, 09:08

Post by dieffe »

Ok but this script is working only after the first time i load the extension from the admin interface, after the first reload the buddy lists are empty and stays this way till i reload the extension from the admin interface again.

Why?
Post Reply