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
Example #2
0
def init():
    if config_dir is None:
        print("Failed to find config directory path")
        return
    if not os.path.isdir(config_dir):
        if os.path.exists(config_dir):
            print(config_dir + " exists and is not a directoy, cannot initialize")
            return
        os.makedirs(config_dir)

    xchat.hook_command("autoxdcc", main, help="/autoxdcc <config_name>")
    print("AutoXdcc loaded")
Example #3
0
    def __init__(self):
#        self._server_charset = {}
        self.fallbacks = ['cp1255'] # that will be configurable and user-settable.
        self._ignore_receive = False
        self._ignore_send = False
        for event in EVENTS:
            xchat.hook_print(event[0], self.convert, event, 
                             priority=xchat.PRI_HIGHEST)
#        xchat.hook_command('', self.debug_print, 'all', priority=xchat.PRI_HIGHEST)
        xchat.hook_command('', self.fix_sends, priority=xchat.PRI_HIGHEST)
        for cmd in ('SAY', 'ME', 'MSG'):
            xchat.hook_command(cmd, self.fix_sendcmd, cmd, priority=xchat.PRI_HIGHEST)
Example #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__))
Example #5
0
    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)
Example #6
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__))
Example #7
0
    def __init__(self):
        self.start_time = time.time()
        for event in XchatSoundHandler.EVENTS:
            xchat.hook_print(event, self.handle_message, event)

        xchat.hook_command("chatsounds", self.handle_prefs)
        xchat.hook_command("cs", self.handle_prefs)

        self.player = SoundPlayer()

        self.sound_dir = os.path.expanduser("~/.xchat2/sounds/")

        self.silenced_channels = []

        print "Loaded chatsounds.py"
Example #8
0
def load(*args):
    groups_load_from_settings()
    compile_strings()
    for event in chat_events:
        xchat.hook_print(event, dispatch_message, event)

    xchat.hook_print("Key Press", dispatch_key)
    xchat.hook_command("", dispatch_command)

    xchat.hook_command("ov", command_handler)

    for event in ["You Join", "You Kicked", "You Part", "you Part with Reason"]:
        xchat.hook_print(event, dispatch_channels_change, event)

    print(__module_name__, __module_version__, 'loaded')
Example #9
0
    def __init__(self) :
        self.start_time = time.time()
        for event in XchatSoundHandler.EVENTS :
            xchat.hook_print(event, self.handle_message, event)

        xchat.hook_command("chatsounds", self.handle_prefs)
        xchat.hook_command("cs", self.handle_prefs)

        self.player = SoundPlayer()

        self.sound_dir = os.path.expanduser("~/.xchat2/sounds/")

        self.silenced_channels = SILENCED_CHANNELS

        debugprint("Loaded chatsounds.py")
Example #10
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
Example #11
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),
Example #12
0
def bind_xchat():
    '''
    Bind to XChat
    '''
    xm = XchatMemory()
    xchat.hook_command('remember',xm.remember)
    xchat.hook_command('lookup',xm.lookup)
    xchat.hook_command('remembered',xm.remembered)
    xchat.hook_command('forget',xm.forget)
Example #13
0
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"
Example #14
0
def enfab_callback(word, word_eol, user_data):
        global fab_hook
        
        if fab_hook is None:
                fab_hook = hexchat.hook_command('', fab_passthru_callback)
                hexchat.prnt('Fabulous mode on')
        
        return hexchat.EAT_ALL
Example #15
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),
      def __init__(self):
          """ Costruttore """
          self.pattern = []
          self.stats = {}
          self.pattern_stats = [0, (0, 0)]

          self.debug = False
          self.label = "Mp3 filter"            

          self.load_config()
          for evnt in filter_event:
               xchat.hook_print(evnt, self.ignore_mp3_notification)            

          xchat.hook_command("mp3filter_reload", self.reload_config,
                               help="Carica nuovamente i filtri dalla config")
          xchat.hook_command("mp3filter_stats", self.pattern_status,
                                          help="Statistiche sui filtri usati")
          xchat.hook_command("mp3filter_debug", self.debug_swap,
                                        help="Stampa i messaggi che vengono \
                                              bloccati; Utile per capire \
                                  quali messaggi bloccano gli attuali filtri")

          xchat.command('MENU ADD "%s"' % self.label)
          xchat.command('MENU ADD "%s/Ricarica filtri" "mp3filter_reload"' %
                                                                   self.label)
          xchat.command('MENU ADD "%s/Statistiche filtri" "mp3filter_stats"' %
                                                                   self.label)
          xchat.command('MENU ADD "%s/Debug" "mp3filter_debug None"' %
                                                                   self.label)

          print "Filtro mp3 caricato su: \x0304%s\x03" % ', '.join(filter_event)
          s=self.pattern_stats
          print "%d/%d filtri caricati!" % (s[1][0], s[0])
