Example #1
0
def crypto_cb(word, word_eol, userdata):
	''' Callback for /crypto command '''
	global m
	global t0
	if len(word) < 2:
		print "\nAvailable actions:"
		print "     auth - initiate crypto session and authenticate participants"
	elif word[1] == "auth":
		m.SetUsers(xchat.get_list("users"))
		setup()
		if '-p2p' in word_eol:
			bcast(xchat.get_list("users"), 1)
		else:
			synchronize()
	elif word[1] == "y":
		m.SetUsers(xchat.get_list("users"))
		acknowledge()
	elif word[1] == "shutdown":
		digest = GetChatDigest(m.path)
		m.digestTable.update({xchat.get_prefs("irc_nick1"):digest})
		bcast(xchat.get_list("users"), 0, "shutdown")
		bcast(xchat.get_list("users"), 0, '0x16' + str(digest))
	else:
		xchat.prnt("Unknown action")
	return xchat.EAT_ALL
Example #2
0
def GetAdd(word, word_eol, userdata):
	nicks = [i.nick for i in xchat.get_list("users")]	
	regex = '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
	Host = ''
	if re.search(regex,word[1]): print word[1],':',GetAddress(GetHost(word[1]))
	elif word[1] in nicks:
		for i in xchat.get_list('users'):
			if i.nick == word[1]:
				Host = i.host
				break
		ip = GetHost(Host)
		print '\00320'+word[1],'('+Host+')',':',GetAddress(ip)+'\003'
def fake(word, word_eol, userdata):
    my_nick = xchat.get_info('nick')
    try:
        topic = word_eol[1]
    except:
        xchat.prnt("fake_log_image.py Error: Invalid arguments!"
                   )  #add error func later
    else:
        nicklist = [xchat.strip(user.nick) for user in xchat.get_list('users')]
        network = xchat.get_info('network')
        chan = xchat.get_info('channel')
        fake_log_image_generator(nicklist, network, chan, my_nick, topic)
        if UPLOAD_TO_IMGUR:
            try:
                import pyimgur
            except ImportError:
                xchat.prnt(
                    "[!] fake_log_image.py Error: pyimgur module not found!")
            else:
                client_id = ''
                im = pyimgur.Imgur(client_id)
                uploaded_image = im.upload_image(
                    PATH + NEW_FILENAME,
                    title="100 PERCENT AUTHENTIC REAL LOGS")
                lnk = uploaded_image.link
                lnk = lnk.replace('http', 'https')
                xchat.command("say I just took a screenshot of this chat: " +
                              lnk)
    return xchat.EAT_ALL
Example #4
0
def CheckCondition(cond, arg):
    if cond in ["ifuser", "ifnotuser"]:
        # EVERY CHANNEL LIKE A RETARD, XCHAT
        # WHY NOT JUST HAVE xchat.get_info("user") HUH? F**K YOU
        username = None
        serv = xchat.get_info("server")
        for ch in xchat.get_list("channels"):
            if ch.server == serv:
                nick = xchat.get_info("nick")
                for user in ch.context.get_list("users"):
                    if user.nick == nick:
                        # FURTHER TROLLING?
                        username = user.host.split("@")[0].lstrip("~")
                        break
                        # endif
                        # endfor
                        # endif
                        # endfor
        if not username:
            return False
        if "not" in cond:
            return arg != username
        else:
            return arg == username
    elif cond == "true":
        return True
    return False
Example #5
0
def hello2(word, word_eol, userdata):
    saying = ""
    nicks = xchat.get_list("users")
    for x in nicks:
        saying = saying + str(x.nick) + " "
    xchat.command("FAINA " + saying)
    return xchat.EAT_ALL
Example #6
0
def isOperator():
    """Return True if you are an operator in the channel of the current context,
    False if not."""
    myNick = xchat.get_info("nick")
    userlist = xchat.get_list("users")
    userPrefixes = dict([(user.nick, user.prefix) for user in userlist])
    return (userPrefixes[myNick] in OPERATOR_PREFIXES)
Example #7
0
def rkick(word, word_eol, userdata):
    #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
