Ejemplo n.º 1
0
    def __init__(self, reactor = None):

        self.chat_room = ChatRoom()

        # each initial mode will need a reference to the
        #  chat service particular to this factory instance.
        #  a global Init function will not suffice, so
        #  we create a new closure for each factory.
        def Init():
            return InitBase(self.chat_room)

        HTTPShellFactory.__init__(
            self,
            Init = Init,
            reactor = reactor,
        )

        self.file_service.next_service = self.chat_room

        # map emoticons into the file service's file hierarchy
        for name in os.listdir(module_path(__file__, 'content', 'tango')):
            self.file_service.contents['.chat/art/tango/' + name] = module_path(
                __file__,
                'content',
                'tango',
                name
            )
Ejemplo n.º 2
0
        else:
            name = next_name(self.chatters)
        self.name = name
        self.chatters[name] = self

        self.message(
            '<p>You are <font color="blue">%s</font>.</p>' % (
                inoculate(self.name)
            )
        )
        self.broadcast(
            '<p><font color="red">%s</font> enters.</p>' % (
                inoculate(self.name)
            )
        )

        self.goto(self.Chat(self))

    def process(self, request):
        print self.name

Chat.commands.load(*(
    module_path(cixar.ish, *file_name)
    for file_name in (
        ('sh', 'general_commands.py'),
        ('chat', 'commands.py'),
        ('chat', 'socials.py'),
    )
))