summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/apns.go2
-rw-r--r--utils/config.go2
-rw-r--r--utils/mail.go14
3 files changed, 14 insertions, 4 deletions
diff --git a/utils/apns.go b/utils/apns.go
index 3d07f17ec..06e8ce6ef 100644
--- a/utils/apns.go
+++ b/utils/apns.go
@@ -10,7 +10,7 @@ import (
"github.com/mattermost/platform/model"
)
-func FireAndForgetSendAppleNotify(deviceId string, message string, badge int) {
+func SendAppleNotifyAndForget(deviceId string, message string, badge int) {
go func() {
if err := SendAppleNotify(deviceId, message, badge); err != nil {
l4g.Error(fmt.Sprintf("%v %v", err.Message, err.DetailedError))
diff --git a/utils/config.go b/utils/config.go
index 2c6f30bf0..15d6b217c 100644
--- a/utils/config.go
+++ b/utils/config.go
@@ -182,12 +182,14 @@ func getClientProperties(c *model.Config) map[string]string {
props["SiteName"] = c.TeamSettings.SiteName
props["EnableTeamCreation"] = strconv.FormatBool(c.TeamSettings.EnableTeamCreation)
+ props["RestrictTeamNames"] = strconv.FormatBool(*c.TeamSettings.RestrictTeamNames)
props["EnableOAuthServiceProvider"] = strconv.FormatBool(c.ServiceSettings.EnableOAuthServiceProvider)
props["SegmentDeveloperKey"] = c.ServiceSettings.SegmentDeveloperKey
props["GoogleDeveloperKey"] = c.ServiceSettings.GoogleDeveloperKey
props["EnableIncomingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableIncomingWebhooks)
+ props["EnableOutgoingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableOutgoingWebhooks)
props["EnablePostUsernameOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostUsernameOverride)
props["EnablePostIconOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostIconOverride)
diff --git a/utils/mail.go b/utils/mail.go
index c91c15a6a..07a79eeb2 100644
--- a/utils/mail.go
+++ b/utils/mail.go
@@ -6,15 +6,22 @@ package utils
import (
l4g "code.google.com/p/log4go"
"crypto/tls"
+ "encoding/base64"
"fmt"
"github.com/mattermost/platform/model"
- "html"
"net"
"net/mail"
"net/smtp"
"time"
)
+func encodeRFC2047Word(s string) string {
+ // TODO: use `mime.BEncoding.Encode` instead when `go` >= 1.5
+ // return mime.BEncoding.Encode("utf-8", s)
+ dst := base64.StdEncoding.EncodeToString([]byte(s))
+ return "=?utf-8?b?" + dst + "?="
+}
+
func connectToSMTPServer(config *model.Config) (net.Conn, *model.AppError) {
var conn net.Conn
var err error
@@ -102,9 +109,10 @@ func SendMailUsingConfig(to, subject, body string, config *model.Config) *model.
headers := make(map[string]string)
headers["From"] = fromMail.String()
headers["To"] = toMail.String()
- headers["Subject"] = html.UnescapeString(subject)
+ headers["Subject"] = encodeRFC2047Word(subject)
headers["MIME-version"] = "1.0"
- headers["Content-Type"] = "text/html"
+ headers["Content-Type"] = "text/html; charset=\"utf-8\""
+ headers["Content-Transfer-Encoding"] = "8bit"
headers["Date"] = time.Now().Format(time.RFC1123Z)
message := ""