コード例 #1
0
ファイル: xchat-minbif.py プロジェクト: dsoulayrol/config
    def setup(self):
        # Register contact events raised by minbif.
        xchat.hook_print('Channel DeVoice', self.replicate_event, (1, 'is away'))
        xchat.hook_print('Channel Voice', self.replicate_event, (1, 'is back'))
        xchat.hook_print('Join', self.replicate_event, (0, 'has joined'))

        # The following is already notified.
        #xchat.hook_print('Quit', self.replicate_event, (0, 'has quit'))

        xchat.hook_unload(self.unload_cb)

        xchat.prnt('%s version %s by %s loaded' % (
                __module_name__, __module_version__, __author__))
コード例 #2
0
    def setup(self):
        self._process = self._create_pipe()

        # Register timed check of screensaver status.
        self._hook = self._register_hook()

        xchat.hook_unload(self.unload_cb)

        # Register some commands.
        xchat.hook_command("xs_start_polling", self.on_start)
        xchat.hook_command("xs_stop_polling", self.on_stop)

        xchat.prnt('%s version %s by %s loaded' %
                   (__module_name__, __module_version__, __author__))
コード例 #3
0
    def setup(self):
        # Register contact events raised by minbif.
        xchat.hook_print('Channel DeVoice', self.replicate_event,
                         (1, 'is away'))
        xchat.hook_print('Channel Voice', self.replicate_event, (1, 'is back'))
        xchat.hook_print('Join', self.replicate_event, (0, 'has joined'))

        # The following is already notified.
        #xchat.hook_print('Quit', self.replicate_event, (0, 'has quit'))

        xchat.hook_unload(self.unload_cb)

        xchat.prnt('%s version %s by %s loaded' %
                   (__module_name__, __module_version__, __author__))
コード例 #4
0
    def setup(self):
        self._process = self._create_pipe()

        # Register timed check of screensaver status.
        self._hook = self._register_hook()

        xchat.hook_unload(self.unload_cb)

        # Register some commands.
        xchat.hook_command("xs_start_polling", self.on_start)
        xchat.hook_command("xs_stop_polling", self.on_stop)

        xchat.prnt('%s version %s by %s loaded' % (
                __module_name__, __module_version__, __author__))
コード例 #5
0
 def __init__(self):
     self._enabled = {}
     for action in (
                 'Channel Action',
                 'Channel Action Hilight',
                 'Channel Message',
                 'Channel Msg Hilight',
             ):
         xchat.hook_print(action, self.message, action)
     xchat.hook_command('audio', self._cmd, help=self.cmd_help())
     xchat.hook_unload(self.kill)
     self.p = None
     self.voice = 'en-us'
     self.speed = 170
     self.pitch = 50
コード例 #6
0
ファイル: geoip-lookup.py プロジェクト: rschmied/geoip-lookup
def setup():
    try:
        cmd = __module_name__.upper()
        xchat.hook_command(cmd,
                           getLocationCB,
                           help="""/{} [<userid>] Gets location of user(s).
            When used in a channel, list location for all users in the channel.
            Otherwise, print the location of the given user <userid>.""".
                           format(cmd))
        xchat.hook_print("Join", getLocationJoinCB)
        xchat.hook_print("Whois Name Line", getLocationWhoisNameCB)
        xchat.hook_unload(unloadCB)
        print colordecode("%C4Plugin %B" + __module_name__ + "%B " +
                          __module_version__ + " loaded.")

    except:
        print "can't hook callbacks to xchat"
コード例 #7
0
ファイル: yakhilite.py プロジェクト: theY4Kman/yakhilite
    def __init__(self, reg_hooks=True):
        # Maps networks to a dict of their active channels against their
        # ChannelCollector objects
        #: @type: dict from str to (dict from str to ChannelCollector)
        self.networks = defaultdict(
            lambda: DefaultDict(lambda channel: ChannelCollector(channel)))

        xchat.prnt('%sYak\'s Highlight Collector loaded! :D' % LOG_TAG)
        if reg_hooks:
            def hook(evt, highlight=False, action=False, me=False):
                xchat.hook_print(evt, self.hook, (highlight, action, me))
            hook(EVENT_CHANNEL_MESSAGE)
            hook(EVENT_CHANNEL_MESSAGE_HIGHLIGHT, True)
            hook(EVENT_CHANNEL_ACTION, action=True)
            hook(EVENT_CHANNEL_ACTION_HIGHLIGHT, True, True)
            hook(EVENT_YOUR_MESSAGE, me=True)
            hook(EVENT_YOUR_ACTION, action=True, me=True)

            xchat.hook_unload(self.on_unload)
コード例 #8
0
ファイル: plugin.py プロジェクト: simonzack/hexfish
 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),
