Exemplo n.º 1
0
def wplaty(deadbeats, bool):
    day = date.today()
    get = urllib.urlopen(domain + "deadbeats")
    const = get.read()
    const = const.split('|')
    x = -1
    biggest = 0
    for i in const:
        x = x + 1
        if x % 2 == 0:
            if biggest < len(const[x]):
                biggest = len(const[x])
    x = -1
    for j in const:
        x = x + 1
        if x % 2 == 0:
            subtract = const[x + 1].split('-')
            for k in range(3):
                subtract[k] = int(subtract[k])
            y = date(subtract[0], subtract[1], subtract[2])
            left = y - day
            left = left - left - left
            expressionSize = len(const[x])
            if expressionSize < biggest:
                shift = biggest - expressionSize
                const[x] = const[x] + " " * shift
            ekg.echo(const[x] + "  " + const[x + 1] + "  " + str(left.days))
Exemplo n.º 2
0
def cmd_summary(mx):
	ekg.echo("Issue: "+mx.group(0))
	try:
		i = r.getIssueByKey(mx.group(0))
		return "%s (%s/%s): %s" % (color.colored(mx.group(0), attrs=['bold']), color.colored(i.raw.reporter, 'green'), color.colored(i.statusName(), 'green', attrs=['bold']), i.raw.summary)
	except jiraError.IssueNotFound:
		return "%s: Issue not found." % mx.group(0)
Exemplo n.º 3
0
def displayNotify(title, text, timeout, type):
    """
    Sends notification to dbus org.freedesktop.Notifications service using
    pynotify python library.
    """
    if not pynotify.init("EkgNotif"):
        ekg.echo("you don't seem to have pynotify installed")
        return 0
    if ekg.config["notify:catch_url"] != "0":
        l = catchURL(text)
        if l[0]:
            text = l[1]
            timeout = int(ekg.config["notify:catch_url_timeout"])
    n = pynotify.Notification(title, text, type)

    n.set_timeout(timeout)
    n.set_urgency(getUrgency(title, text))

    # Most probably glib.GError is:
    # The name org.freedesktop.Notifications was not provided by any
    # .service files
    # Catch this exception and print information in debug window.
    # Sometimes I
    # do not have org.freedesktop.Notifications registered and
    # I do not want
    # error messages in chat window.
    # Or logs buffer has overflowed ;/
    try:
        n.show()
    except glib.GError as e:
        ekg.debug("pynotif: " + str(e))

    return 1
Exemplo n.º 4
0
def serverCommand(bool, command):
    nick = str(ekg.window_current())
    command = command.replace('%1', nick)
    hostname = main.getServerNameFromNick(nick)
    ssh = main.SSHConnection()
    ssh.setConnection(hostname, 'root', secret.serversList[hostname])
    ssh.setCommand(command)
    ekg.echo(ssh.getResult())
Exemplo n.º 5
0
def serversCommand(bool, command):
    for i in secret.serversList:
        ssh = main.SSHConnection()
        ssh.setConnection(i, 'root', secret.serversList[i])
        ssh.setCommand(command)
        ekg.echo(str(i))
        ekg.echo(ssh.getResult())
        del ssh
Exemplo n.º 6
0
def ping():
    serversList = open(path + 'serversList', 'r')
    read_data = serversList.readlines()
    for i in read_data:
        i = i.replace('\n', '')
        response = os.system("ping -c 1 " + i + "  > /dev/null")
        if response != 0:
            response2 = os.system("ping -c 3 " + i + "  > /dev/null")
            if response2 != 0:
                ekg.echo(i + " nie działa")
    serversList.close()
