// Sender returns the sender *User
182404
func (comment *UserPostComment) Sender() *User {
	user, _ := NewUser(comment.NumericSender())
	return user
}
362834
func CloseSender(s Sender) error {
	if c, ok := s.(io.Closer); ok {
		return c.Close()
	}
	return nil
}
1011455
func SendEmail(config cfg.Config, subject, body string, tos []string) error {
	email := Compose(subject, body)
	email.From = config.GetString("smtp_user")
	email.ContentType = "text/html; charset=utf-8"
	email.AddRecipients(tos...)
	err := email.Send(config)
	return err
}
851058
func NewHandler() *sender {
	return &sender{
		Handler:    prometheus.Handler(),
		counters:   make(map[string]*prometheus.CounterVec),
		gauges:     make(map[string]*prometheus.GaugeVec),
		histograms: make(map[string]*prometheus.HistogramVec),
	}
}
809300
func NewSender(o SenderOptions) (s *Sender) {
	s = &Sender{
		client:     o.Client,
		retryFunc:  o.RetryFunc,
		retryMax:   o.RetryMax,
		retrySleep: o.RetrySleep,
	}
	if s.client == nil {
		s.client = &http.Client{}
	}
	if s.retryFunc == nil {
		s.retryFunc = defaultRetryFunc
	}
	return
}
913937
func (c *ContextAction) TriggerUser(user *User) {
	packet := MumbleProto.ContextAction{
		Session: &user.Session,
		Action:  &c.Name,
	}
	c.client.Conn.WriteProto(&packet)
}
40286
func (post *ProjectPost) Sender() *User {
	user, _ := NewUser(post.NumericSender())
	return user
}
447051
func (c oauthClient) User() (wl.User, error) {
	url := fmt.Sprintf(
		"%s/user",
		c.apiURL,
	)

	req, err := c.newGetRequest(url)
	if err != nil {
		return wl.User{}, err
	}

	resp, err := c.do(req)
	if err != nil {
		return wl.User{}, err
	}

	if resp.StatusCode != http.StatusOK {
		return wl.User{}, fmt.Errorf("Unexpected response code %d - expected %d", resp.StatusCode, http.StatusOK)
	}

	if resp.Body == nil {
		return wl.User{}, errors.New("Nil body returned")
	}

	user := wl.User{}
	err = json.NewDecoder(resp.Body).Decode(&user)
	if err != nil {
		return wl.User{}, err
	}

	return user, nil
}
554844
func NewMailer(host string, username string, password string, port int, settings ...MailerSetting) *Mailer {
	return NewCustomMailer(
		fmt.Sprintf("%s:%d", host, port),
		smtp.PlainAuth("", username, password, host),
		settings...,
	)
}
322425
func (c *RemindersAddCall) User(user string) *RemindersAddCall {
	c.user = user
	return c
}
4775
func (c *UsersProfileSetCall) User(user string) *UsersProfileSetCall {
	c.user = user
	return c
}
533190
func (e *Elector) sendErr(err error) {
	e.sendEvent(Event{Err: err})
}
1301419
func (b *bitbucketConnector) user(ctx context.Context, client *http.Client) (user, error) {
	// https://developer.atlassian.com/bitbucket/api/2/reference/resource/user
	var (
		u   user
		err error
	)

	if err = get(ctx, client, b.apiURL+"/user", &u); err != nil {
		return user{}, err
	}

	if u.Email, err = b.userEmail(ctx, client); err != nil {
		return user{}, err
	}

	return u, nil
}
1205807
func User(ctx context.Context) string {
	userIdentity, _ := ctx.Value(UserIdentityKey).(string)
	return userIdentity
}
970416
func (lurk *ProjectPostLurk) Sender() (user *User) {
	user, _ = NewUser(lurk.From)
	return
}
973340
func (lock *UserPostUserLock) Sender() (user *User) {
	user, _ = NewUser(lock.From)
	return
}
476498
func (e *TermsRequiredError) UserErr() error {
	terms := strings.Join(e.Terms, " ")
	return errors.Wrap(e,
		errors.Errorf(`Declined: some terms require agreement. Try: "juju agree %s"`, terms))
}