]> jfr.im git - irc/SurrealServices/srsv.git/blob - branches/erry-devel/auspice/chanslurp.pl
initial commit of erry's Insp work.
[irc/SurrealServices/srsv.git] / branches / erry-devel / auspice / chanslurp.pl
1 #!/usr/bin/perl
2
3 # This file is part of SurrealServices.
4 #
5 # SurrealServices is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # SurrealServices is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with SurrealServices; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 use DBI;
20
21 %acc = (
22 3 => 2,
23 4 => 3,
24 5 => 4,
25 10 => 5,
26 13 => 6
27 );
28
29 $dbh = DBI->connect("DBI:mysql:services", "services", "yQ0AaCLdMhfEBTpxwc0OWw", { AutoCommit => 1, RaiseError => 1 });
30
31 $register = $dbh->prepare("INSERT IGNORE INTO chanreg SET chan=?, descrip=?, founder=?, pass=?, regd=?, last=?, topic=?, topicer='unknown', topicd=?, successor=?, bot=?");
32 $create_acc = $dbh->prepare("INSERT IGNORE INTO chanacc SET chan=?, nick=?, level=?, adder=?");
33
34 $time = time();
35
36 open FILE, $ARGV[0];
37
38 # 0name;1founder;2pass;3time_registered;4url;email;5mlock_key;6welcome;7hold;8mark;9freeze;10forbid;11successor;12mlock_link;13mlock_flood;14bot;15markreason;16freezereason;17holdreason;18lastgetpass;19access-level:nick:adder;20last_topic\ndesc
39
40 while(@in = split(/;/, <FILE>)) {
41 die("Too many fields in $in[0]") if @in > 21;
42 $topic = <FILE>; chomp $topic;
43 $desc = <FILE>; chomp $desc;
44 @data = ($in[0], $desc, $in[1], $in[2], $in[3], $time, $topic, $time, $in[12], $in[15]);
45 print join(', ', @data), "\n";
46 $register->execute(@data);
47 $create_acc->execute($in[0], $in[1], 7, '');
48
49 foreach $acc (split(/,/, $in[20])) {
50 @d = split(/:/, $acc);
51 next unless @d == 3;
52 $d[0] = $acc{$d[0]};
53
54 print "acc: ", join(', ', @d), "\n";
55 $create_acc->execute($in[0], $d[1], $d[0], $d[2]);
56 }
57 }
58