Ejemplo n.º 1
0
    def do_name(self, name):
        """
        From client; set the name of this client.

        @param name: The nickname for this client.
        """
        self.name = name
        yield to(self.client, dict(named=name))
Ejemplo n.º 2
0
 def do_spoke(self, channel, sender, message, id):
     yield to(
         self.client,
         dict(type="spoke",
              channel=channel,
              sender=sender.name,
              message=message,
              id=id))
Ejemplo n.º 3
0
    def do_join(self, channel):
        fountFromChannel, drainToChannel = (
            self._hub.channelNamed(channel).participate(self))
        fountFromChannel.flowTo(self._in.newDrain())
        fountToChannel = self._router.newRoute()
        fountToChannel.flowTo(drainToChannel)

        self._participating[channel] = fountToChannel
        yield to(self._participating[channel], dict(type="joined"))
Ejemplo n.º 4
0
    def do_join(self, channel):
        fountFromChannel, drainToChannel = (
            self._hub.channelNamed(channel).participate(self)
        )
        fountFromChannel.flowTo(self._in.newDrain())
        fountToChannel = self._router.newRoute()
        fountToChannel.flowTo(drainToChannel)

        self._participating[channel] = fountToChannel
        yield to(self._participating[channel],
                 dict(type="joined"))
Ejemplo n.º 5
0
    def do_speak(self, channel, message, id):
        """
        From client; say something on the given channel.

        @param channel: the name of the channel

        @param message: the text of the message to relay

        @param id: a unique identifier for this message
        """
        yield to(self._participating[channel],
                 dict(type="spoke", message=message, id=id))
Ejemplo n.º 6
0
    def do_join(self, channel):
        """
        From client; instruct this client to join a channel with the given
        name.

        @param channel: the name of the channel to join.
        """
        fountFromChannel, drainToChannel = (
            self._hub.channelNamed(channel).participate(self)
        )
        fountFromChannel.flowTo(self._in.newDrain())
        fountToChannel = self._router.newRoute("->{}".format(channel))
        fountToChannel.flowTo(drainToChannel)

        self._participating[channel] = fountToChannel
        yield to(self._participating[channel],
                 dict(type="joined"))
Ejemplo n.º 7
0
 def do_told(self, sender, message):
     yield to(self.client, message)
Ejemplo n.º 8
0
 def do_name(self, name):
     self.name = name
     yield to(self.client, dict(named=name))
Ejemplo n.º 9
0
 def do_shout(self, message, id):
     for channel in self._participating.values():
         yield to(channel, dict(type="spoke", message=message, id=id))
     yield to(self.client, dict(type="shouted", id=id))
Ejemplo n.º 10
0
 def do_tell(self, receiver, message):
     # TODO: implement _establishRapportWith; should be more or less like
     # joining a channel.
     rapport = self._establishRapportWith(receiver)
     yield to(rapport, dict(type="told", message=message))
Ejemplo n.º 11
0
 def do_speak(self, channel, message, id):
     yield to(self._participating[channel],
              dict(type="spoke", message=message, id=id))
Ejemplo n.º 12
0
 def do_speak(self, channel, message, id):
     yield to(self._participating[channel],
              dict(type="spoke", message=message, id=id))
Ejemplo n.º 13
0
 def do_name(self, name):
     self.name = name
     yield to(self.client, dict(named=name))
Ejemplo n.º 14
0
 def do_joined(self, sender, channel):
     """
     Someone joined a channel I'm participating in.
     """
     yield to(self.client, dict(type="joined"))
Ejemplo n.º 15
0
 def do_shout(self, message, id):
     for channel in self._participating.values():
         yield to(channel, dict(type="spoke", message=message, id=id))
     yield to(self.client, dict(type="shouted", id=id))
Ejemplo n.º 16
0
 def do_joined(self, sender, channel):
     """
     Someone joined a channel I'm participating in.
     """
     yield to(self.client, dict(type="joined"))
Ejemplo n.º 17
0
 def do_tell(self, receiver, message):
     # TODO: implement _establishRapportWith; should be more or less like
     # joining a channel.
     rapport = self._establishRapportWith(receiver)
     yield to(rapport, dict(type="told", message=message))
Ejemplo n.º 18
0
 def do_spoke(self, channel, sender, message, id):
     yield to(self.client,
              dict(type="spoke", channel=channel,
                   sender=sender.name, message=message,
                   id=id))
Ejemplo n.º 19
0
 def do_told(self, sender, message):
     yield to(self.client, message)