コード例 #9
0
 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),
コード例 #10
0
ファイル: dict.py プロジェクト: 10crimes/code
		except:
			xchat.prnt("Sorry, you need to input a time in seconds")
	elif word[1][0:3] == "off":
		if active == 1:
			active = 0
			xchat.prnt("Module turned off!")
		else:
			xchat.prnt("Module already disabled!")
	elif word[1][0:2] == "on":
		if active == 0:
			active = 1
			lastcommand = 0
			xchat.prnt("Module turned on!")
		else:
			xchat.prnt("Module already enabled!")
	return xchat.EAT_ALL

def unloading(userdata):
	xchat.prnt("Unloading Dict module...")

# These are all XChat specific functions
xchat.hook_print("Channel Msg Hilight", they_say)
xchat.hook_print("Channel Message", they_say)
xchat.hook_print("Private Message to Dialog", they_say)
xchat.hook_print("Your Message", me_say)
xchat.hook_command("dict", set_vars)
xchat.hook_unload(unloading)

# Print success on load
xchat.prnt("Dict loaded successfully.")
コード例 #11
0
ファイル: XChat_AES.py プロジェクト: Sharker/XChat-FiSH-AES
        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()
コード例 #12
0
            noteType=notif,
            title=title,
            description=message,
            sticky=False,
            icon=icon,
            priority=1,)

# 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)
コード例 #13
0
ファイル: youtitle.py プロジェクト: dokode/hexchat-youtitle
		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"))
コード例 #14
0
    print("XChat-DeaDBeeF {} unloaded!".format(__module_version__))

    return xchat.EAT_ALL


if __name__ == '__main__':
    print("XChat-DeaDBeeF {} loaded successfully! - by {}".format(
        __module_version__, __module_author__))
    print("Protip: using /dbplay when the track is playing resets the track.")

    #Launch/close DeaDBeeF
    xchat.hook_command('deadbeef',
                       call_db_user)  #=>  execute_db() in a new thread.
    xchat.hook_command('dbexit', exit_db_user)

    #Display the current track
    xchat.hook_command('dbshow', track_info_user)
    xchat.hook_command('np', db_current_track)

    #Play, pause, stop track
    xchat.hook_command('dbplay', db_play_track)
    xchat.hook_command('dbpause', db_pause_track)
    xchat.hook_command('dbstop', db_stop_track)

    #Skip to next or previous track
    xchat.hook_command('dbnext', db_next_track)
    xchat.hook_command('dbprev', db_previous_track)

    #Unload XChat-DeaDBeeF
    xchat.hook_unload(unload)
コード例 #15
0
ファイル: otc_tk.py プロジェクト: Ex0deus/xchat_otc_toolkit
		eauthCheck = True
	elif switch == "bauth":
		xchat.prnt("RESERVED FOR FUTURE FUNCTIONALITY")
	else:
		xchat.prnt("\002\00304Invalid Option:\00304\002 %s not defined" % (word[1]))
	
	return xchat.EAT_XCHAT
	
# Hook our functions to the callback handler
xchat.hook_command("OTCTK", otcauth_cb, help="'/OTCTK help' for more help")

# An unload callback function to clean up 
def otcauth_unload_cb(userdata):
	# Remove our MENU's 
	xchat.command('MENU DEL "OTC Toolkit/GPG EAuth" "otctk eauth"')
	xchat.command('MENU DEL "OTC Toolkit/-"')
	xchat.command('MENU DEL "OTC Toolkit/Get Voice"')
	xchat.command('MENU DEL "OTC Toolkit"')

	# Remove nicklist popup menus
	xchat.command('MENU DEL "$NICK/OTC Toolkit/Get WoT Rating"')
	xchat.command('MENU DEL "$NICK/OTC Toolkit/GPG Information"')
	xchat.command('MENU DEL "$NICK/OTC Toolkit"')
	
	# Print out our unloaded message.
	xchat.prnt("\002\00302%s:\00302 \00304[[[UNLOADED]]]\00304\002" % __module_name__)
	return xchat.EAT_XCHAT
	
# And hook into our unload event
xchat.hook_unload(otcauth_unload_cb)
コード例 #16
0
ファイル: remotes.py プロジェクト: GatoLoko/GatoScript
                            #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)
コード例 #17
0
ファイル: growl.py プロジェクト: BFCatalin/plugins
	if nick in word[1] or hostip in word[1]:
		growlnotify('Banned',
		'You have been banned by ' + word[0])

def tray_callback(word, word_eol, userdata):
	if len(word) > 3 and word[1] == '-b':
		growlnotify('Custom', word[2], word_eol[3], 1)
		return xchat.EAT_ALL

def unload_callback(userdata):
	xchat.prnt(__module_name__ + ' version ' + __module_version__ + ' unloaded.')

