Fetches history of messages and events from a multiparty direct message.

        Args:
            channel (str): Multiparty direct message to fetch history for. e.g. 'G1234567890'
550198
def mpim_history(self, *, channel: str, **kwargs) -> SlackResponse:
        
        kwargs.update({"channel": channel})
        return self.api_call("mpim.history", http_verb="GET", params=kwargs)
806103
def get_filter_args_for_all_events_from_channel(
        token_network_address: TokenNetworkAddress,
        channel_identifier: ChannelID,
        contract_manager: ContractManager,
        from_block: BlockSpecification = GENESIS_BLOCK_NUMBER,
        to_block: BlockSpecification = 'latest',
) -> Dict:
    

    event_filter_params = get_filter_args_for_specific_event_from_channel(
        token_network_address=token_network_address,
        channel_identifier=channel_identifier,
        event_name=ChannelEvent.OPENED,
        contract_manager=contract_manager,
        from_block=from_block,
        to_block=to_block,
    )

    # As we want to get all events for a certain channel we remove the event specific code here
    # and filter just for the channel identifier
    # We also have to remove the trailing topics to get all filters
    event_filter_params['topics'] = [None, event_filter_params['topics'][1]]

    return event_filter_params
481603
def exceptlist(self, channel):
        
        with self.lock:
            self.is_in_channel(channel)

            self.send('MODE %s e' % channel)
            excepts = []

            while self.readable():
                msg = self._recv(expected_replies=('348', '349'))

                if msg[0] == '348':
                    exceptmask, who, timestamp = msg[2].split()[1:]
                    excepts.append((self._from_(exceptmask), who, \
                                    self._m_time.localtime(int(timestamp))))
                elif msg[0] == '349':
                    break

            return excepts
1183449
def invite(self, channel, nick):
        
        with self.lock:
            self.is_in_channel(channel)

            self.send('INVITE %s %s' % (nick, channel))

            while self.readable():
                    msg = self._recv(expected_replies=('341', '301'))

                    if msg[0] == '341':
                        pass
                    elif msg[0] == '301':
                        away_msg = msg[2].split()[1].replace(':', '', 1)
                        return 'AWAY', away_msg
464161
def _read_channel(channel, stream, start, duration):
    
    channel_type = lalframe.FrStreamGetTimeSeriesType(channel, stream)
    read_func = _fr_type_map[channel_type][0]
    d_type = _fr_type_map[channel_type][1]
    data = read_func(stream, channel, start, duration, 0)
    return TimeSeries(data.data.data, delta_t=data.deltaT, epoch=start,
                      dtype=d_type)
1076703
def topic(self, channel, topic=None):
        
        with self.lock:
            self.is_in_channel(channel)

            if topic:
                self.send('TOPIC %s :%s' % (channel, topic))
                if self.readable():
                    msg = self._recv(expected_replies=('TOPIC',))
                    if msg[0] == 'TOPIC' and self.hide_called_events:
                        channel = msg[1]
                        self.channels[channel]['TOPIC'] = \
                        msg[2].replace(':', '', 1)
                        if not self.hide_called_events:
                            self.stepback()
            else:
                topic = ''
                set_by = ''
                time_set = ''
                self.send('TOPIC %s' % channel)
                while self.readable():
                    msg = self._recv(expected_replies=('332', '333', '331'))
                    if msg[0] == '332':
                        topic = msg[2].split(':', 1)[1]
                    elif msg[0] == '333':
                        set_by, time_set = msg[2].split()[1:]
                        if self.UTC == False:
                            time_set = self._m_time.localtime(int(time_set))
                        else:
                            time_set = self._m_time.gmtime(int(time_set))
                        set_by = self._from_(set_by)
                    elif msg[0] == '331':
                        topic = ''

                return topic, set_by, time_set
552757
def _bind_channels(self, events, channels):
        
        for channel_name in channels:
            if channel_name in self.channels:
                channel = self.pusher.subscribe(channel_name)
                if isinstance(events, list):
                    for event in events:
                        channel.bind(event, channels[channel_name])
                else:
                    channel.bind(events, channels[channel_name])
588541
async def StatusHistory(self, requests):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Client',
                   request='StatusHistory',
                   version=2,
                   params=_params)
        _params['requests'] = requests
        reply = await self.rpc(msg)
        return reply
532471
def create_channel(self, channel):
        

        data = {'channels': channel}
        return super(ApiInterfaceRequest, self).post('api/v3/channel/', data)
449387
def topic_update(channel, topic_channel):
    

    if topic_channel is not None:
        try:
            channel_message = "Topic channel is now `{}`.".format(topic_channel.name)
        except Exception as e:
            logger.exception(e)
            channel_message = "Topic channel has been updated."
    else:
        channel_message = "Topic channel has been cleared."

    # Create embed UI object
    gui = ui_embed.UI(
            channel,
            "Topic channel updated",
            channel_message,
            modulename=modulename,
            colour=modulecolor_info
    )

    return gui
567441
def _get_all_filtered_channels(self, topics_without_signature):
        
        mpe_address     = self.get_mpe_address()
        event_signature = self.ident.w3.sha3(text="ChannelOpen(uint256,uint256,address,address,address,bytes32,uint256,uint256)").hex()
        topics = [event_signature] + topics_without_signature
        logs = self.ident.w3.eth.getLogs({"fromBlock" : self.args.from_block, "address"   : mpe_address, "topics"    : topics})
        abi           = get_contract_def("MultiPartyEscrow")
        event_abi     = abi_get_element_by_name(abi, "ChannelOpen")
        channels_ids  = [get_event_data(event_abi, l)["args"]["channelId"] for l in logs]
        return channels_ids
