Skip to content
This repository was archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
"matrix:" instead of too generic "switch:"
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 4, 2014
1 parent 69608e5 commit 92c48c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/js/matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ Matrix.prototype.toString = function() {
continue;
}
val = this.switchedOn[srcHostname] ? 'on' : 'off';
out.push('switch: ' + srcHostname + ' ' + val);
out.push('matrix: ' + srcHostname + ' ' + val);
}
return out.sort().join('\n');
};
Expand Down Expand Up @@ -640,6 +640,9 @@ Matrix.prototype.fromString = function(text, append) {
// state = [`on`, `off`]

pos = fieldVal.indexOf('switch:');
if ( pos === -1 ) {
pos = fieldVal.indexOf('matrix:');
}
if ( pos !== -1 ) {
srcHostname = punycode.toASCII(fields[1]);

Expand Down Expand Up @@ -743,7 +746,7 @@ Matrix.prototype.diff = function(other, srcHostname, desHostnames) {
otherVal = other.evaluateSwitch(srcHostname);
if ( thisVal !== otherVal ) {
out.push({
'what': 'switch',
'what': 'matrix',
'src': srcHostname
});
}
Expand Down Expand Up @@ -783,7 +786,7 @@ Matrix.prototype.applyDiff = function(diff, from) {
var action, val;
while ( i-- ) {
action = diff[i];
if ( action.what === 'switch' ) {
if ( action.what === 'matrix' ) {
val = from.evaluateSwitch(action.src);
changed = this.setSwitch(action.src, val) || changed;
continue;
Expand Down

0 comments on commit 92c48c0

Please sign in to comment.