mailcomposer
Advanced tools
Comparing version 0.1.17 to 0.1.18
@@ -116,3 +116,3 @@ var Stream = require("stream").Stream, | ||
if(value && Object.prototype.toString.call(value) == "[object Object]"){ | ||
value = this._encodeMimeWord(JSON.stringify(value), "Q", 50); | ||
value = this._encodeMimeWord(JSON.stringify(value), "Q", 52); | ||
}else{ | ||
@@ -365,3 +365,3 @@ value = (value || "").toString().trim(); | ||
value = (value || "").toString().replace(/\r?\n|\r/g, " "); | ||
return this._encodeMimeWord(value, "Q", 50); | ||
return this._encodeMimeWord(value, "Q", 52); | ||
@@ -430,3 +430,3 @@ case "envelope": | ||
if(this._hasUTFChars(address.name)){ | ||
address.name = this._encodeMimeWord(address.name, "Q", 50); | ||
address.name = this._encodeMimeWord(address.name, "Q", 52); | ||
}else{ | ||
@@ -1187,23 +1187,3 @@ address.name = address.name; | ||
MailComposer.prototype._encodeMimeWord = function(str, encoding, maxlen){ | ||
// adjust maxlen by =?UTF-8?Q??= | ||
if(maxlen && maxlen>12){ | ||
maxlen -= 12; | ||
} | ||
encoding = (encoding || "Q").toUpperCase(); | ||
if(this._hasUTFChars(str)){ | ||
str = mimelib.encodeMimeWord(str, encoding); | ||
if(maxlen && str.length>maxlen){ | ||
if(encoding=="Q"){ | ||
return "=?UTF-8?Q?"+this._splitEncodedString(str.split("?")[3], maxlen).join("?= =?UTF-8?Q?")+"?="; | ||
}else{ | ||
return "=?UTF-8?"+encoding+"?"+str.split("?")[3].replace(new RegExp(".{"+maxlen+"}","g"),"$&?= =?UTF-8?"+encoding+"?")+"?="; | ||
} | ||
}else{ | ||
return str; | ||
} | ||
}else{ | ||
return str; | ||
} | ||
return mimelib.encodeMimeWords(str, encoding, maxlen); | ||
}; | ||
@@ -1210,0 +1190,0 @@ |
{ | ||
"name": "mailcomposer", | ||
"description": "Compose E-Mail messages", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"author" : "Andris Reinman", | ||
@@ -6,0 +6,0 @@ "maintainers":[ |
@@ -147,2 +147,10 @@ var testCase = require('nodeunit').testCase, | ||
test.done(); | ||
}, | ||
"zero length cc": function(test){ | ||
var mc = new MailComposer({keepBcc: true}); | ||
mc.setMessageOption({cc: ""}); | ||
mc._buildMessageHeaders(); | ||
test.equal(mc._getHeader("cc"), ""); | ||
test.done(); | ||
} | ||
@@ -170,3 +178,3 @@ }; | ||
//multiliple | ||
test.equal(mc._encodeMimeWord("äss tekst on see siin või kuidas?","Q", 20), "=?UTF-8?Q?=C3=A4ss?= =?UTF-8?Q?_tekst_o?= =?UTF-8?Q?n_see_si?= =?UTF-8?Q?in_v?= =?UTF-8?Q?=C3=B5i_?= =?UTF-8?Q?kuidas?= =?UTF-8?Q?=3F?="); | ||
test.equal(mc._encodeMimeWord("äss tekst on see siin või kuidas?","Q", 20), "=?UTF-8?Q?=C3=A4ss?= tekst on see siin =?UTF-8?Q?v=C3=B5i?= kuidas?"); | ||
@@ -182,3 +190,3 @@ test.done(); | ||
test.equal(mc._message.from, "\"=?UTF-8?Q?Jaanuar_Veebruar,_M=C3=A4rts?=\" <=?UTF-8?Q?m=C3=A4rts?=@xn--mrts-loa.eu>"); | ||
test.equal(mc._message.from, "\"Jaanuar Veebruar, =?UTF-8?Q?M=C3=A4rts?=\" <=?UTF-8?Q?m=C3=A4rts?=@xn--mrts-loa.eu>"); | ||
@@ -185,0 +193,0 @@ mc.setMessageOption({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171356
2505