| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | # Created by: |
|---|
| 4 | # Stijn Van Looy <Stijn.VanLooy@rug.ac.be> |
|---|
| 5 | # |
|---|
| 6 | # Comments: Use at own risk, first doublecheck the files generated by this |
|---|
| 7 | # script, before you overwrite your licq configfiles. I guess you |
|---|
| 8 | # ain't a fool. ;-) |
|---|
| 9 | # |
|---|
| 10 | # Tested with gnomeICU 0.93 and licq 0.81. |
|---|
| 11 | |
|---|
| 12 | # HOW TO USE THIS SCRIPT: |
|---|
| 13 | # |
|---|
| 14 | # First you need to copy the gnomeICU config file (mostly found in |
|---|
| 15 | # ~/.gnome, depending on version, it can be named GnomeICU, gnomeicu, |
|---|
| 16 | # .GnomeICU, and so on) into the directory you put this script in, |
|---|
| 17 | # and rename it to GnomeICU. |
|---|
| 18 | # |
|---|
| 19 | # Then edit it so only the lines containing uin=alias remain in the file. |
|---|
| 20 | # (The last line also needs a linefeed, otherwise the last char of the |
|---|
| 21 | # last alias is stripped off) |
|---|
| 22 | # |
|---|
| 23 | # Run this script. |
|---|
| 24 | # |
|---|
| 25 | # Copy users.conf and the users dir into ~/.licq/ |
|---|
| 26 | |
|---|
| 27 | $infile = 'GnomeICU'; |
|---|
| 28 | @uins = (); |
|---|
| 29 | @aliases = (); |
|---|
| 30 | |
|---|
| 31 | open (infile, $infile); |
|---|
| 32 | while ($line = <infile>) { |
|---|
| 33 | chop $line; |
|---|
| 34 | $temp = $line; |
|---|
| 35 | $temp =~ s/([0-9]+)=(.*)/\1/; |
|---|
| 36 | push @uins, $temp; |
|---|
| 37 | $line =~ s/([0-9]+)=(.*)/\2/; |
|---|
| 38 | push @aliases, $line; |
|---|
| 39 | } |
|---|
| 40 | close infile; |
|---|
| 41 | $temp = $#uins + 1; |
|---|
| 42 | print "Converting $temp UINs ... \n"; |
|---|
| 43 | |
|---|
| 44 | $head = " |
|---|
| 45 | [user] |
|---|
| 46 | History = default |
|---|
| 47 | Groups.System = 0 |
|---|
| 48 | Groups.User = 1 |
|---|
| 49 | Ip = |
|---|
| 50 | Port = |
|---|
| 51 | NewUser = 0 |
|---|
| 52 | NewMessages = 0 |
|---|
| 53 | LastOnline = 0 |
|---|
| 54 | AutoAccept = 0 |
|---|
| 55 | StatusToUser = 65535 |
|---|
| 56 | CustomAutoRsp = \n"; |
|---|
| 57 | $tail = "FirstName = |
|---|
| 58 | LastName = |
|---|
| 59 | Email1 = |
|---|
| 60 | Email2 = |
|---|
| 61 | City = |
|---|
| 62 | State = |
|---|
| 63 | PhoneNumber = |
|---|
| 64 | FaxNumber = |
|---|
| 65 | Address = |
|---|
| 66 | CellularNumber = |
|---|
| 67 | Zipcode = 0 |
|---|
| 68 | Country = 65535 |
|---|
| 69 | Timezone = 0 |
|---|
| 70 | Authorization = 1 |
|---|
| 71 | HideEmail = 0 |
|---|
| 72 | Age = 65535 |
|---|
| 73 | Gender = 0 |
|---|
| 74 | Homepage = |
|---|
| 75 | BirthYear = 0 |
|---|
| 76 | BirthMonth = 0 |
|---|
| 77 | BirthDay = 0 |
|---|
| 78 | Language1 = 0 |
|---|
| 79 | Language2 = 0 |
|---|
| 80 | Language3 = 0 |
|---|
| 81 | CompanyCity = |
|---|
| 82 | CompanyState = |
|---|
| 83 | CompanyPhoneNumber = |
|---|
| 84 | CompanyFaxNumber = |
|---|
| 85 | CompanyAddress = |
|---|
| 86 | CompanyName = |
|---|
| 87 | CompanyDepartment = |
|---|
| 88 | CompanyPosition = |
|---|
| 89 | CompanyHomepage = \n"; |
|---|
| 90 | |
|---|
| 91 | system 'mkdir users; chmod 700 users'; |
|---|
| 92 | for (0..$#uins) { |
|---|
| 93 | $outfile = ">users/$uins[$_].uin"; |
|---|
| 94 | open (outfile, $outfile); |
|---|
| 95 | print outfile $head; |
|---|
| 96 | print outfile "Alias = $aliases[$_]\n"; |
|---|
| 97 | print outfile $tail; |
|---|
| 98 | close outfile; |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | $outfile = '>users.conf'; |
|---|
| 102 | open (outfile, $outfile); |
|---|
| 103 | $temp = $#uins + 1; |
|---|
| 104 | print outfile "[users]\nNumOfUsers = $temp\n"; |
|---|
| 105 | for (0..$#uins) { |
|---|
| 106 | $temp = $_ + 1; |
|---|
| 107 | print outfile "User$temp = $uins[$_]\n"; |
|---|
| 108 | } |
|---|
| 109 | close outfile; |
|---|
| 110 | print "Done. |
|---|
| 111 | Now copy the users dir and the users.conf file into your licq dir (~/.licq).\n" |
|---|