Commit f7594efa61522654f8d8e1bdfa41af8084cc33ba

Authored by Adhidarma Hadiwinoto
1 parent 93a0e56440
Exists in master

toLowerCase

Showing 1 changed file with 14 additions and 0 deletions Side-by-side Diff

... ... @@ -24,7 +24,9 @@ function MatrixUtil(options) {
24 24 }
25 25  
26 26 MatrixUtil.prototype.updateBuddyState = function(jid, state, statusText, resource) {
  27 + if (!jid) {return; }
27 28 if (jid == 'undefined') {return; }
  29 + jid = jid.toLowerCase();
28 30  
29 31 let logger = this.logger;
30 32 let matrix = this.matrix;
... ... @@ -65,6 +67,9 @@ MatrixUtil.prototype.updateBuddyState = function(jid, state, statusText, resourc
65 67 }
66 68  
67 69 MatrixUtil.prototype.isAFriend = function(jid) {
  70 + if (!jid) { return; }
  71 + jid = jid.toLowerCase();
  72 +
68 73 let matrix = this.matrix;
69 74  
70 75 if (!matrix) { return false; };
... ... @@ -75,6 +80,9 @@ MatrixUtil.prototype.isAFriend = function(jid) {
75 80 }
76 81  
77 82 MatrixUtil.prototype.isPartnerOffline = function(partner) {
  83 + if (!partner) { return; }
  84 + partner = partner.toLowerCase();
  85 +
78 86 let matrix = this.matrix;
79 87 let logger = this.logger;
80 88  
... ... @@ -97,6 +105,9 @@ MatrixUtil.prototype.isPartnerOffline = function(partner) {
97 105 }
98 106  
99 107 MatrixUtil.prototype.updateLastIncoming = function(sender, msg) {
  108 + if (!sender) { return; }
  109 + sender = sender.toLowerCase();
  110 +
100 111 let matrix = this.matrix;
101 112  
102 113 if (!matrix) {
... ... @@ -118,6 +129,9 @@ MatrixUtil.prototype.updateLastIncoming = function(sender, msg) {
118 129 }
119 130  
120 131 MatrixUtil.prototype.updateLastOutgoing = function(destination, msg) {
  132 + if (!destination) { return; }
  133 + destination = destination.toLowerCase();
  134 +
121 135 let matrix = this.matrix;
122 136  
123 137 if (!matrix) {