Browse Source

grp enc interface - ommit pEp_group in adapter_group_create()

LIB-11
heck 1 year ago
parent
commit
a2c5c99046
9 changed files with 49 additions and 66 deletions
  1. +13
    -12
      src/adapter_group.cc
  2. +16
    -35
      src/adapter_group.h
  3. +2
    -3
      src/grp_update_drv_dummy.cc
  4. +2
    -3
      src/grp_update_drv_dummy.hh
  5. +2
    -3
      src/grp_update_drv_engine.cc
  6. +1
    -2
      src/grp_update_drv_engine.hh
  7. +1
    -2
      src/grp_update_interface.hh
  8. +11
    -5
      test/framework/framework.cc
  9. +1
    -1
      test/framework/framework.hh

+ 13
- 12
src/adapter_group.cc View File

@ -18,7 +18,14 @@ using namespace std;
using namespace pEp;
//Listmanager config
string lm_dummy_db_path = "listman_dummy.db";
string lm_dummy_db_filename = "listman_dummy.db";
#ifdef WIN32
string lm_dummy_db_path = string(::per_user_directory()) + "\\" + listman_db_filename;
#else
string lm_dummy_db_path = string(::per_user_directory()) + "/" + lm_dummy_db_filename;
#endif
/*************************************************************************************************
* Group management functions
@ -27,32 +34,26 @@ string lm_dummy_db_path = "listman_dummy.db";
GroupUpdateDriverEngine group_update_driver_engine{};
GroupUpdateInterface *gu_engine = &group_update_driver_engine;
// Listmanager Driver
GroupUpdateDriverDummy group_update_driver_dummy{lm_dummy_db_path};
GroupUpdateDriverDummy group_update_driver_dummy{ lm_dummy_db_path };
GroupUpdateInterface *gu_listman = &group_update_driver_dummy;
DYNAMIC_API PEP_STATUS adapter_group_create(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *manager,
identity_list *memberlist,
pEp_group **group)
identity_list *memberlist)
{
pEpLog("called");
// Do listmanager
PEP_STATUS status = gu_listman->adapter_group_create(
session,
group_identity,
manager,
memberlist,
group);
PEP_STATUS status = gu_listman->adapter_group_create(session, group_identity, manager, memberlist);
if (status != PEP_STATUS_OK) {
return status;
}
// Do engine
status = gu_engine->adapter_group_create(session, group_identity, manager, memberlist, group);
status = gu_engine->adapter_group_create(session, group_identity, manager, memberlist);
if (status != PEP_STATUS_OK) {
// Rollback listman
PEP_STATUS rb_stat = gu_listman->adapter_group_dissolve(session, group_identity, manager);
@ -169,7 +170,7 @@ PEP_STATUS adapter_group_remove_member(
* Group query functions
*************************************************************************************************/
// Listmanager Driver
GroupQueryDriverDummy group_query_driver_dummy{lm_dummy_db_path};
GroupQueryDriverDummy group_query_driver_dummy{ lm_dummy_db_path };
GroupQueryInterface *gq_listman = &group_query_driver_dummy;
DYNAMIC_API PEP_STATUS group_query_groups(PEP_SESSION session, identity_list **groups)


+ 16
- 35
src/adapter_group.h View File

@ -37,9 +37,6 @@ extern "C" {
* a user_id and address, and there must be a default key for the manager
* present in the database
* @param[in,out] member_ident_list list of group member identities
* @param[in,out] group Optional reference for pointer to group object
* representing the created group.
* (When input is NULL, no object is created)
*
* @retval PEP_STATUS_OK on success
* error on failure
@ -58,9 +55,7 @@ DYNAMIC_API PEP_STATUS adapter_group_create(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *manager,
identity_list *memberlist,
pEp_group **group
);
identity_list *memberlist);
/**
@ -84,11 +79,8 @@ DYNAMIC_API PEP_STATUS adapter_group_create(
*
*
*/
DYNAMIC_API PEP_STATUS adapter_group_join(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *as_member
);
DYNAMIC_API PEP_STATUS
adapter_group_join(PEP_SESSION session, pEp_identity *group_identity, pEp_identity *as_member);
/**
* <!-- adapter_group_dissolve() -->
@ -111,11 +103,8 @@ DYNAMIC_API PEP_STATUS adapter_group_join(
* @warning For recipients to accept the dissolution, the sender/manager key used must be a key that they
* have a trust entry for.
*/
DYNAMIC_API PEP_STATUS adapter_group_dissolve(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *manager
);
DYNAMIC_API PEP_STATUS
adapter_group_dissolve(PEP_SESSION session, pEp_identity *group_identity, pEp_identity *manager);
/**
* <!-- adapter_group_invite_member() -->
@ -140,10 +129,9 @@ DYNAMIC_API PEP_STATUS adapter_group_dissolve(
*
*/
DYNAMIC_API PEP_STATUS adapter_group_invite_member(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *group_member
);
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *group_member);
/**
* <!-- adapter_group_remove_member() -->
@ -166,10 +154,9 @@ DYNAMIC_API PEP_STATUS adapter_group_invite_member(
*
*/
PEP_STATUS adapter_group_remove_member(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *group_member
);
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *group_member);
/*************************************************************************************************
@ -210,11 +197,8 @@ DYNAMIC_API PEP_STATUS group_query_groups(PEP_SESSION session, identity_list **g
*
*/
DYNAMIC_API PEP_STATUS group_query_manager(
PEP_SESSION session,
const pEp_identity *const group,
pEp_identity **manager
);
DYNAMIC_API PEP_STATUS
group_query_manager(PEP_SESSION session, const pEp_identity *const group, pEp_identity **manager);
/**
* <!-- group_query_members() -->
@ -232,15 +216,12 @@ DYNAMIC_API PEP_STATUS group_query_manager(
*
*/
DYNAMIC_API PEP_STATUS group_query_members(
PEP_SESSION session,
const pEp_identity *const group,
identity_list **members
);
DYNAMIC_API PEP_STATUS
group_query_members(PEP_SESSION session, const pEp_identity *const group, identity_list **members);
#ifdef __cplusplus
};
#endif
#endif //LIBPEPADAPTER_GROUP_HH
#endif //LIBPEPADAPTER_GROUP_HH

