25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Don't resend badge if there are no offline messages

This commit is contained in:
Alexey Shchepin 2010-09-13 15:46:39 +03:00
parent 73f7b2ba38
commit 261acfce54

View File

@ -251,16 +251,21 @@ resend_badge(To) ->
Host, Host,
0, 0,
[To#jid.luser, Host]), [To#jid.luser, Host]),
Badge = integer_to_list(Offline + 1), if
DeviceID = erlang:integer_to_list(ID, 16), Offline == 0 ->
Packet1 = ok;
{xmlelement, "message", [], true ->
[{xmlelement, "push", [{"xmlns", ?NS_P1_PUSH}], Badge = integer_to_list(Offline),
[{xmlelement, "id", [], DeviceID = erlang:integer_to_list(ID, 16),
[{xmlcdata, DeviceID}]}, Packet1 =
{xmlelement, "badge", [], {xmlelement, "message", [],
[{xmlcdata, Badge}]}]}]}, [{xmlelement, "push", [{"xmlns", ?NS_P1_PUSH}],
ejabberd_router:route(To, ServiceJID, Packet1) [{xmlelement, "id", [],
[{xmlcdata, DeviceID}]},
{xmlelement, "badge", [],
[{xmlcdata, Badge}]}]}]},
ejabberd_router:route(To, ServiceJID, Packet1)
end
end; end;
false -> false ->
{error, "mod_applepush is not loaded"} {error, "mod_applepush is not loaded"}