25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +01:00

Added a protocol for a client to send the number of local unread messages

Conflicts:

	src/ejabberd_c2s.erl
This commit is contained in:
Alexey Shchepin 2010-10-25 08:46:38 +02:00
parent 6134c67df4
commit aea394861d
2 changed files with 15 additions and 2 deletions

View File

@ -2772,7 +2772,7 @@ send_out_of_reception_message(StateData, From, To,
StateData#state.jid,
StateData#state.oor_notification,
Msg,
Unread,
Unread + StateData#state.oor_unread_client,
Sound,
AppID,
SFrom]),
@ -3145,6 +3145,18 @@ process_push_iq(From, To,
oor_send_body = all},
NSD2 = start_keepalive_timer(NSD1),
{{result, []}, NSD2};
{xmlelement, "badge", _, _} ->
SBadge = xml:get_path_s(El, [{attr, "unread"}]),
Badge =
case catch list_to_integer(SBadge) of
B when is_integer(B) ->
B;
_ ->
0
end,
NSD1 =
StateData#state{oor_unread_client = Badge},
{{result, []}, NSD1};
_ ->
{{error, ?ERR_BAD_REQUEST}, StateData}
end,

View File

@ -78,8 +78,9 @@
oor_appid = "",
oor_unread = 0,
oor_unread_users = ?SETS:new(),
oor_unread_client = 0,
oor_offline = false,
ack_enabled = false,
ack_counter = 0,
ack_queue = queue:new(),
ack_timer}).
ack_timer}).