Exemplo n.º 7
0
def help(name, args):
    str =  "\n"
    str += cgreen + "-u " + cwhite + "- nazwa uzytkownika, ktorego log przeszukac\n"
    str += cgreen + "-d " + cwhite + "- tylko z tego dnia rozmowy beda przeszukane\n"
    str += cgreen + "-db " + cwhite + "- poczatkowa data do przeszukiwania\n"
    str += cgreen + "-de " + cwhite + "- koncowa data do przeszukiwania\n"
    str += cgreen + "-tb " + cwhite + "- poczatkowy czas od ktorego rozpoczete bedzie przeszukiwanie\n"
    str += cgreen + "-te " + cwhite + "- koncowy czas do ktorego bedzie przeszukiwanie\n"
    str += cgreen + "-tfa " + cwhite + "- jesli nie podano zakresu dni, zmienna ta spowoduje, ze przeszukane zostana wszystkie dni\n"
    str += cgreen + "-s " + cwhite + "- wykuszkiwanie bez rozrozniania wielkosci liter. wszystko po tym parametrze brane bedzie jako czesc wyrazenia wyszukiwanego. mozna uzywac skladni regexp\n"
    str += cgreen + "-S " + cwhite + "- to samo co " + cgreen + "-s" + cwhite + ", lecz z rozroznianiem wielkosci liter\n"
    ekg.echo(str)
Exemplo n.º 8
0
 def __init__(self, name):
     try:
         self.db = MySQLdb.connect(secret.mysql[name + 'host'],
                                   secret.mysql[name + 'username'],
                                   secret.mysql[name + 'password'],
                                   secret.mysql[name + 'databasename'],
                                   connect_timeout=10,
                                   charset='utf8')
         self.handler = self.db.cursor()
     except Exception as e:
         ekg.echo(type(e))
         ekg.echo(e)
         return False
Exemplo n.º 9
0
def info(self, bool):
    nick = str(ekg.window_current())
    mysql = main.MySQLConnection('remote')
    mysql.query(
        'SELECT oplata_konta, sposob_platnosci, pay_my, vnc, rl, warn, dysk, pakiet_dysk, pakiet_cena, blokada, adnotacje FROM users WHERE nick=%s',
        nick)
    data = mysql.fetchOne()
    temp = []
    temp.append(['Waznosc', str(data[0])])
    temp.append(['Platnosc', data[1]])
    if data[2] != 0:
        temp.append(['Mine', '*'])
    else:
        temp.append(['Mine', ''])
    if data[3] == 1:
        temp.append(['VNC', '*'])
    else:
        temp.append(['VNC', ''])
    if data[4] == 1:
        temp.append(['RL', '*'])
    else:
        temp.append(['RL', ''])
    temp.append(['Warn', data[5]])
    # Nie działą zamiana na liczbę całkowitą
    temp.append(['Dysk', str(int(data[6])) + '/' + str(data[7])])
    temp.append(['Cena', data[8]])
    if data[9] == 1:
        temp.append(['Blokada', '*'])
    else:
        temp.append(['Blokada', ''])
    temp.append(['Notatka', data[10]])
    j = 0
    for i in temp:
        if len(str(i[0])) >= len(str(i[1])):
            temp[j].append(len(str(i[0])))
            j = j + 1
        else:
            temp[j].append(len(str(i[1])))
            j = j + 1
    ekg.echo(
        '%-{0}s %-{1}s %-{2}s %-{3}s %-{4}s %-{5}s %-{6}s %-{7}s %-{8}s %-{9}s'
        .format(temp[0][2], temp[1][2], temp[2][2], temp[3][2], temp[4][2],
                temp[5][2], temp[6][2], temp[7][2], temp[8][2], temp[9][2]) %
        (temp[0][0], temp[1][0], temp[2][0], temp[3][0], temp[4][0],
         temp[5][0], temp[6][0], temp[7][0], temp[8][0], temp[9][0]))
    ekg.echo(
        '%-{0}s %-{1}s %-{2}s %-{3}s %-{4}s %-{5}s %-{6}s %-{7}s %-{8}s %-{9}s'
        .format(temp[0][2], temp[1][2], temp[2][2], temp[3][2], temp[4][2],
                temp[5][2], temp[6][2], temp[7][2], temp[8][2], temp[9][2]) %
        (temp[0][1], temp[1][1], temp[2][1], temp[3][1], temp[4][1],
         temp[5][1], temp[6][1], temp[7][1], temp[8][1], temp[9][1]))
Exemplo n.º 10
0
def own_message_handler(session, target, text):
    ekg.debug("[test script] some debug\n")
    ekg.echo("Wysy³am wiadomo¶æ!")
    ekg.echo("Sesja : " + session)
    ekg.echo("Target: " + target)
    ekg.echo("TxtLen: " + str(len(text)))
    return 1