+ 2
- 3
src/grp_update_drv_dummy.cc View File

@ -18,13 +18,12 @@ namespace pEp {
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *manager,
identity_list *memberlist,
pEp_group **group)
identity_list *memberlist)
{
pEpLogClass("called");
string addr_list = group_identity->address;
string addr_manager = manager->address;
lmd.list_add(addr_list,addr_manager);
lmd.list_add(addr_list, addr_manager);
// TODO:ADD MEMBERLIST
return PEP_STATUS_OK;


+ 2
- 3
src/grp_update_drv_dummy.hh View File

@ -12,14 +12,13 @@ namespace pEp {
class GroupUpdateDriverDummy : public GroupUpdateInterface {
public:
GroupUpdateDriverDummy() = delete;
GroupUpdateDriverDummy(const std::string& db_path);
GroupUpdateDriverDummy(const std::string &db_path);
PEP_STATUS adapter_group_create(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *manager,
identity_list *memberlist,
pEp_group **group) override;
identity_list *memberlist) override;
PEP_STATUS adapter_group_join(
PEP_SESSION session,


+ 2
- 3
src/grp_update_drv_engine.cc View File

@ -12,11 +12,10 @@ namespace pEp {
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *manager,
identity_list *memberlist,
pEp_group **group)
identity_list *memberlist)
{
pEpLogClass("called");
return ::group_create(session, group_identity, manager, memberlist, group);
return ::group_create(session, group_identity, manager, memberlist, nullptr);
}
PEP_STATUS GroupUpdateDriverEngine::adapter_group_join(


+ 1
- 2
src/grp_update_drv_engine.hh View File

@ -15,8 +15,7 @@ namespace pEp {
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *manager,
identity_list *memberlist,
pEp_group **group) override;
identity_list *memberlist) override;
PEP_STATUS adapter_group_join(
PEP_SESSION session,


+ 1
- 2
src/grp_update_interface.hh View File

@ -14,8 +14,7 @@ namespace pEp {
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *manager,
identity_list *memberlist,
pEp_group **group) = 0;
identity_list *memberlist) = 0;
virtual PEP_STATUS adapter_group_join(
PEP_SESSION session,


+ 11
- 5
test/framework/framework.cc View File

@ -24,14 +24,14 @@
#include "../../src/Adapter.hh"
pEp::Test::Transport pEp::Test::transport;
std::string pEp::Test::path;
extern std::thread pEp::Adapter::_sync_thread;
using namespace pEp;
using namespace std;
namespace pEp {
namespace Test {
string per_user_dir;
void setup(vector<string> &args)
{
#ifdef WIN32
@ -67,8 +67,8 @@ namespace pEp {
#else
setenv("HOME", _path, 1);
#endif
path = _path;
cerr << "test directory: " << path << endl;
per_user_dir = _path;
cerr << "test directory: " << per_user_dir << endl;
}
void setup(int argc, char **argv)
@ -135,7 +135,13 @@ namespace pEp {
stringlist_t *keylist;
::PEP_rating rating;
::PEP_decrypt_flags_t flags = 0;
::PEP_STATUS status = ::decrypt_message(Adapter::session(), msg.get(), &_dst, &keylist, &rating, &flags);
::PEP_STATUS status = ::decrypt_message(
Adapter::session(),
msg.get(),
&_dst,
&keylist,
&rating,
&flags);
throw_status(status);
Message dst;


+ 1
- 1
test/framework/framework.hh View File

@ -55,7 +55,7 @@ namespace pEp {
};
extern Transport transport;
extern std::string path;
extern std::string per_user_dir;
}; // namespace Test
}; // namespace pEp


Loading…
Cancel
Save