Public feed #725836

Untitled

public text v1 · immutable
Raw Edit
·published 2007-10-04 18:44 UTC
rendered paste body

    def view_sendMsg(self, perspective, string):
        """Envia una linea de texto mediante el chat; se actualiza estado en el servidor y si esta dentro de un
        room el cambio se guarda en el log de ese room y se difunde a los demas
        clientes; caso contrario actualiza su status solamente.
        """
        
        c = string.decode("utf-8")
        
        #wb = self.wbClients[perspective.avId]
        #d = wb.remote.callRemote("wbSendMsg", string)
        
        #TODO 
        #generar log aqui. 
        
        
        
        if perspective.roomId != None:
            for clientId in self.wbRooms[perspective.roomId].roomListClients():
                if perspective.avId != clientId:
                    try:
                        wb = self.wbClients[clientId]
                        string = "[" + self.wb.name + "]: " + string
                        d = wb.remote.callRemote("wbSendMsg", string)
                    except (pb.DeadReferenceError):
                        pass
        else:
            #no está conectado a ninguna sala.
            wb = self.wbClients[perspective.avId]
            string = "[" + wb.name + "]: " + string
            d = wb.remote.callRemote("wbSendMsg", string)