|
@ -31,35 +31,31 @@ namespace pEp { |
|
|
Utils::is_c_str_empty(manager->address)) { |
|
|
Utils::is_c_str_empty(manager->address)) { |
|
|
status = PEP_ILLEGAL_VALUE; |
|
|
status = PEP_ILLEGAL_VALUE; |
|
|
} else { |
|
|
} else { |
|
|
const string addr_list = group_identity->address; |
|
|
const string addr_list{ group_identity->address }; |
|
|
const string addr_manager = manager->address; |
|
|
const string addr_manager{ manager->address }; |
|
|
|
|
|
|
|
|
PEP_STATUS stat_add; |
|
|
|
|
|
try { |
|
|
try { |
|
|
lmd.list_add(addr_list, addr_manager); |
|
|
lmd.list_add(addr_list, addr_manager); |
|
|
stat_add = PEP_STATUS_OK; |
|
|
status = PEP_STATUS_OK; |
|
|
} catch (const AlreadyExistsException &e) { |
|
|
} catch (const AlreadyExistsException &e) { |
|
|
pEpLogClass(Utils::nested_exception_to_string(e)); |
|
|
pEpLogClass(Utils::nested_exception_to_string(e)); |
|
|
stat_add = PEP_GROUP_EXISTS; |
|
|
status = PEP_GROUP_EXISTS; |
|
|
} catch (const exception &e) { |
|
|
} catch (const exception &e) { |
|
|
pEpLogClass(Utils::nested_exception_to_string(e)); |
|
|
pEpLogClass(Utils::nested_exception_to_string(e)); |
|
|
stat_add = PEP_UNKNOWN_ERROR; |
|
|
status = PEP_UNKNOWN_ERROR; |
|
|
} catch (...) { |
|
|
} catch (...) { |
|
|
pEpLogClass("unknown exception"); |
|
|
pEpLogClass("unknown exception"); |
|
|
status = PEP_UNKNOWN_ERROR; |
|
|
status = PEP_UNKNOWN_ERROR; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (stat_add != PEP_STATUS_OK) { |
|
|
if (status == PEP_STATUS_OK) { |
|
|
status = stat_add; |
|
|
|
|
|
} else { |
|
|
|
|
|
// Add the memberlist (if given)
|
|
|
// Add the memberlist (if given)
|
|
|
// Fail totally on the first member_invite() that fails
|
|
|
// Fail totally on the first member_invite() that fails
|
|
|
PEP_STATUS stat_invite = PEP_UNKNOWN_ERROR; |
|
|
const vector<pEp_identity *> cxx_memberlist = Utils::to_cxx(*memberlist); |
|
|
vector<pEp_identity *> cxx_memberlist = Utils::to_cxx(*memberlist); |
|
|
for (pEp_identity *const member : cxx_memberlist) { |
|
|
for (pEp_identity *member : cxx_memberlist) { |
|
|
status = this->adapter_group_invite_member(session, group_identity, member); |
|
|
stat_invite = this->adapter_group_invite_member(session, group_identity, member); |
|
|
if (status != PEP_STATUS_OK) { |
|
|
if (stat_invite != PEP_STATUS_OK) { |
|
|
status = status; |
|
|
status = stat_invite; |
|
|
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -97,29 +93,26 @@ namespace pEp { |
|
|
Utils::is_c_str_empty(manager->address)) { |
|
|
Utils::is_c_str_empty(manager->address)) { |
|
|
status = PEP_ILLEGAL_VALUE; |
|
|
status = PEP_ILLEGAL_VALUE; |
|
|
} else { |
|
|
} else { |
|
|
const string addr_list = group_identity->address; |
|
|
const string addr_list{ group_identity->address }; |
|
|
const string addr_manager = manager->address; |
|
|
const string addr_manager{ manager->address }; |
|
|
|
|
|
|
|
|
// Check if given manager is correct for the given group
|
|
|
// Check if given manager is correct for the given group
|
|
|
PEP_STATUS stat_query = PEP_UNKNOWN_ERROR; |
|
|
|
|
|
string addr_manager_queried; |
|
|
string addr_manager_queried; |
|
|
try { |
|
|
try { |
|
|
addr_manager_queried = lmd.moderator(addr_list); |
|
|
addr_manager_queried = lmd.moderator(addr_list); |
|
|
stat_query = PEP_STATUS_OK; |
|
|
status = PEP_STATUS_OK; |
|
|
} catch (const ListDoesNotExistException &e) { |
|
|
} catch (const ListDoesNotExistException &e) { |
|
|
pEpLogClass(Utils::nested_exception_to_string(e)); |
|
|
pEpLogClass(Utils::nested_exception_to_string(e)); |
|
|
stat_query = PEP_GROUP_NOT_FOUND; |
|
|
status = PEP_GROUP_NOT_FOUND; |
|
|
} catch (const exception &e) { |
|
|
} catch (const exception &e) { |
|
|
pEpLogClass(Utils::nested_exception_to_string(e)); |
|
|
pEpLogClass(Utils::nested_exception_to_string(e)); |
|
|
stat_query = PEP_UNKNOWN_ERROR; |
|
|
status = PEP_UNKNOWN_ERROR; |
|
|
} catch (...) { |
|
|
} catch (...) { |
|
|
pEpLogClass("unknown exception"); |
|
|
pEpLogClass("unknown exception"); |
|
|
stat_query = PEP_UNKNOWN_ERROR; |
|
|
status = PEP_UNKNOWN_ERROR; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (stat_query != PEP_STATUS_OK) { |
|
|
if (status == PEP_STATUS_OK) { |
|
|
status = stat_query; |
|
|
|
|
|
} else { |
|
|
|
|
|
if (addr_manager_queried != addr_manager) { |
|
|
if (addr_manager_queried != addr_manager) { |
|
|
status = PEP_CANNOT_DISABLE_GROUP; |
|
|
status = PEP_CANNOT_DISABLE_GROUP; |
|
|
} else { |
|
|
} else { |
|
@ -163,8 +156,8 @@ namespace pEp { |
|
|
Utils::is_c_str_empty(group_member->address)) { |
|
|
Utils::is_c_str_empty(group_member->address)) { |
|
|
status = PEP_ILLEGAL_VALUE; |
|
|
status = PEP_ILLEGAL_VALUE; |
|
|
} else { |
|
|
} else { |
|
|
const string addr_list = group_identity->address; |
|
|
const string addr_list{ group_identity->address }; |
|
|
const string addr_member = group_member->address; |
|
|
const string addr_member{ group_member->address }; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
lmd.member_add(addr_list, addr_member); |
|
|
lmd.member_add(addr_list, addr_member); |
|
@ -203,8 +196,8 @@ namespace pEp { |
|
|
Utils::is_c_str_empty(group_member->address)) { |
|
|
Utils::is_c_str_empty(group_member->address)) { |
|
|
status = PEP_ILLEGAL_VALUE; |
|
|
status = PEP_ILLEGAL_VALUE; |
|
|
} else { |
|
|
} else { |
|
|
const string addr_list = group_identity->address; |
|
|
const string addr_list{ group_identity->address }; |
|
|
const string addr_member = group_member->address; |
|
|
const string addr_member{ group_member->address }; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
lmd.member_remove(addr_list, addr_member); |
|
|
lmd.member_remove(addr_list, addr_member); |
|
|