* server:nspass removed. server:idstr added.

* Changed the way we parse strings to support multi-word
      strings in config values.
This commit is contained in:
Elijah Perrault committed 2011-01-21 00:39:49 -07:00
1 parent a4317ecec7
commit ed65193529
3 files changed
+35 -5

No files matched your search

+3
View File
@@ -3,6 +3,9 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev
==================================================================
* server:nspass removed. server:idstr added.
* Changed the way we parse strings to support multi-word
strings in config values.
* Added server:nspass to config options. Will be replaced in
the future by idstr.
* Parse NICK.
+29 -2
View File
@@ -67,9 +67,36 @@ sub parse
next;
}
my $param = $ebuf[1];
$param =~ s/"//g;
my @param = ($param);
if (substr($param, 0, 1) eq '"' and substr($param, length($param) - 1, 1) ne '"') {
# Multi-word string.
$param = substr($param, 1);
for (my $i = 2; $i < scalar(@ebuf); $i++) {
if (substr($ebuf[$i], length($ebuf[$i]) - 1, 1) eq '"') {
$param .= " ".substr($ebuf[$i], 0, length($ebuf[$i]) - 1);
last;
}
else {
$param .= " ".$ebuf[$i];
}
}
}
elsif (substr($param, 0, 1) eq '"' and substr($param, length($param) - 1, 1) eq '"') {
# Single-word string.
$param = substr($param, 1, length($ebuf[1]) - 2);
}
elsif ($param =~ m/[0-9]/) {
# Numeric.
$param =~ s/[^0-9.]//g;
}
else {
# Garbage.
next;
}
my @param = ($param);
unless (!$blk) {
# We're inside a block.
if ($blk =~ m/@@@/) {
+3 -3
View File
@@ -57,9 +57,9 @@ sub num001
$got_001{$svr} = 1;
# Identify string.
unless (!conf_get("server:$svr:nspass")) {
my $nspass = (conf_get("server:$svr:nspass"))[0][0];
Auto::socksnd($svr, "PRIVMSG NickServ :IDENTIFY $nspass");
unless (!conf_get("server:$svr:idstr")) {
my $idstr = (conf_get("server:$svr:idstr"))[0][0];
Auto::socksnd($svr, $idstr);
}
# Get the auto-join from the config.