// extractChannels returns a slice with all channels
// of all given GossipMessages
510617
func extractChannels(a []*emittedGossipMessage) []common.ChainID {
	channels := []common.ChainID{}
	for _, m := range a {
		if len(m.Channel) == 0 {
			continue
		}
		sameChan := func(a interface{}, b interface{}) bool {
			return bytes.Equal(a.(common.ChainID), b.(common.ChainID))
		}
		if util.IndexInSlice(channels, common.ChainID(m.Channel), sameChan) == -1 {
			channels = append(channels, common.ChainID(m.Channel))
		}
	}
	return channels
}
1206372
func (gs *genericStore) getChannelLimits(channel string) *ChannelLimits {
	r := gs.sublist.Match(channel)
	if len(r) == 0 {
		// If there is no match, that means we need to use the global limits.
		return &gs.limits.ChannelLimits
	}
	// If there is a match, use the limits from the last element because
	// we know that the returned array is ordered from widest to narrowest,
	// and the only literal that there is would be the channel we are
	// looking up.
	return r[len(r)-1].(*ChannelLimits)
}
1216317
func (m *MMClient) GetChannels() []*model.Channel {
	m.RLock()
	defer m.RUnlock()
	var channels []*model.Channel
	// our primary team channels first
	channels = append(channels, m.Team.Channels.Channels...)
	for _, t := range m.OtherTeams {
		if t.Id != m.Team.Id {
			channels = append(channels, t.Channels.Channels...)
		}
	}
	return channels
}
715751
func (m *GossipMessage) IsChannelRestricted() bool {
	return m.Tag == GossipMessage_CHAN_AND_ORG || m.Tag == GossipMessage_CHAN_ONLY || m.Tag == GossipMessage_CHAN_OR_ORG
}
501768
func DecodeChannels(data []byte) ([]string, error) {
	channels := []string{}
	pos := 0
	for pos < len(data) {
		if pos+2 > len(data) {
			return nil, fmt.Errorf("unable to decode size, pos=%v len=%v", pos, len(data))
		}
		cl := int(ByteOrder.Uint16(data[pos:]))
		pos += encodedChannelLen
		end := pos + cl
		if end > len(data) {
			return nil, fmt.Errorf("unable to decode channel, pos=%v len=%v max=%v (string=%v)",
				pos, cl, len(data), string(data[pos:]))
		}
		c := string(data[pos:end])
		channels = append(channels, c)
		pos = end
	}
	return channels, nil
}
473088
func ExtractProperties(s *Step) (*structpb.Struct, error) {
	finals := map[string]json.RawMessage{}

	var extract func(s *Step)
	extract = func(s *Step) {
		for _, p := range s.Property {
			finals[p.Name] = json.RawMessage(p.Value)
		}
		for _, substep := range s.GetSubstep() {
			if ss := substep.GetStep(); ss != nil {
				extract(ss)
			}
		}
	}
	extract(s)

	buf, err := json.Marshal(finals)
	if err != nil {
		panic("failed to marshal in-memory map to JSON")
	}

	ret := &structpb.Struct{}
	if err := jsonpb.Unmarshal(bytes.NewReader(buf), ret); err != nil {
		return nil, err
	}
	return ret, nil
}
30154
func (s *Session) GuildChannels(guildID string) (st []*Channel, err error) {

	body, err := s.request("GET", EndpointGuildChannels(guildID), "", nil, EndpointGuildChannels(guildID), 0)
	if err != nil {
		return
	}

	err = unmarshal(body, &st)

	return
}
656252
func (bot *TgBot) GetMessageChannel() chan MessageWithUpdateID {
	ch := make(chan MessageWithUpdateID)
	go bot.MessagesHandler(ch)
	return ch
}
190670
func (m *MMClient) GetMoreChannels() []*model.Channel {
	m.RLock()
	defer m.RUnlock()
	var channels []*model.Channel
	for _, t := range m.OtherTeams {
		channels = append(channels, t.MoreChannels.Channels...)
	}
	return channels
}
525515
func ExtractReplicas(opts ...interface{}) *opt.ReplicasOption {
	for _, o := range opts {
		if v, ok := o.(*opt.ReplicasOption); ok {
			return v
		}
	}
	return nil
}
414459
func (c channelState) Channels() []Channel {
	chans := make([]Channel, 0, len(c))
	for _, channel := range c {
		chans = append(chans, channel)
	}
	return chans
}
104482
func (e *sessionMessages) SessionMessageChannel(topics ...string) chan SessionMessage {
	e.mutex.Lock()
	defer e.mutex.Unlock()
	channelEntry := &sessionMessageChannelEntry{topics: topics, channel: make(chan SessionMessage, 16+len(e.history))}
	e.channels[channelEntry] = true
	for _, oldEvent := range e.history {
		channelEntry.emitSessionEvent(oldEvent)
	}
	return channelEntry.channel
}
1249038
func (c *Client) GetChannel(name string) (rec *ChannelInfo, err error) {
	req, err := newGETRequest(c, "channels/"+PathEscape(name))
	if err != nil {
		return nil, err
	}

	if err = executeAndParseRequest(c, req, &rec); err != nil {
		return nil, err
	}

	return rec, nil
}
530608
func ExtractEntities(text string) []*TwitterEntity {
	var result entitiesT
	result = ExtractUrls(text)
	result = append(result, ExtractHashtags(text)...)
	result = append(result, ExtractMentionsOrLists(text)...)
	result = append(result, ExtractCashtags(text)...)

	sort.Sort(result)
	result.removeOverlappingEntities()
	return result
}
1279695
func (_m *GossipSupport) PeersOfChannel(_a0 common.ChainID) gossipdiscovery.Members {
	ret := _m.Called(_a0)

	var r0 gossipdiscovery.Members
	if rf, ok := ret.Get(0).(func(common.ChainID) gossipdiscovery.Members); ok {
		r0 = rf(_a0)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(gossipdiscovery.Members)
		}
	}

	return r0
}
303322
func ExtractEmails(s string) ([]string, error) {
	emails := regexEmail.FindAllString(s, -1)
	if emails == nil {
		return []string{}, ErrNotFound
	}
	return emails, nil
}
1010955
func (sl *Slack) FindChannel(cb func(*Channel) bool) (*Channel, error) {
	channels, err := sl.ChannelsList()
	if err != nil {
		return nil, err
	}
	for _, channel := range channels {
		if cb(channel) {
			return channel, nil
		}
	}
	return nil, errors.New("No such channel.")
}