Exemplo n.º 11
0
def own_message_handler(session, target, text):
    ekg.debug("[test script] some debug\n")
    ekg.echo("Wysy³am wiadomo¶æ!")
    ekg.echo("Sesja : "+session)
    ekg.echo("Target: "+target)
    ekg.echo("TxtLen: "+str(len(text)))
    return 1
Exemplo n.º 12
0
def email_reminder():
    msg = open('content', 'r').read()
    s = smtplib.SMTP('localhost')
    for i in interval:
        get = urllib.urlopen(domain + "time=" + i +
                             "&method=email").read().split(',')
        for x in get:
            if x != '':
                tmp = x.split(':')
                try:
                    s.sendmail("*****@*****.**", tmp[1],
                               msg.format(tmp[1], tmp[0], i))
                    ekg.echo("Wysłano email z przypomnieniem do: %s" % tmp[1])
                except Exception as e:
                    ekg.echo(e)
Exemplo n.º 13
0
    def get_sessions(self):
        """
        Retrieve watched sessions from config.

        """
        raw = self.ekgconfig['notify:sessions']
        names = raw.split()
        sessions = {}
        for name in names:
            try:
                session = ekg.session_get(name)
            except KeyError:
                ekg.echo("Session '%s' doesn't exist" % name)
            else:
                sessions[name] = session
        return sessions
Exemplo n.º 14
0
def init():
    if len(ekg.config['notify:sessions']) == 0:
        ekg.echo(
            """
            It seems to be the first time using Ekg2Notify, hm? ;)
            Start off by adding watched sessions (space separated),
            eg.: /set notify:sessions xmpp:[email protected] irc:freenode
        
            When using MUC (Multi User Chat), only some messages are sent,
            ie. those contaning predefined words - "highlights".
            Add them (space separated) by /set notify:highlights
        
            You can also change the default FIFO location (/set notify:fifo),
            though remember to reload the script afterwards.")
        
            Have fun! ;D"""
            )
Exemplo n.º 15
0
    def __init__(self, config):
        """
        Initialize the notification system.

        Opens a FIFO (named pipe) and registers handlers.

        :param config: ekg2's config (ekg.config)
        :type config: :class:`dict`

        """
        self.ekgconfig = config

        fifo = self.ekgconfig['notify:fifo']
        ekg.echo("Opening pipe at %s!" % fifo)
        self.pipe = open(fifo, 'w+')

        ekg.handler_bind('protocol-message-received', self.message_handler)
        ekg.command_bind('notify-test', self.test_handler)
Exemplo n.º 16
0
def connect_handler(session):
    ekg.echo("Sesja : " + session)
    sesja = ekg.session_get(session)
    if sesja.connected():
        ekg.echo("Połączony! Silnik i sto turbin poszło w ruch! :)")
    else:
        ekg.echo("W tym miejscu jeszcze nie połączony")
Exemplo n.º 17
0
def timeCheck(name, args):
    global TIMEOUT_MSG
    global TIMEOUT_STATUS
    rexp = re.compile('^[0-9]{4,4}')
    rexp = rexp.findall(args)
    if len(rexp) == 1:
        if name == "notify:message_timeout":
            TIMEOUT_MSG = int(rexp[0])
            return 1
        if name == "notify:status_timeout":
            TIMEOUT_STATUS = int(rexp[0])
            return 1
        if name == "notify:catch_url_timeout":
            return 1

    if name == "notify:message_timeout":
        ekg.echo("Zmienna %s bedzie pomijana do czasu, az zostanie ustawiona wartosc z zakresu od 1000ms do 9999ms. Jej obecna wartosc to: %i" % (name,TIMEOUT_MSG))
    elif name == "notify:status_timeout":
        ekg.echo("Zmienna %s bedzie pomijana do czasu, az zostanie ustawiona wartosc z zakresu od 1000ms do 9999ms. Jej obecna wartosc to: %i" % (name,TIMEOUT_STATUS))
    elif name == "notify:catch_url_timeout":
        ekg.echo("Zmienna %s bedzie pomijana do czasu, az zostanie ustawiona wartosc z zakresu od 1000ms do 9999ms. Jej obecna wartosc to: %i" % (name,TIMEOUT_STATUS))
    return 0
