Merge pull request #620 from glowing-bear/noswitch
Use -noswitch option to open buffers
This commit is contained in:
commit
cf771eb73f
5 changed files with 15 additions and 6 deletions
|
@ -267,7 +267,7 @@ weechat.factory('connection',
|
||||||
};
|
};
|
||||||
|
|
||||||
var sendHotlistClear = function() {
|
var sendHotlistClear = function() {
|
||||||
if (parseInt(models.version.charAt(0)) >= 1) {
|
if (models.version[0] >= 1) {
|
||||||
// WeeChat >= 1 supports clearing hotlist with this command
|
// WeeChat >= 1 supports clearing hotlist with this command
|
||||||
sendMessage('/buffer set hotlist -1');
|
sendMessage('/buffer set hotlist -1');
|
||||||
// Also move read marker
|
// Also move read marker
|
||||||
|
|
|
@ -452,7 +452,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
// the messages in this buffer before you switched to the new one
|
// the messages in this buffer before you switched to the new one
|
||||||
// this is only needed with new type of clearing since in the old
|
// this is only needed with new type of clearing since in the old
|
||||||
// way WeeChat itself takes care of that part
|
// way WeeChat itself takes care of that part
|
||||||
if (parseInt(models.version.charAt(0)) >= 1) {
|
if (models.version[0] >= 1) {
|
||||||
connection.sendHotlistClear();
|
connection.sendHotlistClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,9 +464,17 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
fullName = fullName.substring(0, fullName.lastIndexOf('.') + 1) + bufferName; // substitute the last part
|
fullName = fullName.substring(0, fullName.lastIndexOf('.') + 1) + bufferName; // substitute the last part
|
||||||
|
|
||||||
if (!$scope.setActiveBuffer(fullName, 'fullName')) {
|
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)
|
if (['#', '&', '+', '!'].indexOf(bufferName.charAt(0)) < 0) { // these are the characters a channel name can start with (RFC 2813-2813)
|
||||||
command = 'query';
|
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);
|
connection.sendMessage('/' + command + ' ' + bufferName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
|
||||||
var content = message.objects[0].content;
|
var content = message.objects[0].content;
|
||||||
var version = content.value;
|
var version = content.value;
|
||||||
// Store the WeeChat version in models
|
// Store the WeeChat version in models
|
||||||
models.version = version;
|
// this eats things like 1.3-dev -> [1,3]
|
||||||
|
models.version = version.split(".").map(function(c) { return parseInt(c); });
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleBufferClosing = function(message) {
|
var handleBufferClosing = function(message) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ weechat.directive('inputBar', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// New style clearing requires this, old does not
|
// New style clearing requires this, old does not
|
||||||
if (parseInt(models.version.charAt(0)) >= 1) {
|
if (models.version[0] >= 1) {
|
||||||
connection.sendHotlistClear();
|
connection.sendHotlistClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -463,7 +463,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
* @return active buffer pointer (WeeChat 1.0+) or fullname (older versions)
|
* @return active buffer pointer (WeeChat 1.0+) or fullname (older versions)
|
||||||
*/
|
*/
|
||||||
this.getActiveBufferReference = function() {
|
this.getActiveBufferReference = function() {
|
||||||
if (this.version !== null && parseInt(this.version.charAt(0)) >= 1) {
|
if (this.version !== null && this.version[0] >= 1) {
|
||||||
// pointers are being validated, they're more reliable than
|
// pointers are being validated, they're more reliable than
|
||||||
// fullName (e.g. if fullName contains spaces)
|
// fullName (e.g. if fullName contains spaces)
|
||||||
return "0x"+activeBuffer.id;
|
return "0x"+activeBuffer.id;
|
||||||
|
|
Loading…
Reference in a new issue