Beispiel #1
0
Datei: irc.py Projekt: dpk/duxlot
    def create_public(self):
        public = duxlot.Storage()

        public.data = self.manager.dict()
        public.data.stamp = 0
        public.database = duxlot.database(
            duxlot.config.path(self.config.base + ".database"),
            self.manager.Namespace()
        )
        public.debug = debug
        public.options = options.Options(
            self.config.name,
            self.manager,
            public
        )

        def schedule(*args):
            self.private.queue["schedule"].put(args)
        public.schedule = schedule

        def task(*args):
            self.private.queue["schedule"].put((0,) + args)
        public.task = task

        def send(*args):
            if not all (isinstance(arg, str) for arg in args):
                debug("Error: public.send:", args)
                return
    
            if len(args) > 1:
                args = list(args)
                args[-1] = ":" + args[-1]
    
            octets = " ".join(args).encode("utf-8", "replace")
            self.processes["send"].queue.put(octets)
        public.send = send

        def msg(*args):
            send("PRIVMSG", *args)
        public.msg = msg

        return public
Beispiel #2
0
Datei: irc.py Projekt: dpk/duxlot
    def create_public(self):
        public = duxlot.Storage()

        public.data = self.manager.dict()
        public.data.stamp = 0
        public.database = duxlot.database(
            duxlot.config.path(self.config.base + ".database"),
            self.manager.Namespace())
        public.debug = debug
        public.options = options.Options(self.config.name, self.manager,
                                         public)

        def schedule(*args):
            self.private.queue["schedule"].put(args)

        public.schedule = schedule

        def task(*args):
            self.private.queue["schedule"].put((0, ) + args)

        public.task = task

        def send(*args):
            if not all(isinstance(arg, str) for arg in args):
                debug("Error: public.send:", args)
                return

            if len(args) > 1:
                args = list(args)
                args[-1] = ":" + args[-1]

            octets = " ".join(args).encode("utf-8", "replace")
            self.processes["send"].queue.put(octets)

        public.send = send

        def msg(*args):
            send("PRIVMSG", *args)

        public.msg = msg

        return public
Beispiel #3
0
 def __init__(self):
     # @@ Use the base resolution code in script.py
     self.base = os.path.expanduser("~/.duxlot-console")
     self.database = duxlot.database(self.base)