Browse Source

Fix: Add server prefix to indicate server notices

feature/index.js
Sheogorath 5 years ago
parent
commit
7cff627c6e
No known key found for this signature in database GPG Key ID: 1F05CC3635CDDFFD
  1. 2
      src/server.js
  2. 2
      test/command_user.js
  3. 2
      test/hexchat.js

2
src/server.js

@ -64,7 +64,7 @@ server.create = function create() {
// ignoring servername and hostname, not useful these days // ignoring servername and hostname, not useful these days
user.register(tokenized[1], tokenized[4]) user.register(tokenized[1], tokenized[4])
let address = user.getAddress() let address = user.getAddress()
socket.write(`001 ${user.nickname} :Welcome to the example IRC Project ${user.nickname}!~${user.username}@${address}\r\n`, "ascii")
socket.write(`:irc.example.com 001 ${user.nickname} :Welcome to the example IRC Project ${user.nickname}!~${user.username}@${address}\r\n`, "ascii")
break; break;
case "PRIVMSG": case "PRIVMSG":
let target = userlist[tokenized[1]] let target = userlist[tokenized[1]]

2
test/command_user.js

@ -10,7 +10,7 @@ describe("USER OK", function () {
return { port: 12346, family: 'IPv4', address: '127.0.0.1' } return { port: 12346, family: 'IPv4', address: '127.0.0.1' }
} }
mockedSock.write = function (data) { mockedSock.write = function (data) {
assert.equal(data.toString("ascii"), "001 some_nick :Welcome to the example IRC Project some_nick!~guest@127.0.0.1\r\n")
assert.equal(data.toString("ascii"), ":irc.example.com 001 some_nick :Welcome to the example IRC Project some_nick!~guest@127.0.0.1\r\n")
done() done()
} }
mockedSock.destroy = function () { mockedSock.destroy = function () {

2
test/hexchat.js

@ -10,7 +10,7 @@ describe("hexchat", function () {
return { port: 12346, family: 'IPv4', address: '127.0.0.1' } return { port: 12346, family: 'IPv4', address: '127.0.0.1' }
} }
mockedSock.write = function (data) { mockedSock.write = function (data) {
assert.equal(data.toString("ascii"), "001 some_nick :Welcome to the example IRC Project some_nick!~guest@127.0.0.1\r\n")
assert.equal(data.toString("ascii"), ":irc.example.com 001 some_nick :Welcome to the example IRC Project some_nick!~guest@127.0.0.1\r\n")
done() done()
} }
mockedSock.destroy = function () { mockedSock.destroy = function () {

Loading…
Cancel
Save