//RoomsJoined returns an array of rooms the client c has been added to
163345
func (s *Server) RoomsJoined(id string) []string {
	rooms := make([]string, len(s.joinedRooms[id]))
	s.joinedRoomsMu.RLock()
	defer s.joinedRoomsMu.RUnlock()

	copy(rooms, s.joinedRooms[id])

	return rooms
}
714166
func (r *Room) Entry(ctx context.Context, msg []byte) (*JoinResponse, error) {
	s := pitaya.GetSessionFromCtx(ctx)
	err := s.Bind(ctx, strconv.Itoa(int(s.ID())))
	if err != nil {
		return nil, pitaya.Error(err, "RH-000", map[string]string{"failed": "bind"})
	}
	return &JoinResponse{Result: "ok"}, nil
}
212815
func (b *Builder) FullJoin(joinTable string, joinCond interface{}) *Builder {
	return b.Join("FULL", joinTable, joinCond)
}
915325
func (s *Server) join(roomName string, connID string) {
	if s.rooms[roomName] == nil {
		s.rooms[roomName] = make([]string, 0)
	}
	s.rooms[roomName] = append(s.rooms[roomName], connID)
}
71263
func Joined(a, b *Box) Box {
	var joined Box
	joined.Min = Min(&a.Min, &b.Min)
	joined.Max = Max(&a.Max, &b.Max)
	return joined
}
204072
func (s *Server) BroadcastJSON(room string, v interface{}) {
	s.roomsMu.RLock()
	for _, client := range s.rooms[room] {
		//log.Printf("sending to %s %s\n", client.id, room)
		go func(c *Client) {
			err := c.EmitJSON(v)
			if err != nil {
				log.Println(err)
			}
		}(client)
	}
	s.roomsMu.RUnlock()
}
63659
func (c *cmd) startupJoin(agent *agent.Agent, cfg *config.RuntimeConfig) error {
	if len(cfg.StartJoinAddrsLAN) == 0 {
		return nil
	}

	c.UI.Output("Joining cluster...")
	n, err := agent.JoinLAN(cfg.StartJoinAddrsLAN)
	if err != nil {
		return err
	}

	c.UI.Info(fmt.Sprintf("Join completed. Synced with %d initial agents", n))
	return nil
}
621028
func (b *Builder) LeftJoin(joinTable string, joinCond interface{}) *Builder {
	return b.Join("LEFT", joinTable, joinCond)
}
993833
func (me *Dataset) NaturalJoin(table Expression) *Dataset {
	return me.joinTable(NATURAL_JOIN, table, nil)
}
264055
func (joins *TableJoinMap) GetOrderdActivatedJoins() ([]*TableJoin, error) {
	if err := joins.ActivateRequiredJoins(); err != nil {
		return nil, errs.Wrap(err, "failed to get activate required joins")
	}

	orderer := activationOrderer{
		m:              *joins,
		alreadyVisited: map[*TableJoin]struct{}{},
	}

	for name := range *joins {
		if err := orderer.visitDepthFirst(name); err != nil {
			return nil, errs.Wrapf(err, `failed to visit "%s" join`, name)
		}
	}
	return orderer.orderedActivatedJoins, nil
}
827107
func (s *Account) SetJoinedMethod(v string) *Account {
	s.JoinedMethod = &v
	return s
}
1308701
func (s *SendAnnouncementInput) SetRoomFilters(v []*Filter) *SendAnnouncementInput {
	s.RoomFilters = v
	return s
}
553778
func (r *RoomService) Invite(room string, user string, reason string) (*http.Response, error) {
	reasonReq := &InviteRequest{Reason: reason}

	req, err := r.client.NewRequest("POST", fmt.Sprintf("room/%s/invite/%s", room, user), nil, reasonReq)
	if err != nil {
		return nil, err
	}

	return r.client.Do(req, nil)
}
2377
func (qb *TiDBQueryBuilder) LeftJoin(table string) QueryBuilder {
	qb.Tokens = append(qb.Tokens, "LEFT JOIN", table)
	return qb
}
303779
func (s *DeviceData) SetRoomName(v string) *DeviceData {
	s.RoomName = &v
	return s
}
25907
func (b *Builder) InnerJoin(joinTable string, joinCond interface{}) *Builder {
	return b.Join("INNER", joinTable, joinCond)
}
1227039
func (r *Room) run() {
	for {
		select {
		// Join
		case conn := <-r.join:
			r.members[conn] = true
		// Leave
		case conn := <-r.leave:
			if _, ok := r.members[conn]; ok { // If member exists, delete it
				delete(r.members, conn)
			}
		// Send
		case message := <-r.send:
			for conn := range r.members { // For every connection try to send
				select {
				case conn.send <- message:
				default: // If sending failed, delete member
					delete(r.members, conn)
				}
			}
		// Stop
		case <-r.stop:
			return
		}
	}
}