// Associates an already known nick with an already known channel.
338230
func (st *stateTracker) Associate(c, n string) *ChanPrivs {
	st.mu.Lock()
	defer st.mu.Unlock()
	nk, nok := st.nicks[n]
	ch, cok := st.chans[c]

	if !cok {
		// As we can implicitly delete both nicks and channels from being
		// tracked by dissociating one from the other, we should verify that
		// we're not being passed an old Nick or Channel.
		logging.Error("Tracker.Associate(): channel %s not found in "+
			"internal state.", c)
		return nil
	} else if !nok {
		logging.Error("Tracker.Associate(): nick %s not found in "+
			"internal state.", n)
		return nil
	} else if _, ok := nk.isOn(ch); ok {
		logging.Warn("Tracker.Associate(): %s already on %s.",
			nk, ch)
		return nil
	}
	cp := new(ChanPrivs)
	ch.addNick(nk, cp)
	nk.addChannel(ch, cp)
	return cp.Copy()
}
1103481
func (c *ReactionsRemoveCall) Channel(channel string) *ReactionsRemoveCall {
	c.channel = channel
	return c
}
206962
func NewChannel(buffer int) *Channel {
	return &Channel{
		C:      make(chan Event, buffer),
		closed: make(chan struct{}),
	}
}
1190116
func newChannel(topic string, partition int32) channel {
	return &channelImpl{
		tpc: fmt.Sprintf("%s", topic),
		prt: partition,
	}
}
207989
func (sl *Slack) JoinChannel(name string) error {
	uv := sl.urlValues()
	uv.Add("name", name)

	_, err := sl.GetRequest(channelsJoinApiEndpoint, uv)
	if err != nil {
		return err
	}
	return nil
}
69022
func (a *Application) Channel() csparams.Channel {
	return csparams.Channel(a.doc.Channel)
}
769323
func (conn *Conn) Invite(nick, channel string) {
	conn.Raw(INVITE + " " + nick + " " + channel)
}
258710
func (s *Switch) addLiveLink(link ChannelLink) {
	// We'll add the link to the linkIndex which lets us quickly
	// look up a channel when we need to close or register it, and
	// the forwarding index which'll be used when forwarding HTLC's
	// in the multi-hop setting.
	s.linkIndex[link.ChanID()] = link
	s.forwardingIndex[link.ShortChanID()] = link

	// Next we'll add the link to the interface index so we can
	// quickly look up all the channels for a particular node.
	peerPub := link.Peer().PubKey()
	if _, ok := s.interfaceIndex[peerPub]; !ok {
		s.interfaceIndex[peerPub] = make(map[lnwire.ChannelID]ChannelLink)
	}
	s.interfaceIndex[peerPub][link.ChanID()] = link

	// Inform the channel notifier if the link has become active.
	if link.EligibleToForward() {
		s.cfg.NotifyActiveChannel(*link.ChannelPoint())
	}
}
824130
func (c *Client) SetNick(nick string) error {
	return c.ClientUpdate(NewArg(ClientNickname, nick))
}
8062
func (s *Session) ChannelEdit(channelID, name string) (*Channel, error) {
	return s.ChannelEditComplex(channelID, &ChannelEdit{
		Name: name,
	})
}
88458
func (ch *channel) Channel() *Channel {
	c := &Channel{
		Name:  ch.name,
		Topic: ch.topic,
		Modes: ch.modes.Copy(),
		Nicks: make(map[string]*ChanPrivs),
	}
	for n, cp := range ch.nicks {
		c.Nicks[n.nick] = cp.Copy()
	}
	return c
}
371391
func (n *Network) CreateAndJoinChannels(o *Orderer) {
	for _, c := range n.Channels {
		n.CreateAndJoinChannel(o, c.Name)
	}
}
748660
func (nk *Nick) IsOn(ch string) (*ChanPrivs, bool) {
	cp, ok := nk.Channels[ch]
	return cp, ok
}
1031672
func (r *ChannelRouter) IsKnownEdge(chanID lnwire.ShortChannelID) bool {
	_, _, exists, isZombie, _ := r.cfg.Graph.HasChannelEdge(chanID.ToUint64())
	return exists || isZombie
}
205448
func (s *DiscoverySupport) ChannelExists(channel string) bool {
	return s.SelfChannelInfo(common.ChainID(channel)) != nil
}
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)
}
622990
func AddChannel(ident, channelName, user, organization string) error {
	query := utils.M{
		"org":   organization,
		"user":  user,
		"ident": ident,
	}

	spec := utils.M{
		"$addToSet": utils.M{
			"channels": db.Channel{Name: channelName, Enabled: true},
		},
	}

	result := utils.M{}

	_, err := db.Conn.FindAndUpdate(db.TopicCollection, query, spec, &result)
	return err
}