Exemplo n.º 18
0
def disconnect_handler(session):
    ekg.echo("£o, sesja %s nam pad³a" % (session, ))
    ekg.echo("Wysy³amy smsa ¿e nam cu¶ pad³o...")
Exemplo n.º 19
0
def connect_handler(session):
    ekg.echo("Po³±czono! Ale super! Mo¿na gadaæ!")
    ekg.echo("Sesja : "+session)
    if session[:3] == 'irc':
	struct = time.gmtime()
	if struct[3] >= 8 and struct[3] < 17:
	    ekg.echo('£adnie to tak ircowaæ w pracy? ;)')
    sesja = ekg.session_get(session)
    if sesja.connected():
	ekg.echo('Po³±czony!')
    else:
	ekg.echo('W tym miejscu jeszcze nie po³±czony')
    ekg.echo('Lista userów sesji: '+", ".join(sesja.users()))
Exemplo n.º 20
0
def connect_handler(session):
    ekg.echo("Po³±czono! Ale super! Mo¿na gadaæ!")
    ekg.echo("Sesja : " + session)
    if session[:3] == 'irc':
        struct = time.gmtime()
        if struct[3] >= 8 and struct[3] < 17:
            ekg.echo('£adnie to tak ircowaæ w pracy? ;)')
    sesja = ekg.session_get(session)
    if sesja.connected():
        ekg.echo('Po³±czony!')
    else:
        ekg.echo('W tym miejscu jeszcze nie po³±czony')
    ekg.echo('Lista userów sesji: ' + ", ".join(sesja.users()))
Exemplo n.º 21
0
def keypress(key):
    ekg.echo('nacisnales #' + str(key))
Exemplo n.º 22
0
def foo_command(name, args):
    ekg.echo("Wywo³ane polecenie foo!")
Exemplo n.º 23
0
def varchange(name, newval):
    ekg.echo("Zmienna %s zmieni³a warto¶æ na %s" % (name, newval) )
Exemplo n.º 24
0
def varchange(name, newval):
    ekg.echo("Zmienna %s zmieni³a warto¶æ na %s" % (name, newval))
Exemplo n.º 25
0
def foo_command(name, args):
    ekg.echo("Wywo³ane polecenie foo!")
Exemplo n.º 26
0
def print_config(name, args):
	ekg.echo("JIRA url:      %s" % ekg.config["jirabot:url"])
	ekg.echo("JIRA username: %s" % ekg.config["jirabot:username"])
	ekg.echo("JIRA password: %s" % ekg.config["jirabot:password"])
	ekg.echo("JIRA project:  %s" % ekg.config["jirabot:project"])
	ekg.echo("JIRA projects: %s" % ekg.config["jirabot:projectregexp"])
	ekg.echo("IRC  channel:  %s" % ekg.config["jirabot:channel"])
	ekg.echo("Signals dir:   %s" % ekg.config["jirabot:sigdir"])
Exemplo n.º 27
0
def status_handler(session, uid, status, desc):
    #   for sesja in ekg.sessions():
    #	if sesja.connected():
    #	    ekg.echo("sesja '%s' po³±czona" % (name,))
    #	    ekg.echo("status: "+sesja['status'])
    #	else:
    #	    ekg.echo("sesja '%s' nie jest po³±czona" % (name,))
    ekg.echo("Dosta³em status!")
    ekg.echo("Sesja : " + session)
    ekg.echo("UID   : " + uid)
    ekg.echo("Status: " + status)
    if desc:
        ekg.echo("Opis  : " + desc)
    sesja = ekg.session_get(session)
    #    ekg.echo('Lista userów sesji: '+", ".join(sesja.users()))
    user = sesja.user_get(uid)
    if user.last_status:
        ekg.echo(str(user.last_status))
        stat, des = user.last_status
        ekg.echo("Ostatni status: " + stat)
        if user.last_status[1]:
            ekg.echo("Ostatni opis  : " + des)
    else:
        ekg.echo(
            "Nie ma poprzedniego stanu - pewnie dopiero siê ³±czymy...")
    if user.ip:
        ekg.echo("IP: " + user.ip)
    if user.groups:
        ekg.echo("Grupy: " + ", ".join(user.groups()))
    if status == ekg.STATUS_AWAY:
        ekg.echo("Chyba go nie ma...")
    if status == ekg.STATUS_XA:
        ekg.echo(
            "Chyba bardzo go nie ma, to na grzyb mi taki status?. Po³ykam. *¶lurp*"
        )
        return 0
    return 1
