Beispiel #1
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)
Beispiel #2
0
    if (len(args) <= 1):
        text="Pięćdziesiąt trzy"
    else:
        text = args[1]
  
    return displayNotify(title, text, TIMEOUT_MSG, ekg.config["notify:icon_msg"])

ekg.handler_bind('protocol-status', notifyStatus)
ekg.handler_bind("protocol-message-received", notifyMessage)
ekg.variable_add("notify:ignore_sessions_regexp", "^irc:")
ekg.variable_add("notify:ignore_uids_regexp", "^xmpp:.*@conference\.")
ekg.variable_add("notify:urgency_critical_regexp", "^$")
ekg.variable_add("notify:urgency_normal_regexp", "^$")
ekg.variable_add("notify:icon_status", "dialog-warning")
ekg.variable_add("notify:icon_msg", "dialog-warning")
ekg.variable_add("notify:message_timeout", "3500", timeCheck)
ekg.variable_add("notify:message_notify", "1")
ekg.variable_add("notify:message_notify_unknown", "1")
ekg.variable_add("notify:show_timestamps", "1")
ekg.variable_add("notify:status_timeout", "3500", timeCheck)
ekg.variable_add("notify:status_notify", "1")
ekg.variable_add("notify:catch_url", "1")
ekg.variable_add("notify:catch_url_timeout", "5000", timeCheck)
ekg.command_bind("notify:send", notifyTest)

if int(ekg.config["notify:message_timeout"]) < 1000 or int(ekg.config["notify:message_timeout"]) > 9999:
    timeCheck("notify:message_timeout", ekg.config["notify:message_timeout"])
if int(ekg.config["notify:status_timeout"]) < 1000 or int(ekg.config["notify:status_timeout"]) > 9999:
    timeCheck("notify:status_timeout", ekg.config["notify:status_timeout"])

Beispiel #3
0
def messageHandler(session, uid, type, text, stime, ignore_level):
	for c in command:
		mx = command[c][0].search(text)
		if (mx):
			ekg.command(("/msg %s %s" % (uid, command[c][1](mx))).encode('UTF8'))
			break

def testMessageHandler(session, uid, type, text, stime, ignore_level):
	if text[-21:-4] == "!jirabot selftest":
		for i in color.test():
			ekg.command("/msg %s TEST [%s]" % (uid, i))

ekg.handler_bind("protocol-message-received", messageHandler)
ekg.handler_bind("protocol-message-received", testMessageHandler)
ekg.timer_bind(5, handleSignals)

ekg.variable_add("jirabot:url", "")
ekg.variable_add("jirabot:username", "")
ekg.variable_add("jirabot:password", "")
ekg.variable_add("jirabot:project", "")
ekg.variable_add("jirabot:channel", "")
ekg.variable_add("jirabot:sigdir", "/nonexistent")
ekg.variable_add("jirabot:projectregexp", "[A-Z]+")

ekg.command_bind("jirabot:initialize", initialize)
ekg.command_bind("jirabot:print_config", print_config)
ekg.command_bind("jirabot:signal", lambda n, a: messageHandler(None, ekg.config["jirabot:channel"], None, a, None, None))

initialize(None, None)
Beispiel #4
0
	    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()))

def keypress(key):
    ekg.echo('nacisnales #'+ str(key));
    

def disconnect_handler(session):
    ekg.echo("£o, sesja %s nam pad³a" % (session,))
    ekg.echo("Wysy³amy smsa ¿e nam cu¶ pad³o...")

def foo_command(name, args):
    ekg.echo("Wywo³ane polecenie foo!")

def varchange(name, newval):
    ekg.echo("Zmienna %s zmieni³a warto¶æ na %s" % (name, newval) )
    
ekg.command_bind('foo', foo_command)
ekg.handler_bind('protocol-message-received', message_handler)
ekg.handler_bind('protocol-message-sent', own_message_handler)
ekg.handler_bind('protocol-status', status_handler)
ekg.handler_bind('protocol-connected', connect_handler)
ekg.handler_bind('protocol-disconnected', disconnect_handler)
ekg.handler_bind('ui-keypress', keypress)
ekg.variable_add('zmienna_testowa', 'warto¶æ', varchange)
Beispiel #5
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]))


def advert(msg, uid):
    podziel = uid.split(',')
    sendMessage = main.SendMessage()
    sendMessage.setUid(podziel)
    sendMessage.setMsg(msg)
    sendMessage.sendMessageByUid()


def message_to_everyone_from_list(self, msg):
    f = open('list', 'r')
    sendMessage = main.SendMessage()
    # TODO: pierwszy element nie ma nagłowka
    sendMessage.setUid(f.read().replace('\n', ',gg:'))
    sendMessage.setMsg(msg)
    sendMessage.sendMessageByUid()


ekg.command_bind('blokada', blokada)
ekg.command_bind('deadbeats', wplaty)
ekg.command_bind('info', info)
ekg.command_bind('advert', advert)
ekg.command_bind('announce', message_to_everyone_from_list)
Beispiel #6
0
#!/usr/bin/python

import main
import dddd as secret
import ekg


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


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())


ekg.command_bind('serversCommand', serversCommand)
ekg.command_bind('serverCommand', serverCommand)
Beispiel #7
0
    else:
        ekg.echo('W tym miejscu jeszcze nie po³±czony')
    ekg.echo('Lista userów sesji: ' + ", ".join(sesja.users()))


def keypress(key):
    ekg.echo('nacisnales #' + str(key))


def disconnect_handler(session):
    ekg.echo("£o, sesja %s nam pad³a" % (session, ))
    ekg.echo("Wysy³amy smsa ¿e nam cu¶ pad³o...")


def foo_command(name, args):
    ekg.echo("Wywo³ane polecenie foo!")


def varchange(name, newval):
    ekg.echo("Zmienna %s zmieni³a warto¶æ na %s" % (name, newval))


ekg.command_bind('foo', foo_command)
ekg.handler_bind('protocol-message-received', message_handler)
ekg.handler_bind('protocol-message-sent', own_message_handler)
ekg.handler_bind('protocol-status', status_handler)
ekg.handler_bind('protocol-connected', connect_handler)
ekg.handler_bind('protocol-disconnected', disconnect_handler)
ekg.handler_bind('ui-keypress', keypress)
ekg.variable_add('zmienna_testowa', 'warto¶æ', varchange)
Beispiel #8
0
        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)


ekg.command_bind('logsearch', search)
ekg.command_bind('logsearch:help', help)
ekg.variable_add('logsearch:logdir_path', os.environ["HOME"] + "/.ekg2/logs/")