Example #8
0
def say_cb(word, word_eol, userdata):
	''' Word Interception'''
	global FLAG
	if FLAG == 0 and m.currentState == "MSGSTATE_ENCRYPTED":
		FLAG = 1
		encrypted_broadcast(xchat.get_list("users"), word[1], m.groupkey)
	return xchat.EAT_ALL
def sharedchannels_cb(word, word_eol, userdata):
    mynickname = xchat.get_context().get_info("nick")
    excluded_users = [
        mynickname, 'ChanServ'
    ]  # a list of users to ignore, including your nickname(s)
    if len(word) < 2 or word[1][0] != '#':
        usage()
        return xchat.EAT_XCHAT
    chan1 = word[1]
    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
Example #10
0
def amIOperator():
    """Return True if you are an operator in the channel of the current context,
    False if not."""
    myNick = xchat.get_info("nick")
    userlist = xchat.get_list("users")
    userPrefixes = dict([(user.nick,user.prefix) for user in userlist])
    return (userPrefixes[myNick] in OPERATOR_PREFIXES)
Example #11
0
 def isActive(self):
     list = xchat.get_list("dcc")
     if (list):
         for i in list:
             if i.nick == self.name:
                 return (i.status == 0) | (i.status == 1) | (i.status == 4)
     return False
Example #12
0
def sharedchannels_cb(word, word_eol, userdata):
    mynickname = xchat.get_context().get_info("nick")
    excluded_users = [mynickname, 'ChanServ']      # a list of users to ignore, including your nickname(s)
    if len(word) < 2 or word[1][0] != '#':
        usage(); return xchat.EAT_XCHAT
    chan1 = word[1]
    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
Example #13
0
def isop():
    _isop = False
    mynick = xchat.get_info('nick')
    for user in xchat.get_list('users'):
        if xchat.nickcmp(user.nick, mynick) == 0:
            if user.prefix == "@":
                _isop = True
    return _isop
Example #14
0
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
Example #15
0
def isop():
    _isop = False
    mynick = xchat.get_info('nick')
    for user in xchat.get_list('users'):
        if xchat.nickcmp(user.nick, mynick) == 0:
            if user.prefix == "@":
                _isop = True
    return _isop
Example #16
0
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
Example #17
0
def get_user_object_named(nick):
    """
    Returns the user object that has a matching nickname
    """
    for user in xchat.get_list("users"):
        if user.nick == nick:
            return user
    print "No such user..."
def massinv(word, word_eol, userdata):
    try:
		users = xchat.get_list("users")
		for user in users:
			xchat.command("INVITE %s %s" % (user.nick, word_eol[1]))
    except:
        print "Usage: /massinv <#channel>" 
    return xchat.EAT_ALL
Example #19
0
 def getCurrentBotCPS(bot):
     dcclist = xchat.get_list('dcc')
     cps = 'Unknown CPS'
     for item in dcclist:
         if str(item.nick).lower() == bot.lower():
             cps = '%s CPS' % (str(item.cps))
             break
     return cps
def getFullChannel():
	fullChannel = ''
	list = xchat.get_list('channels')

	if(list):
		for i in list:
			fullChannel = fullChannel+i.channel+'.'

	return fullChannel
Example #21
0
def hello(word, word_eol, userdata):
    nicks = xchat.get_list("users")
    if color_hook != "OFF":
        for x in nicks:
            xchat.command("FAINA " + str(x.nick) + ": " + word_eol[1])
    else:
        for x in nicks:
            xchat.command("SAY " + str(x.nick) + ": " + word_eol[1])
    return xchat.EAT_ALL
Example #22
0
def get_servers():
    chanlist = xchat.get_list("channels")
    servlist = []

    for i in chanlist:
        if i.server not in servlist:
            servlist.append(i.server)

    return servlist
Example #23
0
def slapone(word, word_eol, userdata):
	list = xchat.get_list('users')
	if list:
		if word[1]:
			for i in list:
				xchat.command("ME slaps {0} around a bit with a {1}".format(word[1], i.nick))
		else:
			print("Didnt specify a name to slap")
	return xchat.EAT_ALL
