PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: achiever on 20 May, 2007, 11:32:49

Title: merge registered users xml
Post by: achiever on 20 May, 2007, 11:32:49
hi,

i m need of a script which could merge two registered users xml file as, i redirect non-registered users to other hub to get themselves regged. and also i have regged some users in the main hub so now i need to merge the 2 xmls files with all the users (common and uncommon) in both the xml files.

so can some 1 plzz make 1 such script?

thks,
achiever.
Title: Re: merge registered users xml
Post by: Tw?sT?d-d?v on 20 May, 2007, 13:45:51
Would be quicker to open the 2 files up in notepad and copy and paste the extra 1s over .
Title: Re: merge registered users xml
Post by: achiever on 20 May, 2007, 13:55:05
but i will have to search for the extra names and it would surely be a difficult task to campare so many names.
Title: Re: merge registered users xml
Post by: bastya_elvtars on 20 May, 2007, 15:40:34
There is a program called WinMerge (http://winmerge.org/). It compares two files.
Title: Re: merge registered users xml
Post by: achiever on 21 May, 2007, 07:24:19
Quote from: bastya_elvtars on 20 May, 2007, 15:40:34
There is a program called WinMerge. It compares two files.
a effective tool
but it also changes the pass of users if it has been changed by him back again to old 1's :( , had to do a lot of work to get this done.

is there some other method to just add the details of new nicks and not change ne other part to both xmls?

thks,
Title: Re: merge registered users xml
Post by: bastya_elvtars on 21 May, 2007, 13:47:38
I think reglists can only be sync'd if one hub connects to another as a client.
Title: Re: merge registered users xml
Post by: achiever on 21 May, 2007, 15:04:45
and how can that be done?
Title: Re: merge registered users xml
Post by: bastya_elvtars on 21 May, 2007, 15:17:03
It can be scripted with luasockets.
Title: Re: merge registered users xml
Post by: achiever on 21 May, 2007, 15:42:49
can simple script not be made to compare the two xmls and add the nick absent from either?
Title: Re: merge registered users xml
Post by: bastya_elvtars on 21 May, 2007, 17:24:52
Quote from: achiever on 21 May, 2007, 15:42:49
can simple script not be made to compare the two xmls and add the nick absent from either?

That requires a lua module too. Synchronizing via PtokaX is easier and no hubrestart is needed after synchronization as well.
Title: Re: merge registered users xml
Post by: achiever on 21 May, 2007, 18:34:49
plzz xplain how should i go on doing this?
Title: Re: merge registered users xml
Post by: Tw?sT?d-d?v on 21 May, 2007, 21:21:51
I still say opening the 2 XML's up and copy and pasting would have been easyer ... I ve done this before ..
Backup both copys up 1st ... open to 2 files up in notepad(or whatever you use) copy and paste all nicks into the other ..
When you then start hub up, you shud get popup saying duplicate user reg'd with option to delete ( or somethin along them lines )..
Takes about 30 - 60 secs depending on how many users are reg'd
Title: Re: merge registered users xml
Post by: bastya_elvtars on 22 May, 2007, 03:53:50
In fact it requires a hubside script as well to provide the data available to the hub. An example of simple communication:
connect -> LockToKey handshake -> sending a unique command, like $RegSync <password> -> would send back the data required (return value of GetRegisteredUsers() coinverted to a string) and then close the conn.
Hell of work.
Title: Re: merge registered users xml
Post by: achiever on 22 May, 2007, 19:20:56
Quote from: Tw?sT?d-d?v?l on 21 May, 2007, 21:21:51
I still say opening the 2 XML's up and copy and pasting would have been easyer ... I ve done this before ..
Backup both copys up 1st ... open to 2 files up in notepad(or whatever you use) copy and paste all nicks into the other ..
When you then start hub up, you shud get popup saying duplicate user reg'd with option to delete ( or somethin along them lines )..
Takes about 30 - 60 secs depending on how many users are reg'd
i did not understand u earlier i have not recieved ne popup or ne such thing alerting me of duplicate users.
in fact the xml has still got duplicate users and when my ptokax starts it has just the original list :(

whats going wrong
Title: Re: merge registered users xml
Post by: Tw?sT?d-d?v on 22 May, 2007, 20:07:56
By any chance did you copy these lines too

<?xml version="1.0" encoding="windows-1252" standalone="yes" ?>
<RegisteredUsers>


If you have these in the regusers.xml twice make sure you remove the 2nd one .
Dose urs look something like this , If so remove where i put remove

<?xml version="1.0" encoding="windows-1252" standalone="yes" ?>                <<<<<<    Keep
<RegisteredUsers>                                                                                 <<<<<<    Keep
    <RegisteredUser>
        <Nick>(Angmar)</Nick>
        <Password>****</Password>
        <Profile>1</Profile>
    </RegisteredUser>
    <RegisteredUser>
        <Nick>(NRG)Rebel</Nick>
        <Password>****</Password>
        <Profile>1</Profile>
    </RegisteredUser>
<?xml version="1.0" encoding="windows-1252" standalone="yes" ?>             <<<<<<  Remove
<RegisteredUsers>                                                                              <<<<<<  Remove
    <RegisteredUser>
        <Nick>(Angmar)</Nick>
        <Password>****</Password>
        <Profile>1</Profile>
    </RegisteredUser>
    <RegisteredUser>
        <Nick>(NRG)Rebel</Nick>
        <Password>****</Password>
        <Profile>1</Profile>
    </RegisteredUser>


If you need help with it   email me the 2 files and ill do them for you
twisted-devil@hotmail.co.uk
Title: Re: merge registered users xml
Post by: achiever on 23 May, 2007, 07:05:53
thanks a looooottttttt for ur help
i was not copying the 1st two lines but instead i was copying the last 1

again thanks a lot for ur help :))
achiever