handleRosterPush method

Future<void> handleRosterPush(
  1. RosterPushResult event
)

Handles a roster push from the RosterManager.

Implementation

Future<void> handleRosterPush(RosterPushResult event) async {
  await _lock.synchronized(() async {
    await _loadRosterCache();

    _currentVersion = event.ver;
    final result = _handleRosterItem(event.item);

    if (result.removed != null) {
      return _commitRoster(
        _currentVersion,
        [result.removed!],
        [],
        [],
      );
    } else if (result.modified != null) {
      return _commitRoster(
        _currentVersion,
        [],
        [result.modified!],
        [],
      );
    } else if (result.added != null) {
      return _commitRoster(
        _currentVersion,
        [],
        [],
        [result.added!],
      );
    }
  });
}