Added update check for non-indev releases.

This commit is contained in:
Elijah Perrault committed 2011-02-05 01:03:36 -07:00
1 parent dbc7da9d34
commit 75784ec96c
2 files changed
+39 -4

No files matched your search

+38 -4
View File
@@ -105,12 +105,46 @@ println "* ".NAME." (version ".VER.".".SVER.".".REV.RSTAGE.") is starting up..."
our ($APID, %TIMERS);
# Check for debug mode.
# Get arguments.
our $DEBUG = 0;
our $NUC = 0;
if (defined $ARGV[0]) {
if ($ARGV[0] eq '-d') {
$DEBUG = 1;
}
foreach (@ARGV) {
given ($_) {
when ('-d') { $DEBUG = 1; }
when ('-nuc') { $NUC = 1; }
}
}
}
# Check for updates.
if (!$NUC and RSTAGE ne 'd') {
println "* Connecting to update server...";
my $uss = IO::Socket::INET->new(
'Proto' => 'tcp',
'PeerAddr' => 'dist.xelhua.org',
'PeerPort' => 80,
'Timeout' => 30
) or err(1, "Cannot connect to update server! Aborting update check.");
send($uss, "GET http://dist.xelhua.org/auto/version.txt\n", 0);
my $dll = '';
while (my $data = readline($uss)) {
$data =~ s/(\n|\r)//g;
my ($v, $c) = split('=', $data);
if ($v eq "url") {
$dll = $c;
}
elsif ($v eq "version") {
if (VER.".".SVER.".".REV.RSTAGE ne $c) {
println("!!! NOTICE !!! Your copy of Auto is outdated. Current version: ".VER.".".SVER.".".REV.RSTAGE." - Latest version: ".$c);
println("!!! NOTICE !!! You can get the latest Auto by downloading ".$dll);
}
else {
println("* Auto is up-to-date.");
}
}
}
}
# Parse configuration file.
+1
View File
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev
==================================================================
* Added update check for non-indev releases.
* Added Git revision to version string for dev releases.
* Added an FML module for retrieving random FML quotes.
* Privilege to use a command is now handled by the priv arg of