# AlcServ quote module. Designed to facilitate use of channel quotes. # Written by Saint skullY the Dazed # How it works: # ADD: /msg QuoteServ add #channel quote # RANDOM: /msg QuoteServ random #channel # FIND: /msg QuoteServ find #channel text # FINDNICK: /msg QuoteServ findnick #channel nick # HELP: /msg QuoteServ help # Configuration section @ QUOTECOMMANDS = [HELP ADD RANDOM FIND FINDNICK] @ QUOTENICK = [QuoteServ] @ QUOTESAVE = [/homea/jailbird/as/Quotes] #@ QUOTESAVE = [/home/users/zwhite/as/Quotes] @ QUOTELOG = [/homea/jailbird/as/logs/quote.log] #@ QUOTELOG = [/home/users/zwhite/as/logs/quote.log] # Don't change these unless you know what you're doing! (What if we don't # know in the first place?) @ QUOTESTART = [Y] # When alcserv stops, quit with the appropriate reason EVAL ^on #^hook 23 "stop *" { EVAL ^send :$QUOTENICK QUIT :$1- } # Logging facility eval assign quotelogfd $open($QUOTELOG W) # Send messages alias quoteprivmsg ^send :$QUOTENICK PRIVMSG $0 :$1- alias quotenotice ^send :$QUOTENICK NOTICE $0 :$1- # This sends the user help when they request it EVAL ^on #^hook 23 "privmsg % $QUOTENICK %help*" { quotenotice $1 Help for $QUOTENICK: quotenotice $1 + help This message quotenotice $1 + add Add a quote quotenotice $1 + random Send a random quote quotenotice $1 + find Search for quotenotice $1 + quotenotice $1 + $QUOTENICK is channel based, and maintains seperate lists for quotenotice $1 + each channel. Theorectically, they don't get intermingled. quotenotice $1 + quotenotice $1 + If you have any problems, msg skullY or email skully@onix.net. } # This traps find requests to QuoteServ EVAL ^on #^hook 23 "privmsg % $QUOTENICK %find *" { :$write($quotelogfd $stime($time()) $1 requested FIND for $4 on $5-) assign findfd $open($QUOTESAVE/$tolower($strip(# $4) R)) assign gerbil 0 while ( 1 ) { assign -drug assign drug $read($findfd) if ([$strlen($drug)] > [1]) { if ((match(*$5* $drug))) { assign hax[$gerbil] $encode($drug) @ gerbil++ if ( gerbil > 19 ) { ^quotenotice $1 More than 20 matches found, limiting to the first 20 ^quotenotice $1 You might try refining your search break } } # if ((match(*$5-* $drug))) }{ break } # if ([$strlen($drug)] > [1]) } :$close($findfd) if ([$hax[0]]) { quoteprivmsg $4 Quote find request for \"$5-\" by $1 foreach hax bax { quoteprivmsg $4 $decode($hax[$bax]) assign -hax[$bax] } }{ quotenotice $1 Sorry, no matches found for \"$5-\" } } EVAL ^on #^hook 23 "privmsg % $QUOTENICK %random*" { :$write($quotelogfd $stime($time()) $1 requested RANDOM for $4) if ([$4]) { ^assign randquote $srand($time())$randread($QUOTESAVE/$tolower($strip(# $4))) if ( randquote ) { ^quoteprivmsg $4 Random Quote: $randquote \(Requested by: $1\) }{ ^quotenotice $1 Error opening quotefile. Have any quotes been added for that channel yet? ^quotenotice $1 If so, email skully@onix.net with the command you used } }{ ^quotenotice $1 You must supply a channel name! } } # This traps quote add requests to QuoteServ. EVAL ^on #^hook 23 "privmsg % $QUOTENICK %add *" { :$write($quotelogfd $stime($time()) $1 requested ADD for $4: $5-) if ([$#] < 6) { ^quotenotice $1 Excuse me? Try /msg $QUOTENICK help }{ # I don't think $open() and $close() are part of ircii, but they make this # so incredibly easy and painless I'd be a fool not to use them. The # downside is that QuoteServ only works on epic clients. ^assign quotefd $open($QUOTESAVE/$tolower($strip(# $4) W)) if (quotefd > 0) { if ([$write($quotefd $5-)]) { ^quotenotice $1 Added quote to $4's quote list ^quoteprivmsg $4 $1 added quote: $5- } }{ ^quotenotice $1 Error opening quotefile. Email skully@onix.net with the command you used } :$close($quotefd) } } # This traps garbage EVAL ^on #^hook 23 "privmsg % $QUOTENICK *" { ^quotenotice $1 Excuse me? Try /msg $QUOTENICK help } # Start the service at the appropriate time alias startquote { ^makeuser $QUOTENICK $QUOTENICK $SERVNAME + $QUOTENICK - /msg $QUOTENICK help @ QUOTESTART = [N] } EVAL ^on #hook 23 "start" { ^startquote }