File: licq.winconvert

package info (click to toggle)
licq-data 1.3-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 796 kB
  • ctags: 17
  • sloc: perl: 617; sh: 187; makefile: 47; ansic: 18
file content (77 lines) | stat: -rwxr-xr-x 1,648 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/perl
#
# frontend for ICQ98, ICQ99a & ICQ99b converter, version 2
#
# (c)1999 Erwin Aitenbichler <eait@gmx.at>
# This program is released under the terms of the GPL.
#

if ($#ARGV<0)
 {
  print "syntax:  licq.winconvert <windows_icq_dir>\n";
  print "Extracts all UINs out of an ICQ98, ICQ99a or ICQ99b database.\n\n";
  print "This script requires long filenames. (mount -vfat)\n";
  print "example: licq.winconvert /mnt/Program Files/icq/\n\n";
  exit;
 }

if ($0=~/^(.*)licq.winconvert$/)
 {
  $scriptdir=$1;
 } 

$path=$ARGV[0];
$path.="/" if ($path!~/\/$/);
exit if process_dir($path."Db99b/", ".dat", 3);
exit if process_dir($path."NewDB/", ".dat", 2);
exit if process_dir($path."db/", "msg.idx", 1);
exit if process_dir($path."DB/", "msg.idx", 1);
print "no database found.\n";

sub process_dir()
 {
  ($dir,$postfix,$ver)=@_;
  opendir(DIR, $dir);
  @files=();
  while($fn=readdir(DIR))
   {
    push(@files, $fn) if ($fn=~/^\d+$postfix/);
   }
  return 0 if($#files<0);
  if ($#files==0)
   {
    process_db($dir.$files[0], $ver);
    return 1;
   }
  foreach(@files)
   {
    print "import $_? [y] ";
    $c=<STDIN>;
    chop $c;
    if ($c eq "" || $c eq "y")
     {
      process_db($dir.$_, $ver);
     }
   }
  return 1;
 }

sub process_db()
 {
  ($fn,$ver)=@_;
  if ($ver==1)
   {
    print "found icq98 database $fn\n";
    system($scriptdir."licq.winconvert98 \"$fn\"");
   }
  elsif ($ver==2)
   {
    print "found icq99a database $fn\n";
    system($scriptdir."licq.winconvert99a \"$fn\"");
   }
  else
   {
    print "found icq99b database $fn\n";
    system($scriptdir."licq.winconvert99b \"$fn\"");
   }
 }