# get events from hexchat to call notifications
xchat.hook_print("Channel Msg Hilight", hilight_callback)
xchat.hook_print("Channel Action Hilight", hilight_callback)
xchat.hook_print("Private Message to Dialog", pm_callback)
xchat.hook_print("Private Action to Dialog", pm_callback)
xchat.hook_print("Invited", invited_callback)
xchat.hook_print("Notice", servernotice_callback)
xchat.hook_print("Notify Online", onlinenotify_callback)
xchat.hook_print("Topic Change", topic_callback)
xchat.hook_print("You Kicked", kicked_callback)
xchat.hook_print("Killed", killed_callback)
xchat.hook_print("Channel Ban", banned_callback)
# hook the tray command for other scripts to use
xchat.hook_command("tray", tray_callback)
# just to print its unloaded
xchat.hook_unload(unload_callback)
# Nothing broke yet, its loaded! =)
xchat.prnt(__module_name__ + ' version ' + __module_version__ + ' loaded.')
コード例 #18
0
ファイル: undo.py プロジェクト: BFCatalin/plugins
				text = undobuflist.pop()
			hexchat.command('settext {}'.format(text))
			hexchat.command('setcursor {}'.format(len(text)))

			redobuflist.append(text)

		except IndexError: pass # No undos left

	elif ((key, mod) == ('121', ctrlmod) or # ctrl+y
			(key, mod) == ('90', shiftctrlmod)): # ctrl+shift+z 
		try:
			text = redobuflist.pop()
			if text == inputtext:
				text = redobuflist.pop()
			hexchat.command('settext {}'.format(text))
			hexchat.command('setcursor {}'.format(len(text)))

		except IndexError: pass

	else:
		# Just throw anything else in here if it has changed
		if not undobuflist or undobuflist[-1] != inputtext:
			undobuflist.append(inputtext)

def unload_cb(userdata):
	print(__module_name__, 'version',  __module_version__, 'unloaded.')

hexchat.hook_print('Key Press', keypress_cb) 
hexchat.hook_unload(unload_cb)
print(__module_name__, 'version',  __module_version__, 'loaded.')
コード例 #19
0
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__))
コード例 #20
0
        printStats(nick, data)
    
    return xchat.EAT_NONE 
        
def printStats(nick, data):
    msgOut = []
    msgOut.append("Statistiche del giono %s" % data)
    msgOut.append("Grafico join: %s" % makeChartOfDayJoin(data))
    for joinOra in userList[data]['stats']['joins']:
        msgOut.append("Join alle ore %s: %s" % 
                      (joinOra, str(userList[data]['stats']['joins'][joinOra])))
    msgOut.append("Grafico utenti online: %s" % makeChartOfDay(data))
    for onlineOra in userList[data]['stats']['online']:
        msgOut.append("Online alle ore %s: %s" % 
                      (onlineOra, str(userList[data]['stats']['online'][onlineOra])))
    msgOut.append("Totale utenti unici: %s" % str(len(userList[data]['users'])))
    for messageOut in msgOut:
        channelObj.command('notice %s %s' % (nick, messageOut))
        
def saveState(data):
    cPickle.dump(userList, open('ffstats.p','w'))
    
channelObj = xchat.find_context(channel='#forumfree') 
getUserList()
xchat.hook_server('JOIN', onJoin)
xchat.hook_server('PART', onPart)
#xchat.hook_server('KICK', onPart)
xchat.hook_server('PRIVMSG', onMsg)

xchat.hook_unload(saveState)
コード例 #21
0
ファイル: asciihuayra.py プロジェクト: sjlvanq/xchat-plugins
ascii["furiosa"]	=["   (__)","   (\\/)","    \\/"]
ascii["ambiciosa"]	=["   (__)","   ($$)","    \\/"]
ascii["aburrida"]	=["   (__)","   (--)","    \\/"]
ascii["guerrilla"]	=["   (__)","   (oo)","  / \\/ \\"," D===b=-----"]
ascii["flaca"]		=[" _(~)_","  )\"("," (@_@)","  ) (  autor:hjw"]
ascii["rellenita"]	=["  _ (.\".) _"," '-'/. .\\'-'","   ( o o )","    `\"-\"`   autor:jgs"]

