private void onUser(@NotNull TLAbsUser absUser){
  User currentUser=null;
  User user=null;
  if (absUser instanceof TLUser) {
    final TLUser tlUser=(TLUser)absUser;
    if (tlUser.isMutualContact()) {
      currentUser=(User)databaseManager.getUserById(tlUser.getId());
      user=onUserContact(currentUser,tlUser);
    }
 else     if (tlUser.isDeleted()) {
      currentUser=(User)databaseManager.getUserById(tlUser.getId());
      user=onUserDelete(currentUser,tlUser);
    }
 else     if (tlUser.isContact()) {
      currentUser=(User)databaseManager.getUserById(tlUser.getId());
      user=onUserRequest(currentUser,tlUser);
    }
 else     if (tlUser.isSelf() || !tlUser.isBot()) {
      currentUser=(User)databaseManager.getUserById(tlUser.getId());
      user=onUserForeign(currentUser,tlUser);
    }
 else {
      BotLogger.info(LOGTAG,"Bot received");
    }
  }
  if ((currentUser == null) && (user != null)) {
    databaseManager.addUser(user);
  }
 else   if (user != null) {
    databaseManager.updateUser(user);
  }
}

private void onUser ( @ NotNull TLAbsUser absUser ) { User currentUser = null ; User user = null ; if ( absUser instanceof TLUser ) { final TLUser tlUser = ( TLUser ) absUser ; if ( tlUser . isMutualContact ( ) ) { currentUser = ( User ) databaseManager . getUserById ( tlUser . getId ( ) ) ; user = onUserContact ( currentUser , tlUser ) ; } else if ( tlUser . isDeleted ( ) ) { currentUser = ( User ) databaseManager . getUserById ( tlUser . getId ( ) ) ; user = onUserDelete ( currentUser , tlUser ) ; } else if ( tlUser . isContact ( ) ) { currentUser = ( User ) databaseManager . getUserById ( tlUser . getId ( ) ) ; user = onUserRequest ( currentUser , tlUser ) ; } else if ( tlUser . isSelf ( ) || ! tlUser . isBot ( ) ) { currentUser = ( User ) databaseManager . getUserById ( tlUser . getId ( ) ) ; user = onUserForeign ( currentUser , tlUser ) ; } else { BotLogger . info ( LOGTAG , "Bot received" ) ; } } if ( ( currentUser == null ) && ( user != null ) ) { databaseManager . addUser ( user ) ; } else if ( user != null ) { databaseManager . updateUser ( user ) ; } }
add a user to database
