예제 #1
0
  def post(self):
    chat_room = ChatRoom.get_by_ip(self.request.remote_addr)
    message = self.get_message()
    person = self.person()

#    if message == 'connected':
#      person.send_sign_on_to_chat_room(chat_room)
#    else:
    person.send_message_to_chat_room(message, chat_room)
예제 #2
0
  def get(self):
    ip = self.request.remote_addr
    chat_room = ChatRoom.get_by_ip(ip)
    person = self.person()

    if not person.in_chat_room(chat_room):
      person.remove_from_old_chat_room()
      chat_room.add(person)

    self.template_out('templates/home.html', template_values={
      'token': person.channel_token(),
      'num_people': chat_room.num_people()
    })