You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.2 KiB
75 lines
2.2 KiB
#include "../src/prototype.hh"
|
|
#include <pEp/pEpEngine.h>
|
|
#include <pEp/message_api.h>
|
|
#include <pEp/keymanagement.h>
|
|
#include <pEp/identity_list.h>
|
|
#include <pEp/pEpLog.hh>
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------
|
|
namespace pEp {
|
|
class Identity : public PODStruct<::pEp_identity> {
|
|
public:
|
|
Identity(bool is_owner, ::pEp_identity** ident_p = nullptr) :
|
|
PODStruct<::pEp_identity>(is_owner, ident_p)
|
|
{
|
|
}
|
|
|
|
Identity(
|
|
bool is_owner,
|
|
const std::string& address = "",
|
|
const std::string& username = "",
|
|
const std::string& user_id = "",
|
|
const std::string& fpr = "") :
|
|
PODStruct<::pEp_identity>(is_owner, nullptr)
|
|
{
|
|
pEpLogClass("called");
|
|
this->address = address;
|
|
this->username = username;
|
|
this->user_id = user_id;
|
|
this->fpr = fpr;
|
|
}
|
|
|
|
pEp::String address{ is_owner(), &(*data())->address };
|
|
pEp::String fpr{ is_owner(), &(*data())->fpr };
|
|
pEp::String user_id{ is_owner(), &(*data())->user_id };
|
|
pEp::String username{ is_owner(), &(*data())->username };
|
|
pEp::POD<::PEP_comm_type> comm_type{ &(*data())->comm_type };
|
|
//char[3] lang
|
|
pEp::POD<bool> me{ &(*data())->me };
|
|
pEp::POD<unsigned int> major_ver{ &(*data())->major_ver };
|
|
pEp::POD<unsigned int> minor_ver{ &(*data())->minor_ver };
|
|
pEp::POD<::PEP_enc_format> enc_format{ &(*data())->enc_format };
|
|
pEp::POD<::identity_flags_t> flags{ &(*data())->flags };
|
|
};
|
|
|
|
template<>
|
|
bool PODStruct<::pEp_identity>::log_enabled{ false };
|
|
|
|
} // namespace pEp
|
|
|
|
int main()
|
|
{
|
|
pEp::Adapter::pEpLog::set_enabled(true);
|
|
::PEP_SESSION session;
|
|
setenv("HOME", ".", 1);
|
|
::init(&session, nullptr, nullptr, nullptr);
|
|
|
|
// create identity
|
|
pEp::Identity id1{ true, "wrong@entry.lol", "wrong", "23", "INVA_FPR" };
|
|
|
|
pEpLog(id1);
|
|
id1.username = "alice";
|
|
id1.address = "alice@peptest.org";
|
|
|
|
pEpLog(id1.address);
|
|
pEpLog(id1.username);
|
|
::myself(session, id1);
|
|
pEpLog(id1);
|
|
|
|
pEp::Identity id2{ true, "bob" };
|
|
::update_identity(session, id2);
|
|
pEpLog(id2);
|
|
|
|
return 0;
|
|
}
|