xchat.command("MENU -p5 ADD Huayra")
xchat.command("MENU ADD Huayra/AsciiArt")
xchat.command("MENU ADD Huayra/AsciiArt/Panadero1 \".asciihuayra panadero1\"")
xchat.command("MENU ADD Huayra/AsciiArt/Panadero2 \".asciihuayra panadero2\"")
xchat.command("MENU ADD Huayra/AsciiArt/Netbook \".asciihuayra netbook\"")
xchat.command("MENU ADD Huayra/AsciiArt/Vaquita \".asciihuayra vaquita\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Inexpresiva \".asciihuayra inexpresiva\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Hipnotizada \".asciihuayra hipnotizada\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Muerta \".asciihuayra muerta\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Sarcástica \".asciihuayra sarcastica\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Incredula \".asciihuayra incredula\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Furiosa \".asciihuayra furiosa\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Ambiciosa \".asciihuayra ambiciosa\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Aburrida \".asciihuayra aburrida\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Guerrilla \".asciihuayra guerrilla\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Estilizadas")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Estilizadas/Flaca \".asciihuayra flaca\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Estilizadas/Rellenita \".asciihuayra rellenita\"")

__unhook__ = xchat.hook_command(".asciihuayra",dispatch,help="Ascii Art de vacas y panaderos.")

xchat.hook_unload(unload_ah)
コード例 #22
0
        #                print 'Keys saved to keyfile.'
        #        else:
        #            print 'No password set; keys not saved to keyfile.'

        print 'XChat-FiSH-AES unloaded successfully.'


fish = FiSH_AES()

xchat.hook_command(
    'key',
    getattr(fish, 'set_key'),
    help=('/KEY [<nick/channel>] [<network>] [new_key],'
          'display or set the key for a particular nick or channel.'))
xchat.hook_command('key_list',
                   getattr(fish, 'list_keys'),
                   help='/KEY_LIST, list all currently known keys.')
xchat.hook_command(
    'key_remove',
    getattr(fish, 'remove_key'),
    help='/KEY_REMOVE [<nick/channel>] [<network>], remove a key.')
xchat.hook_command(
    'key_type',
    getattr(fish, 'set_key_type'),
    help=('/KEY_TYPE [<nick/channel>] [<network>] [AES|Blowfish],'
          'display or set the key type for a particular nick or channel.'))

xchat.hook_unload(getattr(fish, 'unload'))

print 'XChat-FiSH-AES loaded successfully.'
コード例 #23
0
#                key.dh = None
#
#        if self.password:
#            with open(os.path.join(xchat.get_info('xchatdir'), 'XChatAES.pickle'), 'wb') as f:
#                pickle.dump(tmp_map, f)
#                print 'Keys saved to keyfile.'
#        else:
#            print 'No password set; keys not saved to keyfile.'

        print 'XChat-FiSH-AES unloaded successfully.'



fish = FiSH_AES()

xchat.hook_command('key', getattr(fish, 'set_key'),
                   help=('/KEY [<nick/channel>] [<network>] [new_key],'
                         'display or set the key for a particular nick or channel.'))
xchat.hook_command('key_list', getattr(fish, 'list_keys'),
                   help='/KEY_LIST, list all currently known keys.')
xchat.hook_command('key_remove', getattr(fish, 'remove_key'),
                   help='/KEY_REMOVE [<nick/channel>] [<network>], remove a key.')
xchat.hook_command('key_type', getattr(fish, 'set_key_type'),
                   help=('/KEY_TYPE [<nick/channel>] [<network>] [AES|Blowfish],'
                         'display or set the key type for a particular nick or channel.'))


xchat.hook_unload(getattr(fish, 'unload'))

print 'XChat-FiSH-AES loaded successfully.'
コード例 #24
0
    ACTIVE_JOBS = 0
    WATCHLIST = {}

    xchat.prnt("Translator reinitialized")
    return xchat.EAT_ALL


xchat.hook_command("TRINIT",
                   initialize,
                   help="/TRINIT - reinitializes the plugin.")


def unload_plugin(userdata):
    global TIMEOUT_HOOK
    global CONN

    if TIMEOUT_HOOK is not None:
        xchat.unhook(TIMEOUT_HOOK)
        TIMEOUT_HOOK = None

    if CONN is not None:
        Translator.closeConnection()

    xchat.prnt("Translator is unloaded.")
    return None


xchat.hook_unload(unload_plugin)

xchat.prnt("Translator is loaded.")
コード例 #25
0
      def label(self, line, align="left"):
          """ Stampa i label del layout """
          c = 0
          for l in line:
               maxchars = self.table[c][1]
               label = len(l[0]) > self.table[c][1] and "%s...." % \
                                                      l[0][:maxchars-4] or l[0]
               print '\x0301,00', label.ljust(l[1], " "),
               c += 1
          print

      def write(self, line, align="left", delimiter=" "):
          """ Stampa i campi della tabella """
          c = 0
          for l in line:
               maxchars = self.table[c][1]
               str = len(l) > self.table[c][1] and "%s...." % \
                                                            l[:maxchars-4] or l
               strlen = len(str)

               if align == 'left': print str.ljust(maxchars, delimiter),
               else: print str.rust(maxchars, delimiter)
               c += 1
          print

