def __init__(self): # fix find a way to remove use of globals self.festival=festival() self.vocalized_channels = set() self.vocalized_nicks = set() self.muted_nicks_in_channels = set() self.actors = { "caleb" : "(voice_kal_diphone)", "ken" : "(voice_ked_diphone)", "randal" : "(voice_rab_diphone)", "alan" : "(voice_cmu_us_awb_arctic_clunits)", "brett" : "(voice_cmu_us_bdl_arctic_clunits)", "carmen" : "(voice_cmu_us_clb_arctic_clunits)", "jerry" : "(voice_cmu_us_jmk_arctic_clunits)", "roger" : "(voice_cmu_us_rms_arctic_clunits)", "sarah" : "(voice_cmu_us_slt_arctic_clunits)", } self.unpack() self.substitutions={ } xchat.hook_command("unmute", self.unmute, help="/unmute [speaker] Turn on speech for this window or a specific speaker in this channel") xchat.hook_command("mute", self.mute, help="/mute [speaker] Turn off speech for this window, or mute a specific speaker in this channel") xchat.hook_command("pronounce", self.pronounce, help="'/pronounce word [pronunciation]' - Fix pronunciation for a word, or delete the pronunciation if it exists.") xchat.hook_command("cast", self.cast, help="'/cast nick [actor]' cast an actor as a particular nick, or clear that casting.") xchat.hook_server("PRIVMSG", self.chat_hook)
def initialize(): print "initialize" global original_nick, timer_begins, timer_ends global uppercase_hook, action_hook, nick_hook, heretic_hook global ACF_BEGIN_TIME, ACF_END_TIME, has_joined has_joined = True hooks = [timer_begins, timer_ends, uppercase_hook, action_hook, nick_hook, heretic_hook] for h in hooks: if h is not None: xchat.unhook(h) h = None timer_begins = xchat.hook_timer(time_to(ACF_BEGIN_TIME), ACF_begin) timer_ends = xchat.hook_timer(time_to(ACF_END_TIME), ACF_end) uppercase_hook = xchat.hook_command("", to_uppercase) action_hook = xchat.hook_command("me", to_uppercase_action) nick_hook = xchat.hook_command("nick", change_nick) heretic_hook = xchat.hook_server("PRIVMSG", heretic_patrol) xchat.hook_command("leave", leave_dc801) original_nick = xchat.get_info("nick") if all_caps_friday() and original_nick.islower(): new_nick = original_nick.upper() cmd = "nick %s" % new_nick xchat.command(cmd) return xchat.EAT_ALL return xchat.EAT_NONE
def ghostcb(word, word_eol, userdata): c = xchat.get_context() nick = word[3] #use this instead of preferred nick, I guess. pw = c.get_info("nickserv") u = {"context":c, "nick":nick} u["hook"] = xchat.hook_server("NOTICE", noticecb, userdata=u) xchat.command("msg nickserv ghost {} {}".format(nick, pw)) return xchat.EAT_NONE
def ghostcb(word, word_eol, userdata): c = xchat.get_context() nick = word[3] #use this instead of preferred nick, I guess. pw = c.get_info("nickserv") u = {"context": c, "nick": nick} u["hook"] = xchat.hook_server("NOTICE", noticecb, userdata=u) xchat.command("msg nickserv ghost {} {}".format(nick, pw)) return xchat.EAT_NONE
def noticecb(word, word_eol, userdata): match = NICKPATTERN.match(word[0]) matchtxt = 'Ghost with your nick has been killed.' if not match or xchat.nickcmp(match.group(1), 'NickServ') != 0: return xchat.EAT_NONE if word_eol[-2][1:] == 'Access denied.': xchat.unhook(userdata["hook"]) elif len(word_eol) > 7 and word_eol[-7][1:] == matchtxt: u = {} u.update(userdata) c = u["context"] c.command("nick " + u["nick"]) u["hook"] = xchat.hook_server("", identifycb, userdata=u) xchat.unhook(userdata["hook"]) return xchat.EAT_NONE
def __init__(self): self.id_dh = {} self.hooks = [ xchat.hook_command('', self.on_send_message), xchat.hook_command('ME', self.on_send_me), xchat.hook_command('MSG', self.on_send_msg), xchat.hook_command('NOTICE', self.on_send_notice), xchat.hook_server('notice', self.on_recv_notice, priority=xchat.PRI_HIGHEST), xchat.hook_print('Change Nick', self.on_change_nick), xchat.hook_unload(self.unload), ] for name in ( 'Channel Action', 'Private Action to Dialog', 'Private Action', 'Channel Message', 'Private Message to Dialog', 'Private Message' ): xchat.hook_print(name, self.on_recv_message, name, priority=xchat.PRI_HIGHEST),
def __init__(self): self.id_dh = {} self.hooks = [ xchat.hook_command('', self.on_send_message), xchat.hook_command('ME', self.on_send_me), xchat.hook_command('MSG', self.on_send_msg), xchat.hook_command('NOTICE', self.on_send_notice), xchat.hook_server('notice', self.on_recv_notice, priority=xchat.PRI_HIGHEST), xchat.hook_print('Change Nick', self.on_change_nick), xchat.hook_unload(self.unload), ] for name in ('Channel Action', 'Private Action to Dialog', 'Private Action', 'Channel Message', 'Private Message to Dialog', 'Private Message'): xchat.hook_print(name, self.on_recv_message, name, priority=xchat.PRI_HIGHEST),
def enable(self, *args): dprint("enable()") if not self.privmsg_hook: self.privmsg_hook = xchat.hook_server("PRIVMSG", self.responder)
import xchat __module_name__ = "KickRejoin" __module_version__ = "1" __module_description__ = "Joins channels that you are kicked from." #Callbacks def kick_cb(word, eol, userdata): if xchat.nickcmp(word[3], xchat.get_info('nick')) == 0: xchat.command("JOIN "+word[2]) #Hooks xchat.hook_server("KICK", kick_cb)
#respuestas = remoto[1].split(",") xchat.command("say Esto no esta implementado aun") else: xchat.command("say {0}".format(remoto[1])) ############################################################################## ## Definimos la funcion para la descarga del programa ############################################################################## def unload_cb(userdata): """Esta funcion debe desenlazar todas las funciones del modulo al descargarse el script. Argumentos: userdata -- variable opcional que se puede enviar a un hook (ignorado) """ # Desconectamos los comandos # Controles remotos xchat.unhook(HOOKREMOTO) # Descarga xchat.unhook(HOOKREMOTOS) ############################################################################## ## Conectamos los "lanzadores" de xchat con las funciones que hemos definido ## para ellos ############################################################################## # Controles remotos HOOKREMOTO = xchat.hook_server('PRIVMSG', remoto_cb) # Descarga del script HOOKREMOTOS = xchat.hook_unload(unload_cb)
import xchat __module_name__ = "InviteJoin" __module_version__ = "1" __module_description__ = "Joins channels that you are invited to." #Callbacks def invite_cb(word, eol, userdata): xchat.command("QUOTE JOIN " + word[3]) #Hooks xchat.hook_server("INVITE", invite_cb)
import xchat __module_name__ = "Pirates-next" __module_author__ = "OSN64" __module_version__ = "1" __module_description__ = "Bot to play pirates game" #__fetch_interval = 47 * 60 # 47 minutes pirate_channel = "#smp" pirate_server = "criten" pirate_host = "JeromeTheBaller" cnc = xchat.find_context(channel=pirate_channel) def msg(word, word_eol, userdata): if xchat.nickcmp(word[1], pirate_host) == 0: xchat.prnt("They are the same!") #xchat.prnt(', '.join(word_eol)) #userlist = context.get_list("users") #xchat.prnt(word) return xchat.EAT_NONE xchat.hook_server("PRIVMSG", msg) #xchat.hook_timer(__fetch_interval * 1000, dig) xchat.prnt(__module_name__ + ' version ' + __module_version__ + ' loaded.')
# Write on disk only if configuration is actually changed conffile = open(conffileName, 'w') conf.write(conffile) conffile.close() print('Successfully removed SASL settings for network ' + network) else: print('SASL authentication is not configured for network ' + network) else: print('Usage: /SASL <-set|-unset> <network> [<nick> <password>]') return xchat.EAT_NONE xchat.hook_print('Connected', connected_cb) xchat.hook_server('AUTHENTICATE', authenticate_cb) xchat.hook_server('CAP', cap_cb) xchat.hook_server('903', sasl_90x_cb) # RPL_SASLSUCCESS xchat.hook_server('904', sasl_90x_cb) # ERR_SASLFAIL xchat.hook_server('905', sasl_90x_cb) # ERR_SASLTOOLONG xchat.hook_server('906', sasl_90x_cb) # ERR_SASLABORTED xchat.hook_server('907', sasl_90x_cb) # ERR_SASLALREADY xchat.hook_command( 'SASL', sasl_cb, help='Usage: /SASL <-set|-unset> <network> [<nick> <password>], ' + 'set or unset SASL authentication for an IRC network. Arguments <nick> and <password> are optional for -unset' )
def unload(self,userdata): if (DEBUG == True): self.writetolog("unloader->unload") if (self.prefs.boolvalue("end") == True): os.kill(self.lcd.composerPID(),signal.SIGKILL) if (DEBUG == True): self.writetolog("Done") def writetolog(self, message): debuglog = open(module_dir + "log.txt","a") debuglog.write(message + "\n") debuglog.close if (DEBUG == True): writetolog("Starting Script...") prefs = preferences() lcd = lcdconnection(prefs) check = checker(prefs,lcd) unload = unloader(prefs,lcd) if (DEBUG == True): writetolog("All Initialised,... Starting hooks.") print "Lattyware's xChat G15 Highlighter Plugin Is Now All Loaded." xchat.hook_server("PRIVMSG", check.check) xchat.hook_command("CLEARLCD", lcd.clearscreen, help="/clearlcd clears the LCD and replaces it with startup image.") xchat.hook_command("OFFLIGHTS", lcd.offlights, help="/clearlights turns off the lights on the keyboard.") xchat.hook_command("RELOADG15PREFS", prefs.loadprefs, help="/reloadg15prefs reloads the preferences from config.txt, for the G15 xChat plugin.") xchat.hook_unload(unload.unload)
xchat.hook_command('ASKPW', askpw_cb, help="/ASKPW Ask user for gpg passphrase.") def detect_eauth_challenge(word, word_eol, userdata): is_challenge = False if word[0] == ':gribble!~gribble@unaffiliated/nanotube/bot/gribble' and re.search( 'hostmask %s!' % (xchat.get_info('nick'), ), word_eol[0]): challenge_url = word[-1] if challenge_url[:-16] == 'http://bitcoin-otc.com/otps/': xchat.challenge_data = urllib.urlopen(challenge_url).read() xchat.command( 'GETSTR "your gpg passphrase" ASKPW "Enter gpg passphrase"') return xchat.EAT_NONE xchat.hook_server('PRIVMSG', detect_eauth_challenge) def eauth_cb(word, word_eol, userdata): xchat.command('msg gribble ;;eauth ' + _otcnick) return xchat.EAT_ALL xchat.hook_command('EAUTH', eauth_cb, help="/EAUTH Initiate auth procedure with gribble.")
DEBUG and xchat.prnt("msg: "+xchat.strip(msg)) url = m.group(1) DEBUG and xchat.prnt("url: "+url) task = Thread() #TODO: task.daemon = True def task_func(): decipher_youtube_url(url,nick,msg,dest) task.run = task_func task.start() return xchat.EAT_NONE def process_priv_msg(word, word_eol, userdata): nick = word[0] nick = nick[1:nick.find('!')] # word[0] format: ":nick!*@host" if(not word[2].startswith('#') and not word[2].startswith('&')): # not a channel message process_youtube_urls(word_eol[0],nick) return xchat.EAT_NONE def process_chan_msg(word, word_eol, userdata, priority): process_youtube_urls(word[1],word[0],xchat.get_info("channel")) return xchat.EAT_NONE xchat.hook_print_attrs("Channel Message", process_chan_msg) xchat.hook_print_attrs("Channel Msg Hilight", process_chan_msg) xchat.hook_server("PRIVMSG", process_priv_msg) xchat.hook_server("NOTICE", process_priv_msg) xchat.prnt(__module_name__+" loaded") xchat.hook_unload(lambda user_data : xchat.prnt(__module_name__+" unloaded"))
except KeyError: irc_kick_message = None xchat.prnt(word[1] + "\00318" + ("." * dots) + "\00319:\x0f " + irc_kick_message) #endif return xchat.EAT_XCHAT #endif return xchat.EAT_NONE #enddef xchat.hook_print("Join", CheckJoin) xchat.hook_print("You Join", BanTimerGo, True) xchat.hook_server("352", CheckWhoRet) xchat.hook_command("set", SetMessage) for x in ["b", "ban"]: xchat.hook_command(x, BanNick, None, xchat.PRI_HIGHEST) for x in ["ub", "unban"]: xchat.hook_command(x, UnbanNick, None, xchat.PRI_HIGHEST) for x in ["k", "kick"]: xchat.hook_command(x, KickNick, (1, 2, None), xchat.PRI_HIGHEST) for x in ["kb", "kickban"]: xchat.hook_command(x, BanNick, True, xchat.PRI_HIGHEST) LoadINIish((banTimes, "bantimes", int)) xchat.hook_unload(SaveINIish, (banTimes, "bantimes")) LoadINIish((bannedNicks, "bannednicks", str)) xchat.hook_unload(SaveINIish, (bannedNicks, "bannednicks")) LoadINIish((banOpts, "banopts", str))
reverse=True) print '-------------------------------' for tup in channels_by_rank: print ' %30s : %5s' %(tup[0], tup[1]) return 1 def stop_timer(word, word_eol, userdata): global myhook if myhook is not None: xchat.unhook(myhook) myhook = None print 'Timer removed!' myhook = xchat.hook_timer(60000, timer) xchat.hook_command("STOP", stop_timer) xchat.hook_server("319", add_channel) xchat.hook_server("312", eat_all) xchat.hook_server("330", eat_all) xchat.hook_server("318", eat_all) xchat.hook_server("311", eat_all) xchat.hook_server("671", eat_all) xchat.hook_server("317", eat_all) # Now whois all the users for user in users: command = 'WHOIS ' + user xchat.command(command)
import xchat xchat.hook_command( 'key', key, help= 'show information or set key, /key <nick> [<--network> <network>] [new_key]' ) xchat.hook_command('key_exchange', key_exchange, help='exchange a new key, /key_exchange <nick>') xchat.hook_command('key_list', key_list, help='list keys, /key_list') xchat.hook_command('key_load', key_load, help='load keys, /key_load') xchat.hook_command('key_pass', key_pass, help='set key file pass, /key_pass password') xchat.hook_command('aes', aes, help='aes #channel/nick 1|0 or True|False') xchat.hook_command('key_remove', key_remove, help='remove key, /key_remove <nick>') xchat.hook_server('notice', dh1080) xchat.hook_print('Channel Message', decrypt_print, 'Channel Message') xchat.hook_print('Change Nick', change_nick) xchat.hook_print('Private Message to Dialog', decrypt_print, 'Private Message to Dialog') xchat.hook_server('332', server_332) xchat.hook_command('', encrypt_privmsg) xchat.hook_unload(unload) load()
# Initialize Alert Object sufix = '...' print __module_name__ + ": Initializing" + sufix rules = Rules() alerts = SmartAlert(rules) # Hook Print Events print __module_name__ + ": Loading hooks" + sufix # Possible Event binds: # Your Message # Message Send -- when sending a priv message # Private Message # Private Message to Dialog # Generic Message -- doesn't seem to work -- probably only at server level # Channel Message # add channel hooks on join... also unloads and reloads every join... # prevents floods! xchat.hook_command('SMARTALERT', alerts.command, userdata=None, priority=xchat.PRI_HIGHEST) xchat.hook_server('JOIN', alerts.joiner, userdata=None, priority=xchat.PRI_HIGHEST) alerts.xchatHook() xchat.hook_unload(alerts.unload)
spew = {'word': word, 'word_eol': word_eol, 'userdata': userdata} print "*** " + repr(spew) return xchat.EAT_NONE # -- main print "\002Loading %s v%s\002" % (__module_name__, __module_version__) xchat.hook_command('spew', hook_spew, help='regugitate parameters') print "\002commands:\002 /spew [followed by nonsense data]" for event in PRINT_EVENTS: xchat.hook_print(event, hook_spew) for event in SERVER_EVENTS: xchat.hook_server(event, hook_spew) # Things I saw that made xchat.hookserver() make more sense to me: #""" { 'word': [ # ':[email protected]', # 'PRIVMSG', # '#farts', # ':yeah', # 'lets', # 'party' # ], # 'word_eol': [ # ':[email protected] PRIVMSG #farts :yeah lets party', # 'PRIVMSG #farts :yeah lets party', # '#farts :yeah lets party', # ':yeah lets party',
global dInfo sServ=xchat.get_info("network") if sServ in dInfo and dInfo[sServ]["on"] == 3: lChannels = xchat.get_list("channels") for i in lChannels: if i.type == 2: lUsers = i.context.get_list("users") for j in lUsers: if j.nick == dInfo[sServ]["nick"]: dInfo[sServ]["on"] = 5 # Wait for quit return #endif #endfor #endif #endfor WhoLoopStart() #endif #enddef xchat.hook_print("Notice", DoNick) xchat.hook_print("Your Nick Changing", DoIdentify) xchat.hook_print("Join", CheckJoin) xchat.hook_print("Quit", CheckQuit) xchat.hook_print("Part", CheckPart) xchat.hook_print("You Join", CheckUserList) xchat.hook_server("376",GhostThatFucker,True) #MOTD End xchat.hook_server("422",GhostThatFucker,True) #MOTD Missing xchat.hook_command("gnick",GhostThatFucker,False) xchat.prnt("Loaded %s version %s." % (__module_name__,__module_version__))
import xchat __module_name__ = "gateway_identify" __module_description__ = "Print the IP of users joining from gateways" __module_version__ = "1.0" hex_ip_regex = re.compile(r'^~?[0-9a-f]{8}$') def make_ip(s): return socket.inet_ntoa(struct.pack('!I', eval('0x' + s))) def identify_gateway(word, word_eol, userdata): id = word[0][1:] nick, ident, host = re.split('[@!]', id) if not (hex_ip_regex.match(ident) and host.startswith('gateway/')): return channel = word[-1][1:] ip = make_ip(ident[-8:]) try: host = dns.resolver.query(dns.reversename.from_address(ip), 'PTR').response.answer[0][0].to_text()[:-1] except (dns.resolver.NXDOMAIN, dns.exception.Timeout): host = 'unknown hostname' xchat.find_context(channel=channel).emit_print( 'Server Notice', "%s is coming from %s (%s)" % (nick, ip, host)) xchat.hook_server('JOIN', identify_gateway, priority=xchat.PRI_LOWEST)
def chat_hook(word, word_eol, userdata): #xchat.prnt("This is word: " + `word`) #xchat.prnt("This is word_eol: " + `word_eol`) words = wordcleanser().clean(word[3:]) #xchat.prnt("This is words: " + `words`) if SPEAK: if SPEAK_CHANNEL: if SPEAK_CHANNEL == word[2]: XCHAT_FESTIVAL.say(' '.join(words)) return xchat.EAT_NONE XCHAT_FESTIVAL.say(' '.join(words)) return xchat.EAT_NONE # fix find a way to remove use of globals global XCHAT_FESTIVAL XCHAT_FESTIVAL=festival() global SPEAK_CHANNEL SPEAK_CHANNEL=False xchat.hook_command("speechon", speechon, help="/speechon Turn on speech") xchat.hook_command("speechoff", speechoff, help="/speechoff Turn off speech") xchat.hook_command("channelon", channelon, help="/channelon Speak current channel only") xchat.hook_command("channeloff", channeloff, help="/channeloff Speak all channels") xchat.hook_server("PRIVMSG", chat_hook) xchat.command('speechon') # /load xchat-speak.py # /unload xchat-speak.py
############################################################################## def unload(): """This function disconects all module functions""" xchat.unhook(HOOKANTINOTICE) xchat.unhook(HOOKANTIDRONE) xchat.unhook(HOOKANTICTCP) xchat.unhook(HOOKANTIHOYGAN) xchat.unhook(HOOKANTICAPS) xchat.unhook(HOOKANTICOLORS) xchat.unhook(HOOKANTIAWAY) ############################################################################## # Hook all callbacks with their respective commands ############################################################################## HOOKANTINOTICE = xchat.hook_server('NOTICE', anti_notice_cb, userdata=None) HOOKANTIDRONE = xchat.hook_server('JOIN', anti_drone_cb, userdata=None) HOOKANTICTCP = xchat.hook_server('PRIVMSG', anti_ctcp_cb, userdata=None) HOOKANTIHOYGAN = xchat.hook_server('PRIVMSG', anti_hoygan_cb, userdata=None) HOOKANTICAPS = xchat.hook_server('PRIVMSG', anti_caps_cb, userdata=None) HOOKANTICOLORS = xchat.hook_server('PRIVMSG', anti_colors_cb, userdata=None) HOOKANTIAWAY = xchat.hook_server('PRIVMSG', anti_away_cb, userdata=None) ############################################################################# # Add menu options ############################################################################# xchat.command('menu ADD "GatoScript/Options/Protections"') xchat.command("".join(['menu -t', helper.conf_read("away", "protections"), ' ADD "GatoScript/Options/Protections/Away"', ' "options protections away 1"',
if len(word) >= 3 and word[2] != '--network': if word_eol[2]=="1" or word_eol[2]=="True" or word_eol[2]=="true": key.aes = True if word_eol[2]=="0" or word_eol[2]=="False" or word_eol[2]=="false": key.aes = False KEY_MAP[id_] = key elif len(word) >= 5 and word[2] == '--network': if word_eol[4]=="1" or word_eol[4]=="True" or word_eol[4]=="true": key.aes = True if word_eol[4]=="0" or word_eol[4]=="False" or word_eol[4]=="false": key.aes = False print 'Key aes', id_, 'set', key.aes return xchat.EAT_ALL import xchat xchat.hook_command('key', key, help='show information or set key, /key <nick> [<--network> <network>] [new_key]') xchat.hook_command('key_exchange', key_exchange, help='exchange a new key, /key_exchange <nick>') xchat.hook_command('key_list', key_list, help='list keys, /key_list') xchat.hook_command('key_load', key_load, help='load keys, /key_load') xchat.hook_command('key_pass', key_pass, help='set key file pass, /key_pass password') xchat.hook_command('aes', aes, help='aes #channel/nick 1|0 or True|False') xchat.hook_command('key_remove', key_remove, help='remove key, /key_remove <nick>') xchat.hook_server('notice', dh1080) xchat.hook_print('Channel Message', decrypt_print, 'Channel Message') xchat.hook_print('Change Nick', change_nick) xchat.hook_print('Private Message to Dialog', decrypt_print, 'Private Message to Dialog') xchat.hook_server('332', server_332) xchat.hook_command('', encrypt_privmsg) xchat.hook_unload(unload) load()
channels = ["#gultij", "#banning-test", "#banning-test-2"] def cb_server_privmsg(word, word_eol, userdata): ident = word[0] nick = word[0].split(":")[1].split("!")[0] command = word[1] #Should be "PRIVMSG" target = word[2] #Channel or me message = word_eol[3].replace(" ", "").lower() me = xchat.get_info("nick") if target not in channels: return xchat.EAT_NONE if re.search(r'chimpout\.com\/forum', message): print "Spammer detected: " + nick + ". He will be kick-banned." xchat.command("msg ChanServ op " + target + " " + me) time.sleep(3) xchat.command("kickban " + nick + " 2") xchat.command("msg ChanServ deop " + target + " " + me) return xchat.EAT_NONE xchat.hook_server("PRIVMSG", cb_server_privmsg) print "Plugin xchat-kickban-reaction loaded!"
# servers.add(server) # print "Suggestible servers are:", " ".join(map(repr, servers)) # return xchat.EAT_ALL # xchat.hook_command("SUGGEST_ADD", add_server, # help="/SUGGEST_ADD <server> become suggestible on server.") # def rem_server(word, word_eol, userdata=None): # for server in word[1:]: # if server in servers: # servers.remove(server) # else: # print "%r is not in servers." % server # print "Suggestible servers are:", " ".join(map(repr, servers)) # return xchat.EAT_ALL # xchat.hook_command("SUGGEST_REM", rem_server, # help="/SUGGEST_REM <server> be not suggestible on server.") def suggestible(word, word_eol, userdata=None): context = xchat.get_context() connected_to = context.get_info("server").lower() context.command("JOIN " + word[3]) return xchat.EAT_XCHAT xchat.hook_server("INVITE", suggestible) print "Becoming suggestible"
"""This function disconects all module functions""" # Store all pending changes to the database helper.gatodb_commit() # Disconnect everything else xchat.unhook(HOOKANTISPAM) xchat.unhook(HOOKANTIADD) xchat.unhook(HOOKANTILIST) xchat.unhook(HOOKANTIDEL) ############################################################################# # Hook all callbacks with their respective commands ############################################################################# # Antispam HOOKANTISPAM = xchat.hook_server('PRIVMSG', antispam_cb, userdata=None, priority=5) HOOKANTIADD = xchat.hook_command('antiadd', antispam_add_cb) HOOKANTILIST = xchat.hook_command('antilist', antispam_list_cb) HOOKANTIDEL = xchat.hook_command('antidel', antispam_del_cb) ############################################################################# # Add menu options ############################################################################# xchat.command('menu ADD "GatoScript/-"') xchat.command('menu ADD "GatoScript/AntiSpam"') xchat.command('menu ADD "GatoScript/AntiSpam/Filters list" "antilist"') xchat.command('menu ADD "GatoScript/AntiSpam/Add filter" "getstr \b \ "antiadd" "Filter:""') xchat.command('menu ADD "GatoScript/AntiSpam/Remove filter" "getstr \b \ "antidel" "Filter:""')
return re.compile('^' + re.escape(data).replace(r'\*','.*').replace(r'\?','.') + '$') _valid_nickname = re.compile(r'^[-a-zA-Z0-9\[\]{}`|_^\\]{0,30}$') valid_nickname = lambda data: _valid_nickname.match(data) _valid_channel = re.compile(r'^[#~].*') # OK, this is cheating valid_channel = lambda data: _valid_channel.match(data) _valid_mask = re.compile(r'^([-a-zA-Z0-9\[\]{}`|_^\\*?]{0,30}!.*?@.*?|\$[ar]:.*)$') valid_mask = lambda data: _valid_mask.match(data) # Data processing def do_mode(word, word_eol, userdata): """Run pending actions when chanserv opped us""" ctx = xchat.get_context() if 'chanserv!' in word[0].lower() and '+o' in word[3] and ctx.get_info('nick') in word: run_pending(just_opped = ctx.get_info('channel')) xchat.hook_server('MODE', do_mode) class User(object): def __init__(self, nick, ident, host, name): self.nick = nick; self.ident = ident; self.host = host; self.name = name self.account = None self.time = time.time() def do_whois(word, word_eol, userdata): """Store whois replies in global cache""" nick = word[3].lower() if word[1] == '330': users[nick].account = word[4] else: users[nick] = User(nick, word[4], word[5], word_eol[7][1:]) xchat.hook_server('311', do_whois) xchat.hook_server('330', do_whois)
def identifycb(word, word_eol, userdata): c = xchat.get_context() match = NICKPATTERN.match(word[0]) matchtxt = "This nickname is registered and protected." if not match or xchat.nickcmp(match.group(1), 'NickServ') != 0: return xchat.EAT_NONE if matchtxt in word_eol[0]: c.command("msg nickserv identify " + c.get_info('nickserv')) return xchat.EAT_NONE def onconnectcb(word, word_eol, userdata): c = xchat.get_context() if xchat.nickcmp(c.get_info('nick'), xchat.get_prefs('irc_nick1')) != 0: c.command('nick ' + xchat.get_prefs('irc_nick1')) xchat.hook_server("433", ghostcb) #server numeric for failed nick change xchat.hook_server("NOTICE", identifycb) #watch for nickserv warning to identify xchat.hook_server("2", onconnectcb) #server numeric sent when first connecting def unloadcb(userdata): xchat.prnt("{} unloaded.".format(__module_name__)) xchat.hook_unload(unloadcb) xchat.prnt("{} loaded.".format(__module_name__))
import xchat lastAlert=0 def Alert(message): message=message.replace("'","`") #make safe for shell #Other options to display message are gdialog, gxmessage os.system("xmessage -nearmouse -default okay '%s' &" % message) # os.system("zenity --info --title='xchat' --text='%s' &" % message) # os.system("play /usr/share/sounds/gtk-events/clicked.wav") def CheckAlert(to,message): global lastAlert now=int(time.time()) nick = xchat.get_info("nick") nick = nick.lower() match = re.search(r'\b(%s)\b' % re.escape(nick), message, re.IGNORECASE) to = to.lower() if to==nick or match: if now-lastAlert > 10: #10s at least since referenced Alert(message) lastAlert=now return xchat.EAT_NONE def ServerMessagePRIVMSG(word, word_eol, userdata): CheckAlert(word[2],word_eol[3][1:]) return xchat.EAT_NONE xchat.hook_server("PRIVMSG", ServerMessagePRIVMSG) print "pixelbeat's xchat notifier loaded"
# Link Good! cURL our string and decrypt. curl = pycurl.Curl() curl.setopt(curl.URL, url) curl.setopt(curl.USERAGENT, """Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)""") curl.setopt(curl.WRITEFUNCTION, buf.write) curl.perform() # Decrypt and message gribble back the verify string. auth_string = buf.getvalue() buf.close() xchat.command("MSG gribble everify %s" % otcauth_gpg_decrypt(auth_string)) eauthCheck = False return xchat.EAT_NONE # Hook the server event when gribble messages us. xchat.hook_server("PRIVMSG", otcauth_gpg_auth) # The callback function to our hook that ties it all together def otcauth_cb(word, word_eol, userdata): if len(word) < 2: switch = "help" else: switch = str(word[1]).lower() if switch == "help": otcauth_help(word[1:]) elif switch == "version": otcauth_ver() elif switch == "eauth": nick = xchat.get_info('nick')
QueuedFile = None if (len(word) > 4): QueuedFile = word_eol[4] DeleteFromQueue(QueuedFile, ToNick, FromNick, \ ServerContext, ChannelContext) return xchat.EAT_ALL if (command == RequestCommand): if (len(word) > 4): RequestedFile = word_eol[4] ProcessRequest(RequestedFile, ToNick, FromNick, \ ServerContext, ChannelContext) return xchat.EAT_PLUGIN else: return xchat.EAT_NONE if (command == FindCommand): if (len(word) > 4): SearchString = word_eol[4] SearchList(dbc, Logger, FromNick, \ ServerContext, ChannelContext, SearchString) return xchat.EAT_PLUGIN else: return xchat.EAT_NONE return xchat.EAT_NONE ## -- Server Hooks -- ## xchat.hook_server('PRIVMSG', InspectMessage, priority=xchat.PRI_HIGHEST)
else: temp_db_size = 0 db_file = xchat.get_info("xchatdir") + "/seen.db" temp_db_file = xchat.get_info("xchatdir") + "/seen.db-journal" xchat.prnt( "\x02\x0313Seen database info\x02:\n" "\x0313\x02Size\x02: %.2fKB\n" #1 "\x0313\x02Temp Size\x02: %.2fKB\n" #2 "\x0313\x02Entries\x02: %d\n" #3 "\x0313\x02File\x02: %s\n" #4 "\x0313\x02Temp File\x02: %s\n" #5 "\x0313\x02Version\x02: %s\n" #6 %( float(db_size/1024.0), #1 float(temp_db_size/1024.0), #2 int(num_of_entrys), #3 db_file, #4 temp_db_file, #5 __module_version__ #6 )) seen = Seen() xchat.hook_unload(seen.on_unload) xchat.hook_server("PRIVMSG", seen.parse) xchat.hook_command("seen", seen.lastseen) xchat.hook_command("seen->info", seen.info) xchat.hook_command("seen->commit", seen.commit) xchat.prnt("%s version %s by %s has been loaded." % (__module_name__, __module_version__, __module_author__)) seen.info(); # xchat.prnt("\x02\x0304Note: NEVER LOAD THIS MORE THEN ONCE! IF YOU NEED TO RELOAD IT MAKE SURE TO UNLOAD IT FIRST!!\x02\x03")
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # If for any reason you need to contact me, see copyright above. __module_name__ = "AutoAccept Invite" __module_version__ = "0.1" __module_description__ = "Automatically accepts invites" import xchat aa_nick = [] aa_chan = ['botwar', '#botwar'] def chan_invite(word, word_eol, _): mform = word[0].index('!') nick = word[0][1:mform] chan = word[3][1:] if nick in aa_nick or chan in aa_chan: xchat.command('join {}'.format(chan)) else: pass return xchat.EAT_NONE xchat.hook_server("INVITE", chan_invite)
def group(n): return (','.join(re.findall(r"\d{1,3}", str(n)[::-1])))[::-1] def privmsg_cb(word, word_eol, userdata): id = get_id_from_url(word_eol[3]) if len(id) == 0: return xchat.EAT_NONE info = get_yt_info(id) if len(info) == 0: return xchat.EAT_NONE show_yt_info(info) return xchat.EAT_NONE def ytcmd_cb(word, word_eol, userdata): if len(word) < 2: print "/yt <url> to get video info" return xchat.EAT_NONE id = get_id_from_url(word_eol[0]) if len(id) == 0: return xchat.EAT_NONE info = get_yt_info(id) if len(info) == 0: return xchat.EAT_NONE show_yt_info(info) return xchat.EAT_NONE xchat.hook_command("yt", ytcmd_cb, help="/yt <url> to get video info") xchat.hook_server("PRIVMSG", privmsg_cb) print "\0034", __module_name__, __module_version__, "has been loaded\003"
temp_db_size = 0 db_file = xchat.get_info("xchatdir") + "/seen.db" temp_db_file = xchat.get_info("xchatdir") + "/seen.db-journal" xchat.prnt("\x02\x0313Seen database info\x02:\n" "\x0313\x02Size\x02: %.2fKB\n" #1 "\x0313\x02Temp Size\x02: %.2fKB\n" #2 "\x0313\x02Entries\x02: %d\n" #3 "\x0313\x02File\x02: %s\n" #4 "\x0313\x02Temp File\x02: %s\n" #5 "\x0313\x02Version\x02: %s\n" #6 % ( float(db_size / 1024.0), #1 float(temp_db_size / 1024.0), #2 int(num_of_entrys), #3 db_file, #4 temp_db_file, #5 __module_version__ #6 )) seen = Seen() xchat.hook_unload(seen.on_unload) xchat.hook_server("PRIVMSG", seen.parse) xchat.hook_command("seen", seen.lastseen) xchat.hook_command("seen->info", seen.info) xchat.hook_command("seen->commit", seen.commit) xchat.prnt("%s version %s by %s has been loaded." % (__module_name__, __module_version__, __module_author__)) seen.info() # xchat.prnt("\x02\x0304Note: NEVER LOAD THIS MORE THAN ONCE! IF YOU NEED TO RELOAD IT MAKE SURE TO UNLOAD IT FIRST!!\x02\x03")
#Other options to display message are gdialog, gxmessage os.system("zenity --timeout=1 --notification %s &" % arg) # os.system("xmessage -nearmouse -default okay %s &" % arg) # os.system("play /usr/share/sounds/gtk-events/clicked.wav") def CheckAlert(to, message): global lastAlert now = int(time.time()) nick = xchat.get_info("nick") nick = nick.lower() match = re.search(r'\b(%s)\b' % re.escape(nick), message, re.IGNORECASE) to = to.lower() if to == nick or match: if now - lastAlert > 10: #10s at least since referenced Alert(message) lastAlert = now return xchat.EAT_NONE def ServerMessagePRIVMSG(word, word_eol, userdata): CheckAlert(word[2], word_eol[3][1:]) return xchat.EAT_NONE xchat.hook_server("PRIVMSG", ServerMessagePRIVMSG) print "pixelbeat's xchat notifier loaded"
if k == "Part": if args[3]: msgid = "Part with Reason" else: msgid = "Part" # We want to keep if it's a highlight intact, so pass the event along. elif k == "Message" or k == "Action": if k == "Action": msg = "\x01ACTION " + args[1] + "\x01" else: msg = args[1] # Emulate the message so that it will promote the channel status appropriately. nick, host = args[0].split("@") xchat.command("RECV :%s PRIVMSG %s :%s" % ( nick + "@" + host + "!" + Host(host), word[2], msg )) return xchat.EAT_XCHAT # Otherwise use the key. else: msgid = k # Emit the actual message. xchat.emit_print(msgid, *args) # Tell xchat not to print H-tan's Channel Message. return xchat.EAT_XCHAT #endif #endfor return xchat.EAT_NONE #enddef xchat.hook_server("PRIVMSG", ProxyMessage) xchat.prnt("Loaded %s version %s." % (__module_name__,__module_version__))
def megapart(self, word, word_eol, userdata): self.whoishook = xchat.hook_server("319",self.got_319) self.timer = xchat.hook_timer(120000,self.reset) user = word[1] xchat.command("QUOTE whois %s" % user)
import dns.exception import dns.resolver import dns.reversename import re import socket import struct import xchat __module_name__ = "gateway_identify" __module_description__ = "Print the IP of users joining from gateways" __module_version__ = "1.0" hex_ip_regex = re.compile(r'^~?[0-9a-f]{8}$') def make_ip(s): return socket.inet_ntoa(struct.pack('!I',eval('0x'+s))) def identify_gateway(word, word_eol, userdata): id = word[0][1:] nick, ident, host = re.split('[@!]', id) if not (hex_ip_regex.match(ident) and host.startswith('gateway/')): return channel = word[-1][1:] ip = make_ip(ident[-8:]) try: host = dns.resolver.query(dns.reversename.from_address(ip), 'PTR').response.answer[0][0].to_text()[:-1] except (dns.resolver.NXDOMAIN, dns.exception.Timeout): host = 'unknown hostname' xchat.find_context(channel=channel).emit_print('Server Notice', "%s is coming from %s (%s)" % (nick, ip, host)) xchat.hook_server('JOIN', identify_gateway, priority=xchat.PRI_LOWEST)
if capture_whois: return xchat.EAT_NONE # Response format: # :server 311 yournick othersnick ~othersuser others/host * :Other's Realname _, _, _, nickname, username, host = word[0:6] raw_real_name = word_eol[7][1:] # Get the real name without pronouns. If they don't have their pronouns # specified in their WHOIS information, it simply shows their real name # string as-is. real_name = strip_pronouns(raw_real_name) # Get their pronouns, or None. pronouns = get_pronouns(raw_real_name) # Print the first line of the WHOIS response, sans pronouns snippet at the end, # exactly how XChat would print it otherwise. xchat.emit_print("WhoIs Name Line", nickname, username, host, real_name) # Print their pronouns as the second line of the WHOIS information, # if they specified anything. Otherwise, do nothing. if pronouns is not None: xchat.emit_print("WhoIs Identified", nickname, "Pronouns: " + pronouns) # Stop XChat from printing the default first WHOIS line. return xchat.EAT_XCHAT xchat.hook_server("311", whois_callback)
# -*- coding: utf-8 -*- __module_author__ = 'Ward Muylaert' __module_name__ = 'ChanOpMsg' __module_version__ = '0.1' __module_description__ = 'Properly shows PRIVMSGs to [@%+]#channel' import xchat def chanopmsg(word, word_eol, userdata): if word[2][0] in ['@', '%', '+']: nick = word[0][1:].split('!')[0] # What about the same channel name on two different servers? channel = xchat.find_context(channel=word[2][1:]) channel.emit_print('Channel Notice', nick, word[2], word_eol[3][1:]) return xchat.EAT_ALL xchat.hook_server('PRIVMSG', chanopmsg) xchat.prnt('Loaded %s v%s by %s.' % (__module_name__, __module_version__, __module_author__))
valid_channel = lambda data: _valid_channel.match(data) _valid_mask = re.compile( r'^([-a-zA-Z0-9\[\]{}`|_^\\*?]{0,30}!.*?@.*?|\$[ar]:.*)$') valid_mask = lambda data: _valid_mask.match(data) # Data processing def do_mode(word, word_eol, userdata): """Run pending actions when chanserv opped us""" ctx = xchat.get_context() if 'chanserv!' in word[0].lower() and '+o' in word[3] and ctx.get_info( 'nick') in word: run_pending(just_opped=ctx.get_info('channel')) xchat.hook_server('MODE', do_mode) class User(object): def __init__(self, nick, ident, host, name): self.nick = nick self.ident = ident self.host = host self.name = name self.account = None self.time = time.time() def do_whois(word, word_eol, userdata): """Store whois replies in global cache""" nick = word[3].lower()
print("ratbox-challenge: Unable to execute respond from " + respond_path + "\n") return xchat.EAT_ALL if not os.access(private_key_path, os.R_OK): print("ratbox-challenge: Unable to open " + private_key_path + "\n") return xchat.EAT_ALL p = Popen([respond_path, private_key_path], stdin=PIPE, stdout=PIPE, bufsize=1) p.stdin.write(keyphrase + "\n") p.stdin.write(challenge + "\n") output = p.stdout.readline().rstrip() if output.startswith("Error:"): print("ratbox-challenge: " + output + "\n") return xchat.EAT_ALL print("ratbox-challenge: Received response, opering..\n") keyphrase = None challenge = None xchat.command("QUOTE CHALLENGE +{}".format(output)); return xchat.EAT_ALL xchat.hook_server("740", handle_rpl_rsachallenge2) xchat.hook_server("741", handle_rpl_endofrsachallenge2) xchat.hook_command("CHALLENGE", handle_challenge, priority=xchat.PRI_HIGHEST, help="Usage: /challenge <opername> [keyphrase]") print "%s loaded." % __module_name__
) curl.setopt(curl.WRITEFUNCTION, buf.write) curl.perform() # Decrypt and message gribble back the verify string. auth_string = buf.getvalue() buf.close() xchat.command("MSG gribble everify %s" % otcauth_gpg_decrypt(auth_string)) eauthCheck = False return xchat.EAT_NONE # Hook the server event when gribble messages us. xchat.hook_server("PRIVMSG", otcauth_gpg_auth) # The callback function to our hook that ties it all together def otcauth_cb(word, word_eol, userdata): if len(word) < 2: switch = "help" else: switch = str(word[1]).lower() if switch == "help": otcauth_help(word[1:]) elif switch == "version": otcauth_ver() elif switch == "eauth": nick = xchat.get_info('nick')
import xchat didJoin = {} def DidJoin(word,word_eol,userdata): global didJoin didJoin[xchat.get_info("server") + "/" + word[1]] = True #enddef def fc(word): return word[1:] if word[0] == ":" else word def OrDidI(word,word_eol,userdata): global didJoin nick = word[0] nick = nick[1:nick.find("!")] if nick == xchat.get_info("nick"): chan = fc(word[2]) if chan[0] == ":": chan = chan[1:] servChan = xchat.get_info("server") + "/" + chan if servChan not in didJoin: xchat.command("part " + chan) return xchat.EAT_ALL else: del didJoin[servChan] #endif #endif #enddef xchat.hook_server("JOIN",OrDidI) xchat.hook_command("join",DidJoin) xchat.prnt("Loaded %s version %s." % (__module_name__,__module_version__))
channel=hilight_query_name) if message[0] == message[-1] and message[0] == '\x01': # CTCP. Only honor CTCP action aka /me if message[1:7].lower() != 'action': return xchat.EAT_NONE ctx.emit_print('Channel Action Hilight', '%s/%s' % (sender[:sender.find('!')], recipient), message[8:-1], '') else: ctx.emit_print('Channel Msg Hilight', '%s/%s' % (sender[:sender.find('!')], recipient), message, '') return xchat.EAT_NONE xchat.hook_server("PRIVMSG", on_msg) def is_highlight(sender, recipient, message): """Are we being highlighted?""" message = irc_lower(message) sender = irc_lower(sender) # Only highlight channels if not recipient[0] in '#&@': return False # Nicks to never highlight nnh = irc_lower(xchat.get_prefs('irc_no_hilight') or '') if match_word(sender[:sender.find('!')], nnh.split(',')): return False # Nicks to always highlight nth = irc_lower(xchat.get_prefs('irc_nick_hilight') or '')
__module_version__ = "0.20" __module_description__ = "Ghost the default nick and change/identify as that user." display = ( __module_name__ + " " + __module_version__ + " has been loaded.", " Module URL: https://github.com/Sepero/xchat_auto_ghost/", " Author: Sepero 2013 - sepero 111 @ gmx . com", " Remote Python developer and Linux administrator for hire.", ) for line in display: print("\0034" + line + "\003") def set_nick(word, word_eol, userdata): desired_nick = xchat.get_prefs("irc_nick1") password = xchat.get_info("nickserv") if word[3] == desired_nick and password: randstring = ''.join(choice(string.lowercase) for i in xrange(16)) xchat.command("nick %s" % randstring) xchat.command("nickserv ghost %s %s" % (desired_nick, password)) xchat.command("nick %s" % desired_nick) xchat.command("nickserv identify %s" % password) return xchat.EAT_XCHAT return xchat.EAT_NONE xchat.hook_server("433", set_nick, priority=xchat.PRI_HIGHEST)
return xchat.EAT_ALL # enddef retime = re.compile("(?:(-?\d+)d)?(?:(-?\d+)h)?(?:(-?\d+)m)?(?:(-?\d+)s)?") def OffsetTime(word, word_eol, userdata): d, h, m, s = tuple(map(lambda x: int(x) if x else 0, retime.match(word[2]).groups())) # XChat's format example: Sat Dec 15 19:38:08 form = word_eol[3] if len(word_eol) > 3 else "%a %b %d %H:%M:%S" time = datetime.datetime.now() + datetime.timedelta(days=d, hours=h, minutes=m, seconds=s) xchat.command("nctcp %s TIME %s" % (word[1], time.strftime(form))) return xchat.EAT_XCHAT # enddef xchat.hook_command("face", DoFace) xchat.hook_command("dump", DumpFile) xchat.hook_command("vercond", SetVerCond) xchat.hook_command("offtime", OffsetTime) xchat.hook_server("privmsg", VersionCond) for x in ["ifuser", "ifnotuser"]: xchat.hook_command(x, IfCondition, x) # endfor xchat.hook_unload(SaveVerCond) xchat.prnt("Loaded %s version %s." % (__module_name__, __module_version__))
sys.path.append(_gnupgdir) import gnupg gpg = gnupg.GPG(gnupghome=_gpghome) def askpw_cb(word, word_eol, userdata): pw = word_eol[0] xchat.pw = pw[6:] if xchat.pw == "": xchat.pw = None response_data = str(gpg.decrypt(xchat.challenge_data, passphrase = xchat.pw)).rstrip() xchat.command('msg gribble ;;everify '+response_data) return xchat.EAT_ALL xchat.hook_command('ASKPW', askpw_cb, help="/ASKPW Ask user for gpg passphrase.") def detect_eauth_challenge(word, word_eol, userdata): is_challenge = False if word[0] == ':gribble!~gribble@unaffiliated/nanotube/bot/gribble' and re.search('hostmask %s!' % (xchat.get_info('nick'),), word_eol[0]): challenge_url = word[-1] if challenge_url[:-16] == 'http://bitcoin-otc.com/otps/': xchat.challenge_data = urllib.urlopen(challenge_url).read() xchat.command('GETSTR "your gpg passphrase" ASKPW "Enter gpg passphrase"') return xchat.EAT_NONE xchat.hook_server('PRIVMSG', detect_eauth_challenge) def eauth_cb(word, word_eol, userdata): xchat.command('msg gribble ;;eauth ' + _otcnick) return xchat.EAT_ALL xchat.hook_command('EAUTH', eauth_cb, help="/RUNAUTH Initiate auth procedure with gribble.")
import string import xchat __module_name__ = "Auto Ghost" __module_version__ = "0.20" __module_description__ = "Ghost the default nick and change/identify as that user." display = (__module_name__ + " " + __module_version__ + " has been loaded.", " Module URL: https://github.com/Sepero/xchat_auto_ghost/", " Author: Sepero 2013 - sepero 111 @ gmx . com", " Remote Python developer and Linux administrator for hire.",) for line in display: print("\0034" + line + "\003") def set_nick(word, word_eol, userdata): desired_nick = xchat.get_prefs("irc_nick1") password = xchat.get_info("nickserv") if word[3] == desired_nick and password: randstring = ''.join(choice(string.ascii_lowercase) for i in range(16)) xchat.command("nick %s" % randstring) xchat.command("nickserv ghost %s %s" % (desired_nick, password)) xchat.command("nick %s" % desired_nick) xchat.command("nickserv identify %s" % password) return xchat.EAT_XCHAT return xchat.EAT_NONE xchat.hook_server("433", set_nick, priority=xchat.PRI_HIGHEST)
banOpts["*"]["irc_kick_message"] = word_eol[2] xchat.prnt("%s set to: %s" % (word[1],word_eol[2])) else: dots = 29-len(word[1]) try: irc_kick_message = banOpts["*"]["irc_kick_message"] except KeyError: irc_kick_message = None xchat.prnt(word[1]+"\00318"+("."*dots)+"\00319:\x0f "+irc_kick_message) #endif return xchat.EAT_XCHAT #endif return xchat.EAT_NONE #enddef xchat.hook_print("Join", CheckJoin) xchat.hook_print("You Join", BanTimerGo, True) xchat.hook_server("352", CheckWhoRet) xchat.hook_command("set",SetMessage) for x in ["b","ban"]: xchat.hook_command(x,BanNick,None,xchat.PRI_HIGHEST) for x in ["-b","ub","unban"]: xchat.hook_command(x,UnbanNick,None,xchat.PRI_HIGHEST) for x in ["k","kick"]: xchat.hook_command(x,KickNick,(1,2,None),xchat.PRI_HIGHEST) for x in ["kb","bk","kickban"]: xchat.hook_command(x,BanNick,True,xchat.PRI_HIGHEST) LoadINIish((banTimes,"bantimes",int)) xchat.hook_unload(SaveINIish,(banTimes,"bantimes")) LoadINIish((bannedNicks,"bannednicks",str)) xchat.hook_unload(SaveINIish,(bannedNicks,"bannednicks")) LoadINIish((banOpts,"banopts",str)) xchat.hook_unload(SaveINIish,(banOpts,"banopts")) xchat.prnt("Loaded %s version %s." % (__module_name__,__module_version__))
'Usage: /RMKW <keyword>, removes a keyword from list of highlighted keywords.' ) else: if cmd_msg[1] in KEYWORDS: KEYWORDS.remove(cmd_msg[1]) return xchat.EAT_ALL def show_keywords(cmd_msg, cmd_slice, xchat_data): xchat.prnt(str(KEYWORDS)) return xchat.EAT_ALL load_modkw() xchat.hook_server('PRIVMSG', keyword_highlight) xchat.hook_command( 'ADDKW', add_keyword, help='Usage: /ADDKW <keyword>, adds a keyword to highlight.') xchat.hook_command( 'RMKW', remove_keyword, help= 'Usage: /RMKW <keyword>, removes a keyword from list of highlighted keywords.' ) xchat.hook_command( 'SHOWKW',