Example #17
0
    def __init__(self):
        #Decode hooks
        xchat.hook_print("Private Message", self.decode, "Private Message")
        xchat.hook_print("Private Message to Dialog", self.decode, "Private Message to Dialog")

        xchat.hook_print("Quit", self.quithook, "Quit")
        xchat.hook_print("Connected", self.resetconversationshook, "Connected")
        xchat.hook_print("Your Nick Changing", self.resetconversationshook,
            "Your Nick Changing")

        #Generic encode hook
        self.allhook = xchat.hook_command("", self.encode)

        #TODO RandomPool is know to be broken
        #Random generator
        self.randfunc = get_random_bytes

        #Initialize configuration directory
        confDir = xchat.get_info("xchatdirfs") + "/cryptochati.conf"
        if not os.path.isdir(confDir):
            os.makedirs(confDir, 0700)

        #Friends file
        self.friendsPath = os.path.join(confDir, "friends.txt")
        #Private key file
        self.myKeyPath = os.path.join(confDir, "my.key")
        #Friends' public keys file
        self.keysPath = os.path.join(confDir, "public.keys")

        #Create/load configuration
        self.openConfiguration()

        #Friend management hook
        xchat.hook_command("Friend", self.friendhook, "Friend", help=
"""Usage:
FRIEND ADD <nick> - adds <nick> as a trusted friend
FRIEND DEL <nick> - deletes <nick> from trusted friends
FRIEND LIST - lists current trusted friends""")
 def enable(self):
     self.is_enabled = True
     #read in config
     self.config = ConfigParser.RawConfigParser()
     self.config.read('config.conf')
     #set menus
     self.setup_nick_menu()
     #create list of channels
     try:
         for channel in xchat.get_list("channel"):
             dir(channel)
     except KeyError:
         pass
     #watch for new channels joined
     xchat.hook_command("join", self.on_channel_join)
     #watch for channels left
     xchat.hook_command("part", self.on_channel_part)
     #set hooks for joti/join/part/messages
     xchat.hook_command("joti", self.dispatch)
     xchat.hook_print('Channel Message', self.on_text)
     xchat.hook_print('Join', self.on_join)
     xchat.hook_print('Part', self.on_part)
Example #19
0
            "name").text  #because .name returns other things
        album = current_track.album.text
        #let's make a status :3
        status = song + " - " + artist
        if album != "":
            status = status + " (" + album + ")"
        if username == xchat.get_info("nick"):
            xchat.command("me last listened to %s" % (status.encode('utf-8')))
        else:
            xchat.command("say " + username + " last listened to %s" %
                          (status.encode('utf-8')))
    except:
        xchat.prnt("An error ocurred, probably a wrong Username")


def EXChatMPD(word, word_eol, userdata):
    current_nick = xchat.get_info("nick")
    if (len(word) <= 1):
        get_playing_song(current_nick)
    else:
        get_playing_song(word[1])
    return xchat.EAT_ALL


xchat.hook_command(
    "lastfm",
    EXChatMPD,
    help=
    "/lastfm for your last played song, or /lastfm NICK, for NICK's current playing song"
)
Example #20
0
    except dbus.exceptions.DBusException:
        return "__DBusException__"


try:
    import xchat

except ImportError:
    res = get_playing()
    if res != "__DBusException__":
        print "Playing:", res
    else:
        import sys
        sys.exit(1)

else:
    __module_name__ = "amarok-nowplaying"
    __module_version__ = "0.1.3"
    __module_description__ = "now playing script for Amarok 2"
    print "Starting", __module_name__, __module_version__

    def nowplaying_command_hook(word, word_eol, userdata):
        res = get_playing()
        if res != "__DBusException__":
            xchat.command("me " + "is listening to " + res)
        else:
            print "DBus exception occurred; most likely Amarok is not running."
        return xchat.EAT_ALL

    xchat.hook_command("playing", nowplaying_command_hook)
		return default_template
	else:
		return template
		
def SetTemplate(word, word_eol, userdata):
	global template
	template = word_eol[1]
	print "Template updated"
	return xchat.EAT_NONE
	
def PrintTemplate(word, word_eol, userdata):
	print GetTemplate()
	return xchat.EAT_NONE
		
def DoeCurInfo(word, word_eol, userdata):
	try:
		spotify = Spotify()
		
	except:
		xchat.prnt("Spotify is not running")
		return xchat.EAT_NONE
	
	
	xchat.command("ME "+GetTemplate() % {"track":spotify.getCurrentTrack(), "artist":spotify.getCurrentArtist(), "randcolor":""+str(randint(0,15)), "randcolor2":""+str(randint(0,15)), "randcolor3":""+str(randint(0,15)), "normal":""})
	return xchat.EAT_NONE

xchat.hook_command("SPOTIFY", DoeCurInfo, help="Displays current song info")
xchat.hook_command("SETSPOTTEMPL", SetTemplate, help="Set the template for /spotify")
xchat.hook_command("GETSPOTTEMPL", PrintTemplate, help="Get the template for /spotify")
print "pytify loaded"
Example #22
0
            return xchat.EAT_XCHAT


