Skip to content

Commit

Permalink
Merge pull request #1183 from David-Muhasa/encrypt-auto
Browse files Browse the repository at this point in the history
Autocrypt messages encrept  automatically
  • Loading branch information
kroky authored Aug 21, 2024
2 parents 22da66e + b7e2ffd commit bc9177b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
7 changes: 5 additions & 2 deletions modules/pgp/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,23 @@ protected function output() {
}
$pub_keys = $this->get('pgp_public_keys', array());
$res = '<script type="text/javascript" src="'.WEB_ROOT.'modules/pgp/assets/openpgp.min.js"></script>';
$res .= '<div class="container">';
$res .= '<div class="row justify-content-md-center">';
$res .= '<div class="col col-lg-8">';
$res .= '<div class="pgp_section">';

$res .= '<span class="pgp_sign"><label for="pgp_sign" class="form-label">'.$this->trans('PGP Sign as').'</label>';
$res .= '<select id="pgp_sign" size="1" class="form-control"></select></span>';

if (count($pub_keys) > 0) {
$res .= '<label for="pgp_encrypt" class="form-label">'.$this->trans('PGP Encrypt for').
$res .= '<label for="pgp_encrypt" class="form-label" style="margin-top:1rem">'.$this->trans('PGP Encrypt for').
'</label><select id="pgp_encrypt" size="1" class="form-control"><option disabled selected value=""></option>';
foreach ($pub_keys as $vals) {
$res .= '<option value="'.$vals['key'].'">'.$vals['email'].'</option>';
}
$res .= '</select>';
}
$res .= '<input type="button" class="pgp_apply" value="'.$this->trans('Apply').'" class="btn btn-primary" /></div>'.prompt_for_passhrase($this);
$res .= '</di></di></di></di>';
return $res;
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/pgp/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ $(function() {
if (($('#pgp_encrypt option').length + $('#pgp_sign option').length) == 0) {
$('.pgp_section').hide();
}
$('.pgp_apply').on("click", function() { Hm_Pgp.process_settings(); return false; });
$('.smtp_send_placeholder').on("click", function() { Hm_Pgp.process_settings(); return false; });
}
else if (hm_page_name() == 'message') {
Hm_Ajax.add_callback_hook('ajax_imap_message_content', Hm_Pgp.check_pgp_msg);
Expand Down
18 changes: 14 additions & 4 deletions modules/smtp/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,15 +966,25 @@ protected function output() {
}
}

/**
* @subpackage smtp/output
*/
class Hm_Output_compose_title extends Hm_Output_Module {
protected function output() {
return'<div class="content_title px-3">'.$this->trans('Compose').'</div>';
}
}

/**
* @subpackage smtp/output
*/
class Hm_Output_compose_form_start extends Hm_Output_Module {
protected function output() {
return'<div class="compose_page p-0"><div class="content_title px-3">'.$this->trans('Compose').'</div>'.
'<div class="container"><div class="row justify-content-md-center">'.
'<div class="col col-lg-8">'.
'<form class="compose_form p-4" method="post" action="?page=compose" data-reminder="' . $this->get('enable_attachment_reminder', 0) . '">';
$res = '<div class="container">';
$res .= '<div class="row justify-content-md-center">';
$res .= '<div class="col col-lg-8">';
$res .= '<form class="compose_form p-4" method="post" action="?page=compose" data-reminder="' . $this->get('enable_attachment_reminder', 0) . '">';
return $res;
}
}

Expand Down
3 changes: 2 additions & 1 deletion modules/smtp/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
add_handler('compose', 'load_smtp_servers_from_config', true, 'smtp', 'load_smtp_reply_to_details', 'after');
add_handler('compose', 'add_smtp_servers_to_page_data', true, 'smtp', 'load_smtp_servers_from_config', 'after');
add_handler('compose', 'process_compose_form_submit', true, 'smtp', 'load_smtp_servers_from_config', 'after');
add_output('compose', 'compose_form_start', true, 'smtp', 'content_section_start', 'after');
add_output('compose', 'compose_title', true, 'smtp', 'content_section_start', 'after');
add_output('compose', 'compose_form_start', true, 'smtp', 'compose_title', 'after');
add_output('compose', 'compose_form_draft_list', true, 'smtp', 'compose_form_start', 'before');
add_output('compose', 'compose_form_content', true, 'smtp', 'compose_form_start', 'after');
add_output('compose', 'compose_form_end', true, 'smtp', 'compose_form_content', 'after');
Expand Down

0 comments on commit bc9177b

Please sign in to comment.