diff options
| author | anekos | 2011-03-26 01:59:09 +0900 | 
|---|---|---|
| committer | anekos | 2011-03-26 01:59:09 +0900 | 
| commit | 708a41faeb71f84ab955fe8088b0a75635b10d5b (patch) | |
| tree | aef68b43f6283298231d28d4f806428b55a97dad /twittperator | |
| parent | c6671a377211b5c60468181391b609a1ce7e11e1 (diff) | |
| download | vimperator-plugins-708a41faeb71f84ab955fe8088b0a75635b10d5b.tar.bz2 | |
改行等を適当に処理
Diffstat (limited to 'twittperator')
| -rw-r--r-- | twittperator/sstp.tw | 19 | 
1 files changed, 11 insertions, 8 deletions
diff --git a/twittperator/sstp.tw b/twittperator/sstp.tw index f89ae1b..b39eaac 100644 --- a/twittperator/sstp.tw +++ b/twittperator/sstp.tw @@ -59,15 +59,18 @@ let INFO =      let outputStream = transport.openOutputStream(0, 0, 0);      let conv = Cc['@mozilla.org/intl/converter-output-stream;1'].                              createInstance(Ci.nsIConverterOutputStream); + +    msg = msg.replace(/\\/g, "\\\\").msg.replace(/[\r\n]+/g, "\\n"); +      let buf = [ -      "SEND SSTP/1.1\r\n", -      "Sender: Twittperator\r\n", -      "Charset: UTF-8\r\n", -      "Script: \\h\\s0" + msg + "\\e\r\n", -      "Options: nodescript,notranslate\r\n", -      "Charset: UTF-8\r\n", -      "\r\n", -    ].join(''); +      "SEND SSTP/1.1", +      "Sender: Twittperator", +      "Charset: UTF-8", +      "Script: \\h\\s0" + msg + "\\e", +      "Options: nodescript,notranslate", +      "Charset: UTF-8", +      "", +    ].map(function (it) (it + "\r\n")).join('');      conv.init(outputStream, 'UTF-8', buf.length, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);      conv.writeString(buf);  | 
