]> jfr.im git - irc/SurrealServices/srsv.git/blob - tags/0.4.3.1-pre2/auspice/nickslurp.pl
cut of branches/0.4.3
[irc/SurrealServices/srsv.git] / tags / 0.4.3.1-pre2 / auspice / nickslurp.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 $dbh = DBI->connect("DBI:mysql:services", "services", "yQ0AaCLdMhfEBTpxwc0OWw", { AutoCommit => 1, RaiseError => 1 });
22
23 $register = $dbh->prepare("INSERT IGNORE INTO nickreg SET nick=?, pass=?, email=?, regd=?, last=?, flags=1, ident=?, vhost=?, gecos=?, quit=?");
24 $create_alias = $dbh->prepare("INSERT IGNORE INTO nickalias SET root=?, alias=?");
25
26 $time = time();
27
28 open FILE, $ARGV[0];
29
30 while(@in = split(/;/, <FILE>)) {
31 next unless($in[2] eq 'slave:no');
32
33 my ($ident, $host) = split('@', $in[3]) or ('', '');
34 next unless $ident;
35
36 @data = ($in[0], $in[1], $in[6], $in[4], $time, $ident, $host, $in[17], $in[16]);
37 print join(', ', @data), "\n";
38 $register->execute(@data);
39 $create_alias->execute($in[0], $in[0]);
40 }
41
42 open FILE, $ARGV[0];
43
44 while(@in = split(/;/, <FILE>)) {
45 next unless($in[2] eq 'slave:yes');
46
47 @data = ($in[3], $in[0]);
48 print join(', ', @data), "\n";
49 $create_alias->execute(@data);
50 }