mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/mod_offline.erl: Returns an error message to sender when
message is discarded due to quota (EJAB-314). SVN Revision: 871
This commit is contained in:
parent
915d94b0dc
commit
db957c4295
@ -1,3 +1,8 @@
|
|||||||
|
2007-08-13 Mickael Remond <mickael.remond@process-one.net>
|
||||||
|
|
||||||
|
* src/mod_offline.erl: Returns an error message to sender when
|
||||||
|
message is discarded due to quota (EJAB-314).
|
||||||
|
|
||||||
2007-08-12 Mickael Remond <mickael.remond@process-one.net>
|
2007-08-12 Mickael Remond <mickael.remond@process-one.net>
|
||||||
|
|
||||||
* src/odbc/ejabberd_odbc.erl: UTF-8 support for MySQL5 (EJAB-318).
|
* src/odbc/ejabberd_odbc.erl: UTF-8 support for MySQL5 (EJAB-318).
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
%% TODO: Move this part as a module config file parameter:
|
%% TODO: Move this part as a module config file parameter:
|
||||||
%% Can be an integer > 0 or infinity:
|
%% Can be an integer > 0 or infinity:
|
||||||
-define(MAX_OFFLINE_MSGS, infinity).
|
%%-define(MAX_OFFLINE_MSGS, infinity).
|
||||||
|
-define(MAX_OFFLINE_MSGS, 5).
|
||||||
|
|
||||||
start(Host, _Opts) ->
|
start(Host, _Opts) ->
|
||||||
mnesia:create_table(offline_msg,
|
mnesia:create_table(offline_msg,
|
||||||
@ -69,8 +70,7 @@ loop() ->
|
|||||||
end,
|
end,
|
||||||
if
|
if
|
||||||
Count > ?MAX_OFFLINE_MSGS ->
|
Count > ?MAX_OFFLINE_MSGS ->
|
||||||
%% TODO: Warn that messages have been discarded
|
discard_warn_sender(Msgs);
|
||||||
ok;
|
|
||||||
true ->
|
true ->
|
||||||
if
|
if
|
||||||
Len >= ?OFFLINE_TABLE_LOCK_THRESHOLD ->
|
Len >= ?OFFLINE_TABLE_LOCK_THRESHOLD ->
|
||||||
@ -405,3 +405,19 @@ update_table() ->
|
|||||||
?INFO_MSG("Recreating offline_msg table", []),
|
?INFO_MSG("Recreating offline_msg table", []),
|
||||||
mnesia:transform_table(offline_msg, ignore, Fields)
|
mnesia:transform_table(offline_msg, ignore, Fields)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
%% Helper functions:
|
||||||
|
|
||||||
|
%% Warn senders that their messages have been discarded:
|
||||||
|
discard_warn_sender(Msgs) ->
|
||||||
|
lists:foreach(
|
||||||
|
fun(#offline_msg{from=From, to=To, packet=Packet}) ->
|
||||||
|
ErrText = "Your contact offline message queue is full. The message has been discarded.",
|
||||||
|
Lang = xml:get_tag_attr_s("xml:lang", Packet),
|
||||||
|
Err = jlib:make_error_reply(
|
||||||
|
Packet, ?ERRT_RESOURCE_CONSTRAINT(Lang, ErrText)),
|
||||||
|
ejabberd_router:route(
|
||||||
|
To,
|
||||||
|
From, Err)
|
||||||
|
end, Msgs).
|
||||||
|
Loading…
Reference in New Issue
Block a user