diff --git a/src/sync_api.c b/src/sync_api.c index 2ca24c91..f03b2c25 100644 --- a/src/sync_api.c +++ b/src/sync_api.c @@ -378,3 +378,25 @@ DYNAMIC_API PEP_STATUS disable_identity_for_sync(PEP_SESSION session, status = key_reset_identity(session, ident, NULL); return status; } + +DYNAMIC_API PEP_STATUS disable_all_sync_channels(PEP_SESSION session) +{ + assert(session); + if (!session) + return PEP_ILLEGAL_VALUE; + + identity_list *own_identities = NULL; + PEP_STATUS status = own_identities_retrieve(session, &own_identities); + if (status) + return status; + + for (identity_list *oi = own_identities; oi && oi->ident; oi = oi->next) { + status = set_identity_flags(session, oi->ident, PEP_idf_not_for_sync); + if (status) + break; + } + + free_identity_list(own_identities); + return status; +} + diff --git a/src/sync_api.h b/src/sync_api.h index eaa34d3c..52f98b8a 100644 --- a/src/sync_api.h +++ b/src/sync_api.h @@ -306,6 +306,19 @@ DYNAMIC_API PEP_STATUS disable_identity_for_sync(PEP_SESSION session, pEp_identity *ident); +/** + * + * + * @brief Disable sync for all identities; use this function to reset + * the state which identities will be synced and which not + * This function is intended to be used at app init + * + * + */ + +DYNAMIC_API PEP_STATUS disable_all_sync_channels(PEP_SESSION session); + + #ifdef __cplusplus } #endif