add provider db documentation url

default case for unwrapping
try fixing python linting
This commit is contained in:
Simon Laux
2019-12-20 15:17:07 +01:00
parent 7da5fe2726
commit 5479877f65
3 changed files with 9 additions and 6 deletions

View File

@@ -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);

View File

@@ -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(),
}
}