Exemple #1
0
// SendGroupAttachment sends an attachment to a given group.
func SendGroupAttachment(hexid string, msg string, r io.Reader) (uint64, error) {
	ct, r := magic.MIMETypeFromReader(r)
	a, err := uploadAttachment(r, ct)
	if err != nil {
		return 0, err
	}
	return sendGroupHelper(hexid, msg, a)
}
// SendAttachment sends the contents of a reader, along
// with an optional message to a given contact.
func SendAttachment(tel, msg string, r io.Reader) (uint64, error) {
	ct, r := magic.MIMETypeFromReader(r)
	a, err := uploadAttachment(r, ct)
	if err != nil {
		return 0, err
	}
	omsg := &outgoingMessage{
		tel:        tel,
		msg:        msg,
		attachment: a,
	}
	return sendMessage(omsg)
}