# Path: conf.py
# CONF_FILE = os.path.join(urk.userpath,'urk.conf')
# def pprint(obj, depth=-2):
# def save(*args):


import sys
import os
import events
import urk
from conf import conf
    __slots__ = ["command"]
    def __init__(self, command):
        self.command = command
    def __call__(self, e):
        loc = sys.modules.copy()
        loc.update(e.__dict__)
        result = eval(self.command,loc)
        if isinstance(result,basestring):
            events.run(result,e.window,e.network)

for name in aliases:
    globals()['onCommand'+name.capitalize()] = CommandHandler(aliases[name])

def onCommandAlias(e):
    if e.args and 'r' in e.switches:
        name = e.args[0].lower()
        command = aliases[name]
        del aliases[name]
        conf['aliases'] = aliases
        e.window.write("* Deleted alias %s%s (was %s)" % (conf.get('command-prefix','/'),name,command))
        events.load(__name__,reloading=True)
    elif 'l' in e.switches:
        e.window.write("* Current aliases:")
        for i in aliases:
            e.window.write("*  %s%s: %s" % (conf.get('command-prefix','/'),i,aliases[i]))
    elif len(e.args) >= 2:
        name = e.args[0].lower()
        command = ' '.join(e.args[1:])
        aliases[name] = command
        conf['aliases'] = aliases

# Path: conf.py
# CONF_FILE = os.path.join(urk.userpath,'urk.conf')
# def pprint(obj, depth=-2):
# def save(*args):


# Path: scripts/alias.py
import sys
import os
import events
import urk
from conf import conf

    __slots__ = ["command"]
    def __init__(self, command):
        self.command = command
    def __call__(self, e):
        loc = sys.modules.copy()
        loc.update(e.__dict__)
        result = eval(self.command,loc)
        if isinstance(result,basestring):
            events.run(result,e.window,e.network)

for name in aliases:
    globals()['onCommand'+name.capitalize()] = CommandHandler(aliases[name])

def onCommandAlias(e):
    if e.args and 'r' in e.switches:
        name = e.args[0].lower()
        command = aliases[name]
        del aliases[name]
        conf['aliases'] = aliases
        e.window.write("* Deleted alias %s%s (was %s)" % (conf.get('command-prefix','/'),name,command))
        events.load(__name__,reloading=True)
    elif 'l' in e.switches:
        e.window.write("* Current aliases:")
        for i in aliases:
            e.window.write("*  %s%s: %s" % (conf.get('command-prefix','/'),i,aliases[i]))
    elif len(e.args) >= 2:
        name = e.args[0].lower()
        command = ' '.join(e.args[1:])
        aliases[name] = command
        conf['aliases'] = aliases

        e.window.write("* Created an alias %s%s to %s" % (conf.get('command-prefix','/'),name,command))