Example #1
0
def __init__():
    commands.register('list_ous',
                      execute,
                      description="List organizational units.")
Example #2
0
def __init__():
    commands.register('list_mailbox_acls',
                      execute,
                      description=description(),
                      aliases=['lam'])
Example #3
0
def __init__():
    commands.register('user_info', execute, description="Display user information.")
Example #4
0
def __init__():
    commands.register('list_mailboxes', execute, description=description(), aliases='lm')
def __init__():
    commands.register('delete_mailbox_acl', execute, description=description(), aliases=['dam'])
Example #6
0
def __init__():
    commands.register('find_domain', execute, description=description())
Example #7
0
from commands.functions import safeName, RE_NAME
from commands import functions

_PUSH_STR = """@__value__
D=A
@SP
A=M
M=D
@SP
M=M+1
"""

_RE_ACCEPT = r"^function (?P<name>%s) (?P<args>\d+)$" % RE_NAME
class FunctionDeclareCommand:
    def __init__(self, arg, fileName):
        self.fileName = fileName
        m = re.match(_RE_ACCEPT, arg)
        self.fName = m.group("name")
        self.argc = int(m.group("args"))
    def assembly(self):
        functions.scope = safeName(self.fName)
        asmStr = "(%s)\n" % functions.scope
        asmStr += _PUSH_STR.replace("__value__", "0") * self.argc
        return asmStr
    @staticmethod
    def accept(arg, fileName):
        return re.match(_RE_ACCEPT, arg) is not None
import commands
commands.register(FunctionDeclareCommand)
Example #8
0
def __init__():
    commands.register('export_mailbox', execute)
Example #9
0
def __init__():
    commands.register('undelete_mailbox', execute, description=description())
Example #10
0
    randStr = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(_randPower))
    return "%s_%s" % (str(_make_rand_id.salt), randStr)
_make_rand_id.salt = 0

_RE_ACCEPT = r"^call (?P<name>%s) (?P<args>\d+)$" % RE_NAME
class FunctionCallCommand:
    def __init__(self, arg, fileName):
        self.fileName = fileName
        m = re.match(_RE_ACCEPT, arg)
        self.fName = m.group("name")
        self.argc = m.group("args")
    def assembly(self):
        self.returnLabel = "LABEL_RET_%s_%s" % (functions.scope, _make_rand_id())
        asmStr = self.push_stuff_asm()
        asmStr += _ARG_LCL_UPDATE_STR.replace("__value__", str(self.argc))
        asmStr += _JMP_STR.replace("__value__", self.fName)
        asmStr += "(%s)" % self.returnLabel
        return asmStr
    def push_stuff_asm(self):
        asmStr = _PUSH_STR.replace("__value__", self.returnLabel)
        asmStr += _PUSH_STR_REF.replace("__value__", "LCL")
        asmStr += _PUSH_STR_REF.replace("__value__", "ARG")
        asmStr += _PUSH_STR_REF.replace("__value__", "THIS")
        asmStr += _PUSH_STR_REF.replace("__value__", "THAT")
        return asmStr
    @staticmethod
    def accept(arg, fileName):
        return re.match(_RE_ACCEPT, arg) is not None
import commands
commands.register(FunctionCallCommand)
Example #11
0
    "neg": _cmd_a_neg,
    "eq": _cmd_a_eq,
    "gt": _cmd_a_gt,
    "lt": _cmd_a_lt,
    "and": _cmd_a_and,
    "or": _cmd_a_or,
    "not": _cmd_a_not,
}

def joinForRE(iterable, joiner):
    strings = []
    for e in iterable:
        if e is not None:
            strings.append(re.escape(e))
    return joiner.join(strings)

_RE_ACCEPT = r"^(?P<command>%s)$" % joinForRE(_A_COMMANDS, "|")
class ArithmeticCommand:
    def __init__(self, arg, fileName):
        self.cmd = re.match(_RE_ACCEPT, arg).group("command")
    def assembly(self):
        val = _A_COMMANDS[self.cmd]
        if callable(val):
            val = val()
        return val
    @staticmethod
    def accept(arg, fileName):
        return re.match(_RE_ACCEPT, arg) is not None
