Created
October 24, 2017 21:53
-
-
Save libussa/877e19ad2589cc1d29e7d37ec58ed6b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hexchat | |
__module_name__ = 'Ignore Channel' | |
__module_version__ = '0.5' | |
__module_description__ = 'Later' | |
#always ignore those channels | |
channels2ignore = set(["#spam"]) | |
channels2ignoreTMP = set([]) | |
# add some channel to the temporary ignored list | |
def ic(word, word_eol, userdata): | |
global channels2ignoreTMP | |
channels2ignoreTMP.add(hexchat.get_info("channel")) | |
hexchat.prnt("Temporarily ignored channels: %s" % channels2ignoreTMP) | |
# remove some channel from the temporary ignored list | |
def icc(word, word_eol, userdata): | |
global channels2ignoreTMP | |
channels2ignoreTMP.discard(hexchat.get_info("channel")) | |
hexchat.prnt("Temporarily ignored channels: %s" % channels2ignoreTMP) | |
# clear the temporary ignored list | |
def icclear(word, word_eol, userdata): | |
global channels2ignoreTMP | |
channels2ignoreTMP = set([]) | |
hexchat.prnt("Temporarily ignored channels: %s" % channels2ignoreTMP) | |
def channel2ignore_cb(word, word_eol, userdata): | |
global channels2ignoreTMP | |
if (hexchat.get_info("channel") in channels2ignore or hexchat.get_info("channel") in channels2ignoreTMP): | |
hexchat.command("gui color 0") | |
return hexchat.EAT_NONE | |
hexchat.hook_print("Channel Message", channel2ignore_cb) | |
hexchat.hook_print("Join", channel2ignore_cb) | |
hexchat.hook_print("Part", channel2ignore_cb) | |
hexchat.hook_print("Part with Reason", channel2ignore_cb) | |
hexchat.hook_print("Channel Action", channel2ignore_cb) | |
hexchat.prnt(__module_name__ + " V" + __module_version__ + " loaded!") | |
hexchat.hook_command('ic', ic) | |
hexchat.hook_command('icc', icc) | |
hexchat.hook_command('icclear', icclear) | |
# /ic to add the current channel to the temporary ignore list | |
# /ic to remove the current channel from the temporary ignore list | |
# /icclear to clear the temporary ignored list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment