Exemplo n.º 1
0
    def say(self, *args, **kwargs):
        ret = []
        args = args[0]
        if args is not None:
            ret = self.decode_module_message(args)
            msg = "%s %s\n" % (color("<%s>" % self.name, self.color), ret)

            for client in self.client_facto.clients:
                client.transport.write(msg.encode("utf-8"))
Exemplo n.º 2
0
    def say(self, *args, **kwargs):
        ret = []
        args = args[0]
        if args is not None:
            ret = self.decode_module_message(args)
            msg = "%s %s\n" % (color("<%s>" % self.name, self.color), ret)

            for client in self.client_facto.clients:
                client.transport.write(msg.encode("utf-8"))
Exemplo n.º 3
0
    def dataReceived(self, data):
        if not self.username:
            username, jid, role = data.strip().split(";")
            self.factory.bot.occupants.add_user(username, jid, role)
            print "%s joined : jid=%s; role=%s" % (username, jid, role)
            self.username = username
            self.jid = jid
            self.role = role
            msg = "*** %s has joined\n" % username
        else:
            msg = "%s %s\n" % (color("<%s>" % self.username, self.color),
                               data.strip())

            msg += "%s %s\n" % (color("<%s>" % self.factory.bot.name, self.factory.bot.color),
                                self.factory.bot.create_msg(self.username, data.strip()))

        #Broadcast message to all clients + bot answer
        for client in self.factory.clients:
            client.transport.write(msg.encode("utf-8"))
Exemplo n.º 4
0
    def dataReceived(self, data):
        if not self.username:
            username, jid, role = data.strip().split(";")
            self.factory.bot.occupants.add_user(username, jid, role)
            print "%s joined : jid=%s; role=%s" % (username, jid, role)
            self.username = username
            self.jid = jid
            self.role = role
            msg = "*** %s has joined\n" % username
        else:
            msg = "%s %s\n" % (color("<%s>" % self.username,
                                     self.color), data.strip())

            msg += "%s %s\n" % (
                color("<%s>" % self.factory.bot.name, self.factory.bot.color),
                self.factory.bot.create_msg(self.username, data.strip()))

        #Broadcast message to all clients + bot answer
        for client in self.factory.clients:
            client.transport.write(msg.encode("utf-8"))