import commands
commands.register(ArithmeticCommand)
Example #12
0
def __init__():
    commands.register(
            'dump_config',
            execute,
            description=description()
        )
Example #13
0
def __init__():
    commands.register('add_user', execute, description="Add a user.")
Example #14
0
def __init__():
    commands.register('set_quota', execute, description=description(), aliases=['sq'])
Example #15
0
def __init__():
    commands.register('sync_mailhost_attrs',
                      execute,
                      description=description())
Example #16
0
import re

from commands.flow import safeLabel, RE_LABEL
from commands import functions

_RE_ACCEPT = r"^label (?P<label>%s)$" % RE_LABEL


class LabelCommand:
    def __init__(self, arg, fileName):
        self.fileName = fileName
        m = re.match(_RE_ACCEPT, arg)
        self.label = m.group("label")

    def assembly(self):
        return "(%s:%s)\n" % (functions.scope, self.label)

    @staticmethod
    def accept(arg, fileName):
        return re.match(_RE_ACCEPT, arg) is not None


import commands
commands.register(LabelCommand)
Example #17
0
    for bouquet in json["bouquets"]:
        if bouquet[1] == name:
            return bouquet[0]
    else:
        raise ValueError("Bouquet not found: " + name)


def getDefaultBRef():
    json = utils.requestJson("bouquets")

    return json["bouquets"][0][0]


def consume():
    json = utils.requestJson("bouquets")

    for bouquet in json["bouquets"]:
        print(bouquet[1])


def help():
    print("""\
Usage: owifc bouquets

Lists all known bouquets.""")


commands.register("bouquets", "Lists all known bouquets.", lambda: consume(),
                  lambda: help())
Example #18
0
def __init__():
    commands.register('set_language', execute, description=description())
def __init__():
    commands.register('list_domain_mailboxes', execute)
Example #20
0
def __init__():
    commands.register('add_alias', execute, description="Add alias.")
def __init__():
    commands.register('remove_user_subscription', execute, description=description())
def __init__():
    commands.register('list_deleted_mailboxes', execute)
Example #23
0
import commands
import irc
import sys

@commands.owners_only
@commands.help_text('Reloads the bot\'s internal functions and config file')
def refresh(bot):
    reload(commands)
    reload(irc)
    commands.conf = commands.load_config()
    commands.register(bot)
    return irc.Response('Bot successfully refreshed internal functions', pm_user=True)

if __name__ == '__main__':
    commands.conf = commands.load_config()
    reload(sys)
    sys.setdefaultencoding('utf-8')
    bot = irc.Bot(**commands.conf)
    bot.add_command(refresh)
    commands.register(bot)
    bot.run()
Example #24
0
import re

from commands.flow import safeLabel, RE_LABEL
from commands import functions

_RE_ACCEPT = r"^label (?P<label>%s)$" % RE_LABEL
class LabelCommand:
    def __init__(self, arg, fileName):
        self.fileName = fileName
        m = re.match(_RE_ACCEPT, arg)
        self.label = m.group("label")
    def assembly(self):
        return "(%s:%s)\n" % (functions.scope, self.label)
    @staticmethod
    def accept(arg, fileName):
        return re.match(_RE_ACCEPT, arg) is not None
import commands
commands.register(LabelCommand)
Example #25
0
def refresh(bot):
    reload(commands)
    reload(irc)
    commands.conf = commands.load_config()
    commands.register(bot)
    return irc.Response('Bot successfully refreshed internal functions', pm_user=True)
Example #26
0
    "static": _cmd_pop_static,
    "constant": _cmd_pop_constant,
    "this": _cmd_pop_this,
    "that": _cmd_pop_that,
    "pointer": _cmd_pop_pointer,
    "temp": _cmd_pop_temp,
}

def joinForRE(iterable, joiner):
    strings = []
    for e in iterable:
        if e is not None:
            strings.append(re.escape(e))
    return joiner.join(strings)