for event in events:
    xchat.hook_print(event, cocktography_cb)


def enchode_cb(word, word_eol, userdata):
    input = word_eol[1][:150]
    s = choder.enchode(input, 2, 340)
    buffer["input"] = s.splitlines()
    for dongs in buffer["input"]:
        xchat.get_context().command('say ' + dongs)
    del buffer["input"]
    xchat.emit_print(
        "Channel Message",
        '\0034\002\037' + xchat.get_info('nick') + '\0034\002\037', input, "")

    return xchat.EAT_XCHAT


def dechode_cb(word, word_eol, userdata):
    xchat.prnt(choder.dechode(word[1])[0])
    return xchat.EAT_XCHAT


xchat.hook_command("enchode", enchode_cb)
xchat.hook_command("dechode", dechode_cb)

xchat.prnt(__module_name__ + " version " + __module_version__ + " loaded")
Example #23
0
def np(user):
	# get currently playing song
	recent = fetch('user.getRecentTracks', {'user' : username, 'limit': '1', 'extended': '1'})['recenttracks']['track']

	if type(recent) == list:
		recent = recent[0]

	try:
		artist = recent['artist']['name']
		track  = recent['name']
		loved  = '♥' if recent['loved'] == '1' else ''
	except Exception as e:
		try:
			return recent['error']
		except:
			return e

	# get song tags
	tags = getTags(artist, track)
	
	# return np text
	return 'np: {} - {} {} {}'.format(artist, track, tags, loved)


def np_hook(word,word_eol,userdata):
	command('me {}'.format(np(username)))
	return EAT_ALL

hook_command('np', np_hook, help='/np displays your now playing from last.fm') 
Example #24
0
 def __init__(self):
   xchat.hook_command("hostcheck", self.check_process, help="/hostcheck <channel>")
Example #25
0
			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__))
	def kill_spammer(self, word, word_eol, userdata):
		if not self.loggedin:
			xchat.prnt('Error: please reload module with correct login details')
			return None
		if len(word) < 2:
			xchat.prnt('Error: username was not supplied')
			return None

		username = word_eol[1]
		user = wikitools.User(self.wiki, username)
		if self.is_old_user(user):
			xchat.prnt('User:'******' is > 1 day old. Backing off.')
		elif not user.isBlocked():
			self.block_user(user)
			xchat.prnt('User:'******' has been blocked')

			edits = self.get_user_edits(username)
			pagescreated = self.get_created_pages(edits)
			self.delete_pages(pagescreated)
		else:
			xchat.prnt('User:'******' has already been blocked')


def kill_spammer(word, word_eol, userdata):
	thread.kill_spammer(word, word_eol, userdata)

thread = KillerThread()
thread.login()

xchat.hook_command('block', kill_spammer)
Example #27
0
                                                        or y[x + 1] == h - 1):
                    s[x] = '$h'
                else:
                    s[x] = '$h'
        s = "".join(s)
        _text.append(s)
    return _text


def plot(word, word_eol, userdata):
    x = symbols('x')
    arg1 = word[1]
    arg2 = word[2]
    txt = word[3]
    # nicklist = [user.nick for user in xchat.get_list('users')
    #             if xchat.nickcmp(user.nick, 'erm') != 0]
    # for z in xrange(40):
    #     text = textplot_(sympy.sin(x), z, 5)
    text = textplot_(sympy.sin(x), arg1, arg2)
    text = [i.replace('$h', color(txt)) for i in text]
    for i in text:
        xchat.command("say %s" % i)
    return xchat.EAT_ALL


xchat.hook_command('plot', plot, help="/plot")


def color(txt):
    return "%d,%d%s" % (random.randint(1, 10), random.randint(1, 10), txt)
Example #28
0
cmd_aliases = {'highlights': {'xhighlights': {'helpfix': ('XHIGH', 'HIGH')},
                              },
               }

# Fix help and descriptions for aliases
for aliasname in cmd_aliases.keys():
    # Fix help
    for cmd in cmd_aliases[aliasname]:
        replacestr, replacewith = cmd_aliases[aliasname][cmd]['helpfix']
        cmd_help[aliasname] = cmd_help[cmd].replace(replacestr, replacewith)
    # Fix description
    aliasforcmds = list(cmd_aliases[aliasname].keys())
    aliasfor = aliasforcmds[0]
    commands[aliasname]['desc'] = commands[aliasfor]['desc']

# Hook all enabled commands.
for cmdname in commands.keys():
    if commands[cmdname]['enabled']:
        xchat.hook_command(cmdname.upper(),
                           commands[cmdname]['func'],
                           userdata=None,
                           help=cmd_help[cmdname])

