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,7 +251,11 @@ resend_badge(To) ->
Host, Host,
0, 0,
[To#jid.luser, Host]), [To#jid.luser, Host]),
Badge = integer_to_list(Offline + 1), if
Offline == 0 ->
ok;
true ->
Badge = integer_to_list(Offline),
DeviceID = erlang:integer_to_list(ID, 16), DeviceID = erlang:integer_to_list(ID, 16),
Packet1 = Packet1 =
{xmlelement, "message", [], {xmlelement, "message", [],
@ -261,6 +265,7 @@ resend_badge(To) ->
{xmlelement, "badge", [], {xmlelement, "badge", [],
[{xmlcdata, Badge}]}]}]}, [{xmlcdata, Badge}]}]}]},
ejabberd_router:route(To, ServiceJID, Packet1) ejabberd_router:route(To, ServiceJID, Packet1)
end
end; end;
false -> false ->
{error, "mod_applepush is not loaded"} {error, "mod_applepush is not loaded"}