Example #24
0
def random_ping(word, word_eol, userdata):
    users = xchat.get_list('users')
    nicks = choice((users))
    try:
        return xchat.command('say %s' % nicks.nick)
    except:
        return xchat.prnt(help)
        
    return xchat.EAT_ALL
Example #25
0
def get_servers():
	chanlist = xchat.get_list("channels")
	servlist = []

	for i in chanlist:
		if i.server not in servlist:
			servlist.append(i.server)

	return servlist
Example #26
0
def greet_user(nick):
    time.sleep(2)
    print "greet !"
    for user in xchat.get_list("users"):
        print user.nick
        if user.nick == nick:
            print user.host
            print user.realname
            xchat.command("MSG #glob2 Welcome to %s, running version %s" % (nick, user.realname))
            break
Example #27
0
def banned_callback(word, word_eol, userdata):
    # this now works on a basic level, will possibly be improved
    nick = xchat.get_info('nick')
    for user in xchat.get_list('users'):
        if xchat.nickcmp(nick, user.nick) == 0:
            userhost = user.host
    hostip = re.split('@', userhost)[1]

    if re.search(nick, word[1]) or re.search(hostip, word[1]):
        growlnotify('Banned', 'You have been banned by ' + word[0])
Example #28
0
def slapall(word, word_eol, userdata):
	names = []
	list = xchat.get_list('users')
	if list:
		for i in list:
			names.append(i.nick)
		for i in list:
			for name in names:
				xchat.command("ME slaps {0} around a bit with a {1}".format(i.nick, name))
	return xchat.EAT_ALL
Example #29
0
def banned_callback(word, word_eol, userdata):
	# this now works on a basic level, will possibly be improved
	nick = xchat.get_info('nick')
	for user in xchat.get_list('users'):
		if xchat.nickcmp(nick, user.nick) == 0:
			userhost = user.host
	hostip = re.split('@', userhost)[1]

	if re.search(nick, word[1]) or re.search(hostip, word[1]):
		growlnotify('Banned',
		'You have been banned by ' + word[0])
Example #30
0
def get_random(word, word_eol, userdata):
    try:
        list = xchat.get_list("users") 
        if not list:
            xchat.prnt(help)
        selection = random.choice((list))
        print '\x02User found! Username: \x0303%s\x0304%s\x03 (Connected via "\x0304%s\x03")\x02' % (selection.prefix, selection.nick, selection.host)
    except:
        xchat.prnt(help)
        
    return xchat.EAT_ALL
Example #31
0
def test_cb(word, word_eol, userdata):
	global FLAG
	if FLAG == 0 and m.currentState == "MSGSTATE_ENCRYPTED":
		FLAG = 1
		m.t0 = time.clock()
		f = open('myfile.dat', 'w+')
		f.write(str(m.t0))
		print str(m.t0)
		xchat.emit_print("Channel Message", xchat.get_prefs("irc_nick1"), word_eol[0], "@")
		encrypted_broadcast(xchat.get_list("users"), word_eol[0], m.groupkey)
	return xchat.EAT_ALL
Example #32
0
def catch_join(words, words_eol, userdata):
    nick = words[0]
    channel = words[1]
    
    if channel == "#glob2" and xchat.get_info("network") == "OFTC" and \
        not nick.lower().startswith("zenfur") and \
        not nick.lower().endswith("zenfur"):
        for user in xchat.get_list("users"):
            if user.nick.startswith("zenfur"):
                xchat.command("MSG %s %s ~> %s has just joined %s." % 
                              (user.nick, user.nick, nick, channel))
Example #33
0
def setup():
	global acceptlist
	global userlist
	global m
	acceptlist = []
	userlist = xchat.get_list("users")
	m.SetInfo(xchat.get_info("server"), xchat.get_info("channel"), xchat.get_prefs("irc_nick1"))
	for x in userlist:
		if xchat.nickcmp(x.nick, xchat.get_prefs("irc_nick1")) == 0:
			acceptlist.append([x, 1])
		else:
			acceptlist.append([x, 0])
