Esempio n. 1
0
    def process(session_id, fields):
        usage = "Usage: cancel {-q} {-n nick|-s address}"

        try:
            opts, nick = ltd.get_opts(fields[0], quiet="q", mode="ns")

            if not nick:
                raise LtdErrorException(usage)

        except:
            raise LtdErrorException(usage)

        ACTION(actions.group.Group).cancel(session_id, nick, **opts)
Esempio n. 2
0
    def process(session_id, fields):
        usage = "Usage: /stats {-s|-t|-m|-y|-a}"

        try:
            opts, rest = ltd.get_opts(fields[0], timeframe="stmya")

            if rest:
                raise LtdErrorException(usage)

            ACTION(actions.info.Info).stats(session_id,
                                            **opts,
                                            msgid=msgid(fields))
        except LtdErrorException as ex:
            raise ex
        except:
            raise LtdErrorException(usage)
Esempio n. 3
0
    def process(session_id, fields):
        usage = "Usage: talk {-q} {-d} {-r} {-n nick|-s address}"

        try:
            opts, nick = ltd.get_opts(fields[0],
                                      quiet="q",
                                      delete="d",
                                      registered="r",
                                      mode="ns")

            if not nick:
                raise LtdErrorException(usage)

        except:
            raise LtdErrorException(usage)

        ACTION(actions.group.Group).talk(session_id, nick, **opts)
Esempio n. 4
0
    def process(session_id, fields):
        usage = "Usage: notify {-q} {-n nick|-s address}"

        if fields[0]:
            try:
                opts, target = ltd.get_opts(fields[0], quiet="q", mode="ns")

                if not target:
                    raise LtdErrorException(usage)

            except:
                raise LtdErrorException(usage)

            ACTION(actions.notification.Notify).toggle(session_id, target,
                                                       **opts)
        else:
            ACTION(actions.notification.Notify).list(session_id)
Esempio n. 5
0
    def process(session_id, fields):
        usage = "Usage: whereis {-a} {nick}"

        if fields[0]:
            try:
                opts, nick = ltd.get_opts(fields[0], mode="a")

                if not nick:
                    raise LtdErrorException(usage)

            except:
                raise LtdErrorException(usage)

            ACTION(actions.usersession.UserSession).whereis(
                session_id, nick, **opts, msgid=msgid(fields))
        else:
            raise LtdErrorException(usage)
Esempio n. 6
0
    def process(session_id, fields):
        usage = "Usage: hush {-q} {-n nick|-s address}"

        if fields[0]:
            try:
                opts, target = ltd.get_opts(fields[0],
                                            quiet="q",
                                            mode="ns",
                                            msg_type="op")

                if not target:
                    raise LtdErrorException(usage)

            except:
                raise LtdErrorException(usage)

            ACTION(actions.hush.Hush).toggle(session_id, target, **opts)
        else:
            ACTION(actions.hush.Hush).list(session_id)