diff --git a/libretroshare/src/retroshare/rsmsgs.h b/libretroshare/src/retroshare/rsmsgs.h index fdaa88525..2567ee5d9 100644 --- a/libretroshare/src/retroshare/rsmsgs.h +++ b/libretroshare/src/retroshare/rsmsgs.h @@ -48,20 +48,21 @@ #define RS_MSG_OUTBOX 0x03 /* Outbox */ #define RS_MSG_DRAFTBOX 0x05 /* Draftbox */ -#define RS_MSG_NEW 0x0010 /* New */ -#define RS_MSG_TRASH 0x0020 /* Trash */ -#define RS_MSG_UNREAD_BY_USER 0x0040 /* Unread by user */ -#define RS_MSG_REPLIED 0x0080 /* Message is replied */ -#define RS_MSG_FORWARDED 0x0100 /* Message is forwarded */ -#define RS_MSG_STAR 0x0200 /* Message is marked with a star */ +#define RS_MSG_NEW 0x000010 /* New */ +#define RS_MSG_TRASH 0x000020 /* Trash */ +#define RS_MSG_UNREAD_BY_USER 0x000040 /* Unread by user */ +#define RS_MSG_REPLIED 0x000080 /* Message is replied */ +#define RS_MSG_FORWARDED 0x000100 /* Message is forwarded */ +#define RS_MSG_STAR 0x000200 /* Message is marked with a star */ // system message -#define RS_MSG_USER_REQUEST 0x0400 /* user request */ -#define RS_MSG_FRIEND_RECOMMENDATION 0x0800 /* friend recommendation */ +#define RS_MSG_USER_REQUEST 0x000400 /* user request */ +#define RS_MSG_FRIEND_RECOMMENDATION 0x000800 /* friend recommendation */ #define RS_MSG_SYSTEM (RS_MSG_USER_REQUEST | RS_MSG_FRIEND_RECOMMENDATION) -#define RS_MSG_ENCRYPTED 0x1000 /* message is encrypted */ -#define RS_MSG_SIGNATURE_CHECKS 0x2000 /* message was signed, and signature checked */ -#define RS_MSG_SIGNED 0x4000 /* message was signed and signature didn't check */ -#define RS_MSG_LOAD_EMBEDDED_IMAGES 0x8000 /* load embedded images */ +#define RS_MSG_ENCRYPTED 0x001000 /* message is encrypted */ +#define RS_MSG_SIGNATURE_CHECKS 0x002000 /* message was signed, and signature checked */ +#define RS_MSG_SIGNED 0x004000 /* message was signed and signature didn't check */ +#define RS_MSG_LOAD_EMBEDDED_IMAGES 0x008000 /* load embedded images */ +#define RS_MSG_DECRYPTED 0x010000 /* message was previously encrypted, and is now decrypted */ #define RS_CHAT_LOBBY_EVENT_PEER_LEFT 0x01 #define RS_CHAT_LOBBY_EVENT_PEER_STATUS 0x02 diff --git a/libretroshare/src/serialiser/rsmsgitems.h b/libretroshare/src/serialiser/rsmsgitems.h index 70924c7f5..7ddece845 100644 --- a/libretroshare/src/serialiser/rsmsgitems.h +++ b/libretroshare/src/serialiser/rsmsgitems.h @@ -433,6 +433,7 @@ const uint32_t RS_MSG_FLAGS_DISTANT = 0x00008000; const uint32_t RS_MSG_FLAGS_SIGNATURE_CHECKS = 0x00010000; const uint32_t RS_MSG_FLAGS_SIGNED = 0x00020000; const uint32_t RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES = 0x00040000; +const uint32_t RS_MSG_FLAGS_DECRYPTED = 0x00080000; class RsMessageItem: public RsItem { diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc index 4dfa6ad08..f28dd4bd1 100644 --- a/libretroshare/src/services/p3msgservice.cc +++ b/libretroshare/src/services/p3msgservice.cc @@ -1511,6 +1511,9 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi) if (msg->msgFlags & RS_MSG_FLAGS_ENCRYPTED) mi.msgflags |= RS_MSG_ENCRYPTED ; + if (msg->msgFlags & RS_MSG_FLAGS_DECRYPTED) + mi.msgflags |= RS_MSG_DECRYPTED ; + if (msg->msgFlags & RS_MSG_FLAGS_TRASH) { mi.msgflags |= RS_MSG_TRASH; @@ -1603,6 +1606,9 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis) if (msg->msgFlags & RS_MSG_FLAGS_ENCRYPTED) mis.msgflags |= RS_MSG_ENCRYPTED ; + if (msg->msgFlags & RS_MSG_FLAGS_DECRYPTED) + mis.msgflags |= RS_MSG_DECRYPTED ; + if (msg->msgFlags & RS_MSG_FLAGS_SIGNED) mis.msgflags |= RS_MSG_SIGNED ; @@ -2007,6 +2013,7 @@ bool p3MsgService::decryptMessage(const std::string& mId) msgi = *item ; // copy everything msgi.msgId = msgId ; // restore the correct message id, to make it consistent msgi.msgFlags &= ~RS_MSG_FLAGS_ENCRYPTED ; // just in case. + msgi.msgFlags |= RS_MSG_FLAGS_DECRYPTED ; // previousy encrypted msg is now decrypted msgi.PeerId(senders_id.toStdString()) ; for(std::list::iterator it(msgi.msgto.ids.begin());it!=msgi.msgto.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ; diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index 7d6cd68b9..7c9ce35a8 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -1222,7 +1222,12 @@ void MessagesDialog::insertMessages() item[COLUMN_SIGNATURE]->setToolTip(tr("This message is encrypted. Right click to decrypt it.")) ; item[COLUMN_SUBJECT]->setIcon(QIcon(":/images/mail-encrypted-full.png")) ; } - else + else if(it->msgflags & RS_MSG_DECRYPTED) + { + item[COLUMN_SIGNATURE]->setIcon(QIcon(":/images/blue_lock_open.png")) ; + item[COLUMN_SIGNATURE]->setToolTip(tr("This message has been successfully decrypted, and is unsigned.")) ; + item[COLUMN_SUBJECT]->setIcon(QIcon(":/images/mail-decrypted-full.png")) ; + if(it->msgflags & RS_MSG_SIGNED) if(it->msgflags & RS_MSG_SIGNATURE_CHECKS) { @@ -1234,8 +1239,9 @@ void MessagesDialog::insertMessages() item[COLUMN_SIGNATURE]->setIcon(QIcon(":/images/stock_signature_bad.png")) ; item[COLUMN_SIGNATURE]->setToolTip(tr("This message was signed but the signature doesn't check")) ; } - else - item[COLUMN_SIGNATURE]->setIcon(QIcon()) ; + } + else + item[COLUMN_SIGNATURE]->setIcon(QIcon()) ; if (bInsert) { /* add to the list */ diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index 96a2ed415..d593a7bd1 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -5,6 +5,7 @@ images/decrypt-mail.png images/inbox_22.png images/blue_lock.png + images/blue_lock_open.png images/d-chat64.png images/edit_24.png images/stock_signature_bad.png diff --git a/retroshare-gui/src/gui/images/blue_lock.png b/retroshare-gui/src/gui/images/blue_lock.png index 00b98d715..1f29dc001 100644 Binary files a/retroshare-gui/src/gui/images/blue_lock.png and b/retroshare-gui/src/gui/images/blue_lock.png differ diff --git a/retroshare-gui/src/gui/images/blue_lock_open.png b/retroshare-gui/src/gui/images/blue_lock_open.png new file mode 100644 index 000000000..02434339a Binary files /dev/null and b/retroshare-gui/src/gui/images/blue_lock_open.png differ