Example #34
0
def banned_callback(word, word_eol, userdata):
	# this now works on a basic level, will possibly be improved
	nick = xchat.get_info('nick')
	for user in xchat.get_list('users'):
		if xchat.nickcmp(nick, user.nick) == 0:
			userhost = user.host
	if not userhost:
		return None
	hostip = userhost.split('@')[1]

	if nick in word[1] or hostip in word[1]:
		growlnotify('Banned',
		'You have been banned by ' + word[0])
Example #35
0
def verify_errors(word, word_eol, userdata):
    global last_msg
    nick, rest = split_nick(word_eol[0],
                            seps=[xchat.get_prefs('completion_suffix')])
    if word_eol[0] != last_msg:
        last_msg = word_eol[0]
        if nick == xchat.get_info('nick'):
            print 'WARNING: Sending message to yourself - Repeat to confirm.'
            return xchat.EAT_ALL
        elif nick and all(nick != user.nick
                          for user in xchat.get_list('users')):
            print 'WARNING: %r is not here. Repeat to confirm.' % nick
            return xchat.EAT_ALL
Example #36
0
 def menu_update(self):
     self.menu_clear()
     # Main menu
     menu_add("Overwatch/"+self.name)
     self.menu_item("Remove group", "ov group_remove {name}")
     self.menu_item("-")
     for network in self.channels:
         for channel in self.channels[network]:
             self.menu_item("Remove {chan} ({net})", "ov channel_remove {net}??{chan}??{name}", network, channel)
     self.menu_item("-")
     for x in xchat.get_list("channels"):
         if x.type == 2 and (x.network not in self.channels or x.channel not in self.channels[x.network]):
             self.menu_item("Add {chan} ({net})", "ov channel_add {net}??{chan}??{name}", x.network, x.channel)
Example #37
0
def nicklist(text):
    _text = []
    _nicklist = [
        user.nick for user in xchat.get_list('users')
        if xchat.nickcmp(user.nick, my_nick) != 0
    ]
    longest_nick_len = len(max(_nicklist, key=len))
    for txt in text:
        _nick = random.choice(_nicklist)
        space = longest_nick_len - len(_nick)
        txt = "%s%s %s" % (_nick, " " * (space), txt)
        _text.append(txt)
    return _text
Example #38
0
def dispwallop(word, word_eol, userdata):
	SRV = xchat.get_info("server")
	srvWin = xchat.find_context(server='%s' % SRV)
	for i in xchat.get_list("channels"):
		dispwallop_dbg(xchat, ("Server: %s; Network: %s; Name: %s; Type: %d" %
			(i.server, i.network, i.channel, i.type)))
		if i.type == 1 and i.server == xchat.get_info("server"):
			srvWin = i.context
			#srvWin = xchat.find_context(i.server,i.channel)
	dispwallop_dbg(srvWin, "Here's srvWin")
	dispwallop_dbgEmit(srvWin, "Notice",'%s/Wallops@%s' % (word[0], SRV),'%s' % word[1])
	srvWin.emit_print("Notice",'%s/Wallops' % word[0],'%s' % word[1])
	srvWin.command("gui color 3")
	return xchat.EAT_ALL
Example #39
0
def colorize_message(word, word_eol, userdata):
    """
    Callback for message printing events. Scans contents of a message for both
    URLs and nicks and colorizes them. This colorized output is sent along to the
    client
    """
    if len(word) < 2:
        return xchat.EAT_NONE

    message = word[1]

    # This prevents recursive printing
    if is_colorized(message):
        return xchat.EAT_NONE

    current_channel = xchat.get_info('channel')

    # Private messages - the channel is the nick
    if not current_channel.startswith('#'):
        nicks = [current_channel, xchat.get_info('nick')]
    else:
        nicks = [u.nick for u in xchat.get_list('users')]

    # Only perform nick coloring if the setting is enabled
    if color_enabled():
        output = []

        # Split up the message delimited by a possible nick
        for token in nick_pat.split(message):
            if token in nicks:
                token = colorize_string(token)
            output.append(token)

        output = ''.join(output)
    else:
        output = message

    # Colorize URLs
    for url in url_pat.findall(output):
        output = output.replace(url, '\037\00328%s\017' % xchat.strip(url, len(url), 3))

    # This is a bit of a hack where we tag the message with a non-printing
    # color so we don't recurse forever
    if not is_colorized(output):
        output = '%s%s' % (output, colorize_string(''))
    xchat.command('gui color 2')
    xchat.emit_print(userdata, word[0], output)
    return xchat.EAT_ALL
