// Returns a string representing the channel modes. Looks like:
//	+npk key
189247
func (cm *ChanMode) String() string {
	if cm == nil {
		return "No modes set"
	}
	str := "+"
	a := make([]string, 0)
	v := reflect.Indirect(reflect.ValueOf(cm))
	t := v.Type()
	for i := 0; i < v.NumField(); i++ {
		switch f := v.Field(i); f.Kind() {
		case reflect.Bool:
			if f.Bool() {
				str += ChanModeToString[t.Field(i).Name]
			}
		case reflect.String:
			if f.String() != "" {
				str += ChanModeToString[t.Field(i).Name]
				a = append(a, f.String())
			}
		case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
			if f.Int() != 0 {
				str += ChanModeToString[t.Field(i).Name]
				a = append(a, strconv.FormatInt(f.Int(), 10))
			}
		}
	}
	for _, s := range a {
		if s != "" {
			str += " " + s
		}
	}
	if str == "+" {
		str = "No modes set"
	}
	return str
}
486291
func (fi *FileInfo) Mode() os.FileMode {
	mode, err := WritePermMode(
		fi.fs.ctx, fi.node, os.FileMode(0), fi.fs.config.KBPKI(),
		fi.fs.config, fi.fs.h)
	if err != nil {
		fi.fs.log.CWarningf(
			fi.fs.ctx, "Couldn't get mode for file %s: %+v", fi.Name(), err)
		mode = os.FileMode(0)
	}

	mode |= 0400
	switch fi.ei.Type {
	case data.Dir:
		mode |= os.ModeDir | 0100
	case data.Sym:
		mode |= os.ModeSymlink
	case data.Exec:
		mode |= 0100
	}
	return mode
}
1161569
func (lbm LBMode) String() string {
	if name, ok := modeNames[lbm]; ok {
		return name
	}
	return "(unknown)"
}
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
}
562122
func (m WaiterMatchMode) String() string {
	switch m {
	case PathAllWaiterMatch:
		return "pathAll"
	case PathWaiterMatch:
		return "path"
	case PathAnyWaiterMatch:
		return "pathAny"
	case PathListWaiterMatch:
		return "pathList"
	case StatusWaiterMatch:
		return "status"
	case ErrorWaiterMatch:
		return "error"
	default:
		return "unknown waiter match mode"
	}
}
375281
func (c *ReactionsGetCall) Channel(channel string) *ReactionsGetCall {
	c.channel = channel
	return c
}
162375
func (api *Client) GetChannelInfoContext(ctx context.Context, channelID string) (*Channel, error) {
	values := url.Values{
		"token":          {api.token},
		"channel":        {channelID},
		"include_locale": {strconv.FormatBool(true)},
	}

	response, err := api.channelRequest(ctx, "channels.info", values)
	if err != nil {
		return nil, err
	}
	return &response.Channel, nil
}
391123
func (s *Server) GetChannel(name string) (*Channel, bool) {
	ch, ok := s.channels[name]
	return ch, ok
}
1297376
func (c *Channel) Link(channel ...*Channel) {
	packet := MumbleProto.ChannelState{
		ChannelId: &c.ID,
		LinksAdd:  make([]uint32, len(channel)),
	}
	for i, ch := range channel {
		packet.LinksAdd[i] = ch.ID
	}
	c.client.Conn.WriteProto(&packet)
}
1195257
func (d *JSONDecoder) DecodeChannels(data []byte) (*ChannelsRequest, error) {
	var p ChannelsRequest
	err := json.Unmarshal(data, &p)
	if err != nil {
		return nil, err
	}
	return &p, nil
}
282744
func (ls *LState) ToChannel(n int) chan LValue {
	if lv, ok := ls.Get(n).(LChannel); ok {
		return (chan LValue)(lv)
	}
	return nil
}
903776
func (c *PodConfig) Channel(source string) chan<- interface{} {
	c.sourcesLock.Lock()
	defer c.sourcesLock.Unlock()
	c.sources.Insert(source)
	return c.mux.Channel(source)
}
1029389
func ChannelID(env *cb.Envelope) (string, error) {
	chdr, err := ChannelHeader(env)
	if err != nil {
		return "", errors.WithMessage(err, "error retrieving channel header")
	}

	return chdr.ChannelId, nil
}
817674
func (dep Departure) Mode() (mode TransportMode, err error) {
	return parseMode(dep.Line)
}
1086955
func (s *Subscriber) Channels() []string {
	s.mu.Lock()
	defer s.mu.Unlock()

	var cs []string
	for c := range s.channels {
		cs = append(cs, c)
	}
	sort.Strings(cs)
	return cs
}
1087779
func (s *grpcAPIService) Channels(ctx context.Context, req *ChannelsRequest) (*ChannelsResponse, error) {
	return s.api.Channels(ctx, req), nil
}
1066344
func (bttvAPI *BTTVAPI) GetChannel(channelName string, onSuccess func(ChannelResponse),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback) {
	var channel ChannelResponse
	onSuccessfulRequest := func() {
		onSuccess(channel)
	}
	bttvAPI.Get("/2/channels/"+channelName, nil, &channel, onSuccessfulRequest,
		onHTTPError, onInternalError)
}