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.
71 lines
2.0 KiB
71 lines
2.0 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 Sleeve<::pEp_identity> {
|
|
public:
|
|
Identity(::pEp_identity** ident_p = nullptr) : PODStruct<::pEp_identity>(ident_p) {}
|
|
|
|
Identity(
|
|
const std::string& address = "",
|
|
const std::string& username = "",
|
|
const std::string& user_id = "",
|
|
const std::string& fpr = "") :
|
|
Sleeve<::pEp_identity>(nullptr)
|
|
{
|
|
pEpLogClass("called");
|
|
this->address = address;
|
|
this->username = username;
|
|
this->user_id = user_id;
|
|
this->fpr = fpr;
|
|
}
|
|
|
|
pEp::String fpr{ &data()->fpr };
|
|
pEp::String user_id{ &data()->user_id };
|
|
pEp::String username{ &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 Sleeve<::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{ "wrong@entry.lol", "wrong", "23", "INVA_FPR" };
|
|
|
|
pEpLog(id1.c_data());
|
|
id1.username = "alice";
|
|
id1.address = "alice@peptest.org";
|
|
id1.
|
|
|
|
pEpLog(id1.address);
|
|
pEpLog(id1.username);
|
|
::myself(session, id1);
|
|
pEpLog(id1.c_data());
|
|
|
|
pEp::Identity id2{ "bob" };
|
|
::update_identity(session, id2);
|
|
pEpLog(id2.c_data());
|
|
|
|
return 0;
|
|
}
|