private async Task updateDeviceListAsync(OmemoXmlDevices devices) { setState(OmemoHelperState.UPDATING_DEVICE_LIST); // Make sure we set the item ID to "current": devices.setId(); Logger.Info("[OMEMO HELPER](" + CONNECTION.account.getBareJid() + ") Updating device list."); MessageResponseHelperResult <IQMessage> result = await CONNECTION.OMEMO_COMMAND_HELPER.setDeviceListAsync(devices); if (result.STATE == MessageResponseHelperResultState.SUCCESS) { if (result.RESULT is IQErrorMessage errMsg) { Logger.Error("[OMEMO HELPER](" + CONNECTION.account.getBareJid() + ") Failed to set OMEMO device list to: " + CONNECTION.account.user.domainPart + "\n" + errMsg.ERROR_OBJ.ToString()); setState(OmemoHelperState.ERROR); } else { Logger.Info("[OMEMO HELPER](" + CONNECTION.account.getBareJid() + ") Device list updated."); if (tmpDeviceId != 0) { if (CONNECTION.account.omemoDeviceId != tmpDeviceId) { CONNECTION.account.omemoDeviceId = tmpDeviceId; CONNECTION.account.omemoBundleInfoAnnounced = false; } } if (!CONNECTION.account.omemoBundleInfoAnnounced) { await announceBundleInfoAsync(); } else { setState(OmemoHelperState.ENABLED); } } } else { onRequestError(result); } }