_RE_ACCEPT = r"^pop (?P<segment>%s) (?P<offset>\d+)$" % joinForRE(_SEGMENTS, "|")
class PopCommand:
    def __init__(self, arg, fileName):
        self.fileName = fileName
        m = re.match(_RE_ACCEPT, arg)
        segment = m.group("segment")
        self.cmd = _SEGMENTS[segment]
        self.offset = int(m.group("offset"))
    def assembly(self):
        return self.cmd(self.offset).replace("__file__", self.fileName)
    @staticmethod
    def accept(arg, fileName):
        return re.match(_RE_ACCEPT, arg) is not None
import commands
commands.register(PopCommand)
Example #27
0
def initialize_commands():
    commands.register(Quit())
    commands.register(Walk())
    commands.register(Walk('north'))
    commands.register(Walk('east'))
    commands.register(Walk('south'))
    commands.register(Walk('west'))
    commands.register(RoomAdd())
    commands.register(RoomAddExit())
    commands.register(RoomFind())
    commands.register(RoomAddEvent())
    commands.register(WorldList())

    commands.register(commands.Help())
Example #28
0
def __init__():
    commands.register('set', execute, description=description())
Example #29
0
def __init__():
    commands.register('transfer_mailbox', execute, description="Transfer a mailbox to another server.")
Example #30
0
def __init__():
    commands.register('remove_mail', execute, description=description())
Example #31
0
def __init__():
    commands.register('delete_mailbox', execute, description=description(), aliases=['dm'])
Example #32
0
def __init__():
    commands.register('server_info', execute, description=description())
Example #33
0
def __init__():
    commands.register('list_quota', execute, description=description(), aliases=['lq'])
Example #34
0
def __init__():
    commands.register('add_domain', execute, description=description())
Example #35
0
def __init__():
    commands.register('delete_message', execute, description=description())
def __init__():
    commands.register('sync_mailhost_attrs', execute, description=description())
Example #37
0
        if not value:
            raise ValueError("The VALUE is missing.")

        setConfiguredValue(key, value)

    elif key == "remove":
        key = popArg(1)
        if not key:
            raise ValueError("The KEY is missing.")

        removeConfiguredValue(key)

    else:
        raise ValueError("The ACTION ist missing.")


def help():
    print("""\
Usage: owifc config ACTION

Known ACTIONs are:

list ................ List all key/value pairs in the config file.
set KEY VALUE ....... Write a key/value pair to the config file.
remove KEY .......... Removes the value from the config file.
""")


commands.register("config", "Reads and writes the configuration.",
                  lambda: consume(), lambda: help())
Example #38
0
def __init__():
    commands.register('role_info', execute, description="Display role information.")
Example #39
0
                                        cmd.lvl(user, display_name, channel, params[1])
                                    except IndexError:
                                        cmd.lvl(user, display_name, channel)
                                    db(opt.CHANNELS).update_one_by_name(channel, { '$set': { 'cmd_use_time': time.time() } }, upsert=True)
                                    db(opt.USERS).update_one(user, { '$set': { 'cmd_use_time': time.time() } }, upsert=True)

                                if params[0] == 'winrate' or params[0] == 'wr':
                                    try:
                                        cmd.winrate(user, display_name, channel, params[1])
                                    except IndexError:
                                        cmd.winrate(user, display_name, channel)
                                    db(opt.CHANNELS).update_one_by_name(channel, { '$set': { 'cmd_use_time': time.time() } }, upsert=True)
                                    db(opt.USERS).update_one(user, { '$set': { 'cmd_use_time': time.time() } }, upsert=True)

                            if params[0] == 'register':
                                cmd.register(user, display_name, channel)

                            if params[0] == 'join':
                                tags = db(opt.TAGS).find_one_by_id(user)
                                if tags and tags.get('bot') == 1:
                                    continue
                                else:
                                    dungeon = db(opt.GENERAL).find_one_by_id(0)
                                    channel_raids = db(opt.CHANNELS).find_one({'name': channel})
                                    if dungeon['raid_start'] == 1 and channel_raids['raid_events'] == 1:
                                        if not [usr for usr in raid_users if user in usr]:
                                            raid_user = db(opt.USERS).find_one_by_id(user)
                                            if raid_user and raid_user.get('user_level'):
                                                raid_users.append((channel, raid_user['_id']))
                                            else:
                                                if time.time() > user_cmd_use_time + global_cooldown:
def __init__():
    commands.register('list_domain_mailboxes', execute)