# Hook into channel msgs
for eventname in ('Channel Message', 'Channel Msg Hilight', 'Your Message'):
    xchat.hook_print(eventname, message_filter, userdata=eventname)


# Print status
print('{} loaded.'.format(color_text('blue', VERSIONSTR)))
Example #29
0
__module_name__ = "age"
__module_version__ = "1.0"
__module_description__ = "Display your age in the active channel"

import xchat, datetime
''' Set these variables to your birthday '''
YEAR = 1970
MONTH = 1
DAY = 1


def cmd_age(word, wordl, ud):
    woot = (datetime.datetime.today() -
            datetime.datetime(year=YEAR, month=MONTH, day=DAY)).days / 365.24
    xchat.command("MSG %s Age: %s" % (xchat.get_info("channel"), woot))
    return xchat.EAT_ALL


xchat.hook_command("age",
                   cmd_age,
                   help="Display your age in the active channel")
Example #30
0
def parse_response(page_data):
    page = page_data.content
    page_soup = BeautifulSoup(page)
    p_tags = page_soup.findAll('p')
    if (any(i.text == 'It may also refer to:' for i in p_tags)
            or len(p_tags) < 4):
        multi_page(page_soup)
    else:
        for p in p_tags:
            paragraph = p.text.encode('ascii', 'ignore')
            xchat.prnt(paragraph)


def multi_page(page_soup):
    xchat.prnt('Multiple Entries:')
    entries = page_soup.findAll('a')
    entries = [i['href'].split('/')[-1] for i in entries]
    entries = [
        i for i in entries if 'Help:' not in i and 'File:' not in i
        and '&namespace=0' not in i and 'index.php' not in i
    ]
    for link in entries:
        xchat.prnt('[%d] %s' % (entries.index(link) + 1, link))


xchat.hook_command(
    'wiki',
    chk_wiki,
    help='Usage: /WIKI <query>, checks wikipedia for information on <query>.')
_gnupgdir = '/home/YOUR_USERNAME/.xchat2/'

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
Example #32
0
__module_name__ = "Hexchat Call ALL"
__module_version__ = "final"
__module_description__ = "GET B&"
__author__ = "b0nk"

import xchat as XC


def ca(word, word_eol, userdata):
    try:
        XC.command('say %s' % (' '.join(i.nick for i in XC.get_list('users'))))
    except Exception as e:
        print e


XC.hook_command("callall", ca, help="/callall and GET B&!!!")
XC.prnt(__module_name__ + ' version ' + __module_version__ + ' loaded.')
Example #33
0
                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

Example #34
0
    content = opener.open(baseurl % query).read()

    if debug:
        for i in range(len(content)/1000):
            print content[i*1000:(i+1)*1000]
        return xchat.EAT_ALL

    lindex = content.find('<h2 class=r style="font-size:138%">')
    if lindex == -1:
        xchat.prnt('Nothing found. If this seems wrong, please debug.')
        return xchat.EAT_ALL
    lindex = lindex + len('<h2 class=r style="font-size:138%"><b>')
    rindex = content.find('</b></h2>', lindex)
    result = content[lindex:rindex]
    result = " ".join(result.split())
    result = result.replace('&nbsp;', ' ')
    result = result.replace('&#215;', '×')
    result = re.sub(r'<sup>(\d+)<\/sup>&#8260;<sub>(\d+)</sub>',
            r' \1⁄\2',
            result)
    result = result.replace('<sup>', '^')
    result = result.replace('</sup>', '')
    result = result.replace('<font size=-2> </font>', ',')
    xchat.prnt("Google Calculator: %s" % result)
    return xchat.EAT_ALL

xchat.hook_command('gcalc', gcalc)

xchat.prnt('Loaded %s v%s by %s.'
        % (__module_name__, __module_version__, __module_author__))
Example #35
0
        if word[1].lower() == "add":
            addAop(word[2:])
        elif word[1].lower() == "remove":
            removeAop(word[2:])
        elif word[1].lower() == "list":
            printList()
        else:
            printHelp()
    except IndexError:
        printHelp()

    return xchat.EAT_ALL


xchat.hook_print("Join", processJoin)
xchat.hook_command("xaop", xaop_callback, help="/xaop add|remove|list|help")

# Load the aop list from a file:

try:
    f = open(CONFIG_FILE_LOCATION, "rb")
    aopList = pickle.load(f)
    f.close()
except IOError:
    aopList = []
except EOFError:
    aopList = []


