// NewRefToMessage initializes a reference to to a message.
16844
func NewRefToMessage(channel, timestamp string) ItemRef {
	return ItemRef{Channel: channel, Timestamp: timestamp}
}
603812
func NewMessage(chatID int64, text string) MessageConfig {
	return MessageConfig{
		BaseChat: BaseChat{
			ChatID:           chatID,
			ReplyToMessageID: 0,
		},
		Text:                  text,
		DisableWebPagePreview: false,
	}
}
393057
func (s *server) OnNewMessage(callback func(c *Client, message string)) {
	s.onNewMessage = callback
}
346280
func (perm *SESPermission) NewMessageBodyStorageReference(prexistingBucketName string) (*MessageBodyStorage, error) {
	store := &MessageBodyStorage{}
	store.bucketNameExpr = gocf.String(prexistingBucketName)
	return store, nil
}
654129
func (m *DummyMailbox) NewMessage() Message {
	return &DummyMessage{
		sequenceNumber: 0,
		uid:            0,
		header:         make(textproto.MIMEHeader),
		internalDate:   time.Now(),
		flags:          types.Flags(0),
		mailstore:      m.mailstore,
		mailboxID:      m.ID,
		body:           "",
	}
}
246882
func newMessage(verb messageVerb, sender *Node, senderHeartbeat uint32) message {
	return message{
		sender:          sender,
		senderHeartbeat: senderHeartbeat,
		verb:            verb,
	}
}
482763
func (api *PublicWhisperAPI) NewMessageFilter(req Criteria) (string, error) {
	var (
		src     *ecdsa.PublicKey
		keySym  []byte
		keyAsym *ecdsa.PrivateKey
		topics  [][]byte

		symKeyGiven  = len(req.SymKeyID) > 0
		asymKeyGiven = len(req.PrivateKeyID) > 0

		err error
	)

	// user must specify either a symmetric or an asymmetric key
	if (symKeyGiven && asymKeyGiven) || (!symKeyGiven && !asymKeyGiven) {
		return "", ErrSymAsym
	}

	if len(req.Sig) > 0 {
		if src, err = crypto.UnmarshalPubkey(req.Sig); err != nil {
			return "", ErrInvalidSigningPubKey
		}
	}

	if symKeyGiven {
		if keySym, err = api.w.GetSymKey(req.SymKeyID); err != nil {
			return "", err
		}
		if !validateDataIntegrity(keySym, aesKeyLength) {
			return "", ErrInvalidSymmetricKey
		}
	}

	if asymKeyGiven {
		if keyAsym, err = api.w.GetPrivateKey(req.PrivateKeyID); err != nil {
			return "", err
		}
	}

	if len(req.Topics) > 0 {
		topics = make([][]byte, len(req.Topics))
		for i, topic := range req.Topics {
			topics[i] = make([]byte, TopicLength)
			copy(topics[i], topic[:])
		}
	}

	f := &Filter{
		Src:      src,
		KeySym:   keySym,
		KeyAsym:  keyAsym,
		PoW:      req.MinPow,
		AllowP2P: req.AllowP2P,
		Topics:   topics,
		Messages: make(map[common.Hash]*ReceivedMessage),
	}

	id, err := api.w.Subscribe(f)
	if err != nil {
		return "", err
	}

	api.mu.Lock()
	api.lastUsed[id] = time.Now()
	api.mu.Unlock()

	return id, nil
}
1066339
func NewMessage(mtype messageType, data []byte) *Message {
	return &Message{
		MessageHeader: MessageHeader{
			Version: uint8(2),
			Type:    uint8(mtype),
			DataLen: msgLenToBytes(int64(len(data))),
		},
		Data: data,
	}
}
730764
func NewMessage(settings ...MessageSetting) *Message {
	msg := &Message{
		header:   make(header),
		charset:  "UTF-8",
		encoding: QuotedPrintable,
	}

	msg.applySettings(settings)

	var e quotedprintable.Encoding
	if msg.encoding == Base64 {
		e = quotedprintable.B
	} else {
		e = quotedprintable.Q
	}
	msg.hEncoder = e.NewHeaderEncoder(msg.charset)

	return msg
}
368735
func NewMessageSentSizeStatsHandler(sub Subsystem, vec *prometheus.HistogramVec) *MessageSentSizeStatsHandler {
	return &MessageSentSizeStatsHandler{
		baseStatsHandler: baseStatsHandler{
			subsystem: sub,
			collector: vec,
		},
		vec: vec,
	}
}
152169
func toMessage(messages []*ReceivedMessage) []*Message {
	msgs := make([]*Message, len(messages))
	for i, msg := range messages {
		msgs[i] = ToWhisperMessage(msg)
	}
	return msgs
}
685301
func NewMessage() *Message {
	return &Message{
		payload: lane.NewStack(),
		Reports: lane.NewStack(),
		Opts:    cmap.New(),
	}
}
376371
func NewReceiptFromJSON(data string) (*Receipt, error) {
	r := &Receipt{
		receipt: new(types.Receipt),
	}
	if err := json.Unmarshal([]byte(data), r.receipt); err != nil {
		return nil, err
	}
	return r, nil
}
1067739
func (this *FcmClient) NewFcmTopicMsg(to string, body map[string]string) *FcmClient {

	this.NewFcmMsgTo(to, body)

	return this
}
225227
func NewMessage(command, family, flags int) (*Message, error) {
	nlm := C.nlmsg_alloc()
	if nlm == nil {
		return nil, errors.New("failed to create netlink message")
	}
	C.genlmsg_put(nlm, C.NL_AUTO_PID, C.NL_AUTO_SEQ, C.int(family), 0, C.int(flags), C.uint8_t(command), genlVersion)
	return &Message{nlm: nlm}, nil
}
260680
func NewMessageWithTitle(message, title string) *Message {
	return &Message{Message: message, Title: title}
}
246854
func NewRunMessage(statement string, parameters map[string]interface{}) RunMessage {
	return RunMessage{
		statement:  statement,
		parameters: parameters,
	}
}