mp3blocker = mp3filter()
cososwap = mp3filter.debug_swap
xchat.hook_unload(mp3blocker.unload)

コード例 #26
0
ファイル: betterkb.py プロジェクト: hondje/random
                       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))
xchat.hook_unload(SaveINIish, (banOpts, "banopts"))
xchat.prnt("Loaded %s version %s." % (__module_name__, __module_version__))
コード例 #27
0
ファイル: seen.py プロジェクト: AwwCookies/xchat-plugin-seen
            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")
コード例 #28
0
    for channel in channels:
        if channel not in channel_list:
            xchat.prnt('%sNoNotify - Adding %s to NoNotify channel list.' %
                       (green, channel))
            channel_list.append(channel)
        else:
            xchat.prnt(
                '%sNoNotify -  Not adding %s, already in NoNotify channel list.'
                % (green, channel))
    return xchat.EAT_ALL


def show_nonotify():
    if not channel_list:
        xchat.prnt('%sNoNotify - The NoNotify list is empty.' % green)
    else:
        xchat.prnt(
            '%sNoNotify - The following channels are on the NoNotify list:' %
            green)
        for channel in channel_list:
            xchat.prnt('%s    - %s' % (green, channel))
    return xchat.EAT_ALL


xchat.hook_print('Channel Msg Hilight', nonotify_callback)
xchat.hook_print('Channel Action Hilight', nonotify_callback)
xchat.hook_command('nonotify', nonotify)
xchat.hook_unload(on_unload)

xchat.prnt('%sModule No Notify Loaded.' % green)
コード例 #29
0
# 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)
コード例 #30
0
            ctx.prnt("treenumbers: %s" % msg)


numerator = TreeNumerator()

# open context seems to overwrite any label changes, delay longer
hooks = []


def unload_cb(arg):
    for hook in hooks:
        xchat.unhook(hook)
    numerator.log("successfully unloaded")


hooks.append(xchat.hook_unload(unload_cb))


def init(ignore_data=None):
    hooks.append(xchat.hook_timer(500, numerator.update_timer_cb))
    hooks.append(xchat.hook_print("Focus Tab", numerator.reset_activity_cb))

    for evt in ('Channel Action Hilight', 'Channel Msg Hilight',
                'Channel Message', 'Private Message to Dialog',
                'Private Action to Dialog'):
        hooks.append(xchat.hook_print(evt, numerator.activity_cb))

    try:
        numerator.enumerate_tabs()
    except WindowsError as e:
        numerator.log("error on initial enumeration")
コード例 #31
0
ファイル: seen.py プロジェクト: AwwCookies/xchat-plugin-seen
                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")
コード例 #32
0
            # using emit_print results in an infinite loop with activity_cb
            # even when filtering by channel != >>python<<
            #ctx.emit_print("Channel Message", "treenumbers", msg)
            ctx.prnt("treenumbers: %s" % msg)

numerator = TreeNumerator()

# open context seems to overwrite any label changes, delay longer
hooks = []

def unload_cb(arg):
    for hook in hooks:
        xchat.unhook(hook)
    numerator.log("successfully unloaded")

hooks.append(xchat.hook_unload(unload_cb))

def init(ignore_data=None):
    hooks.append(xchat.hook_timer(500, numerator.update_timer_cb))
    hooks.append(xchat.hook_print("Focus Tab",
        numerator.reset_activity_cb))

    for evt in ('Channel Action Hilight'
               ,'Channel Msg Hilight'
               ,'Channel Message'
               ,'Private Message to Dialog'
               ,'Private Action to Dialog'):
        hooks.append(xchat.hook_print(evt, numerator.activity_cb))


    try:
コード例 #33
0
	xchat.prnt("Last error: " + LAST_ERROR)
xchat.hook_command("LASTERROR", readError, help = "/LASTERROR - prints out the last error message to screen locally.")

'''
	Adds a new translation job to the queue.
'''
def addJob(word, word_eol, userdata):
	channel = xchat.get_info('channel')
	key = channel + " " + word[0].lower()

	if(AUTOUSER.has_key(key)):
		dest, src = AUTOUSER[key]
		ThreadController.addJob((xchat.get_context(), word[0], src, dest, word[1]))

	return xchat.EAT_NONE

xchat.hook_print("Channel Message", addJob)

'''
	Shuts down the threads and thread controller when unloading the module.
'''
def unload_translator(userdata):
	ThreadController.worker.kill = True
	ThreadController.addJob(None)
	print 'Translator is unloaded'

xchat.hook_unload(unload_translator)

