Пример #1
0
def cmd_wintest(data, server, witem):
    act_win = irssi.active_win()
    act_server = irssi.active_server()

    print "active_win", act_win, "ref", act_win.refnum
    print "active_server", act_server

    items = act_win.items()
    print "win.items()", items

    for i in items:
        print i, "window ref", i.window().refnum, "window name", i.window().name

    print
    print "all windows"
    for i in irssi.windows():
        print "window refnum", i.refnum, "window name", i.name
    print

    f0 = irssi.window_find_name("melbo")
    f1 = irssi.window_find_name("(status)")
    print "irssi.window_find_name(melbo)", f0
    print "irssi.window_find_name(status)", f1
Пример #2
0
def cmd_wintest(data, server, witem):
    act_win = irssi.active_win()   
    act_server = irssi.active_server()   

    print 'active_win', act_win, 'ref', act_win.refnum
    print 'active_server', act_server

    items = act_win.items()
    print 'win.items()', items

    for i in items:
        print i, 'window ref', i.window().refnum, 'window name', i.window().name

    print
    print 'all windows'
    for i in irssi.windows():
        print 'window refnum', i.refnum, 'window name', i.name
    print

    f0 = irssi.window_find_name('melbo')
    f1 = irssi.window_find_name('(status)') 
    print 'irssi.window_find_name(melbo)', f0
    print 'irssi.window_find_name(status)', f1 
Пример #3
0
def cmd_chanstat(data, server, witem):
	def chancmp(a, b):
		return cmp(a[1], b[1])

	prevdate = None
	datelimit = None
	datestr = ""
	if data == "yesterday":
		datestr = " previous"
		prevdate = 86400
		datelimit = 86400

	nick = irssi.active_server().nick

	current = time.localtime()
	fro = int(time.mktime(current) - current.tm_hour*3600 - current.tm_min*60 - current.tm_sec)
	if prevdate:
		fro -= prevdate
	to = None
	if datelimit:
		to = fro + datelimit

	sock = open(statfile)

	lines = []
	for i in sock.readlines():
		items = i.strip().split(' ')
		if int(items[0]) > fro and items[2] not in ignore and items[2][0] == "#":
			if to:
				if int(items[0]) < to:
					lines.append(items)
			else:
				lines.append(items)
	sock.close()
	total = len(lines)

	chans = {}

	for i in lines:
		chan = i[2]
		if chan not in chans.keys():
			chans[chan] = 1
		else:
			chans[chan] += 1

	sorted = []
	for k, v in chans.items():
		sorted.append([k, v])

	sorted.sort(chancmp, reverse=True)

	if nick[-1] == 's':
		s = "'"
	else:
		s = "'s"

	dstr = "%s%s day: %s" % (s, datestr, " ".join(["%s [%sm]" % (i, j) for i, j in sorted]))
	if witem:
		witem.command("/me %s" % dstr)
	else:
		print "* %s %s" % (nick, dstr)