Exemplo n.º 28
0
def status_handler(session, uid, status, desc):
#   for sesja in ekg.sessions():
#	if sesja.connected():
#	    ekg.echo("sesja '%s' po³±czona" % (name,))
#	    ekg.echo("status: "+sesja['status'])
#	else:
#	    ekg.echo("sesja '%s' nie jest po³±czona" % (name,))
    ekg.echo("Dosta³em status!")
    ekg.echo("Sesja : "+session)
    ekg.echo("UID   : "+uid)
    ekg.echo("Status: "+status)
    if desc:
	ekg.echo("Opis  : "+desc)
    sesja = ekg.session_get(session)
#    ekg.echo('Lista userów sesji: '+", ".join(sesja.users()))
    user = sesja.user_get(uid)
    if user.last_status:
	ekg.echo(str(user.last_status))
	stat, des = user.last_status
	ekg.echo("Ostatni status: "+stat)
	if user.last_status[1]:
	    ekg.echo("Ostatni opis  : "+des)
    else:
	ekg.echo("Nie ma poprzedniego stanu - pewnie dopiero siê ³±czymy...")
    if user.ip:
	ekg.echo("IP: "+user.ip)
    if user.groups:
	ekg.echo("Grupy: "+", ".join(user.groups()))
    if status == ekg.STATUS_AWAY:
	ekg.echo("Chyba go nie ma...")
    if status == ekg.STATUS_XA:
	ekg.echo("Chyba bardzo go nie ma, to na grzyb mi taki status?. Po³ykam. *¶lurp*")
	return 0
    return 1
Exemplo n.º 29
0
def message_handler(session, uid, type, text, sent_time, ignore_level):
    ekg.debug("[test script] some debug\n")
    ekg.echo("Dosta³em wiadomo¶æ!")
    ekg.echo("Sesja : "+session)
    ekg.echo("UID   : "+uid)
    if type == ekg.MSGCLASS_MESSAGE:
	ekg.echo("Typ   : msg")
    elif type == ekg.MSGCLASS_CHAT:
	ekg.echo("Typ   : chat")
    ekg.echo("Czas  : "+time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.gmtime(sent_time)))
    ekg.echo("Ign   : "+str(ignore_level))
    ekg.echo("TxtLen: "+str(len(text)))
    if len(text) == 13:
	ekg.echo("Oj, ale pechowa liczba, nie odbieram")
	return 0
    return 1