Example #41
0
def __init__():
    commands.register('sync',
                      execute,
                      description="Synchronize Kolab Users with IMAP.")
Example #42
0
def __init__():
    commands.register('create_mailbox', execute, description=description(), aliases='cm')
Example #43
0
def __init__():
    commands.register('sync', execute, description="Synchronize Kolab Users with IMAP.")
Example #44
0
    "static": _cmd_push_static,
    "constant": _cmd_push_constant,
    "this": _cmd_push_this,
    "that": _cmd_push_that,
    "pointer": _cmd_push_pointer,
    "temp": _cmd_push_temp,
}

def joinForRE(iterable, joiner):
    strings = []
    for e in iterable:
        if e is not None:
            strings.append(re.escape(e))
    return joiner.join(strings)

_RE_ACCEPT = r"^push (?P<segment>%s) (?P<offset>\d+)$" % joinForRE(_SEGMENTS, "|")
class PushCommand:
    def __init__(self, arg, fileName):
        self.fileName = fileName
        m = re.match(_RE_ACCEPT, arg)
        segment = m.group("segment")
        self.cmd = _SEGMENTS[segment]
        self.offset = int(m.group("offset"))
    def assembly(self):
        return self.cmd(self.offset).replace("__file__", self.fileName)
    @staticmethod
    def accept(arg, fileName):
        return re.match(_RE_ACCEPT, arg) is not None
import commands
commands.register(PushCommand)
def __init__():
    commands.register('list_mailbox_metadata', execute, description=description())
Example #46
0
def __init__():
    commands.register('list_mailbox_acls', execute, description=description(), aliases=['lam'])
Example #47
0
import commands
import json
import utils


def consume():
    response = utils.requestJson("about")

    print(json.dumps(response, indent=4))


def help():
    print("""\
Usage: owifc about

Calls the about service and prints the result.""")


commands.register("about", "Calls the about service.", lambda: consume(),
                  lambda: help())
Example #48
0
import re

from commands.flow import safeLabel, RE_LABEL
from commands import functions

JMP_STR = """@__label__
0; JMP
"""

_RE_ACCEPT = r"^goto (?P<label>%s)$" % RE_LABEL


class GotoCommand:
    def __init__(self, arg, fileName):
        self.fileName = fileName
        m = re.match(_RE_ACCEPT, arg)
        self.label = m.group("label")

    def assembly(self):
        newLabel = "%s:%s" % (functions.scope, self.label)
        return JMP_STR.replace("__label__", newLabel)

    @staticmethod
    def accept(arg, fileName):
        return re.match(_RE_ACCEPT, arg) is not None


import commands
commands.register(GotoCommand)
Example #49
0
def __init__():
    commands.register('rename_mailbox',
                      execute,
                      description=description(),
                      aliases=['rm'])
Example #50
0
def __init__():
    commands.register('transfer_mailbox',
                      execute,
                      description="Transfer a mailbox to another server.")
def __init__():
    commands.register('remove_user_subscription',
                      execute,
                      description=description())
Example #52
0
def __init__():
    commands.register('mailbox_cleanup', execute, description=description())
Example #53
0
def __init__():
    commands.register('list_domains', execute, description="List Kolab domains.")
Example #54
0
def __init__():
    commands.register('undelete_mailbox', execute, description=description())
Example #55
0
                  timeTable.toHumanReadable(), timeTable.toHtml())
    else:
        print(timeTable.toHumanReadable())


def help():
    print("""\
Usage: owifc notify [OPTION ...] [TERM ...]

Calls the program guide and print's matching programs.

The TERM is a regular expression. It may contain the keywords AND, NOT and IN.
If at least one TERM is given, it will print only lines, that contain the pattern.
Don't forget to put your search term in quotes!

Examples:

"foo AND bar" - Must contain "foo" and "bar" in any field.
"foo IN title" - Must contain "foo" in the field "title". Other fields are 
               "description" and "channel".
"foo AND NOT bar IN channel" - The channel must not contain "bar".

Currently it matches whole words only. The case is ignored.

Respects follwing options: bouquet, debug, email, host, html.""")


commands.register("notify",
                  "Searches the program guide and prints notifications.",
                  lambda: consume(), lambda: help())