def mypower(text, text_eol, userdata):
	count, total, channelcount = 0, 0, 0
	
	windows = xchat.get_list('channels')
	for window in windows:
		if window.type == 2:
			channelcount += 1
			userlist = window.context.get_list('users')
			for user in userlist:
				if user.nick == xchat.get_info('nick'):
					if user.prefix in ['~','&','@','%', '!']:
						count += len(userlist)
					break
			total += len(userlist)
	percentage = round(((count / total) * 100),2)
	xsay('I have power over {}/{} people ({}%) in {} channels.'.format(count, total, percentage, channelcount))
	return xchat.EAT_ALL	
Example #41
0
def CheckUserList(word,word_eol,userdata):
	global dInfo
	sServ=xchat.get_info("network")
	if sServ in dInfo and dInfo[sServ]["on"] == 3:
		lChannels = xchat.get_list("channels")
		for i in lChannels:
			if i.type == 2:
				lUsers = i.context.get_list("users")
				for j in lUsers:
					if j.nick == dInfo[sServ]["nick"]:
						dInfo[sServ]["on"] = 5 # Wait for quit
						return
					#endif
				#endfor
			#endif
		#endfor
		WhoLoopStart()
Example #42
0
def check_and_send(config_name):
    config_path = os.path.join(config_dir, config_name + ".conf")
    if not os.path.isfile(config_path):
        print("Cannot find " + config_path)
        return

    config = parse_config(config_path)
    if config is None:
        print(config_path + " has an invalid format")
        return

    chan = xchat.get_info("channel")
    if chan is None or chan != config.get('irc', 'channel'):
        print("Wrong channel. Expected " + config.get('irc', 'channel') + ", currently in " + str(chan))
        return

    bot = config.get('irc', 'bot')
    found_bot = False
    for user in xchat.get_list('users'):
        if xchat.nickcmp(bot, user.nick) == 0:
            found_bot = True
            break
    if not found_bot:
        print("Failed to find " + bot + " in current channel")
        return

    history = parse_downloads()

    matched_files = get_packlist_matches(config)
    # Remove files we've already downloaded before
    matched_files = [file for file in matched_files if not file[0] in history]

    if len(matched_files) == 0:
        print("No new files to download")

    for idx, file in enumerate(matched_files):
        xchat.hook_timer(idx * 5000, xdcc_send, userdata=(config, file))
        history.append(file[0])

    save_downloads(history)
Example #43
0
def getLocationCB(word, word_eol, userdata):
    all_users = not len(word) > 1
    channel = xchat.get_info("channel")
    if channel.startswith("#"):
        users = xchat.get_list('users')
        found = False or all_users
        for user in users:
            loc = user.host.split('@')[1]
            if not all_users and not xchat.nickcmp(user.nick, word[1]):
                found = True
            if found:
                printLocationLine(user.nick, loc)
            if found and not all_users:
                break
        if not found:
            xchat.emit_print("Server Error", "Can't find user %s" % word[1])
    elif not all_users:
        xchat.command('whois %s' % word[1])
    else:
        xchat.emit_print("Generic Message", "@",
                         "no username given or not in a channel")
    return xchat.EAT_ALL
Example #44
0
def nick_to_fullname(nick):
  " john -> [email protected] "
  userlist = xchat.get_list('users')
  for i in userlist:
    if xchat.nickcmp(nick, i.nick) == 0 :
      return "%s!%s" % (i.nick, i.host)
Example #45
0
def nick_to_prefix(nick):
  " john -> @ "
  userlist = xchat.get_list('users')
  for i in userlist:
    if xchat.nickcmp(nick, i.nick) == 0 :
      return i.prefix
