From 3a1f64914f175e3a3e20469cb504d80670474697 Mon Sep 17 00:00:00 2001 From: timriker Date: Tue, 22 Feb 2005 05:11:45 +0000 Subject: [PATCH] allow per-channel addressCharacter git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1165 c11ca15a-4712-0410-83d8-924469b57eb5 --- files/sample/blootbot.chan | 3 ++- files/sample/blootbot.config | 3 --- src/IRC/IrcHelpers.pl | 11 +++++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/files/sample/blootbot.chan b/files/sample/blootbot.chan index 8dba2f6..7e6e47c 100644 --- a/files/sample/blootbot.chan +++ b/files/sample/blootbot.chan @@ -1,4 +1,4 @@ -#v1: blootbot -- infobot -- written Fri Feb 18 08:39:35 2005 +#v1: blootbot -- infobot -- written Tue Feb 22 05:10:22 2005 #botpark +RootWarn @@ -41,6 +41,7 @@ _default +W3Search +Weather +Zippy + addressCharacter ~ +allowConv +allowTelling +babelfish diff --git a/files/sample/blootbot.config b/files/sample/blootbot.config index 4570cdf..bb71a63 100644 --- a/files/sample/blootbot.config +++ b/files/sample/blootbot.config @@ -125,9 +125,6 @@ set allowTelling 1 # addressing. set addressing REQUIRE -# [char] One-character easy recognition. -set addressCharacter ~ - # [str] how the bot should send messages. # PRIVATE -- reply to private messages only, rejecting public msgs. # DEFAULT -- reply to public _and_ private queries. diff --git a/src/IRC/IrcHelpers.pl b/src/IRC/IrcHelpers.pl index e620b22..13f4469 100644 --- a/src/IRC/IrcHelpers.pl +++ b/src/IRC/IrcHelpers.pl @@ -91,12 +91,19 @@ sub hookMsg { if ($msgType =~ /private/) { # private messages. $addressed = 1; + if (&IsChanConf('addressCharacter')) { + $addressCharacter = getChanConf('addressCharacter'); + if ($message =~ s/^\Q$addressCharacter\E//) { + &msg($who, "please don't use the the addressCharacter when private messaging"); + } + } } else { # public messages. # addressing revamped by the xk. ### below needs to be fixed... - if (&IsParam("addressCharacter")) { - if ($message =~ s/^\Q$param{'addressCharacter'}\E//) { + if (&IsChanConf('addressCharacter')) { + $addressCharacter = getChanConf('addressCharacter'); + if ($message =~ s/^\Q$addressCharacter\E//) { $addrchar = 1; $addressed = 1; } -- 2.39.2