// ChatKBFSToImpteamUpgrade implements the chat1.NotifyChatInterface
// for ChatRPC.
765265
func (c *ChatRPC) ChatKBFSToImpteamUpgrade(
	_ context.Context, _ chat1.ChatKBFSToImpteamUpgradeArg) error {
	return nil
}
1173500
func (bot TgBot) SimpleSendPhoto(msg Message, photo interface{}) (res Message, err error) {
	cid := msg.Chat.ID
	ressm := bot.SendPhoto(cid, photo, nil, nil, nil)
	return splitResultInMessageError(ressm)
}
572637
func (c *Client) SendFromAsync(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) FutureSendFromResult {
	addr := toAddress.EncodeAddress()
	cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(), nil,
		nil, nil)
	return c.sendCmd(cmd)
}
1284547
func (c chatResponseFull) getMessageTimestamp() string {
	if len(c.Timestamp) > 0 {
		return c.Timestamp
	}
	return c.MessageTimeStamp
}
932133
func (c *ChatRPC) ChatInboxSynced(
	_ context.Context, _ chat1.ChatInboxSyncedArg) error {
	return nil
}
1152531
func (bot TgBot) SimpleSendSticker(msg Message, sticker interface{}) (res Message, err error) {
	cid := msg.Chat.ID
	ressm := bot.SendSticker(cid, sticker, nil, nil)
	return splitResultInMessageError(ressm)
}
1203144
func (conn *BytesConnectionFields) MarkOffset(msg client.ConsumerMessage, metadata string) {
	if conn.multiplexer != nil && conn.multiplexer.Consumer != nil {
		conn.multiplexer.Consumer.MarkOffset(&msg, metadata)
	}
}
336407
func (s *Session) ChannelMessageEditEmbed(channelID, messageID string, embed *MessageEmbed) (*Message, error) {
	return s.ChannelMessageEditComplex(NewMessageEdit(channelID, messageID).SetEmbed(embed))
}
981773
func (c *chatServiceHandler) SearchRegexpV1(ctx context.Context, opts searchRegexpOptionsV1) Reply {
	convID, rlimits, err := c.resolveAPIConvID(ctx, opts.Channel)
	if err != nil {
		return c.errReply(err)
	}

	client, err := GetChatLocalClient(c.G())
	if err != nil {
		return c.errReply(err)
	}

	if opts.MaxHits <= 0 {
		opts.MaxHits = 10
	}

	if opts.MaxMessages <= 0 {
		opts.MaxMessages = 10000
	}

	searchOpts := chat1.SearchOpts{
		SentBy:        opts.SentBy,
		MaxHits:       opts.MaxHits,
		MaxMessages:   opts.MaxMessages,
		BeforeContext: opts.BeforeContext,
		AfterContext:  opts.AfterContext,
	}

	if opts.SentBefore != "" && opts.SentAfter != "" {
		err := fmt.Errorf("Only one of `sent_before` and `sent_after` can be specified")
		return c.errReply(err)
	}
	if opts.SentBefore != "" {
		sentBefore, err := dateparse.ParseAny(opts.SentBefore)
		if err != nil {
			return c.errReply(err)
		}
		searchOpts.SentBefore = gregor1.ToTime(sentBefore)
	}
	if opts.SentAfter != "" {
		sentAfter, err := dateparse.ParseAny(opts.SentAfter)
		if err != nil {
			return c.errReply(err)
		}
		searchOpts.SentAfter = gregor1.ToTime(sentAfter)
	}
	searchOpts.IsRegex = opts.IsRegex

	arg := chat1.SearchRegexpArg{
		ConvID:           convID,
		IdentifyBehavior: keybase1.TLFIdentifyBehavior_CHAT_CLI,
		Query:            opts.Query,
		Opts:             searchOpts,
	}

	res, err := client.SearchRegexp(ctx, arg)
	if err != nil {
		return c.errReply(err)
	}

	allLimits := append(rlimits, res.RateLimits...)
	searchRes := SearchRegexpRes{
		Hits: res.Hits,
		RateLimits: RateLimits{
			c.aggRateLimits(allLimits),
		},
		IdentifyFailures: res.IdentifyFailures,
	}
	return Reply{Result: searchRes}
}
427668
func (b *Bslack) skipMessageEvent(ev *slack.MessageEvent) bool {
	switch ev.SubType {
	case sChannelLeave, sChannelJoin:
		return b.GetBool(noSendJoinConfig)
	case sPinnedItem, sUnpinnedItem:
		return true
	case sChannelTopic, sChannelPurpose:
		// Skip the event if our bot/user account changed the topic/purpose
		if ev.User == b.si.User.ID {
			return true
		}
	}

	// Skip any messages that we made ourselves or from 'slackbot' (see #527).
	if ev.Username == sSlackBotUser ||
		(b.rtm != nil && ev.Username == b.si.User.Name) ||
		(len(ev.Attachments) > 0 && ev.Attachments[0].CallbackID == "matterbridge_"+b.uuid) {
		return true
	}

	if ev.SubMessage != nil {
		// It seems ev.SubMessage.Edited == nil when slack unfurls.
		// Do not forward these messages. See Github issue #266.
		if ev.SubMessage.ThreadTimestamp != ev.SubMessage.Timestamp &&
			ev.SubMessage.Edited == nil {
			return true
		}
		// see hidden subtypes at https://api.slack.com/events/message
		// these messages are sent when we add a message to a thread #709
		if ev.SubType == "message_replied" && ev.Hidden {
			return true
		}
	}

	if len(ev.Files) > 0 {
		return b.filesCached(ev.Files)
	}
	return false
}
1253208
func (bot TgBot) SimpleSendChatAction(msg Message, ca ChatAction) {
	bot.SendChatAction(msg.Chat.ID, ca)
}
1034564
func (c *ChatRPC) ChatSetTeamRetention(
	_ context.Context, _ chat1.ChatSetTeamRetentionArg) error {
	return nil
}
997751
func NewPubKeyMultisigThreshold(k int, pubkeys []crypto.PubKey) crypto.PubKey {
	if k <= 0 {
		panic("threshold k of n multisignature: k <= 0")
	}
	if len(pubkeys) < k {
		panic("threshold k of n multisignature: len(pubkeys) < k")
	}
	return PubKeyMultisigThreshold{uint(k), pubkeys}
}
1194236
func (c *Client) sendBufAllocMsg(frames, channels int) (*Buffer, error) {
	buf := &Buffer{client: c}
	msg := osc.Message{
		Address: bufferAllocAddress,
		Arguments: osc.Arguments{
			osc.Int(buf.Num),
			osc.Int(int32(frames)),
			osc.Int(int32(channels)),
		},
	}
	if err := c.oscConn.Send(msg); err != nil {
		return nil, err
	}
	return buf, nil
}
1005821
func (c *Client) UnsubscribeMultiple(topics []string) (GenericFuture, error) {
	c.mutex.Lock()
	defer c.mutex.Unlock()

	// check if connected
	if atomic.LoadUint32(&c.state) != clientConnected {
		return nil, ErrClientNotConnected
	}

	// allocate unsubscribe packet
	unsubscribe := packet.NewUnsubscribe()
	unsubscribe.Topics = topics
	unsubscribe.ID = c.Session.NextID()

	// create future
	unsubscribeFuture := future.New()

	// store future
	c.futureStore.Put(unsubscribe.ID, unsubscribeFuture)

	// send packet
	err := c.send(unsubscribe, true)
	if err != nil {
		return nil, c.cleanup(err, false, false)
	}

	return unsubscribeFuture, nil
}
760468
func (b *Bxmpp) skipMessage(message xmpp.Chat) bool {
	// skip messages from ourselves
	if b.parseNick(message.Remote) == b.GetString("Nick") {
		return true
	}

	// skip empty messages
	if message.Text == "" {
		return true
	}

	// skip subject messages
	if strings.Contains(message.Text, "</subject>") {
		return true
	}

	// do not show subjects on connect #732
	if strings.Contains(message.Text, "has set the subject to:") && time.Since(b.startTime) < time.Second*5 {
		return true
	}

	// skip delayed messages
	t := time.Time{}
	return message.Stamp != t
}
1083466
func (c *Client) KickChatMember(chatID string, userID int, opts ...sendOption) error {
	req := url.Values{}
	req.Set("chat_id", chatID)
	req.Set("user_id", fmt.Sprint(userID))
	for _, opt := range opts {
		opt(req)
	}
	var kicked bool
	return c.doRequest("kickChatMember", req, &kicked)
}