'This is where we process commands.'

def on_line(self, line):

    try:
        m = re.match('^join    (\\S+)$', line)
        if m:
            (room_name,) = m.groups()
            self.print_line(('%s    joining    %s' % (self.user, room_name)))
            self.server.join_room(room_name, self.user, self.user)
            return
        m = re.match('^invite    (\\S+)    (\\S+)$', line)
        if m:
            (room_name, invitee) = m.groups()
            self.print_line(('%s    invited    to    %s' % (invitee, room_name)))
            self.server.invite_to_room(room_name, self.user, invitee)
            return
        m = re.match('^send    (\\S+)    (.*)$', line)
        if m:
            (room_name, body) = m.groups()
            self.print_line(('%s    send    to    %s' % (self.user, room_name)))
            self.server.send_message(room_name, self.user, body)
            return
        m = re.match('^backfill    (\\S+)$', line)
        if m:
            (room_name,) = m.groups()
            self.print_line(('backfill    %s' % room_name))
            self.server.backfill(room_name)
            return
        self.print_line('Unrecognized    command')
    except Exception as e:
        logger.exception(e)
