Commit 05d3da1e1ca86f922ba32b952494a00fce80e73d

Authored by Adhidarma Hadiwinoto
1 parent cf811f203d
Exists in master

last message

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

... ... @@ -24,6 +24,23 @@ function onPM(sender, msg) {
24 24 if (callbacks.onPM) {
25 25 callbacks.onPM(sender, msg);
26 26 }
  27 +
  28 + if (!matrix) {
  29 + return;
  30 + }
  31 +
  32 + if (!matrix.buddies) {
  33 + matrix.buddies = {};
  34 + }
  35 +
  36 + if (!matrix.buddies[sender]) {
  37 + matrix.buddies[sender] = {};
  38 + }
  39 +
  40 + matrix.buddies[sender].lastIncoming = {
  41 + msg: msg,
  42 + lastUpdate: moment().format('YYYYMMdd HH:mm:ss')
  43 + }
27 44 }
28 45  
29 46 function onError(err) {
... ... @@ -53,7 +70,7 @@ function onBuddy(jid, state, statusText, resource) {
53 70 matrix.buddies[jid].states.[resource] = {
54 71 state: state,
55 72 statusText: statusText,
56   - lastStateUpdate: moment().format('YYYYMMdd HH:mm:ss')
  73 + lastUpdate: moment().format('YYYYMMdd HH:mm:ss')
57 74 }
58 75 }
59 76