Skip to content

Commit

Permalink
Send scheduled messages via ajax
Browse files Browse the repository at this point in the history
  • Loading branch information
josaphatim committed Jan 22, 2025
1 parent 95fdb6a commit 0b49229
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/imap/hm-imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ public function get_message_list($uids, $raw=false, $include_content_body = fals
$status = $this->check_response($res, true);
$tags = array('X-GM-MSGID' => 'google_msg_id', 'X-GM-THRID' => 'google_thread_id', 'X-GM-LABELS' => 'google_labels', 'UID' => 'uid', 'FLAGS' => 'flags', 'RFC822.SIZE' => 'size', 'INTERNALDATE' => 'internal_date');
$junk = array('X-AUTO-BCC', 'MESSAGE-ID', 'REFERENCES', 'X-SNOOZED', 'X-SCHEDULE', 'X-PROFILE-ID', 'X-DELIVERY', 'LIST-ARCHIVE', 'SUBJECT', 'FROM', 'CONTENT-TYPE', 'TO', '(', ')', ']', 'X-PRIORITY', 'DATE');
$flds = array('x-auto-bcc' => 'x_auto_bcc', 'message-id' => 'message_id', 'references' => 'references', 'x-snoozed' => 'x_snoozed', 'x-schedule' => 'x_schedule', 'x-profile-id' => 'x_profile_id', 'x-delivery' => 'x_delivery', 'list-archive' => 'list_archive', 'date' => 'date', 'from' => 'from', 'to' => 'to', 'subject' => 'subject', 'content-type' => 'content_type', 'x-priority' => 'x_priority');
$flds = array('x-auto-bcc' => 'x_auto_bcc', 'message-id' => 'message_id', 'references' => 'references', 'x-snoozed' => 'x_snoozed', 'x-schedule' => 'x_schedule', 'x-profile-id' => 'x_profile_id', 'x-delivery' => 'x_delivery', 'list-archive' => 'list_archive', 'date' => 'date', 'from' => 'from', 'to' => 'to', 'subject' => 'subject', 'content-type' => 'content_type', 'x-priority' => 'x_priority', 'body' => 'content_body');
$headers = array();

foreach ($res as $n => $vals) {
Expand Down
2 changes: 0 additions & 2 deletions modules/imap/js_modules/route_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ function applyImapMessageListPageHandlers(routeParams) {
imap_setup_snooze();
imap_setup_tags();

Hm_Message_List.set_row_events();

processNextActionDate();

if (window.inlineMessageMessageListAndSearchPageHandler) inlineMessageMessageListAndSearchPageHandler(routeParams);
Expand Down
19 changes: 19 additions & 0 deletions modules/smtp/js_modules/route_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,23 @@ function applySmtpComposePageHandlers() {

if (window.pgpComposePageHandler) pgpComposePageHandler();
if (window.profilesComposePageHandler) profilesComposePageHandler();

var scheduled_msg_count = 0;
var sendScheduledMessages = function() {
Hm_Ajax.request(
[{'name': 'hm_ajax_hook', 'value': 'ajax_send_scheduled_messages'}],
function(res) {
scheduled_msg_count = res.scheduled_msg_count;
},
);
}

// sendScheduledMessages();
// setInterval(sendScheduledMessages, 60000);
// window.onbeforeunload = () => {
// if (scheduled_msg_count == 0) {
// return;
// }
// return sprintf(hm_trans("You have %d scheduled messages that won\'t be executed if you quit"), scheduled_msg_count);
// };
}

0 comments on commit 0b49229

Please sign in to comment.