# Load successful, print message
print 'Translator script loaded successfully.'
コード例 #34
0
		pass
	elif any(word[2] == stopcmd for stopcmd in stopcommands):
		mySyntax = " "
		moreInfoLines = ["Terminates all livestreamer processes"]
	if len(mySyntax) > 0:
		haveTopic = True
	else:
		haveTopic = False
	if len(moreInfoLines) > 0:
		haveMoreInfo = True
	else:
		haveMoreInfo = False
	if haveTopic:
		print("Usage: /xstream {0} {1}".format(word[2], mySyntax))
	if haveMoreInfo:
		for nextLine in moreInfoLines:
			print("{0}".format(nextLine))
	if not haveTopic and len(word) >= 3:
		print("Sorry, I don't have any help topics for {0}".format(word_eol[2]))
	return xchat.EAT_ALL

def unload_xstream(userdata):
	print("{0} unloaded".format(__module_name__))

xchat.hook_unload(unload_xstream)
xchat.hook_command("xstream", main, help="Usage: /xstream (<channel>) (<quality>) (<server>)")
xchat.hook_command("livestreamer", main, help="Usage: /livestreamer (<channel>) (<quality>) (<server>)")
xchat.hook_command("xs", main, help="Usage: /xs (<channel>) (<quality>) (<server>)")

print("{0} {1} loaded".format(__module_name__, __module_version__))
コード例 #35
0
    primarymod = 1 << 2
shiftmod = 1 << 0


def get_valid_mod(mod):
    """Modifiers are full of junk we dont care about, remove them"""
    return int(mod) & (1 << 0 | 1 << 2 | 1 << 3 | 1 << 28)


def keypress_cb(word, word_eol, userdata):

    key = word[0]
    mod = get_valid_mod(word[1])

    if (key, mod) == ('65293', primarymod):

        lasttext = hexchat.get_info('inputbox')
        newline = "\n"
        newtext = lasttext + newline
        hexchat.command('settext {}'.format(newtext))
        hexchat.command('setcursor {}'.format(len(newtext)))


def unload_cb(userdata):
    print(__module_name__, 'version', __module_version__, 'unloaded.')


hexchat.hook_print('Key Press', keypress_cb)
hexchat.hook_unload(unload_cb)
print(__module_name__, 'version', __module_version__, 'loaded.')
コード例 #36
0
ファイル: otc_tk.py プロジェクト: nixworks/shitter-1
                   (word[1]))

    return xchat.EAT_XCHAT


# Hook our functions to the callback handler
xchat.hook_command("OTCTK", otcauth_cb, help="'/OTCTK help' for more help")


# An unload callback function to clean up
def otcauth_unload_cb(userdata):
    # Remove our MENU's
    xchat.command('MENU DEL "OTC Toolkit/GPG EAuth" "otctk eauth"')
    xchat.command('MENU DEL "OTC Toolkit/-"')
    xchat.command('MENU DEL "OTC Toolkit/Get Voice"')
    xchat.command('MENU DEL "OTC Toolkit"')

    # Remove nicklist popup menus
    xchat.command('MENU DEL "$NICK/OTC Toolkit/Get WoT Rating"')
    xchat.command('MENU DEL "$NICK/OTC Toolkit/GPG Information"')
    xchat.command('MENU DEL "$NICK/OTC Toolkit"')

    # Print out our unloaded message.
    xchat.prnt("\002\00302%s:\00302 \00304[[[UNLOADED]]]\00304\002" %
               __module_name__)
    return xchat.EAT_XCHAT


# And hook into our unload event
xchat.hook_unload(otcauth_unload_cb)
コード例 #37
0

def addJob(word, word_eol, userdata):
    channel = xchat.get_info('channel')
    key = channel + " " + word[0].lower()

    if (AUTOUSER.has_key(key)):
        dest, src = AUTOUSER[key]
        ThreadController.addJob(
            (xchat.get_context(), word[0], src, dest, word[1]))

    return xchat.EAT_NONE


xchat.hook_print("Channel Message", addJob)
'''
	Shuts down the threads and thread controller when unloading the module.
'''


def unload_translator(userdata):
    ThreadController.worker.kill = True
    ThreadController.addJob(None)
    print 'Translator is unloaded'


xchat.hook_unload(unload_translator)

# Load successful, print message
print 'Translator script loaded successfully.'
コード例 #38
0
ファイル: rainbowtext.py プロジェクト: Jake0720/XChat-Scripts
        return hexchat.EAT_ALL

def defab_callback(word, word_eol, user_data):
        global fab_hook
        
        if fab_hook is not None:
                hexchat.unhook(fab_hook)
                fab_hook = None
                hexchat.prnt('Fabulous mode off')
        
        return hexchat.EAT_ALL

def fab_passthru_callback(word, word_eol, user_data):
        global in_fab_hook
        
        if in_fab_hook:
                return hexchat.EAT_NONE
        else:
                hexchat.command('fab {0}'.format(word_eol[0]))
                
                return hexchat.EAT_ALL
