// AddRecipient appends a receiver to the To: header of a message.
// It will return an error if the limit of recipients have been exceeded for this message
553853
func (m *Message) AddRecipient(recipient string) error {
	return m.AddRecipientAndVariables(recipient, nil)
}
1369993
func (m *Message) AddRecipientAndVariables(r string, vars map[string]interface{}) error {
	if m.RecipientCount() >= MaxNumberOfRecipients {
		return fmt.Errorf("recipient limit exceeded (max %d)", MaxNumberOfRecipients)
	}
	m.to = append(m.to, r)
	if vars != nil {
		if m.recipientVariables == nil {
			m.recipientVariables = make(map[string]map[string]interface{})
		}
		m.recipientVariables[r] = vars
	}
	return nil
}
1073226
func HasRecipientFunc(ctx context.Context) bool {
	imf, ok := ctx.Value(ctxKeyRecipientFunc).(store.RecipientCallback)
	return ok && imf != nil
}
63432
func (mp *MockPeerCCSupport) AddCC(name string, recv chan *pb.ChaincodeMessage, send chan *pb.ChaincodeMessage) (*MockCCComm, error) {
	if mp.ccStream[name] != nil {
		return nil, fmt.Errorf("CC %s already added", name)
	}
	mcc := &MockCCComm{name: name, recvStream: recv, sendStream: send}
	mp.ccStream[name] = mcc
	return mcc, nil
}
191401
func (bow *Browser) AddRequestHeader(name, value string) {
	bow.headers.Set(name, value)
}
373408
func (c *ContivClient) addCustomRequestHeader(name, value string) {

	// lowercase the header name so we can easily check for duplicates in other places.
	// there can legitimately be many headers with the same name, but in some cases
	// (e.g., auth token) we want to enforce that there is only one.
	// Go internally canonicalizes them when we call Header.Add() anyways.
	name = strings.ToLower(name)

	c.customRequestHeaders = append(c.customRequestHeaders, [2]string{name, value})
}
360641
func (msm *MultistreamMuxer) AddHandler(protocol string, handler HandlerFunc) {
	msm.AddHandlerWithFunc(protocol, fulltextMatch(protocol), handler)
}
260939
func (n *Net) AddCIDR(s string, value interface{}) (err error) {
	var r *net.IPNet
	if _, r, err = net.ParseCIDR(s); err == nil {
		n.Add(r, value)
	}
	return
}
646100
func (es *EventStream) AddReceiver(w http.ResponseWriter) (*EventReceiver, error) {
	w.Header().Set("Content-Type", "text/event-stream")
	w.Header().Set("Cache-Control", "no-cache")
	w.Header().Set("Connection", "keep-alive")

	w.WriteHeader(200)

	hj, ok := w.(http.Hijacker)
	if !ok {
		return nil, ErrUnableToHijackRequest
	}

	hjConn, hjBufrw, err := hj.Hijack()
	if err != nil {
		return nil, err
	}

	rec := &EventReceiver{es, hjConn, hjBufrw}

	es.mutex.Lock()
	es.receivers[hjConn] = rec
	es.mutex.Unlock()

	return rec, nil
}
144668
func (m *Message) AddCC(emailAddr string) {
	m.cc = append(m.cc, emailAddr)
}
428624
func (o *SMTPOptions) AddRecipients(addresses ...string) error {
	if len(addresses) == 0 {
		return errors.New("AddRecipients requires one or more strings that contain comma " +
			"separated email addresses")
	}

	o.mutex.Lock()
	defer o.mutex.Unlock()

	addrs, err := mail.ParseAddressList(strings.Join(addresses, ","))
	if err != nil {
		return err
	}

	o.toAddrs = append(o.toAddrs, addrs...)

	return nil
}
509701
func (si *SolrInterface) Add(docs []Document, chunk_size int, params *url.Values) (*SolrUpdateResponse, error) {
	result := &SolrUpdateResponse{Success: true}
	responses := M{}
	chunks := makeAddChunks(docs, chunk_size)

	for i := 0; i < len(chunks); i++ {
		res, err := si.Update(chunks[i], params)
		if err != nil {
			return nil, err
		}
		result.Success = result.Success && res.Success
		responses[fmt.Sprintf("chunk_%d", i+1)] = M{
			"result":  res.Result,
			"success": res.Success,
			"total":   len(chunks[i]["add"].([]Document))}
	}
	result.Result = responses
	return result, nil
}
115669
func (c Client) AddTransmission(t contract.Transmission) (string, error) {
	conn := c.Pool.Get()
	defer conn.Close()

	err := addTransmission(conn, &t)
	if err != nil {
		return "", err
	}

	return t.ID, nil
}
1340049
func (s *BouncedRecipientInfo) SetRecipient(v string) *BouncedRecipientInfo {
	s.Recipient = &v
	return s
}
302539
func (m *Message) AddTo(emailAddr string) {
	m.to = append(m.to, emailAddr)
}
455712
func (h *Header) Add(k, v string) {
	k = textproto.CanonicalMIMEHeaderKey(k)

	if h.m == nil {
		h.m = make(map[string][]*headerField)
	}

	h.l = append(h.l, newHeaderField(k, v, nil))
	f := &h.l[len(h.l)-1]
	h.m[k] = append(h.m[k], f)
}
20111
func (s *server) AddBytesReceived(bytesReceived uint64) {
	atomic.AddUint64(&s.bytesReceived, bytesReceived)
}