\r
\r
this.parseKiwi = function (command, data) {\r
+ var client_info_data;\r
+\r
this.trigger('kiwi:' + command, data);\r
this.trigger('kiwi', data);\r
\r
switch (command) {\r
case 'connected':\r
+ // Send some info on this client to the server\r
+ client_info_data = {\r
+ command: 'client_info',\r
+ build_version: _kiwi.global.build_version\r
+ };\r
+ this.rpc.call('kiwi', client_info_data);\r
+\r
this.connect_callback && this.connect_callback();\r
delete this.connect_callback;\r
+\r
break;\r
}\r
};\r
} else {
return callback('Hostname, port and nickname must be specified');
}
- break;
+
+ break;
+
+ case 'client_info':
+ // keep hold of selected parts of the client_info
+ this.client_info = {
+ build_version: command.build_version.toString() || undefined
+ };
+
+ break;
+
default:
callback();
}
},
'PRIVMSG': function (command) {
- var tmp, namespace, time, msg;
+ var tmp, namespace, time, msg, version_string, client_info;
// Check if we have a server-time
time = getServerTime.call(this, command);
time: time
});
} else if (msg.substr(1, 7) === 'VERSION') {
- this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'VERSION KiwiIRC' + String.fromCharCode(1));
+ client_info = this.irc_connection.state.client.client_info;
+ version_string = global.build_version;
+
+ // If the client build_version differs from the server, add this to the version_string
+ if (client_info && client_info.build_version !== global.build_version) {
+ version_string += ', client build: ' + client_info.build_version;
+ }
+
+ version_string = 'KiwiIRC (' + version_string + ')';
+
+ this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'VERSION ' + version_string + String.fromCharCode(1));
} else if (msg.substr(1, 6) === 'SOURCE') {
this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'SOURCE http://www.kiwiirc.com/' + String.fromCharCode(1));
} else if (msg.substr(1, 10) === 'CLIENTINFO') {
process.chdir(__dirname + '/../');
+// Get our own version from package.json
+global.build_version = require('../package.json').version;
+
+// Load the config, using -c argument if available
(function (argv) {
var conf_switch = argv.indexOf('-c');
if (conf_switch !== -1) {