routeInfo method

void routeInfo(
  1. InfoMessage info
)

Implementation

void routeInfo(InfoMessage info) {
  if (info.what != 'kp') {
    var user = _users[info.from];
    if (user != null) {
      if (info.what == 'recv') {
        user.recv = info.seq;
      }
      if (info.what == 'read') {
        user.read = info.seq;
      }

      if ((user.recv ?? 0) < (user.read ?? 0)) {
        user.recv = user.read;
      }
    }

    // If this is an update from the current user, update the contact with the new count too.
    if (_tinodeService.isMe(info.from ?? '')) {
      var me = _tinodeService.getTopic(topic_names.TOPIC_ME) as TopicMe;
      me.setMsgReadRecv(info.topic!, info.what!, info.seq!, null);
    }
  }
  onInfo.add(info);
}