def onUnload(userdata):
        hexchat.prnt('%s has been unloaded.' % __module_name__)

hexchat.hook_command('fab', fab_callback, help=fabhelp)
hexchat.hook_command('fab2', fab2_callback, help=fab2help)
hexchat.hook_command('spoiler', spoiler_callback, help=spoilerhelp)
hexchat.hook_command('enfab', enfab_callback, help=enfabhelp)
hexchat.hook_command('defab', defab_callback, help=defabhelp)
hexchat.hook_unload(onUnload)
コード例 #39
0
ファイル: Randomkick.py プロジェクト: Jake0720/XChat-Scripts
    #try:
    reason = select((
                     'Goodbye!','See you later.','Cya.','Bye.','Later!',
                     'Kindergarden is elsewhere!','Ugh. BYE!','G\'day',
                     'Seeya later!','Be gone!','This is awkward. Bye.',
                     'I didn\'t do it!'
                    ))
    if len(word) == 2:
        # Assume they supplied a username
        return xchat.command('kick %s %s' % (word[1], reason))
    elif len(word) == 1:
        # Assume they want a random user
        list = xchat.get_list("users") 
        if not list:
            return xchat.prnt(help)
        user = select((list))
        return xchat.command('kick %s %s' % (user.nick, reason))
    else:
        # Assume they entered some weird stuff
        return xchat.prnt(help)
    #except:
    #    xchat.prnt(help)
    
    return xchat.EAT_ALL

def onUnload(userdata):
    xchat.prnt('%s%s has been unloaded.' % (c, __module_name__))

xchat.hook_command('rkick', rkick, help=help)
xchat.hook_unload(onUnload)
コード例 #40
0
	elif len(word) == 2:
		if word[1] == 'msg':
			xchat.prnt("/dlm msg Message to send to people here")
		if word[1] == 'msg':
			xchat.prnt("/dlm delay milliseconds")
		elif word[1] == 'method':
			xchat.prnt("/dlm method notice|msg|say|none")
		elif word[1] == 'show':
			xchat.prnt("Settings for %s:" % sChan)
			xchat.prnt("Message: "+GetOpt(2))
			xchat.prnt("Delay: "+str(GetOpt(1)))
			xchat.prnt("Method: "+GetOpt(0))
		#endif
	else:
		xchat.prnt("/dlm msg|method|delay arguments")
	#endif
	return xchat.EAT_ALL
#enddef

xchat.hook_command("dlm",Settings)
xchat.hook_print("Join",ReadySend)

for x in ["Notice Send","Message Send"]:
	xchat.hook_print(x,BlockSelf)
#endfor

xchat.hook_unload(SaveSettings)

xchat.prnt("Loaded %s version %s." % (__module_name__,__module_version__))

コード例 #41
0
ファイル: ircrypt.py プロジェクト: lordi/ircrypt-xchat
	else:
		xchat.prnt('Found %s' % version)
		ircrypt_options['BINARY'] = ircrypt_gpg_binary

def test(word, word_eol, userdata):


	xchat.prnt(word[-2])
	return xchat.EAT_ALL

# Initialize
ircrypt_init()

# Chek if gpg binary is set
ircrypt_check_binary()

# hook for ircrypt command
xchat.hook_command('ircrypt', ircrypt_command_hook, help=ircrypt_help_text)

# hook for encryption
xchat.hook_command('', ircrypt_encrypt_hook)

# hook for decryption
xchat.hook_print('Channel Message', ircrypt_decrypt_hook, 'Channel Message')

# hook to check for asymmetric encryption in notices
xchat.hook_print('Notice', ircrypt_notice_hook)

# Unload
xchat.hook_unload(ircrypt_unload)
コード例 #42
0
ファイル: ctcp.py プロジェクト: GunfighterJ/xchat-plugins
    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__))
コード例 #43
0
ファイル: geoip-lookup.py プロジェクト: rschmied/geoip-lookup
                xchat.emit_print("Server Error", "Can't find user %s" % word[1])
        else:
            xchat.command('whois %s' % word[1])
    return xchat.EAT_ALL


def getLocationJoinCB(word, word_eol, userdata):
    loc = word[2].split('@')[1]
    printLocationLine(word[0], loc)
    return xchat.EAT_NONE


def unloadCB(userdata):
    print colordecode("%C4Plugin %B" + __module_name__ + "%B " + __module_version__ + " unloaded.")


