Browse Source

Fixing integration with Qt5

master
David Lanzendörfer 1 month ago
parent
commit
576be0e7c2
7 changed files with 116 additions and 40 deletions
  1. +47
    -8
      CMakeLists.txt
  2. +15
    -0
      pep-dbus-adapter.cpp
  3. +39
    -0
      pep-dbus-adapter.h
  4. +3
    -4
      pep-introspect.xml
  5. +4
    -15
      pep-server.cpp
  6. +2
    -12
      pep-server.h
  7. +6
    -1
      tests.cpp

+ 47
- 8
CMakeLists.txt View File

@ -1,8 +1,5 @@
project(pEpDBusAdapter)
string( REPLACE "fno-exceptions" "fexceptions" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string( REPLACE "fno-exceptions" "fexceptions" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
include_directories(${PROJECT_SOURCE_DIR}/types)
############################ Server glue ###########################
@ -28,24 +25,66 @@ set_source_files_properties(${PROJECT_BINARY_DIR}/pep-client-glue.h PROPERTIES G
#######################
add_library(pEpDBusAdapterClient SHARED pep-client.cpp ${PROJECT_BINARY_DIR}/pep-client-glue.h)
target_link_libraries(pEpDBusAdapterClient pEpEngine dbus-c++-1)
target_link_libraries(pEpDBusAdapterClient
pEpEngine
pEpAdapter
dbus-c++-1
sequoia_ffi
sequoia_openpgp_ffi
)
set_target_properties(pEpDBusAdapterClient PROPERTIES
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0
)
add_library(pEpDBusAdapterServer SHARED pep-server.cpp ${PROJECT_BINARY_DIR}/pep-server-glue.h)
target_link_libraries(pEpDBusAdapterServer pEpEngine dbus-c++-1)
add_library(pEpDBusAdapter SHARED pep-dbus-adapter.cpp ${PROJECT_BINARY_DIR}/pep-server-glue.h)
target_link_libraries(pEpDBusAdapter
pEpEngine
pEpAdapter
pEpMIME
dbus-c++-1
sequoia_ffi
sequoia_openpgp_ffi
)
set_target_properties(pEpDBusAdapter PROPERTIES
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0
)
add_library(pEpDBusAdapterServer SHARED pep-server.cpp)
target_link_libraries(pEpDBusAdapterServer
pEpDBusAdapter
pEpAdapter
pEpEngine
dbus-c++-1
sequoia_ffi
sequoia_openpgp_ffi
)
set_target_properties(pEpDBusAdapterServer PROPERTIES
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0
)
add_executable(pep-dbus-server server.cpp)
target_link_libraries(pep-dbus-server pEpDBusAdapterServer dbus-c++-1 sequoia_ffi sequoia_openpgp_ffi)
target_link_libraries(pep-dbus-server
pEpDBusAdapter
pEpDBusAdapterServer
pEpEngine
dbus-c++-1
sequoia_ffi
sequoia_openpgp_ffi
)
add_executable(tests tests.cpp)
target_link_libraries(tests pEpDBusAdapterClient dbus-c++-1 sequoia_ffi sequoia_openpgp_ffi)
target_link_libraries(tests
pEpEngine
pEpDBusAdapterClient
dbus-c++-1
sequoia_ffi
sequoia_openpgp_ffi
)
configure_file(security.pep.service.in ${CMAKE_CURRENT_BINARY_DIR}/security.pep.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/security.pep.service


+ 15
- 0
pep-dbus-adapter.cpp View File

@ -0,0 +1,15 @@
#include "pep-dbus-adapter.h"
pEp::pEpDBusAdapter::pEpDBusAdapter() {}
pEp::pEpDBusAdapter::~pEpDBusAdapter() {}
void pEp::pEpDBusAdapter::decrypt_message(const std::string& src, int32_t& status, std::string& dst, std::vector< std::string >& keylist, int32_t& flags)
{
bool has_possible_pEp_msg;
std::cout << "Trying to decrypt the data" << std::endl;
message **srcm;
::mime_decode_message(src.c_str(), src.size(), srcm, &has_possible_pEp_msg );
//status = ::decrypt_message( mSession, srcm, dstm, keylist, rating, flags );
}

+ 39
- 0
pep-dbus-adapter.h View File

@ -0,0 +1,39 @@
#ifndef PEP_DBUS_ADAPTER_H
#define PEP_DBUS_ADAPTER_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <iostream>
#include <vector>
#include <pEp/pEpEngine.h>
#include <pEp/message_cache.hh>
#include <pEp/mime.h>
#include "pep-server-glue.h"
namespace pEp {
class pEpDBusAdapter
: public security::pep_adaptor
{
public:
pEpDBusAdapter();
~pEpDBusAdapter();
// Message API
void decrypt_message(const std::string& src, int32_t& status, std::string& dst, std::vector< std::string >& keylist, int32_t& flags);
private:
PEP_SESSION mSession;
};
}
#endif

+ 3
- 4
pep-introspect.xml View File

@ -1,13 +1,12 @@
<?xml version="1.0" ?>
<node name="/security/pep/">
<node>
<interface name="security.pep">
<method name="decrypt_message">
<arg direction="out" name="status" type="i" />
<arg direction="out" name="dst" type="s" />
<arg direction="in" name="src" type="s" />
<arg direction="in" name="keylist" type="as" />
<arg direction="in" name="rating" type="i" />
<arg direction="in" name="flags" type="i"/>
<arg direction="out" name="keylist" type="as" />
<arg direction="out" name="flags" type="i"/>
</method>
</interface>
</node>

+ 4
- 15
pep-server.cpp View File

@ -7,25 +7,14 @@
#include <stdio.h>
#include <limits.h>
#include <pEp/message_cache.hh>
#include "pep-server.h"
pEp::Server::Server(DBus::Connection &connection)
: DBus::ObjectAdaptor(connection, "/security/pep")
pEp::Server::Server(DBus::Connection &connection) :
DBus::ObjectAdaptor(connection, "/security/pep"),
pEpDBusAdapter()
{
}
pEp::Server::~Server()
{
}
{}
void pEp::Server::decrypt_message(const std::string& src, const std::vector< std::string >& keylist, const int32_t& rating, const int32_t& flags, int32_t& status, std::string& dst)
{
bool has_possible_pEp_msg;
std::cout << "Trying to decrypt the data" << std::endl;
message **srcm;
//::pEp::mime_decode_message(src.c_str(), src.size(), srcm, &has_possible_pEp_msg );
//status = ::decrypt_message( mSession, srcm, dstm, keylist, rating, flags );
}

+ 2
- 12
pep-server.h View File

@ -3,27 +3,17 @@
#include <dbus-c++/dbus.h>
#include "pep-server-glue.h"
struct _pEpSession;
#include "pep-dbus-adapter.h"
namespace pEp {
class Server
: public security::pep_adaptor,
: public pEpDBusAdapter,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
{
public:
explicit Server(DBus::Connection &connection);
~Server();
// Message API
void decrypt_message(const std::string& src, const std::vector< std::string >& keylist, const int32_t& rating, const int32_t& flags, int32_t& status, std::string& dst);
private:
struct _pEpSession* mSession;
};
}


+ 6
- 1
tests.cpp View File

@ -21,8 +21,13 @@ int main()
pEpDBusEncryptionFlags flags;
pEpDBusStatus status;
src.clear();*/
//client.decrypt_message(src,keylist,rating,flags,status,dst);
std::string src;
std::vector< std::string > keylist;
int32_t flags;
int32_t status;
std::string dst;
//client.decrypt_message(src, keylist, &flags, status, dst);
return 0;
}

Loading…
Cancel
Save