Feature request - XEP-0373: OpenPGP for XMPP (OX)

Basic implementation of XEP-0373: OpenPGP for XMPP.
https://xmpp.org/extensions/xep-0373.html

Command /ox

Issue: #1331
This commit is contained in:
DebXWoody
2020-06-21 09:43:42 +02:00
committed by Michael Vetter
parent 3afd854dc8
commit 2c94ee5a88
20 changed files with 991 additions and 4 deletions

View File

@@ -90,6 +90,9 @@ chatwin_new(const char *const barejid)
if (prefs_get_boolean(PREF_MAM)) {
iq_mam_request(chatwin);
}
// XEP-0373: OpenPGP for XMPP
chatwin->is_ox = FALSE;
return chatwin;
}
@@ -344,6 +347,8 @@ chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id,
enc_char = prefs_get_pgp_char();
} else if (enc_mode == PROF_MSG_ENC_OMEMO) {
enc_char = prefs_get_omemo_char();
} else if (enc_mode == PROF_MSG_ENC_OX) {
enc_char = prefs_get_ox_char();
} else {
enc_char = strdup("-");
}

View File

@@ -503,6 +503,7 @@ mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *c
ProfWin *window = (ProfWin*)mucwin;
char *mynick = muc_nick(mucwin->roomjid);
// displayed message char
char *ch;
if (mucwin->message_char) {
ch = strdup(mucwin->message_char);
@@ -512,6 +513,8 @@ mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *c
ch = prefs_get_pgp_char();
} else if (enc_mode == PROF_MSG_ENC_OMEMO) {
ch = prefs_get_omemo_char();
} else if (enc_mode == PROF_MSG_ENC_OX) {
ch = prefs_get_omemo_char();
} else {
ch = strdup("-");
}

View File

@@ -439,6 +439,20 @@ _show_privacy(ProfChatWin *chatwin)
return;
}
// XEP-0373: OpenPGP for XMPP
if (chatwin->is_ox) {
wprintw(win, " ");
wattron(win, bracket_attrs);
wprintw(win, "[");
wattroff(win, bracket_attrs);
wattron(win, encrypted_attrs);
wprintw(win, "OX");
wattroff(win, encrypted_attrs);
wattron(win, bracket_attrs);
wprintw(win, "]");
wattroff(win, bracket_attrs);
}
if (chatwin->is_otr) {
wprintw(win, " ");
wattron(win, bracket_attrs);

View File

@@ -155,6 +155,7 @@ typedef struct prof_chat_win_t {
gboolean pgp_send;
gboolean pgp_recv;
gboolean is_omemo;
gboolean is_ox; // XEP-0373: OpenPGP for XMPP
char *resource_override;
gboolean history_shown;
unsigned long memcheck;

View File

@@ -1144,6 +1144,8 @@ win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMes
enc_char = prefs_get_otr_char();
} else if (message->enc == PROF_MSG_ENC_PGP) {
enc_char = prefs_get_pgp_char();
} else if (message->enc == PROF_MSG_ENC_OX) { // XEP-0373: OpenPGP for XMPP
enc_char = prefs_get_ox_char();
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
enc_char = prefs_get_omemo_char();
} else {