Browse Source

starting with basic API

PYADPT-55
Volker Birk 9 years ago
parent
commit
bfe55ff589
  1. 10
      src/Identity.cc
  2. 1
      src/Identity.hh
  3. 8
      src/pEpmodule.cc
  4. 3
      src/pEpmodule.hh

10
src/Identity.cc

@ -36,6 +36,13 @@ namespace pEp {
free_identity(_ident);
}
Identity::operator pEp_identity *()
{
if (!_ident)
throw bad_cast();
return _ident;
}
void Identity::attach(pEp_identity *ident)
{
free_identity(_ident);
@ -115,8 +122,7 @@ namespace pEp {
extract< string > extract_string(value);
if (extract_string.check()) {
string str = extract_string();
pEp_identity *_ident = new_identity(str.c_str(), NULL, NULL,
NULL);
pEp_identity *_ident = new_identity(str.c_str(), NULL, NULL, NULL);
if (!_ident)
throw bad_alloc();
free_identity(ident);

1
src/Identity.hh

@ -21,6 +21,7 @@ namespace pEp {
Identity(const Identity& second);
Identity(pEp_identity *ident);
~Identity();
operator pEp_identity *();
void attach(pEp_identity *ident);
pEp_identity *detach();

8
src/pEpmodule.cc

@ -2,14 +2,13 @@
#include <boost/locale.hpp>
#include <string>
#include <sstream>
#include <pEp/pEpEngine.h>
#include "Identity.hh"
#include "Message.hh"
#include "basic_api.hh"
namespace pEp {
namespace PythonAdapter {
using namespace std;
static const char *version_string = "p≡p Python adapter version 0.1";
static string about()
{
string version = string(version_string) + "\np≡p version "
@ -160,6 +159,9 @@ BOOST_PYTHON_MODULE(pEp)
(void(Message::*)(PEP_enc_format)) &Message::enc_format,
"0: unencrypted, 1: inline PGP, 2: S/MIME, 3: PGP/MIME, 4: p≡p format");
def("update_identity", &update_identity, "update identity information");
def("myself", &myself, "ensures that the own identity is being complete");
PyModuleDef * _def = PyModule_GetDef(scope().ptr());
_def->m_free = free_module;

3
src/pEpmodule.hh

@ -1,11 +1,12 @@
#pragma once
#include <boost/python.hpp>
#include "Identity.hh"
#include "Message.hh"
#include <pEp/pEpEngine.h>
namespace pEp {
namespace PythonAdapter {
const char *version_string = "p≡p Python adapter version 0.1";
extern PEP_SESSION session;
}
}

Loading…
Cancel
Save