From e81ad6e69c8dc6c33a6e5e7812f3fc47a3d09fec Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Fri, 6 May 2016 20:51:38 +0300 Subject: [PATCH] Update irc-framework --- defaults/config.js | 2 +- package.json | 3 ++- src/client.js | 3 +++ src/plugins/inputs/action.js | 2 +- src/plugins/irc-events/ctcp.js | 4 ---- src/plugins/irc-events/error.js | 9 +-------- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/defaults/config.js b/defaults/config.js index 5757a7a7c8..46287a07f9 100644 --- a/defaults/config.js +++ b/defaults/config.js @@ -118,7 +118,7 @@ module.exports = { // Format (function): // {"irc.example.net": function(client, args, trusted) { // // here, we return a webirc object fed directly to `irc-framework` - // return {password: "hunter1", address: args.ip, hostname: "webirc/"+args.hostname}; + // return {username: "thelounge", password: "hunter1", address: args.ip, hostname: "webirc/"+args.hostname}; // }} // // @type string | function(client, args):object(webirc) diff --git a/package.json b/package.json index dface793ee..7a6009f58b 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "type": "git", "url": "https://github.com/thelounge/lounge.git" }, + "homepage": "https://thelounge.github.io/", "scripts": { "start": "node index", "build": "npm run build:grunt && npm run build:handlebars", @@ -41,7 +42,7 @@ "commander": "2.9.0", "event-stream": "3.3.2", "express": "4.13.4", - "irc-framework": "1.0.10", + "irc-framework": "2.0.0", "lodash": "4.11.2", "mkdirp": "0.5.1", "moment": "2.13.0", diff --git a/src/client.js b/src/client.js index 90513ea68d..05fc691640 100644 --- a/src/client.js +++ b/src/client.js @@ -1,4 +1,5 @@ var _ = require("lodash"); +var package = require("../package.json"); var Chan = require("./models/chan"); var crypto = require("crypto"); var userLog = require("./userLog"); @@ -182,6 +183,7 @@ Client.prototype.connect = function(args) { } else { webirc = { password: config.webirc[network.host], + username: package.name, address: args.ip, hostname: args.hostname }; @@ -198,6 +200,7 @@ Client.prototype.connect = function(args) { "znc.in/self-message", ]); network.irc.connect({ + version: package.name + " " + package.version + " -- " + package.homepage, host: network.host, port: network.port, nick: nick, diff --git a/src/plugins/inputs/action.js b/src/plugins/inputs/action.js index 986493f67f..4f8a400092 100644 --- a/src/plugins/inputs/action.js +++ b/src/plugins/inputs/action.js @@ -15,7 +15,7 @@ exports.input = function(network, chan, cmd, args) { text = text || args.join(" "); - irc.say(chan.name, "\u0001ACTION " + text + "\u0001"); + irc.action(chan.name, text); if (!network.irc.network.cap.isEnabled("echo-message")) { irc.emit("action", { diff --git a/src/plugins/irc-events/ctcp.js b/src/plugins/irc-events/ctcp.js index 44a43d052f..f853d60b29 100644 --- a/src/plugins/irc-events/ctcp.js +++ b/src/plugins/irc-events/ctcp.js @@ -1,4 +1,3 @@ -var pkg = require(process.cwd() + "/package.json"); var Msg = require("../../models/msg"); module.exports = function(irc, network) { @@ -22,9 +21,6 @@ module.exports = function(irc, network) { irc.on("ctcp request", function(data) { switch (data.type) { - case "VERSION": - irc.ctcpResponse(data.nick, "VERSION", pkg.name + " " + pkg.version); - break; case "PING": var split = data.message.split(" "); if (split.length === 2) { diff --git a/src/plugins/irc-events/error.js b/src/plugins/irc-events/error.js index 001acd2229..b77097387e 100644 --- a/src/plugins/irc-events/error.js +++ b/src/plugins/irc-events/error.js @@ -3,14 +3,7 @@ var Msg = require("../../models/msg"); module.exports = function(irc, network) { var client = this; - // TODO: remove later - irc.on("irc_error", function(data) { - log.debug("Got an irc_error"); - irc.emit("error", data); - }); - - irc.on("error", function(data) { - log.debug("error", data); + irc.on("irc error", function(data) { var text = data.error; if (data.reason) { text = data.reason + " (" + text + ")";