/*
ForwardMessage forwards message from one chat to another. Available options:
	- OptDisableNotification
*/
488313
func (c *Client) ForwardMessage(chatID, fromChatID string, messageID int, opts ...sendOption) (*Message, error) {
	req := url.Values{}
	req.Set("chat_id", chatID)
	req.Set("from_chat_id", fromChatID)
	req.Set("message_id", strconv.Itoa(messageID))
	for _, opt := range opts {
		opt(req)
	}
	msg := &Message{}
	err := c.doRequest("forwardMessage", req, msg)
	return msg, err
}
787162
func (s *IdentityNotificationAttributes) SetForwardingEnabled(v bool) *IdentityNotificationAttributes {
	s.ForwardingEnabled = &v
	return s
}
104858
func (s *Server) SendMessage(channel string, message *Message) {
	if len(channel) == 0 {
		s.options.Logger.Print("broadcasting message to all channels.")

		for _, ch := range s.channels {
			ch.SendMessage(message)
		}
	} else if _, ok := s.channels[channel]; ok {
		s.options.Logger.Printf("message sent to channel '%s'.", channel)
		s.channels[channel].SendMessage(message)
	} else {
		s.options.Logger.Printf("message not sent because channel '%s' has no clients.", channel)
	}
}
100979
func (d *Daemon) SendNotification(typ monitorAPI.AgentNotification, text string) error {
	if option.Config.DryMode {
		return nil
	}
	event := monitorAPI.AgentNotify{Type: typ, Text: text}
	return d.nodeMonitor.SendEvent(monitorAPI.MessageTypeAgent, event)
}
451624
func (p *Player) SendMessage(message string) {
	pkt := &packet.ChatMessage{message}
	pkt.WriteTo(p.Conn)
}
1364823
func (m *message) getForwardTo() *messageMember {
	if len(m.members) > 0 && m.members[0].status == StatusForwardTo {
		return m.members[0]
	}

	return nil
}
500078
func (a *SetPausedInDebuggerMessageArgs) SetMessage(message string) *SetPausedInDebuggerMessageArgs {
	a.Message = &message
	return a
}
725998
func (s *PutEmailIdentityFeedbackAttributesInput) SetEmailForwardingEnabled(v bool) *PutEmailIdentityFeedbackAttributesInput {
	s.EmailForwardingEnabled = &v
	return s
}
797372
func (m *MMClient) SendDirectMessage(toUserId string, msg string, rootId string) { //nolint:golint
	m.SendDirectMessageProps(toUserId, msg, rootId, nil)
}
6361
func (r *RelayMessageOption) RelayMessage() (*RelayMessage, error) {
	rm := new(RelayMessage)
	err := rm.UnmarshalBinary(*r)
	if err != nil {
		return nil, err
	}

	return rm, nil
}
369305
func messageForError(err error) string {
	msg, ok := StandardErrorMessage(err)
	if !ok {
		msg = err.Error()
	}
	return msg
}
1322381
func (s *Server) sendMessage(peer Peer, msg wtwire.Message) error {
	// TODO(conner): use buffer pool?

	var b bytes.Buffer
	_, err := wtwire.WriteMessage(&b, msg, 0)
	if err != nil {
		err = fmt.Errorf("unable to encode msg: %v", err)
		return err
	}

	err = peer.SetWriteDeadline(time.Now().Add(s.cfg.WriteTimeout))
	if err != nil {
		err = fmt.Errorf("unable to set write deadline: %v", err)
		return err
	}

	logMessage(peer, msg, false)

	_, err = peer.Write(b.Bytes())
	return err
}
314206
func (c *Connection) putInMessage(x *buffer.InMessage) {
	c.mu.Lock()
	c.inMessages.Put(unsafe.Pointer(x))
	c.mu.Unlock()
}
1244173
func (c *connToLeader) forwardCommand(cb *commandCallback, cmdName string, args [][]byte) error {
	c.l.Lock()
	defer c.l.Unlock()
	// marshal log object
	lg := logForCommand(cb.originAddr, cb.reqNo, cmdName, args)
	// put response chan in pending
	// send
	err := c.e.Encode(lg)
	if err != nil {
		cb.cancel()
		cb.result <- Result{nil, err}
		return err
	} else {
		// so our responseReader will forward appropriately
		c.pending <- cb
	}
	return nil
}
1209870
func (r *remoteServer) nextMessage() *params.PubSubMessage {
	r.mutex.Lock()
	defer r.mutex.Unlock()
	val, ok := r.pending.PopFront()
	if !ok {
		// nothing to do
		return nil
	}
	// Even though it isn't exactly sent right now, it effectively will
	// be very soon, and we want to keep this counter in the mutex lock.
	r.sent++
	return val.(*params.PubSubMessage)
}
1344054
func (p Proxy) Forward(state request.Request) (*dns.Msg, error) {
	return p.lookup(state)
}
864960
func ForwardAllSignals(ctx gocontext.Context, task killer) chan os.Signal {
	sigc := make(chan os.Signal, 128)
	signal.Notify(sigc)
	go func() {
		for s := range sigc {
			logrus.Debug("forwarding signal ", s)
			if err := task.Kill(ctx, s.(syscall.Signal)); err != nil {
				logrus.WithError(err).Errorf("forward signal %s", s)
			}
		}
	}()
	return sigc
}