diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 8e785dfdd..d29b022d5 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -3663,22 +3663,24 @@ int dc_contact_is_verified (dc_contact_t* contact); /** * Get the provider json object for the given domain. + * For more documentation see https://docs.rs/deltachat-provider-database/ * * @memberof dc_provider_t * @param domain The domain to get provider info for. - * @return a provider json object as string. If no provider info is found, an empty string will be returned. + * @return a provider json object as string. If no provider info is found, an empty string will be returned. */ char* dc_provider_json_from_domain (const char* domain); /** * Get the provider json object for the given email address. + * For more documentation see https://docs.rs/deltachat-provider-database/ * * The provider is extracted from the email address and it's information is returned. * * @memberof dc_provider_t * @param email The user's email address to extract the provider info form. - * @return a provider json object as string. If no provider info is found, an empty string will be returned. + * @return a provider json object as string. If no provider info is found, an empty string will be returned. */ char* dc_provider_json_from_email (const char* email); diff --git a/deltachat-ffi/src/providers.rs b/deltachat-ffi/src/providers.rs index 807407eac..ef950bd9a 100644 --- a/deltachat-ffi/src/providers.rs +++ b/deltachat-ffi/src/providers.rs @@ -11,7 +11,7 @@ pub unsafe extern "C" fn dc_provider_json_from_domain( ) -> *mut libc::c_char { let domain = to_string_lossy(domain); match deltachat_provider_database::get_provider_info(&domain) { - Some(provider) => serde_json::to_string(provider).unwrap().strdup(), + Some(provider) => serde_json::to_string(provider).unwrap_or("".to_owned()).strdup(), None => "".strdup(), } } @@ -23,7 +23,7 @@ pub unsafe extern "C" fn dc_provider_json_from_email( let email = to_string_lossy(email); let domain = deltachat_provider_database::get_domain_from_email(&email); match deltachat_provider_database::get_provider_info(domain) { - Some(provider) => serde_json::to_string(provider).unwrap().strdup(), + Some(provider) => serde_json::to_string(provider).unwrap_or("".to_owned()).strdup(), None => "".strdup(), } } diff --git a/python/src/deltachat/provider.py b/python/src/deltachat/provider.py index cb066fde8..d7ad92b2b 100644 --- a/python/src/deltachat/provider.py +++ b/python/src/deltachat/provider.py @@ -1,9 +1,10 @@ """Provider info class.""" -from .capi import ffi, lib +from .capi import lib from .cutil import as_dc_charpointer, from_dc_charpointer import json + class ProviderNotFoundError(Exception): """The provider information was not found.""" @@ -55,7 +56,7 @@ class Provider(object): def status(self): """The status of the provider information. - This is + This is :attr:`"OK"`, :attr:`"PREPARATION"` or :attr:`"BROKEN"`.