Leaves a channel.

        Prevent user from leaving the primary channel.
508779
def do_part(self, cmdargs, nick, target, msgtype, send, c):
        
        channel = self.config['core']['channel']
        botnick = self.config['core']['nick']
        if not cmdargs:
            # don't leave the primary channel
            if target == channel:
                send("%s must have a home." % botnick)
                return
            else:
                cmdargs = target
        if not cmdargs.startswith(('#', '+', '@')):
            cmdargs = '#' + cmdargs
        # don't leave the primary channel
        if cmdargs == channel:
            send("%s must have a home." % botnick)
            return
        # don't leave the control channel
        if cmdargs == self.config['core']['ctrlchan']:
            send("%s must remain under control, or bad things will happen." % botnick)
            return
        self.send(cmdargs, nick, "Leaving at the request of %s" % nick, msgtype)
        c.part(cmdargs)
1003811
def disconnect(self, name=None):
        
        if name is None:
            self._channels = {}
        else:
            self._channels.pop(name)
        if self._ctxt is not None:
            self._ctxt.disconnect(name)
815381
def part(self, channel, reason=''):
        
        with self.lock:
            self.is_in_channel(channel)

            self.send('PART %s :%s' % (channel, reason))
            msg = self._recv(expected_replies=('PART',))
            if msg[0] == 'PART':
                del self.channels[msg[1]]
                if not self.hide_called_events:
                    self.stepback()
804176
def cancel(self, consumer_tag):
        """"""
        if not self.channel.conn:
            return
        self.channel.basic_cancel(consumer_tag)
321746
@Override
  public void close() {
    if (closed) return;
    
    closed = true;
    
    try {
      channel.close();
    } catch (Exception e) {
      logger.log("Failed to close channel for: '" + name + "'", e);
    }
  }
1367532
def unsubscribe(self, client):
        """"""
        for channel in self.channels.values():
            channel.unsubscribe(client)
529159
def cancel(self, consumer_tag):
        """"""
        if not self.channel.connection:
            return
        self.channel.basic_cancel(consumer_tag)
884894
public void stop() {
			if (this.channels.size() > 0) 
			{
	            logger.info(regularConfiguration.getName() + " currently has [" + this.channels.size() + "] open child channel(s) that will be closed as part of stop()");
	        }
			this.channelFactory.shutdown();
			this.channels.close().awaitUninterruptibly();
			this.regularBootstrap.shutdown();
			if(this.securedBootstrap!=null)
			this.securedBootstrap.shutdown();
	        logger.info(regularConfiguration.getName() + " stopped at " + regularConfiguration.getHost());
		}
730647
void stopIfNecessary() {
    synchronized (lock) {
      if (goAway && !stopped && streams.size() == 0) {
        stopped = true;
      } else {
        return;
      }
    }
    listener.transportTerminated();
  }
1268079
def channels_remove_owner(self, room_id, user_id, **kwargs):
        """"""
        return self.__call_api_post('channels.removeOwner', roomId=room_id, userId=user_id, kwargs=kwargs)
67662
function close() {
            var all = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];

            return Channel.close(this, all);
        }
1274015
public void removeChannel(
            T channel,
            String functionalityName,
            String requesterID,
            String conversationID)
    {
        synchronized (this.channelsWithId)
        {
            this.channelsWithId.remove(calculateId(functionalityName, requesterID, conversationID));
        }
        synchronized (this.channelsWithFunctionalityName)
        {
            this.channelsWithFunctionalityName.get(functionalityName).remove(channel);
        }
    }
484003
def purge(self):
        
        self.channel.purge_stream(self.stream_id, remove_definition=False, sandbox=None)
1326107
private void removeOldChannels()
    {
        Iterator<AsteriskChannelImpl> i;

        synchronized (channels)
        {
            i = channels.values().iterator();
            while (i.hasNext())
            {
                final AsteriskChannel channel = i.next();
                final Date dateOfRemoval = channel.getDateOfRemoval();
                if (channel.getState() == ChannelState.HUNGUP && dateOfRemoval != null)
                {
                    final long diff = DateUtil.getDate().getTime() - dateOfRemoval.getTime();
                    if (diff >= REMOVAL_THRESHOLD)
                    {
                        i.remove();
                    }
                }
            }
        }
    }
56821
def _nick(self, nick):
        
        with self.lock:
            self.send('NICK :%s' % nick)

            if self.readable():
                msg = self._recv(expected_replies='NICK')
                if msg[0] == 'NICK':
                    if not self.hide_called_events:
                        self.stepback()

            for channel in self.channels:
                if 'USERS' in self.channels[channel]:
                    priv_level = \
                    self.channels[channel]['USERS'][self.current_nick]
                    del self.channels[channel]['USERS'][self.current_nick]
                    self.channels[channel]['USERS'][nick] = priv_level
            self.current_nick = nick
585777
protected void disconnect() {
		if (channel != null) {
			try {
				channel.close();
			} catch (Throwable cause) {
				logger.warn("Unexpected error occurred while closing AMQP channel!", cause);
			} finally {
				channel = null;
			}
		}
		if (client != null) {
			try {
				client.close();
			} catch (Throwable cause) {
				logger.warn("Unexpected error occurred while closing AMQP client!", cause);
			} finally {
				client = null;
			}
		}
	}
168410
def close(self, channel):
        
        self.params.update({
            'channel': channel,
            })
        return FromUrl('https://slack.com/api/im.close', self._requests)(data=self.params).post()