Comparison

mod_push2/mod_push2.lua @ 6035:9b50ee822638

mod_push2: fix push during smacks hibernate
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Fri, 01 Nov 2024 11:08:26 -0500
parent 6034:b4bf44765ce6
child 6185:c887820cd884
comparison
equal deleted inserted replaced
6034:b4bf44765ce6 6035:9b50ee822638
383 handle_notify_request(event.stanza, node, notify_push_services, true); 383 handle_notify_request(event.stanza, node, notify_push_services, true);
384 end, 1); 384 end, 1);
385 385
386 local function process_stanza_queue(queue, session, queue_type) 386 local function process_stanza_queue(queue, session, queue_type)
387 if not session.push_registration_id then return; end 387 if not session.push_registration_id then return; end
388 local user_push_services = {[session.push_registration_id] = session.push_settings};
389 local notified = { unimportant = false; important = false } 388 local notified = { unimportant = false; important = false }
390 for i=1, #queue do 389 for i=1, #queue do
391 local stanza = queue[i]; 390 local stanza = queue[i];
392 -- fast ignore of already pushed stanzas 391 -- fast ignore of already pushed stanzas
393 if stanza and not (stanza._push_notify2 and stanza._push_notify2[session.push_registration_id]) then 392 if stanza and not (stanza._push_notify2 and stanza._push_notify2[session.push_registration_id]) then
394 local node = get_push_settings(stanza, session); 393 local node, all_push_services = get_push_settings(stanza, session)
394 local user_push_services = {[session.push_registration_id] = all_push_services[session.push_registration_id]}
395 local stanza_type = "unimportant"; 395 local stanza_type = "unimportant";
396 if is_important(stanza) then stanza_type = "important"; end 396 if is_important(stanza) then stanza_type = "important"; end
397 if not notified[stanza_type] then -- only notify if we didn't try to push for this stanza type already 397 if not notified[stanza_type] then -- only notify if we didn't try to push for this stanza type already
398 if handle_notify_request(stanza, node, user_push_services, false) ~= 0 then 398 if handle_notify_request(stanza, node, user_push_services, false) ~= 0 then
399 if session.hibernating and not session.first_hibernated_push then 399 if session.hibernating and not session.first_hibernated_push then