def unload_cb(userdata):
    hexchat.prnt(__module_name__ + ' version ' + __module_version__ +
Example #36
0
		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.")
Example #37
0
print('%s%s has been loaded.' % (c, __module_name__))


def pban(word, word_eol, userdata):
    if word[1] == "0":
        xchat.command('ban %s!*@*' % (word[2]))
        xchat.command('kick %s Merci de choisir un pseudo plus addapté. :)' %
                      (word[2]))

    if word[1] == "1":
        xchat.command('ban %s*!*@*' % (word[2]))
        xchat.command('kick %s Merci de choisir un pseudo plus addapté. :)' %
                      (word[2]))

    if word[1] == "2":
        xchat.command('ban *%s!*@*' % (word[2]))
        xchat.command('kick %s Merci de choisir un pseudo plus addapté. :)' %
                      (word[2]))

    if word[1] == "3":
        xchat.command('ban *%s*!*@*' % (word[2]))
        xchat.command('kick %s Merci de choisir un pseudo plus addapté. :)' %
                      (word[2]))


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


xchat.hook_command('pban', pban, help=help0)
Example #38
0
        if checklist.values().count(checklist[user]) > 1:
            clones.append((checklist[user], user))
    if clones:
        clones.sort()
        print color["red"] + "The following clones were found in " + \
        thecontext.get_info('channel') + ":"
        for clone in clones:
            print color["blue"] + clone[1] + " " + clone[0]
    else:
        print color["blue"] + "No clones found"

    return xchat.EAT_ALL


load_vars()
#---Hooks---#000000#FFFFFF------------------------------------------------------
xchat.hook_print('Channel Message', on_text)
xchat.hook_print('Join', on_join)
xchat.hook_print('Part', on_part)
xchat.hook_print('Change Nick', on_change_nick)
xchat.hook_print('WhoIs Name Line', on_whois_nameline)
xchat.hook_print('WhoIs Channel/Oper Line', on_whois_channels)
xchat.hook_print('Notice', on_notice)
xchat.hook_print('Channel DeVoice', on_devoice)
xchat.hook_print('Channel Voice', on_voice)
xchat.hook_print('Ban List', on_banlist)
xchat.hook_command('clonescan', clonescan_local, help="/clonescan")

#LICENSE GPL
#Last modified 10-07-08
Example #39
0
def country_to_flag(countrycode):
    try:
        flag = _country_to_flag_dict[countrycode.upper()]
        flag = flag.replace('\\k', chr(3)).replace('\\b', chr(2))
        return flag
    except KeyError:
        raise LookupError


def flag(word, word_eol, userdata):
    channel = xchat.get_info('channel')
    modes = xchat.get_info('modes')
    if isinstance(modes, basestring):
        modes = modes.partition(' ')[0]
    if channel[0] == '#' and ('S' in modes or 'c' in modes):
        xchat.prnt('ERROR: Detected channel mode S or c')
        return xchat.EAT_ALL
    try:
        flag = country_to_flag(word[1]).split('\n')
        for line in flag:
            xchat.command('say ' + line)
    except LookupError:
        xchat.prnt('ERROR: No such country code')
    return xchat.EAT_ALL


xchat.hook_command('flag', flag, help='/FLAG COUNTRYCODE')

xchat.prnt('Loaded %s v%s by %s.' %
           (__module_name__, __module_version__, __module_author__))
Example #40
0

    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

      Show to user why the script wont work without DBus-Python installed properly.
Example #41
0
__module_name__ = "Hexchat Clear command replacer"
__module_version__ = "final"
__module_description__ = "Clears window and prints channel topic/motd"
__author__ = "b0nk"

import xchat as XC


def clearWindow(word, word_eol, userdata):
    print XC.get_context()


XC.hook_command("clear", clearWindow, help="/callall and GET B&!!!")
XC.prnt(__module_name__ + ' version ' + __module_version__ + ' loaded.')
Example #42
0
        cmd.file = split[2]
        cmd.queued = False
        cmd.transfering = True

def dccStall(split, full, data):
    global CommandQueue, Active
    botname = str(split[2])
    for cmd in (c for c in Active if c.bot == botname):
        print_error("Requested file \"%s\" has stalled during transport." % (split[1]))
        ret = cmd.retry()
        if ret:
            print_info("Re-requesting file \"%s\" (%d of 3 retries)" % (split[1], Active.retries))
        else:
            print_error("Retry limit reached for file \"%s\".  Stopping the queue." % (split[1]))

__unhook__ = xchat.hook_command("xdccq", dispatch, help=USAGE_STR)

print_info("XdccQ-TNG loaded successfully")
usage()

noticeHook = xchat.hook_print("Notice", notice, "data")
dccRecvCompleteHook = xchat.hook_print("DCC RECV Complete", dccComplete, "data")
dccRecvConnectHook = xchat.hook_print("DCC RECV Connect", dccConnect, "data")
dccRecvStallHook = xchat.hook_print("DCC Stall", dccStall, "data")

if __name__ == "__main__":
    def tests():
        """
        >>> numToList("1")
        [1]
        >>> numToList("1,2,4")
Example #43
0
        user = word[1]
        count = int(word[2])
    except IndexError:
        error("Invalid arguments!")
    else:
        ctx = twitter_context()
        for t in api.user_timeline(user, count=count):
            tid = t.id_str
            txt = t.text.encode('utf-8').split()
            txt = ' '.join(['11%s' % t if '@' in t 
                                else '2%s' % t if 'http' in t 
                                    else t 
                                        for t in txt])
            ctx.prnt('[11@%s] %s - 15https://twitter.com/%s/status/%s' % (user, txt, user, tid))
    return xchat.EAT_ALL
xchat.hook_command("timeline", timeline, help="/timline [user_name] [count]")

def tweet(word, word_eol, userdata):
    try:
        tweet_msg = word_eol[1]
    except IndexError:
        error("Invalid arguments!")
    else:
        if (len(tweet_msg) > 140):
            error("Tweet greater than 140 characters!")
        else:
            if ANNOUNCE_CHAN:
                tweet_msg = tweet_msg+' via '+str(xchat.get_info('channel')) 
            try:
                api.update_status(tweet_msg)
            except tweepy.error.TweepError as e:
Example #44
0
        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()
Example #45
0
###############################################################################
# I was foolish and didn't realize XChat provides an /allserv command.        #
# It is more straightforward to just make a user command that redirects       #
# /allaway to /allserv away                                                   #
###############################################################################

__module_author__ = 'Ward Muylaert'
__module_name__ = 'AllAway'
__module_version__ = '0.1'
__module_description__ = 'Sets you away on all the servers you are connected to.'

import xchat


def allaway(word, word_eol, userdata):
    channels = xchat.get_list('channels')
    for channel in channels:
        # Channel type 1 is a server, meaning we'll do it in every status tab
        # Second check is to make sure we are connected
        if channel.type == 1 and channel.context.get_info('server') != None:
            channel.context.command(word_eol[0][3:])
    return xchat.EAT_ALL


xchat.hook_command('allaway', allaway)
xchat.hook_command('allback', allaway)

xchat.prnt('Loaded %s v%s by %s.' %
           (__module_name__, __module_version__, __module_author__))
  except dbus.exceptions.DBusException as Err:
    xchat.prnt("An error occured, but xchat crashes when it gets printed.")
    #xchat.prnt(Err.get_dbus_message()) # Unsafe *cough*

def chooseSong(word, word_eol, next):
  if next:
    if os.system("exaile -n") == 0:
      xchat.prnt("Song changed")
    else:
      xchat.prnt("Song changing failed")
  else:
    if os.system("exaile -p") == 0:
      xchat.prnt("Song changed")
    else:
      xchat.prnt("Song changing failed")

def playPause(word, word_eol, ud):
  if os.system("exaile -t") == 0:
    xchat.prnt("Pause/play")
  else:
    xchat.prnt("Pause/play failed")

xchat.prnt("Exaile script initialized")
xchat.prnt("Use /np to announce the currently played song")
xchat.hook_command("np", printSong, False)
xchat.hook_command("npc", printSong, True)
xchat.hook_command("exaile_ver", printExaileVersion)
xchat.hook_command("exnext", chooseSong, True)
xchat.hook_command("exprev", chooseSong, False)
xchat.hook_command("pause", playPause)
Example #47
0
    active_pairs.add(pair)
    return xchat.EAT_NONE


def remove_pair(word, word_eol, userdata):
    try:
        active_pairs.remove(word[1])
        print "Removing %s" % word[1]

    except KeyError:
        print "No such pair is active"

    return xchat.EAT_NONE


xchat.hook_print("Channel Message", translate)
xchat.hook_command(
    "add_pair",
    add_pair,
    help=
    "/add_pair <pair> will start using the language pair to translate IRC text"
)
xchat.hook_command(
    "remove_pair",
    remove_pair,
    help=
    "/remove_pair <pair> will stop using the language pair to translate IRC text"
)

print "Plugin translate loaded!"
#  

__module_name__ = "XChat-DeaDBeeF"
__module_author__ = "iceTwy / mwgg"
__module_description__ = "DeaDBeeF integration in XChat and HexChat."
__module_version__ = "1.0"
__module_deadbeef_version__ = "0.5.6"

############################
import xchat              
import subprocess

from threading import Thread 
from time import sleep      
############################
	
def deadbeef_current_track(word, word_eol, userdata):
        read_track = subprocess.check_output('/usr/bin/deadbeef --nowplaying "%a - (%b) - %t [%@:BPS@bit / %@:BITRATE@kbps / %@:SAMPLERATE@Hz]"',shell=True).decode("utf-8")
        xchat.command("me is listening to " + read_track)
        return xchat.EAT_ALL

def unload(userdata):
        print("XChat-DeaDBeeF %s unloaded!" % (__module_version__))
        return xchat.EAT_ALL

if __name__ == '__main__':
        print("XChat-DeaDBeeF %s loaded successfully! - by %s" % (__module_version__,__module_author__))

#Display the current track
        xchat.hook_command('tellnp',deadbeef_current_track)
Example #49
0
    client.setvol(volume)
  except:
    print("invalid argument value")
    
def command_invalid(client, args):
  print("unknown command")
  
commands_selection={
    "play"  : command_play,
    "pause" : command_pause,
    "stop"  : command_stop,
    "setvol": command_set_volume,
    "prev"  : command_prev,
    "next"  : command_next
  }

def EXChatMPD(word, word_eol, userdata):
  client = mpd.MPDClient()
  try:
    client.connect("localhost",6600) #TODO parametrize
    if(len(word)<=1):
      send_status(client)
    else: #it's got at least a command
      commands_selection.get(word[1],command_invalid)(client, word[2::])
    client.disconnect()
  except: #fail to connect
    print("connection failed")
  return xchat.EAT_ALL
  
xchat.hook_command("mpd", EXChatMPD, help="/mpd command or just /mpd for current playing song")
Example #50
0
     current = xchat.get_context()
     if audacious_check():
     #playing?
         playing = commands.getstatusoutput(audtool_prog + " playback-playing")
         if (playing[0] == 0):
             song = commands.getoutput(audtool_prog + " current-song")
             artist = commands.getoutput(audtool_prog + " current-song-tuple-data artist")

             total = commands.getoutput(audtool_prog + " current-song-length")
             output = commands.getoutput(audtool_prog + " current-song-output-length")
             final = bold_char + "Now Playing: " + bold_char + song + (" - ") + artist + " (" + output + "/" + total + ")"
             #make sure it's not in a server window
             if ((current.get_info("channel") != current.get_info("server")) and (current.get_info("channel") != current.get_info("network"))):
                 #Say it.
                 xchat.command("msg " + current.get_info("channel") + " " + final)
             else:
                 #Print it
                 current.prnt(final)
         else:
             current.prnt("Check that Audacious is playing!")
     else:
         current.prnt("Check that you have Audacious installed and audtool_prog set properly!")
     #accept the command no matter what happens, to prevent unknown command messages
     return xchat.EAT_XCHAT

if audacious_check():
     xchat.hook_command("audacious", shout, help="/audacious - Sends currently playing information to current context.")
     xchat.prnt("Audacious Shout plugin loaded!")
else:
     xchat.prnt("Please check that Audacious is installed and audtool_prog is set properly. Plugin not loaded!")
Example #51
0
                # 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'
)
Example #52
0
		return xchat.EAT_NONE
	
	command = word[1].split(' ')[0].lower()
	if command == "!since":
		#Command not particularly useful if stream is live
		if monitoring["monotonetim"][0] is Status.online:
			xchat.command("say MonotoneTim is live right now!")
			timer = xchat.hook_timer(60000, cooldown_cb)
			cooldown = True
			return xchat.EAT_NONE
		
		if lastStreamTime == -1:
			file = open(filename, "r")
			lastStreamTime = float(file.read())
			file.close()
		delta = TimeDelta(time.time() - lastStreamTime)
		xchat.command("say " + delta.readableTime())
		timer = xchat.hook_timer(60000, cooldown_cb)
		cooldown = True
	return xchat.EAT_NONE

def cooldown_cb(userdata):
	global cooldown
	#There should only be one cooldown in this script,
	#as the other script covers cooldown commands
	cooldown = False
	return 0
	
xchat.hook_print("Channel Message", since_cb)
xchat.hook_command("monitor", monitor_cb, help = "/MONITOR Alerts when Tim is live")
xchat.hook_command("unmonitor", unmonitor_cb, help = "/UNMONITOR Stop monitoring")
Example #53
0
    }
    args['guessed'] = used_letters
    args['game'] = 'hangman'
    args['action'] = 'display'

    r = requests.post('http://nmichaels.org/hangsolve.py', data=args)
    guess = str(
        BeautifulSoup(r.content).find('span', {
            'class': 'guess'
        }).text[0])
    XC.hook_timer(random.randint(2000, 5000), guess_letter)
    used_letters += guess


# for not answering in just a moment when the task appears =)
def guess_letter(arg):
    global game
    global guess

    game.command('say !hangman ' + guess)


XC.hook_timer(4000, init_cb)
XC.hook_command(
    "hbot",
    bot_cb,
    help=
    "/hbot X - hangman X times (if nothing - 1 time) or start/stop or status")
XC.hook_print("Channel Message", message_cb)
XC.hook_print("Channel Msg Hilight", message_cb)
Example #54
0
import string
import random
import xchat

__module_name__ = "HexChat random channel plugin"
__module_version__ = "0.0.1"
__module_description__ = "randchan cmd"
__author__ = "Rylee Elise Fowler"

def randchan (word, word_eol, userdata):
    xchat.command('join #' + ''.join(random.sample(string.ascii_lowercase, 10)))

xchat.hook_command("randchan", randchan)
xchat.prnt(__module_name__ + ' version ' + __module_version__ + ' loaded.')
Example #55
0
    if len(text) > 1: target = text[1].strip()
    else: target = xchat.get_info('channel')
    xsay('{} status:'.format(target))
    xsay('☑  TOLD')
    xsay('☐  NOT TOLD')
    return xchat.EAT_ALL


def zalgo(text, text_eol, userdata):
    if len(text) > 1: text = text_eol[1].strip()
    else: return
    xsay('{}'.format('҉'.join(list(text))))
    return xchat.EAT_ALL


xchat.hook_command('alert', alert, 'alert')
xchat.hook_command('attention', alert, 'attention')
xchat.hook_command('box', box)
xchat.hook_command('colors', colors)
xchat.hook_command('dick', give, 'dick')
xchat.hook_command('double', double)
xchat.hook_command('eatadick', give, 'eatadick')
xchat.hook_command('flash', flash)
xchat.hook_command('leet', leet)
xchat.hook_command('megatold', megatold)
xchat.hook_command('moki', moki)
xchat.hook_command('nicks', nicks)
xchat.hook_command('rbe', rbe)
xchat.hook_command('reverse', reverse)
xchat.hook_command('rose', give, 'rose')
xchat.hook_command('scroll', scroll)
Example #56
0
            if relaypair[0] == network and relaypair[1] == channel:
                destination = xchat.find_context(server=relaypair[2],
                                                 channel=relaypair[3])
                destination.command("say " + "<" + triggernick +
                                    "> was deoped by " + operator + " in " +
                                    channel + " on " + network)


load_vars()

#The hooks go here
xchat.hook_print('Channel Message', on_text)
xchat.hook_print('Join', on_join)
xchat.hook_print('Part', on_part)
xchat.hook_print('Channel Voice', on_voice)
xchat.hook_print('Channel DeVoice', on_devoice)
xchat.hook_print('Kick', on_kick)
xchat.hook_print('Channel Ban', on_ban)
xchat.hook_print('Channel UnBan', on_unban)
xchat.hook_print('Channel Operator', on_op)
xchat.hook_print('Channel DeOp', on_deop)
xchat.hook_command(
    'relaybot',
    on_local,
    help=
    "Commands are /relaybot add list delete off on, see readme for full help")
# Todo: Maybe later we add relaying joins, parts, bans, etc, no maybe not

#LICENSE GPL
#Last modified 04-13-08
Example #57
0
    cc = xchat.find_context(channel=chan1)
    if not cc:
        print "Oops - you don't seem to be in channel", chan1
        return xchat.EAT_XCHAT

    chan1server = cc.get_info('server')
    userlist = {}
    for chan in xchat.get_list('channels'):
        if chan.server == chan1server and chan.type == chantype['channel']:
            for user in chan.context.get_list('users'):
                if user.nick not in excluded_users:
                    userlist.setdefault(chan.channel, []).append(user.nick)

    print "###############################################################################"  # 79
    print "# " + (
        "The users in %s share the following channels with you (%s)" %
        (chan1, mynickname)).center(79 - 4) + " #"
    print "###############################################################################"  # 79
    for chan in sorted(userlist.keys()):
        if chan != chan1:
            usersincommon = sorted(set(userlist[chan1]) & set(userlist[chan]))
            if usersincommon:
                print "%15s:\t%s" % (chan, ', '.join(usersincommon))
    print "###############################################################################"  # 79

    return xchat.EAT_XCHAT


xchat.hook_command("sharedchans", sharedchannels_cb)
xchat.prnt(__module_name__ + ' v' + __module_version__ + ' loaded.')
Example #58
0
__module_name__ = "giphysearch"
__module_version__ = "1.0"
__module_description__ = "Search giphy for gifs to send to your friends"

import xchat
import os
import sys
import webbrowser

sys.path.insert(0, os.path.dirname(__file__))
import gifhax

def gif_cb(word, word_eol, userdata):
    ctx = xchat.get_context()
    chan = xchat.get_info("channel")
    def cb(url):
        if url:
            ctx.command("msg %s %s" % (chan, url))
    url = gifhax.search_gifs(word[1:], cb)
    if url:
        webbrowser.open_new(url)
    return xchat.EAT_ALL

xchat.hook_command("gif", gif_cb, help="/gif <words> Search for gifs about words")
Example #59
0
__module_name__ = "Hexchat AMIP Announcer"
__module_version__ = "0.1"
__module_description__ = "Announces the currently played song using AMIP"
__author__ = "Johan Ljungberg"

AMIP_FILE = 'd:/amip.txt'  # Update this path to reflect your configuration

import xchat as XC


def nowplaying_cb(word, word_eol, userdata):
    try:
        with open(AMIP_FILE, 'r') as f:
            title = f.read().split(' || ')[0]
            XC.command('me listens to: %s' % title)
    except IOError:
        print 'ERROR: Could not read %s, have you configured the plugin properly?' % AMIP_FILE


XC.hook_command("np",
                nowplaying_cb,
                help="/np Announces the currently played song using AMIP")
XC.prnt(__module_name__ + ' version ' + __module_version__ + ' loaded.')