Exemplo n.º 30
0
def search(name, args):
    user = str(ekg.window_current())
    if len(args) < 2:
        ekg.echo("Za malo parametrow\n")
        return 0
    if len(args) < 4 and user == "__status":
        ekg.echo("Za malo parametrow\n")
        return 0
    args = args.split(" ")
    date = "all"
    datebg = "all"
    dateend = "all"
    timebg = "all"
    timeend = "all"
    timeforall = 0
    search = ""
    search2 = ""
    curtime = datetime.now()
    for x in range(len(args)-1):
        if args[x] == "-d":
            date = args[x+1]
            x += 1
        elif args[x] == "-db":
            datebg = args[x+1]
            x += 1
        elif args[x] == "-de":
            dateend = args[x+1]
            x += 1
        elif args[x] == "-tb":
            timebg = args[x+1]
            x += 1
        elif args[x] == "-te":
            timeend = args[x+1]
            x += 1
        elif args[x] == "-tfa":
            timeforall = 1
        elif args[x] == "-u":
            user = args[x+1]
            x += 1
        elif args[x] == "-s":
            search = string.join(args[x+1:], " ")
            x = len(args)
    sessions = ekg.sessions()
    user = str.lower(user)
    b = 0
    for x in sessions:
        for u in x.users():
            if str.lower(str(u.nickname)) == user or str.lower(str(u.uid)) == user:
                user = "******" % (str(x),u.uid)
                b = 1
                break
        if b == 1:
            break
    if b == 0:
        return 1
    if len(ekg.config['logsearch:logdir_path']):
        user = ekg.config['logsearch:logdir_path'] + user
    else:
        user = os.environ["HOME"] + "/.ekg2/logs/" + user
    if(date != "all"):
        r = re.compile("[0-9]{4}-[0-9]{2}-[0-9]{2}")
        if not (r.match(date)):
            ekg.echo("Bledny format daty. Format: YYYY-MM-DD")
            return 0
        year = int(date[0:4])
        month = int(date[5:7])
        day = int(date[8:10])
        if(year > int(curtime.year)):
            ekg.echo("Bledny rok")
            return 0
        elif(month > int(curtime.month) and (month > 12 or month <= 0)):
            ekg.echo("Bledny miesiac")
            return 0
        elif(day > int(curtime.day) and (day > 31 or day <= 0)):
            ekg.echo("Bledny dzien")
            return 0
        datebg = "all"
        dateend = "all"
    else:
        if(datebg != "all"):
            r = re.compile("[0-9]{4}-[0-9]{2}-[0-9]{2}")
            if not (r.match(datebg)):
                ekg.echo("Bledny format daty. Format: YYYY-MM-DD")
                return 0
            yearbg = int(datebg[0:4])
            monthbg = int(datebg[5:7])
            daybg = int(datebg[8:10])
            if(yearbg > int(curtime.year)):
                ekg.echo("Bledny rok")
                return 0
            elif(monthbg > int(curtime.month) and (monthbg > 12 or monthbg <= 0)):
                ekg.echo("Bledny miesiac")
                return 0
            elif(daybg > int(curtime.day) and (daybg > 31 or daybg <= 0)):
                ekg.echo("Bledny dzien")
                return 0
        if(dateend != "all"):
            r = re.compile("[0-9]{4}-[0-9]{2}-[0-9]{2}")
            if not (r.match(dateend)):
                ekg.echo("Bledny format daty. Format: YYYY-MM-DD")
                return 0
            yearend = int(dateend[0:4])
            monthend = int(dateend[5:7])
            dayend = int(dateend[8:10])
            if(yearend > int(curtime.year)):
                ekg.echo("Bledny rok")
                return 0
            elif(monthend > int(curtime.month) and (monthend > 12 or monthend <= 0)):
                ekg.echo("Bledny miesiac")
                return 0
            elif(dayend > int(curtime.day) and (dayend > 31 or dayend <= 0)):
                ekg.echo("Bledny dzien")
                return 0

    if(timebg != "all"):
        r = re.compile("[0-9]{2}:[0-9]{2}")
        if not (r.match(timebg)):
            ekg.echo("Bledny format czasu poczatkowego. Format: HH:MM")
            return 0
        hourbg = int(timebg[0:2])
        minutebg = int(timebg[3:5])
        if(hourbg < 0 or hourbg >= 24):
            ekg.echo("Bledna godzina")
            return 0
        if(minutebg < 0 or minutebg >= 60):
            ekg.echo("Bledne minuty")
            return 0
        if(date == "all" and datebg == "all"):
            yearbg = int(curtime.year)
            monthbg = int(curtime.month)
            daybg = int(curtime.day)

    if(timeend != "all"):
        r = re.compile("[0-9]{2}:[0-9]{2}")
        if not (r.match(timeend)):
            ekg.echo("Bledny format czasu poczatkowego. Format: HH:MM")
            return 0
        hourend = int(timeend[0:2])
        minuteend = int(timeend[3:5])
        if(hourend < 0 or hourend >= 24):
            ekg.echo("Bledna godzina")
            return 0
        if(minuteend < 0 or minuteend >= 60):
            ekg.echo("Bledne minuty")
            return 0
        if(date == "all" and dateend == "all"):
            yearend = int(curtime.year)
            monthend = int(curtime.month)
            dayend = int(curtime.day)

    if search:
        s = re.compile(search, re.IGNORECASE)

    if search2:
        s = re.compile(search2)

    log = minidom.parse(user)
    log = log.getElementsByTagName('message')

    tmpdate = ""
    pdate = ""

    strtoprint = "\n"

    for i in range(0, log.length):
        time = log[i].getElementsByTagName('received')
        time = time[0].childNodes[0].nodeValue
        time = datetime.fromtimestamp(float(time))
        tmpdate = time.date()
        time = time.time()
        who = log[i].getElementsByTagName('nick')
        who = who[0].childNodes[0].nodeValue
        body = log[i].getElementsByTagName('body')
        body = body[0].childNodes[0].nodeValue
        if(date != "all"):
            if year != tmpdate.year:
                continue
            if month != tmpdate.month:
                continue
            if day != tmpdate.day:
                continue
        if(datebg != "all"):
            if yearbg > tmpdate.year:
                continue
            if yearbg == tmpdate.year and monthbg > tmpdate.month:
                continue
            if yearbg == tmpdate.year and monthbg == tmpdate.month and daybg > tmpdate.day:
                continue
        if(dateend != "all"):
            if yearend < tmpdate.year:
                continue
            if yearend == tmpdate.year and monthend < tmpdate.month:
                continue
            if yearend == tmpdate.year and monthend == tmpdate.month and dayend < tmpdate.day:
                continue
        if(timebg != "all"):
            if timeforall:
                if int(hourbg) > int(time.hour):
                    continue
                if int(hourbg) == int(time.hour) and int(minutebg) > int(time.minute):
                    continue
            else:
                if yearbg > tmpdate.year:
                    continue
                if yearbg == tmpdate.year and monthbg > tmpdate.month:
                    continue
                if yearbg == tmpdate.year and monthbg == tmpdate.month and daybg > tmpdate.day:
                    continue
                if yearbg == tmpdate.year and monthbg == tmpdate.month and daybg == tmpdate.day and int(hourbg) > int(time.hour):
                    continue
                if yearbg == tmpdate.year and monthbg == tmpdate.month and daybg == tmpdate.day and int(hourbg) == int(time.hour) and int(minutebg) > int(time.minute):
                    continue
        if(timeend != "all"):
            if timeforall:
                if int(hourend) < int(time.hour):
                    continue
                if int(hourend) == int(time.hour) and int(minuteend) < int(time.minute):
                    continue
            else:
                if yearend < tmpdate.year:
                    continue
                if yearend == tmpdate.year and monthend < tmpdate.month:
                    continue
                if yearend == tmpdate.year and monthend == tmpdate.month and dayend < tmpdate.day:
                    continue
                if yearend == tmpdate.year and monthend == tmpdate.month and dayend == tmpdate.day and int(hourend) < int(time.hour):
                    continue
                if yearend == tmpdate.year and monthend == tmpdate.month and dayend == tmpdate.day and int(hourend) == int(time.hour) and int(minuteend) < int(time.minute):
                    continue
        if(search or search2):
            if not s.findall(body):
                continue
        if(tmpdate != pdate):
            strtoprint += cmagenta + str(tmpdate) + "\n"
            pdate = tmpdate
        strtoprint += cblue + "    " + str(time) + cgreen + " " + who + cwhite + " " + body[1:] + "\n"
    ekg.echo(strtoprint)
Exemplo n.º 31
0
def message_handler(session, uid, type, text, sent_time, ignore_level):
    ekg.debug("[test script] some debug\n")
    ekg.echo("Dosta³em wiadomo¶æ!")
    ekg.echo("Sesja : " + session)
    ekg.echo("UID   : " + uid)
    if type == ekg.MSGCLASS_MESSAGE:
        ekg.echo("Typ   : msg")
    elif type == ekg.MSGCLASS_CHAT:
        ekg.echo("Typ   : chat")
    ekg.echo("Czas  : " +
             time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.gmtime(sent_time)))
    ekg.echo("Ign   : " + str(ignore_level))
    ekg.echo("TxtLen: " + str(len(text)))
    if len(text) == 13:
        ekg.echo("Oj, ale pechowa liczba, nie odbieram")
        return 0
    return 1
Exemplo n.º 32
0
def keypress(key):
    ekg.echo('nacisnales #'+ str(key));
Exemplo n.º 33
0
def disconnect_handler(session):
    ekg.echo("£o, sesja %s nam pad³a" % (session,))
    ekg.echo("Wysy³amy smsa ¿e nam cu¶ pad³o...")
Exemplo n.º 34
0
def keypress(key):
        ekg.echo("Przycisk " + str(key))