openBuffer: send /join and /query with -noswitch parameter

this functionality is currently broken (#618) but this is a good idea nonetheless
This commit is contained in:
Lorenz Hübschle-Schneider 2015-06-06 16:55:49 +02:00 committed by Tor Hveem
parent 8c965e0b90
commit 2626b5e936

View file

@ -459,9 +459,17 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
fullName = fullName.substring(0, fullName.lastIndexOf('.') + 1) + bufferName; // substitute the last part
if (!$scope.setActiveBuffer(fullName, 'fullName')) {
var command = 'join';
// WeeChat 0.4.0+ supports /join -noswitch
// As Glowing Bear requires 0.4.2+, we don't need to check the version
var command = 'join -noswitch';
// Check if it's a query and we need to use /query instead
if (['#', '&', '+', '!'].indexOf(bufferName.charAt(0)) < 0) { // these are the characters a channel name can start with (RFC 2813-2813)
command = 'query';
// WeeChat 1.2+ supports /query -noswitch. See also #577 (different context)
if ((models.version[0] == 1 && models.version[1] >= 2) || models.version[1] > 1) {
command += " -noswitch";
}
}
connection.sendMessage('/' + command + ' ' + bufferName);
}