Changeset 107f1de91b246fbacbe7ad9de1281d0c25831e89

Show
Ignore:
Timestamp:
09/05/08 22:07:38 (3 months ago)
Author:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
git-committer:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> 1220638058 +0200
git-parent:

[362295025c0b9bb6ba98579047ab68b3fc5723a9]

git-author:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> 1220638058 +0200
Message:

quiet exception list

Keep a track of exceptions to a global 'quiet' command so that user can
use !quiet and !talk in here to make the bot only talk in one channel
without quiet-ing it by hand in each one of the other channels.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/rbot/ircbot.rb

    r43b5cd9 r107f1de  
    592592    # 
    593593    @quiet = Set.new 
     594    # but we always speak here 
     595    @not_quiet = Set.new 
    594596 
    595597    # the nick we want, if it's different from the irc.nick config value 
     
    785787  # checks if we should be quiet on a channel 
    786788  def quiet_on?(channel) 
    787     return @quiet.include?('*') || @quiet.include?(channel.downcase) 
     789    ch = channel.downcase 
     790    return (@quiet.include?('*') && !@not_quiet.include?(ch)) || @quiet.include?(ch) 
    788791  end 
    789792 
     
    791794    if channel 
    792795      ch = channel.downcase.dup 
     796      @not_quiet.delete(ch) 
    793797      @quiet << ch 
    794798    else 
    795799      @quiet.clear 
     800      @not_quiet.clear 
    796801      @quiet << '*' 
    797802    end 
     
    800805  def reset_quiet(channel = nil) 
    801806    if channel 
    802       @quiet.delete channel.downcase 
     807      ch = channel.downcase.dup 
     808      @quiet.delete(ch) 
     809      @not_quiet << ch 
    803810    else 
    804811      @quiet.clear 
     812      @not_quiet.clear 
    805813    end 
    806814  end