Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #21 from Meshiest/patch-1
Browse files Browse the repository at this point in the history
Fix templates for filenames with spaces
  • Loading branch information
tritium21 committed Apr 27, 2018
2 parents 38e06ff + dd6a86b commit f53ead8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/dcc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ const netUtil = require("./net-util");
const Chat = require("./chat").Chat;
const parse = require("./parser").parse;

const send_template = "DCC SEND {filename} {addr} {port} {length}";
const send_template = "DCC SEND \"{filename}\" {addr} {port} {length}";
const chat_template = "DCC CHAT chat {addr} {port}";
const accept_template = "DCC ACCEPT {filename} {port} {position}";
const resume_template = "DCC RESUME {filename} {port} {position}";
const accept_template = "DCC ACCEPT \"{filename}\" {port} {position}";
const resume_template = "DCC RESUME \"{filename}\" {port} {position}";


const DCC = module.exports = function (client, options) {
Expand Down Expand Up @@ -187,4 +187,4 @@ const parseDCC = module.exports.parseDCC = function (line) {
} catch (e) {
return null;
}
};
};
8 changes: 4 additions & 4 deletions test/dcc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ describe("DCC", () => {
});
it("should call irc.Client.ctcp (with position)", () => {
var fakeCB = () => { };
var expected = ["nick", "privmsg", "DCC RESUME filename 2000 1234"];
var expected = ["nick", "privmsg", "DCC RESUME \"filename\" 2000 1234"];
var dcc = new DCC(fakeClient, { localAddress: "0.0.0.0" });
dcc.acceptFile("nick", "192.168.1.100", 2000, "filename", 1234567, 1234, fakeCB);
assert.deepEqual(fakeClient.ctcp.lastCall.args, expected);
Expand Down Expand Up @@ -528,7 +528,7 @@ describe("DCC", () => {
});
assert.deepEqual(
fakeClient.ctcp.lastCall.args,
["to", "privmsg", "DCC SEND filename 3232235876 2000 0"]
["to", "privmsg", "DCC SEND \"filename\" 3232235876 2000 0"]
);
});
it("should resume", (done) => {
Expand All @@ -555,7 +555,7 @@ describe("DCC", () => {
});
assert.deepEqual(
fakeClient.ctcp.lastCall.args,
["to", "privmsg", "DCC ACCEPT filename 2000 50"]
["to", "privmsg", "DCC ACCEPT \"filename\" 2000 50"]
);
});
it("should callback with pos == 50", (done) => {
Expand Down Expand Up @@ -713,4 +713,4 @@ describe("DCC", () => {
});
});
});
});
});

0 comments on commit f53ead8

Please sign in to comment.