Browse Source

Starting to fill the data structure

The MIME function which generates a string from the struct still
crashes, probably due to an empty string list.
master
David Lanzendörfer 1 year ago
parent
commit
fa05243265
5 changed files with 73 additions and 22 deletions
  1. +2
    -2
      CMakeLists.txt
  2. +1
    -1
      messageviewerplugin/CMakeLists.txt
  3. +55
    -3
      messageviewerplugin/pephelpers.cpp
  4. +14
    -15
      messageviewerplugin/viewerpluginpepinterface.cpp
  5. +1
    -1
      pEpDBusAdapter

+ 2
- 2
CMakeLists.txt View File

@ -15,8 +15,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF)
set(CMAKE_CXX_FLAGS_RELEASE "-g -fexceptions")
set(CMAKE_CXX_FLAGS_DEBUG "-g -fexceptions")
set(CMAKE_CXX_FLAGS_RELEASE "-g -fpermissive -fexceptions")
set(CMAKE_CXX_FLAGS_DEBUG "-g -fpermissive -fexceptions")
set(PIM_VERSION "5.16.2")
set(KF5_MIN_VERSION "5.75.0")


+ 1
- 1
messageviewerplugin/CMakeLists.txt View File

@ -23,7 +23,7 @@ target_link_libraries(messageviewer_pepplugin
KF5::AkonadiWidgets
KF5::KontactInterface
dbus-c++-1
pEpDBusAdapterTypes
pEpDBusAdapterClient
pEpMIME
)

+ 55
- 3
messageviewerplugin/pephelpers.cpp View File

@ -11,11 +11,63 @@ void pEpViewerInterface::convert_pEpMessage_to_mMessage(message m)
message pEpViewerInterface::convert_mMessage_to_pEpMessage()
{
message m;
pEp_identity from;
from.address=mMessage->from()->asUnicodeString().toLatin1().data();
m.from=&from;
return m;
m.dir=0;
m.id=""; // UTF-8 string of message ID
m.shortmsg=""; // UTF-8 string of short message
m.longmsg=""; // UTF-8 string of long message (plain)
m.longmsg_formatted=""; // UTF-8 string of long message (formatted)
bloblist_t attachments;
m.attachments=&attachments; // blobs with attachements
m.rawmsg_ref=""; // reference to raw message data
m.rawmsg_size=0; // size of raw message data
timestamp sent;
m.sent=&sent; // when the message is sent
timestamp recv;
m.recv=&recv; // when the message is received
pEp_identity from;
m.from=&from; // whom the message is from
m.from->address=mMessage->from()->asUnicodeString().toLatin1().data();
identity_list to;
m.to=&to; // whom the message is to
pEp_identity recv_by;
m.recv_by=&recv_by; // via which identity the message is received
identity_list cc;
m.cc=&cc; // whom a CC is being sent
identity_list bcc;
m.bcc=&bcc; // whom a BCC is being sent
identity_list reply_to;
m.reply_to=&reply_to; // where a reply should go to
stringlist_t in_reply_to;
m.in_reply_to=&in_reply_to; // list of UTF-8 strings with MessageIDs of refering messages
/*
struct _message *refering_msg_ref; // reference to refering message
stringlist_t *references; // list of UTF-8 strings with references
struct _message_ref_list *refered_by; // list of references to messages being
// refered
stringlist_t *keywords; // list of UTF-8 strings with keywords
char *comments; // UTF-8 string with comments
stringpair_list_t *opt_fields; // optional fields
PEP_enc_format enc_format; // format of encrypted data
char* _sender_fpr; // INTERNAL USE ONLY - fingerprint of
// sending signer.
// (read_only to the outside)
*/
/* QByteArray type;
QByteArray pgpText;


+ 14
- 15
messageviewerplugin/viewerpluginpepinterface.cpp View File

@ -33,14 +33,10 @@
#include <AkonadiCore/ServerManager>
// The pEp engine
#include <pEp/mime.h>
#include <pEp/message.h>
// The pEp D-Bus binding
#include <pEpDBusAdapter/types/pEpDBusMessage.h>
#include <pEpDBusAdapter/types/pEpDBusStringList.h>
#include <pEpDBusAdapter/types/pEpDBusRating.h>
#include <pEpDBusAdapter/types/pEpDBusEncryptionFlags.h>
#include <pEpDBusAdapter/types/pEpDBusStatus.h>
#include <pEpDBusAdapter/pep-client.h>
DBus::BusDispatcher dispatcher;
@ -97,16 +93,19 @@ bool pEpViewerInterface::isApEpMessage(KMime::Content *content)
void pEpViewerInterface::decryptMessage()
{
message m = convert_mMessage_to_pEpMessage();
pEpDBusMessage src, dst;
pEpDBusStringList keylist;
pEpDBusRating rating;
pEpDBusEncryptionFlags flags;
pEpDBusStatus status;
src << m;
//m_pEpDBusAdapter->decrypt_message(src,keylist,rating,flags,status,dst);
dst >> m;
convert_pEpMessage_to_mMessage(m);
message m;
char *ms;
std::vector<std::string> keylist;
int flags, status, rating;
std::string src, dst;
// fill the pEp message struct and turn it into a string
m = convert_mMessage_to_pEpMessage();
::mime_encode_message(&m, true, &ms, true);
src = std::string(ms);
m_pEpDBusAdapter->decrypt_message(src,keylist,rating,flags,status,dst);
//convert_pEpMessage_to_mMessage(m);
//mMessage->contentType()->setMimeType(QByteArray("text/plain"));
}


+ 1
- 1
pEpDBusAdapter

@ -1 +1 @@
Subproject commit 515f8337856a7f32e9a6200946b9a14534ecaf8c
Subproject commit 8c79c84bcfb82c4097bead4c568aefb292c93d89

Loading…
Cancel
Save