Changeset 107f1de91b246fbacbe7ad9de1281d0c25831e89
- 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
| r43b5cd9 |
r107f1de |
|
| 592 | 592 | # |
|---|
| 593 | 593 | @quiet = Set.new |
|---|
| | 594 | # but we always speak here |
|---|
| | 595 | @not_quiet = Set.new |
|---|
| 594 | 596 | |
|---|
| 595 | 597 | # the nick we want, if it's different from the irc.nick config value |
|---|
| … | … | |
| 785 | 787 | # checks if we should be quiet on a channel |
|---|
| 786 | 788 | 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) |
|---|
| 788 | 791 | end |
|---|
| 789 | 792 | |
|---|
| … | … | |
| 791 | 794 | if channel |
|---|
| 792 | 795 | ch = channel.downcase.dup |
|---|
| | 796 | @not_quiet.delete(ch) |
|---|
| 793 | 797 | @quiet << ch |
|---|
| 794 | 798 | else |
|---|
| 795 | 799 | @quiet.clear |
|---|
| | 800 | @not_quiet.clear |
|---|
| 796 | 801 | @quiet << '*' |
|---|
| 797 | 802 | end |
|---|
| … | … | |
| 800 | 805 | def reset_quiet(channel = nil) |
|---|
| 801 | 806 | if channel |
|---|
| 802 | | @quiet.delete channel.downcase |
|---|
| | 807 | ch = channel.downcase.dup |
|---|
| | 808 | @quiet.delete(ch) |
|---|
| | 809 | @not_quiet << ch |
|---|
| 803 | 810 | else |
|---|
| 804 | 811 | @quiet.clear |
|---|
| | 812 | @not_quiet.clear |
|---|
| 805 | 813 | end |
|---|
| 806 | 814 | end |
|---|