493765
def capture_message(sock, get_channel=False):
    
    # Fetching the Arb ID, DLC and Data
    try:
        if get_channel:
            if HAS_NATIVE_SUPPORT:
                cf, addr = sock.recvfrom(CANFD_MTU)
                channel = addr[0] if isinstance(addr, tuple) else addr
            else:
                data = ctypes.create_string_buffer(CANFD_MTU)
                addr = ctypes.create_string_buffer(32)
                addrlen = ctypes.c_int(len(addr))
                received = libc.recvfrom(sock.fileno(), data, len(data), 0,
                                         addr, ctypes.byref(addrlen))
                cf = data.raw[:received]
                # Figure out the channel name
                family, ifindex = struct.unpack_from("Hi", addr.raw)
                assert family == AF_CAN
                data = struct.pack("16xi", ifindex)
                res = fcntl.ioctl(sock, SIOCGIFNAME, data)
                channel = ctypes.create_string_buffer(res).value.decode()
        else:
            cf = sock.recv(CANFD_MTU)
            channel = None
    except socket.error as exc:
        raise can.CanError("Error receiving: %s" % exc)

    can_id, can_dlc, flags, data = dissect_can_frame(cf)
    #log.debug('Received: can_id=%x, can_dlc=%x, data=%s', can_id, can_dlc, data)

    # Fetching the timestamp
    binary_structure = "@LL"
    res = fcntl.ioctl(sock, SIOCGSTAMP, struct.pack(binary_structure, 0, 0))

    seconds, microseconds = struct.unpack(binary_structure, res)
    timestamp = seconds + microseconds * 1e-6

    # EXT, RTR, ERR flags -> boolean attributes
    #   /* special address description flags for the CAN_ID */
    #   #define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
    #   #define CAN_RTR_FLAG 0x40000000U /* remote transmission request */
    #   #define CAN_ERR_FLAG 0x20000000U /* error frame */
    is_extended_frame_format = bool(can_id & CAN_EFF_FLAG)
    is_remote_transmission_request = bool(can_id & CAN_RTR_FLAG)
    is_error_frame = bool(can_id & CAN_ERR_FLAG)
    is_fd = len(cf) == CANFD_MTU
    bitrate_switch = bool(flags & CANFD_BRS)
    error_state_indicator = bool(flags & CANFD_ESI)

    if is_extended_frame_format:
        #log.debug("CAN: Extended")
        # TODO does this depend on SFF or EFF?
        arbitration_id = can_id & 0x1FFFFFFF
    else:
        #log.debug("CAN: Standard")
        arbitration_id = can_id & 0x000007FF

    msg = Message(timestamp=timestamp,
                  channel=channel,
                  arbitration_id=arbitration_id,
                  is_extended_id=is_extended_frame_format,
                  is_remote_frame=is_remote_transmission_request,
                  is_error_frame=is_error_frame,
                  is_fd=is_fd,
                  bitrate_switch=bitrate_switch,
                  error_state_indicator=error_state_indicator,
                  dlc=can_dlc,
                  data=data)

    #log_rx.debug('Received: %s', msg)

    return msg
1071730
def raw_channel_mentions(self):
        
        return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)]
397678
def get_channel_by_channel_id(self, channel_id):
        
        self._validate_uuid(channel_id)

        url = "/notification/v1/channel/{}".format(channel_id)

        response = NWS_DAO().getURL(url, self._read_headers)

        if response.status != 200:
            raise DataFailureException(url, response.status, response.data)

        data = json.loads(response.data)
        return self._channel_from_json(data.get("Channel"))
39119
def post_channel(self, channel_id, message):
        
        headers = {"Authorization": "Bearer " + self.token}
        props = {'channel_id': channel_id, 'message': message}
        p = requests.post(self.url + '/posts', headers=headers, data=json.dumps(props))
        return p
11144
def direct_messages_show(self, id):
        
        params = {}
        set_str_param(params, 'id', id)
        d = self._get_api('direct_messages/show.json', params)
        d.addCallback(lambda dms: dms[0])
        return d
458827
async def async_get_channels(no_cache=False, refresh_interval=4):
    '''
    
    '''
    # Check cache
    now = datetime.datetime.now()
    max_cache_age = datetime.timedelta(hours=refresh_interval)
    if not no_cache and 'channels' in _CACHE:
        cache = _CACHE.get('channels')
        cache_age = cache.get('last_updated')
        if now - cache_age < max_cache_age:
            _LOGGER.debug('Found channel list in cache.')
            return cache
        else:
            _LOGGER.debug('Found outdated channel list in cache. Update it.')
            _CACHE.pop('channels')
    soup = await _async_request_soup(BASE_URL + '/plan.html')
    channels = {}
    for li_item in soup.find_all('li'):
        try:
            child = li_item.findChild()
            if not child or child.name != 'a':
                continue
            href = child.get('href')
            if not href or not href.startswith('/programme/chaine'):
                continue
            channels[child.get('title')] = BASE_URL + href
        except Exception as exc:
            _LOGGER.error('Exception occured while fetching the channel '
                          'list: %s', exc)
    if channels:
        _CACHE['channels'] = {'last_updated': now, 'data': channels}
        return _CACHE['channels']