Example #46
0
def fb(word, word_eol, userdata):
    nicklist = [
        user.nick for user in xchat.get_list('users')
        if xchat.nickcmp(user.nick, my_nick) != 0
    ]
    if len(nicklist) < 1:
        error("No users in channel!")
    else:
        try:
            mode = word[1]
            if not mode in '1 2 3 4 5':
                error("Invalid mode argument!")
        except IndexError:
            error("Missing mode argument! (e.g. /fb 1, 2, 3, 4, or 5)")
        else:
            if mode in '1 2 3 4':
                if mode == '1':
                    if len(word) < 4 or not '$n' in word_eol:
                        error("Not enough arguments!")
                    else:
                        cmd = word[2]
                        message = word_eol[3]
                        for nick in nicklist:
                            xchat.command("%s %s" %
                                          (cmd, message.replace('$n', nick)))
                elif mode in '2 3 4':
                    if len(word) < 3:
                        error("Not enough arguments!")
                    else:
                        message = word_eol[2]
                        if mode == '2':
                            message = ' '.join(
                                [nick + ' ' + message for nick in nicklist])
                            xchat.command("say %s" % message)
                        else:
                            placeholder = []
                            for nick in nicklist:
                                usr_code = color()
                                msg_code = color()
                                placeholder.append(
                                    "%s%s%s %s" %
                                    (usr_code, nick, msg_code, message))
                            if mode == '3':
                                for line in placeholder:
                                    xchat.command("say %s" % line)
                            else:
                                message = ''.join(placeholder)
                                xchat.command("say %s" % message)
            else:
                x = True
                for nick in nicklist:
                    if x:
                        message = "01,08/!\08,01* *FLASHING BAR* *01,08/!\\"
                        x = False
                    else:
                        message = "08,01/!\01,08* *FLASHING BAR* *08,01/!\\"
                        x = True
                    space = 65 - (len(message) + len(nick))
                    new_msg = "%s %s> %s" % (nick, "-" * (space - 1), message)
                    xchat.command("say %s" % new_msg)
    return xchat.EAT_ALL
Example #47
0
 def _get_channels(self, nick):
     return [
         i.context for i in xchat.get_list('channels')
         if i.type == 3 and 0 == xchat.nickcmp(i.channel, nick)
     ]
import xchat
import operator
import time
import sys
import os

users_lists = []
users = []
joined_channels = {}
channels = {}

myhook = None

# Get a list of all the channels, process it to make a user list
for chan in xchat.get_list('channels'):
	if chan.channel not in joined_channels.keys():
		joined_channels[chan.channel] = chan

for channel in joined_channels.itervalues():
	users_lists.append(channel.context.get_list('users'))

for user_list in users_lists:
	for user in user_list:
		nick = user.nick
		if nick not in users:
			users.append(nick)

print 'Number of users: %d\n' % (len(users))

# Try opening a file to write the results in
Example #49
0
def allctcp(word, word_eol, userdata):
    nicks = xchat.get_list("users")
    for x in nicks:
        xchat.command("CTCP " + x.nick + " " + word[1])
    return xchat.EAT_ALL
Example #50
0
def cleanup(userdata):
    channels = xchat.get_list('channels')
    for channel in channels:
        if channel.type == 3:
            channel.context.command('close')
    return 1
Example #51
0
def voice(word, word_eol, userdata):
	list = xchat.get_list('users')
	if list:
		for i in list:
			xchat.command("VOICE {0}".format(i.nick))
	return xchat.EAT_ALL
Example #52
0
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
Example #53
0
def discon_cb(word, word_eol, userdata):
    network = hexchat.get_info('network')

    for chan in hexchat.get_list('channels'):
        if chan.network == network and chan.type == 2:  # Don't close server tab or queries
            chan.context.command('timer 1 close')  # Delay to avoid crash
Example #54
0
def closepm(word, word_eol, userdata):
    for v in xchat.get_list('channels'):
        if v.type == 3 and v.channel.lower() == word[1].lower():
            v.context.command("CLOSE")

    return xchat.EAT_XCHAT