try:
    cmd = __module_name__.upper()
    xchat.hook_command(cmd, getLocationCB, help="/" + cmd + " <userid> Gets location of user")
    xchat.hook_print("Join", getLocationJoinCB)
    xchat.hook_print("Whois Name Line", getLocationWhoisNameCB)
    xchat.hook_unload(unloadCB)
    print colordecode("%C4Plugin %B" + __module_name__ + "%B " + __module_version__ + " loaded.")

except:
    print "can't hook callbacks to xchat"

if __name__ == '__main__':
    pass

コード例 #44
0
		xchat.unhook(TIMEOUT_HOOK)
		TIMEOUT_HOOK = None

	if CONN is not None:
		CONN.close()
		CONN = None

	ACTIVE_JOBS = 0
	WATCHLIST = {}

	xchat.prnt("Translator reinitialized")
	return xchat.EAT_ALL
xchat.hook_command("TRINIT", initialize, help = "/TRINIT - reinitializes the plugin.")

def unload_plugin(userdata):
	global TIMEOUT_HOOK
	global CONN

	if TIMEOUT_HOOK is not None:
		xchat.unhook(TIMEOUT_HOOK)
		TIMEOUT_HOOK = None

	if CONN is not None:
		Translator.closeConnection()

	xchat.prnt("Translator is unloaded.")
	return None
xchat.hook_unload(unload_plugin)

xchat.prnt("Translator is loaded.")
コード例 #45
0
ファイル: mpx-xchat.py プロジェクト: mderezynski/Youki2
        style_itt += 1


    def unload_cb (userdata):
        xchat.command('DELBUTTON "::bmpx::"')
        xchat.command('DELBUTTON "::song::"')
        bmpctrl.XChatRemoveButtons()
        xchat.command('MENU del "Music"')
        print '%s is unloaded' %__module_name__
 
 
    #=========================================================================
    # Hooks
    #=========================================================================
 
    xchat.hook_unload(unload_cb)
    xchat.hook_command('BMPRECONN', bmpctrl.Reconnect, help="Reconnect to BMPx on DBus")
    xchat.hook_command('BMP', bmpctrl.XChatCallback, help=__doc__)
    xchat.hook_command('BMPQUERY', UIQuery, help="Dialog to query for tracks in music library")
    xchat.hook_command('BMPSEARCH', UISearch, help="Dialog to search for a track in playlist")
    xchat.hook_command('BMPTRACK', UITrack, help="Dialog to play a track in the playlist")
    xchat.hook_command('BMPABOUT', UIAbout, help="About dialog")

    print '%s - Version %s\n(c)2003-2006 %s\n\037%s' % (__module_description__ , __module_version__, __module_author__, __module_href__)
    print 'Most of functions are broken, they will be updated later'


#=============================================================================
except ImportError:
    """Failed to Import dbus modules
コード例 #46
0
#############################################################################
# Script unloading function.
#############################################################################
def unload_cb(userdata):
    xchat.unhook(HOOKGHELP)
    for entry in dir(gmodules):
        if "__" not in entry:
            command = ''.join(["gmodules.", entry, ".unload()"])
            messages = eval(command)
            if messages is not None:
                for message in messages:
                    print(message)
    xchat.unhook(HOOKUNLOAD)
    xchat.command('menu del GatoScript')
    print("".join(["GatoScript ", __module_version__, " has been unloaded"]))


#############################################################################
# Hooks for all functions provided by this module
#############################################################################
help_usage = "Usage: ghelp, shows GatoScript help"
HOOKGHELP = xchat.hook_command("gatohelp", help_cb, help=help_usage)
HOOKUNLOAD = xchat.hook_unload(unload_cb)


# If this point is reached, it means the script has been loaded succefully, so
# we anounce it.
message = "".join(["GatoScript ", __module_version__, " has been loaded."])
gmodules.helper.gprint(message)
コード例 #47
0
ファイル: betterkb.py プロジェクト: GunfighterJ/xchat-plugins
			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__))
コード例 #48
0
ファイル: dict.py プロジェクト: joeytwiddle/code
    elif word[1][0:3] == "off":
        if active == 1:
            active = 0
            xchat.prnt("Module turned off!")
        else:
            xchat.prnt("Module already disabled!")
    elif word[1][0:2] == "on":
        if active == 0:
            active = 1
            lastcommand = 0
            xchat.prnt("Module turned on!")
        else:
            xchat.prnt("Module already enabled!")
    return xchat.EAT_ALL


def unloading(userdata):
    xchat.prnt("Unloading Dict module...")


# These are all XChat specific functions
xchat.hook_print("Channel Msg Hilight", they_say)
xchat.hook_print("Channel Message", they_say)
xchat.hook_print("Private Message to Dialog", they_say)
xchat.hook_print("Your Message", me_say)
xchat.hook_command("dict", set_vars)
xchat.hook_unload(unloading)

# Print success on load
xchat.prnt("Dict loaded successfully.")