diff --git a/ChangeLog b/ChangeLog
index c03ba622c..b7c0329aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2008-09-16 Jean-Sébastien Pédron
+
+ Merge from trunk (r1457 to r1563).
+
+2008-09-15 Badlop
+
+ * doc/guide.tex: Fix explanation of mod_muc's anonymous
+ option. Make clear that an ejabberd_service can only serve a
+ single external component. Provide Mnesia directory when setting
+ clustering (thanks to Matthew Reilly)
+
+2008-09-12 Badlop
+
+ * src/web/ejabberd_http.hrl: Provide Host, Port, Headers and
+ Transfer Protocol in request (thanks to Eric Cestari)(EJAB-560)
+ * src/web/ejabberd_http.erl: Likewise
+
+2008-09-02 Badlop
+
+ * doc/guide.tex: Fix mod_proxy configuration example
+ * doc/guide.html: Likewise
+
+2008-09-02 Mickael Remond
+
+ * src/odbc/mssql2000.sql: Script for MSSQL 2000
+ * src/odbc/mssql2005.sql: Script for MSSQL 2005 (EJAB-535)
+ * src/odbc/mssql.sql: removed
+
2008-08-27 Jean-Sébastien Pédron
* src/mod_roster.erl: Remove a debugging io:format/2.
@@ -5,8 +33,14 @@
* src/mod_caps.erl: handle_cast({disco_response, ...}, ...) now
receives an #iq record: update the code to handle this.
- * src/mod_vcard.erl: VCard are now stored as #xmlel. Mnesia tables are
- converted during startup.
+ * src/mod_vcard.erl: VCards are now stored as #xmlel. Mnesia tables
+ are converted during startup.
+
+2008-08-27 Christophe Romain
+
+ * src/mod_pubsub/mod_pubsub.erl: send last published events now
+ supports PEP events from unavailable users nodes (EJAB-698)
+ * src/ejabberd_c2s.erl: Likewise
2008-08-26 Jean-Sébastien Pédron
@@ -35,6 +69,81 @@
binary instead of an empty string, for consistency's sake. Fix some
bugs.
+2008-08-26 Badlop
+
+ * doc/release_notes_2.0.2.txt: Update for final release
+
+ * doc/guide.tex: Windows binary installer requires MSVC++ 5
+ * doc/guide.html: Likewise
+
+2008-08-26 Christophe Romain
+
+ * src/mod_pubsub/mod_pubsub.erl: get_items bugfix (EJAB-716)
+
+2008-08-25 Christophe Romain
+
+ * src/mod_privacy_odbc.erl: Prevent case_clause error when
+ ejabber_odbc:sql_query returns {error, Reason}
+ * src/mod_vcard_odbc.erl: Likewise
+ * src/mod_last_odbc.erl: Likewise
+ * src/mod_offline_odbc.erl: Likewise
+
+2008-08-25 Badlop
+
+ * src/ejabberd_check.erl: Detect correctly MSSQL and ODBC
+ configuration (EJAB-710)
+
+2008-08-24 Geoff Cant
+
+ * src/mod_mud/mod_muc_room.erl: is_visitor/2 fix - use get_role
+ not get_affiliation
+
+2008-08-22 Badlop
+
+ * src/ejabberd_router.erl: Fix call to mnesia match_object
+
+2008-08-21 Badlop
+
+ * doc/guide.tex: Fix names of chatroom to room, user to occupant
+ * doc/guide.html: Likewise
+
+2008-08-18 Badlop
+
+ * src/mod_muc/mod_muc_log.erl: MUC log files options: plaintext
+ format; filename with only room name (EJAB-596)
+ * doc/guide.tex: Document both options
+ * doc/guide.html: Likewise
+
+ * src/mod_register.erl: Change password using mod_register always
+ returns success regardless of real result (EJAB-723)
+ * src/ejabberd_auth.erl: Likewise
+ * src/ejabberd_auth_external.erl: Likewise
+ * src/ejabberd_auth_internal.erl: Likewise
+ * src/ejabberd_auth_odbc.erl: Likewise
+
+2008-08-18 Christophe Romain
+
+ * src/mod_pubsub/node_dispatch.erl: Fix call to unexported function
+ nodetree_default:get_subnodes/2
+
+2008-08-17 Badlop
+
+ * contrib/extract_translations/extract_translations.erl: Use
+ Gettext PO for translators, export to ejabberd MSG (EJAB-648)
+ * contrib/extract_translations/prepare-translation.sh: Likewise
+ * doc/guide.tex: Likewise
+ * doc/guide.html: Likewise
+ * src/Makefile.in: New option 'make translations'
+ * src/msgs/ejabberd.pot: Template translation file
+ * src/msgs/*.po: Generated from old MSG files
+ * src/msgs/*.msg: Automatic exported from PO files
+
+2008-08-16 Badlop
+
+ * src/msgs/sv.msg: Fixed formatting typos
+
+ * src/gen_mod.erl: Export stop_module_keep_config/2 (EJAB-706)
+
2008-08-14 Jean-Sébastien Pédron
* translate.erl (ascii_tolower): Accept 'undefined' as a language and
@@ -49,6 +158,25 @@
src/mod_disco.erl, src/mod_last.erl: Convert to the new #iq record
from Exmpp.
+2008-08-13 Badlop
+
+ * doc/guide.tex: Explain that LDAP is read-only storage (thanks to
+ Evgeniy Khramtsov)
+ * doc/guide.html: Likewise
+
+2008-08-10 Badlop
+
+ * src/msgs/eo.msg: Updated (thanks to Andreas van Cranenburgh)
+ * src/msgs/nl.msg: Updated (thanks to Andreas van Cranenburgh)
+ * src/msgs/sk.msg: Updated (thanks to Marek Becka)
+ * src/msgs/sv.msg: Updated (thanks to Thore Alstromer and Heysan)
+
+2008-08-09 Badlop
+
+ * src/ejabberd_service.erl: Fix XEP-0114 compliance: define xmlns
+ in header of error response; include in response the JID of served
+ component not server (thanks to Sergei Golovan)(EJAB-717)
+
2008-08-06 Jean-Sébastien Pédron
* src/mod_offline.erl, src/mod_offline_odbc.erl, src/mod_echo.erl,
@@ -65,11 +193,131 @@
src/mod_echo.erl, src/mod_offline.erl, src/mod_roster.erl,
src/mod_vcard.erl: Update to use the new names used in exmpp_jid.
+2008-08-04 Jerome Sautret
+
+ * src/odbc/ejabberd_odbc.erl: Restart the database connection when
+ it's lost or it reaches timeout with MySQL. Set transaction isolation level
+ to SERIALIZABLE when establishing connection to MySQL.
+
+2008-08-01 Badlop
+
+ * doc/release_notes_2.0.2.txt: Added for ejabberd 2.0.2-beta1
+
+ * src/web/ejabberd_http.erl: Temporary solution for check of
+ packet size when HTTPS (EJAB-611)(EJAB-507)(EJAB-574)
+
+2008-07-31 Badlop
+
+ * src/msgs/uk.msg: Fix: each string in a single line
+ * src/msgs/wa.msg: Likewise
+
+ * src/msgs/es.msg: Fix typo
+ * src/msgs/gl.msg: Likewise
+ * src/msgs/pt-br.msg: Likewise
+
+ * src/msgs/zh.msg: Fix some translations (thanks to Zhan Caibao)
+
+ * src/msgs/ca.msg: Updated (thanks to Badlop)
+ * src/msgs/cs.msg: Updated (thanks to Lukas Poliuvk)
+ * src/msgs/de.msg: Updated (thanks to Nikolaus Polak)
+ * src/msgs/es.msg: Updated (thanks to Badlop)
+ * src/msgs/fr.msg: Updated (thanks to Christophe Romain)
+ * src/msgs/it.msg: Updated (thanks to Luca Brivio)
+ * src/msgs/ja.msg: Updated (thanks to Tsukasa Hamano)
+ * src/msgs/no.msg: Updated (thanks to Stian B. Barmen)
+ * src/msgs/pl.msg: Updated (thanks to Zbyszek Zolkiewski)
+ * src/msgs/pt-br.msg: Updated (thanks to Otavio Fernandes)
+ * src/msgs/ru.msg: Updated (thanks to Evgeniy Khramtsov)
+ * src/msgs/tr.msg: Updated (thanks to Doruk Fisek)
+ * src/msgs/uk.msg: Updated (thanks to Ruslan Rakhmanin)
+ * src/msgs/wa.msg: Updated (thanks to Pablo Saratxaga)
+ * src/msgs/zh.msg: Updated (thanks to Shelley Shyan)
+
+ * README: Update location where mnesia, ebin and priv directories
+ are installed; install headers and doc (EJAB-696)
+
+ * doc/guide.tex: Update Process-one name to ProcessOne (EJAB-708)
+ * doc/guide.html: Likewise
+ * doc/api/overview.edoc: Likewise
+ * src/*/*.erl: Likewise
+ * src/*/*.hrl: Likewise
+ * src/*/*.c: Likewise
+ * src/odbc/*.sql: Likewise
+
+2008-07-30 Badlop
+
+ * src/mod_muc/mod_muc_room.erl: Support Reasons for all
+ affiliation and role changes (EJAB-306)
+
+ * src/gen_mod.erl: When ejabberd is kindly stopped, don't forget
+ modules configuration (EJAB-706)
+ * src/ejabberd_app.erl: Likewise
+
+2008-07-28 Badlop
+
+ * doc/guide.tex: Document how to get error message when ejabberd
+ crash dumps at start (EJAB-660)
+ * doc/guide.html: Likewise
+
2008-07-25 Jean-Sébastien Pédron
* src/adhoc.erl, src/mod_configure.erl, src/mod_announce.erl,
src/mod_adhoc.erl, src/gen_iq_handler.erl: Convert to exmpp.
+2008-07-25 Christophe Romain
+
+ * src/mod_pubsub/mod_pubsub.erl: Speedup startup with many pubsub
+ nodes (EJAB-669)
+ * src/mod_pubsub/nodetree_default.erl: Likewise
+
+2008-07-24 Badlop
+
+ * doc/guide.tex: Include example PAM configuration file
+ ejabberd.pam (thanks to Evgeniy Khramtsov)(EJAB-704)
+ * doc/guide.html: Likewise
+
+ * src/mod_proxy65/mod_proxy65_lib.erl: Send protocol compliant
+ SOCKS5 reply; this breaks support of uncompliant Psi<0.10 (thanks
+ to Felix Geyer)(EJAB-632)
+ * src/mod_proxy65/mod_proxy65_stream.erl: Likewise
+
+ * src/mod_register.erl: When a registration is blocked due to IP
+ limitation, return description in error stanza (EJAB-692)
+
+2008-07-24 Christophe Romain
+
+ * src/mod_pubsub/mod_pubsub.erl: Allow owner to subscribe/get its own
+ node (EJAB-705)
+
+2008-07-24 Badlop
+
+ * doc/guide.tex: Document room options allow_visitor_nickchange
+ and allow_visitor_status (EJAB-624)
+ * doc/guide.html: Likewise
+
+2008-07-23 Geoff Cant
+
+ * src/mod_muc/mod_muc_room.erl: new room options,
+ allow_visitor_presence and allow_visitor_nickchange to
+ block/enable visitors to broadcast presence updates to the room
+ (EJAB-624).
+ * src/mod_muc/mod_muc_room.erl: renaming allow_visitor_presence to
+ allow_visitor_status and altering effect (when false) to remove
+ custom status tags in presence broadcasts to muc rooms by
+ visitors.
+
+2008-07-23 Christophe Romain
+
+ * src/mod_pubsub/mod_pubsub.erl: remove_user hook removes
+ subscriptions (EJAB-684), send the last published and not the
+ first published item (EJAB-675), remove the pubsub/nodes tree,
+ subscribing to a node sends only last items (EJAB-700)
+ * src/mod_pubsub/node_pep.erl: added acl and jid match on node
+ creation permission (EJAB-663)
+ * src/mod_pubsub/node_default.erl: fix node creation permission
+ issue for service
+ * src/mod_pubsub/node_zoo.erl: Likewise
+
2008-07-22 Jean-Sébastien Pédron
* src/mod_disco.erl, src/gen_iq_handler.erl: Convert to exmpp.
@@ -80,6 +328,15 @@
* src/ejabberd_local.erl (process_iq_reply): IQ handler are now always
called with arguments in the new format.
+2008-07-22 Badlop
+
+ * src/ejabberd_config.erl: If syntax mistake in config file, show
+ specific error message (EJAB-616)
+
+2008-07-22 Alexey Shchepin
+
+ * src/odbc/odbc_queries.erl: Fixed a typo
+
2008-07-21 Jean-Sébastien Pédron
* src/gen_iq_handler.erl: Prepare gen_iq_handler to pass arguments in
@@ -94,6 +351,15 @@
* src/jlib.erl: Add support for #xmlel to parse_xdata_submit/1 and
friends. This fixes the user search in mod_vcard.
+2008-07-03 Jerome Sautret
+
+ * src/ejabberd_ctl.erl: Call reopen_log_hook for each virtual host.
+
+2008-07-17 Badlop
+
+ * src/mod_muc/mod_muc_room.erl: Fix to allow a server admin to add
+ himself as owner of a room (EJAB-687)
+
2008-07-17 Jean-Sébastien Pédron
Merge revisions from 1444 to revision 1457 from trunk.
@@ -243,7 +509,7 @@
automatically (EJAB-407)
* src/mod_roster.erl: Likewise
-
+
* src/mod_muc/mod_muc_log.erl: Fix XHTML compliance: ensure some
language is set, include ID attribute in each message, add
microseconds to ensure unique value (EJAB-497)
diff --git a/README b/README
index df5c68281..e798e9095 100644
--- a/README
+++ b/README
@@ -30,9 +30,11 @@ To install ejabberd, run this command with system administrator rights
sudo make install
These commands will:
- - Install a startup script: /sbin/ejabberdctl
- - Install ejabberd in /var/lib/ejabberd/
- Install the configuration files in /etc/ejabberd/
+ - Install ejabberd binary, header and runtime files in /lib/ejabberd/
+ - Install the administration script: /sbin/ejabberdctl
+ - Install ejabberd documentation in /share/doc/ejabberd/
+ - Create a spool directory: /var/lib/ejabberd/
- Create a directory for log files: /var/log/ejabberd/
diff --git a/contrib/ejabberd-modules.repo b/contrib/ejabberd-modules.repo
index d25d350e0..a38715e90 100644
--- a/contrib/ejabberd-modules.repo
+++ b/contrib/ejabberd-modules.repo
@@ -1,5 +1,5 @@
% List of ejabberd-modules to add for ejabberd packaging (source archive and installer)
%
% HTTP-binding:
-https://svn.process-one.net/ejabberd-modules/http_bind/tags/ejabberd-2.0.0-beta1
-https://svn.process-one.net/ejabberd-modules/mod_http_fileserver/tags/ejabberd-2.0.0-beta1
+https://svn.process-one.net/ejabberd-modules/http_bind/trunk
+https://svn.process-one.net/ejabberd-modules/mod_http_fileserver/trunk
diff --git a/contrib/extract_translations/extract_translations.erl b/contrib/extract_translations/extract_translations.erl
index 5c727e785..1f38cd08e 100644
--- a/contrib/extract_translations/extract_translations.erl
+++ b/contrib/extract_translations/extract_translations.erl
@@ -20,9 +20,14 @@
start() ->
ets:new(translations, [named_table, public]),
+ ets:new(translations_obsolete, [named_table, public]),
ets:new(files, [named_table, public]),
ets:new(vars, [named_table, public]),
case init:get_plain_arguments() of
+ ["-srcmsg2po", Dir, File] ->
+ print_po_header(File),
+ Status = process(Dir, File, srcmsg2po),
+ halt(Status);
["-unused", Dir, File] ->
Status = process(Dir, File, unused),
halt(Status);
@@ -50,7 +55,11 @@ process(Dir, File, Used) ->
unused ->
ets:foldl(fun({Key, _}, _) ->
io:format("~p~n", [Key])
- end, ok, translations);
+ end, ok, translations);
+ srcmsg2po ->
+ ets:foldl(fun({Key, Trans}, _) ->
+ print_translation_obsolete(Key, Trans)
+ end, ok, translations_obsolete);
_ ->
ok
end,
@@ -74,46 +83,52 @@ parse_form(Dir, File, Form, Used) ->
{call,
_,
{remote, _, {atom, _, translate}, {atom, _, translate}},
- [_, {string, _, Str}]
+ [_, {string, Line, Str}]
} ->
- process_string(Dir, File, Str, Used);
+ process_string(Dir, File, Line, Str, Used);
{call,
_,
{remote, _, {atom, _, translate}, {atom, _, translate}},
[_, {var, _, Name}]
} ->
case ets:lookup(vars, Name) of
- [{_Name, Value}] ->
- process_string(Dir, File, Value, Used);
+ [{_Name, Value, Line}] ->
+ process_string(Dir, File, Line, Value, Used);
_ ->
ok
end;
{match,
_,
{var, _, Name},
- {string, _, Value}
+ {string, Line, Value}
} ->
- ets:insert(vars, {Name, Value});
+ ets:insert(vars, {Name, Value, Line});
L when is_list(L) ->
lists:foreach(
fun(F) ->
- parse_form(Dir, File, F, Used)
+ parse_form(Dir, File, F, Used)
end, L);
T when is_tuple(T) ->
lists:foreach(
fun(F) ->
- parse_form(Dir, File, F, Used)
+ parse_form(Dir, File, F, Used)
end, tuple_to_list(T));
_ ->
ok
end.
-process_string(_Dir, File, Str, Used) ->
+process_string(_Dir, _File, _Line, "", _Used) ->
+ ok;
+
+process_string(_Dir, File, Line, Str, Used) ->
case {ets:lookup(translations, Str), Used} of
{[{_Key, _Trans}], unused} ->
ets:delete(translations, Str);
{[{_Key, _Trans}], used} ->
ok;
+ {[{_Key, Trans}], srcmsg2po} ->
+ ets:delete(translations_obsolete, Str),
+ print_translation(File, Line, Str, Trans);
{_, used} ->
case ets:lookup(files, File) of
[{_}] ->
@@ -127,6 +142,15 @@ process_string(_Dir, File, Str, Used) ->
_ -> io:format("{~p, \"\"}.~n", [Str])
end,
ets:insert(translations, {Str, ""});
+ {_, srcmsg2po} ->
+ case ets:lookup(files, File) of
+ [{_}] ->
+ ok;
+ _ ->
+ ets:insert(files, {File})
+ end,
+ ets:insert(translations, {Str, ""}),
+ print_translation(File, Line, Str, "");
_ ->
ok
end.
@@ -140,7 +164,8 @@ load_file(File) ->
"" ->
ok;
_ ->
- ets:insert(translations, {Orig, Trans})
+ ets:insert(translations, {Orig, Trans}),
+ ets:insert(translations_obsolete, {Orig, Trans})
end
end, Terms);
Err ->
@@ -191,3 +216,77 @@ print_usage() ->
" extract_translations . ./msgs/ru.msg~n"
).
+
+%%%
+%%% Gettext
+%%%
+
+print_po_header(File) ->
+ MsgProps = get_msg_header_props(File),
+ {Language, [LastT | AddT]} = prepare_props(MsgProps),
+ application:load(ejabberd),
+ {ok, Version} = application:get_key(ejabberd, vsn),
+ print_po_header(Version, Language, LastT, AddT).
+
+get_msg_header_props(File) ->
+ {ok, F} = file:open(File, [read]),
+ Lines = get_msg_header_props(F, []),
+ file:close(F),
+ Lines.
+
+get_msg_header_props(F, Lines) ->
+ String = io:get_line(F, ""),
+ case io_lib:fread("% ", String) of
+ {ok, [], RemString} ->
+ case io_lib:fread("~s", RemString) of
+ {ok, [Key], Value} when Value /= "\n" ->
+ %% The first character in Value is a blankspace:
+ %% And the last characters are 'slash n'
+ ValueClean = string:substr(Value, 2, string:len(Value)-2),
+ get_msg_header_props(F, Lines ++ [{Key, ValueClean}]);
+ _ ->
+ get_msg_header_props(F, Lines)
+ end;
+ _ ->
+ Lines
+ end.
+
+prepare_props(MsgProps) ->
+ Language = proplists:get_value("Language:", MsgProps),
+ Authors = proplists:get_all_values("Author:", MsgProps),
+ {Language, Authors}.
+
+print_po_header(Version, Language, LastTranslator, AdditionalTranslatorsList) ->
+ AdditionalTranslatorsString = build_additional_translators(AdditionalTranslatorsList),
+ HeaderString =
+ "msgid \"\"\n"
+ "msgstr \"\"\n"
+ "\"Project-Id-Version: " ++ Version ++ "\\n\"\n"
+ ++ "\"X-Language: " ++ Language ++ "\\n\"\n"
+ "\"Last-Translator: " ++ LastTranslator ++ "\\n\"\n"
+ ++ AdditionalTranslatorsString ++
+ "\"MIME-Version: 1.0\\n\"\n"
+ "\"Content-Type: text/plain; charset=UTF-8\\n\"\n"
+ "\"Content-Transfer-Encoding: 8bit\\n\"\n",
+ io:format("~s~n", [HeaderString]).
+
+build_additional_translators(List) ->
+ lists:foldl(
+ fun(T, Str) ->
+ Str ++ "\"X-Additional-Translator: " ++ T ++ "\\n\"\n"
+ end,
+ "",
+ List).
+
+print_translation(File, Line, Str, StrT) ->
+ {ok, StrQ, _} = regexp:gsub(Str, "\"", "\\\""),
+ {ok, StrTQ, _} = regexp:gsub(StrT, "\"", "\\\""),
+ io:format("#: ~s:~p~nmsgid \"~s\"~nmsgstr \"~s\"~n~n", [File, Line, StrQ, StrTQ]).
+
+print_translation_obsolete(Str, StrT) ->
+ File = "unknown.erl",
+ Line = 1,
+ {ok, StrQ, _} = regexp:gsub(Str, "\"", "\\\""),
+ {ok, StrTQ, _} = regexp:gsub(StrT, "\"", "\\\""),
+ io:format("#: ~s:~p~n#~~ msgid \"~s\"~n#~~ msgstr \"~s\"~n~n", [File, Line, StrQ, StrTQ]).
+
diff --git a/contrib/extract_translations/prepare-translation.sh b/contrib/extract_translations/prepare-translation.sh
index 2fd895bf5..d1c435fbe 100755
--- a/contrib/extract_translations/prepare-translation.sh
+++ b/contrib/extract_translations/prepare-translation.sh
@@ -8,10 +8,10 @@ prepare_dirs ()
# Where is Erlang binary
ERL=`which erl`
- EJA_DIR=`pwd`/../..
+ EJA_DIR=`pwd`/..
EXTRACT_DIR=$EJA_DIR/contrib/extract_translations/
- EXTRACT_ERL=extract_translations.erl
- EXTRACT_BEAM=extract_translations.beam
+ EXTRACT_ERL=$EXTRACT_DIR/extract_translations.erl
+ EXTRACT_BEAM=$EXTRACT_DIR/extract_translations.beam
SRC_DIR=$EJA_DIR/src
MSGS_DIR=$SRC_DIR/msgs
@@ -22,9 +22,7 @@ prepare_dirs ()
if !([[ -x $EXTRACT_BEAM ]])
then
- echo -n "Compiling extract_translations.erl: "
sh -c "cd $EXTRACT_DIR; $ERL -compile $EXTRACT_ERL"
- echo "ok"
fi
}
@@ -140,6 +138,116 @@ find_unused_full ()
cd ..
}
+extract_lang_srcmsg2po ()
+{
+ LANG_CODE=$1
+ MSGS_PATH=$MSGS_DIR/$LANG_CODE.msg
+ PO_PATH=$MSGS_DIR/$LANG_CODE.po
+
+ $ERL -pa $EXTRACT_DIR -pa $SRC_DIR -noinput -noshell -s extract_translations -s init stop -extra -srcmsg2po . $MSGS_PATH >$PO_PATH.1
+ sed -e 's/ \[\]$/ \"\"/g;' $PO_PATH.1 > $PO_PATH.2
+ msguniq --sort-by-file $PO_PATH.2 --output-file=$PO_PATH
+
+ rm $PO_PATH.*
+}
+
+extract_lang_src2pot ()
+{
+ LANG_CODE=ejabberd
+ MSGS_PATH=$MSGS_DIR/$LANG_CODE.msg
+ POT_PATH=$MSGS_DIR/$LANG_CODE.pot
+
+ echo -n "" >$MSGS_PATH
+ echo "% Language: Language Name" >>$MSGS_PATH
+ echo "% Author: Translator name and contact method" >>$MSGS_PATH
+ echo "" >>$MSGS_PATH
+
+ cd $SRC_DIR
+ $ERL -pa $EXTRACT_DIR -pa $SRC_DIR -noinput -noshell -s extract_translations -s init stop -extra -srcmsg2po . $MSGS_PATH >$POT_PATH.1
+ sed -e 's/ \[\]$/ \"\"/g;' $POT_PATH.1 > $POT_PATH.2
+ msguniq --sort-by-file $POT_PATH.2 --output-file=$POT_PATH
+
+ rm $POT_PATH.*
+ rm $MSGS_PATH
+}
+
+extract_lang_popot2po ()
+{
+ LANG_CODE=$1
+ PO_PATH=$MSGS_DIR/$LANG_CODE.po
+ POT_PATH=$MSGS_DIR/ejabberd.pot
+
+ msgmerge $PO_PATH $POT_PATH >$PO_PATH.translate 2>/dev/null
+ mv $PO_PATH.translate $PO_PATH
+}
+
+extract_lang_po2msg ()
+{
+ LANG_CODE=$1
+ PO_PATH=$LANG_CODE.po
+ MS_PATH=$PO_PATH.ms
+ MSGID_PATH=$PO_PATH.msgid
+ MSGSTR_PATH=$PO_PATH.msgstr
+ MSGS_PATH=$LANG_CODE.msg
+
+ cd $MSGS_DIR
+
+ # Check PO has correct ~
+ # Let's convert to C format so we can use msgfmt
+ PO_TEMP=$LANG_CODE.po.temp
+ cat $PO_PATH | sed 's/%/perc/g' | sed 's/~/%/g' | sed 's/#:.*/#, c-format/g' >$PO_TEMP
+ msgfmt $PO_TEMP --check-format
+ result=$?
+ rm $PO_TEMP
+ if [ $result -ne 0 ] ; then
+ exit 1
+ fi
+
+ msgattrib $PO_PATH --translated --no-fuzzy --no-obsolete --no-location --no-wrap | grep "^msg" | tail --lines=+3 >$MS_PATH
+ grep "^msgid" $PO_PATH.ms | sed 's/^msgid //g' >$MSGID_PATH
+ grep "^msgstr" $PO_PATH.ms | sed 's/^msgstr //g' >$MSGSTR_PATH
+ paste $MSGID_PATH $MSGSTR_PATH --delimiter=, | awk '{print "{" $0 "}."}' | sort -g >$MSGS_PATH
+
+ rm $MS_PATH
+ rm $MSGID_PATH
+ rm $MSGSTR_PATH
+}
+
+extract_lang_updateall ()
+{
+ echo "Generating POT"
+ extract_lang_src2pot
+
+ cd $MSGS_DIR
+ echo ""
+ echo -e "File Missing Language Last translator"
+ echo -e "---- ------- -------- ---------------"
+ for i in *.msg; do
+ LANG_CODE=${i%.msg}
+ echo -n $LANG_CODE | awk '{printf "%-6s", $1 }'
+
+ # Convert old MSG file to PO
+ PO=$LANG_CODE.po
+ [ -f $PO ] || extract_lang_srcmsg2po $LANG_CODE
+
+ extract_lang_popot2po $LANG_CODE
+ extract_lang_po2msg $LANG_CODE
+
+ MISSING=`msgfmt --statistics $PO 2>&1 | awk '{printf "%5s", $4 }'`
+ echo -n " $MISSING"
+
+ LANGUAGE=`grep "Language:" $PO | sed 's/\"X-Language: //g' | sed 's/\\\\n\"//g' | awk '{printf "%-12s", $1}'`
+ echo -n " $LANGUAGE"
+
+ LASTAUTH=`grep "Last-Translator" $PO | sed 's/\"Last-Translator: //g' | sed 's/\\\\n\"//g'`
+ echo " $LASTAUTH"
+ done
+ echo ""
+ rm messages.mo
+
+ cd ..
+}
+
translation_instructions ()
{
echo ""
@@ -158,34 +266,56 @@ translation_instructions ()
echo " $MSGS_PATH"
}
+prepare_dirs
case "$1" in
- -help)
- echo "Options:"
- echo " -langall"
- echo " -lang LANGUAGE_FILE"
- echo ""
- echo "Example:"
- echo " ./prepare-translation.sh -lang es.msg"
- exit 0
- ;;
-lang)
LANGU=$2
- prepare_dirs
extract_lang $LANGU
shift
shift
;;
-langall)
- prepare_dirs
extract_lang_all
shift
;;
- *)
- echo "unknown option: '$1 $2'"
+ -srcmsg2po)
+ LANG_CODE=$2
+ extract_lang_srcmsg2po $LANG_CODE
shift
shift
;;
+ -popot2po)
+ LANG_CODE=$2
+ extract_lang_popot2po $LANG_CODE
+ shift
+ shift
+ ;;
+ -src2pot)
+ extract_lang_src2pot
+ shift
+ ;;
+ -po2msg)
+ LANG_CODE=$2
+ extract_lang_po2msg $LANG_CODE
+ shift
+ shift
+ ;;
+ -updateall)
+ extract_lang_updateall
+ shift
+ ;;
+ *)
+ echo "Options:"
+ echo " -langall"
+ echo " -lang LANGUAGE_FILE"
+ echo " -srcmsg2po LANGUAGE Construct .msg file using source code to PO file"
+ echo " -src2pot Generate template POT file from source code"
+ echo " -popot2po LANGUAGE Update PO file with template POT file"
+ echo " -po2msg LANGUAGE Export PO file to MSG file"
+ echo " -updateall Generate POT and update all PO"
+ echo ""
+ echo "Example:"
+ echo " ./prepare-translation.sh -lang es.msg"
+ exit 0
+ ;;
esac
-
-echo ""
-echo "End."
diff --git a/doc/api/overview.edoc b/doc/api/overview.edoc
index 55f7b1f68..89815c8c0 100644
--- a/doc/api/overview.edoc
+++ b/doc/api/overview.edoc
@@ -1,6 +1,6 @@
@author Mickael Remond
[http://www.process-one.net/]
-@copyright 2007 Process-one
+@copyright 2007 ProcessOne
@version {@vsn}, {@date} {@time}
@title ejabberd Development API Documentation
diff --git a/doc/guide.html b/doc/guide.html
index 02ea12132..97e0f9248 100644
--- a/doc/guide.html
+++ b/doc/guide.html
@@ -272,9 +272,9 @@ Support for virtual hosting.
Probably the easiest way to install an ejabberd instant messaging server
-is using the binary installer published by Process-one.
+is using the binary installer published by ProcessOne.
The binary installers of released ejabberd versions
-are available in the Process-one ejabberd downloads page:
+are available in the ProcessOne ejabberd downloads page:
http://www.process-one.net/en/ejabberd/downloads
The installer will deploy and configure a full featured ejabberd
server and does not require any extra dependencies.
In *nix systems, remember to set executable the binary installer before starting it. For example:
chmod +x ejabberd-2.0.0_1-linux-x86-installer.bin
@@ -290,7 +290,19 @@ go to the Windows service settings and set ejabberd to be automatically started.
Note that the Windows service is a feature still in development,
and for example it doesn’t read the file ejabberdctl.cfg.
On a *nix system, if you want ejabberd to be started as daemon at boot time,
copy ejabberd.init from the ’bin’ directory to something like /etc/init.d/ejabberd
-(depending on your distribution) and call /etc/inid.d/ejabberd start to start it.
Alternatively, the latest development version can be retrieved from the Subversion repository using this command:
The MUC service allows any Jabber ID to register a nickname,
so nobody else can use that nickname in any room in the MUC service.
To register a nickname, open the Service Discovery in your
-Jabber client and Register in the MUC service.
The MUC service allows the service administrator to send a message
-to all existing chatrooms.
-To do so, send the message to the Jabber ID of the MUC service.
This module supports clustering and load
+Jabber client and register in the MUC service.
This module supports clustering and load
balancing. One module can be started per cluster node. Rooms are
distributed at creation time on all available MUC module
-instances. The multi-user chat module is clustered but the room
+instances. The multi-user chat module is clustered but the rooms
themselves are not clustered nor fault-tolerant: if the node managing a
set of rooms goes down, the rooms disappear and they will be recreated
on an available node on first connection attempt.
Module options:
@@ -1956,19 +1978,19 @@ hostname of the virtual host with the prefix ‘conference.’
is replaced at start time with the real virtual host name.
Maximum number of occupants in the room.
@@ -2097,8 +2124,8 @@ and the default value of 20 history messages will be send to the users.
{access_admin, muc_admins}]},
...
]}.
-In the following example, MUC anti abuse options are used. A
-user cannot send more than one message every 0.4 seconds and cannot
+In the following example, MUC anti abuse options are used. An
+occupant cannot send more than one message every 0.4 seconds and cannot
change its presence more than once every 4 seconds. No ACLs are
defined, but some user restriction could be added as well:{modules,
[
@@ -2108,7 +2135,7 @@ defined, but some user restriction could be added as well:
...
]}.
This example shows how to use default_room_options to make sure
-newly created chatrooms have by default those options.
+the newly created rooms have by default those options.
{modules,
[
...
@@ -2128,17 +2155,17 @@ newly created chatrooms have by default those options.
]}.
-
This module enables optional logging of Multi-User Chat (MUC) conversations to
-HTML. Once you enable this module, users can join a chatroom using a MUC capable
+
This module enables optional logging of Multi-User Chat (MUC) public conversations to
+HTML. Once you enable this module, users can join a room using a MUC capable
Jabber client, and if they have enough privileges, they can request the
-configuration form in which they can set the option to enable chatroom logging.
Features:
+configuration form in which they can set the option to enable room logging.
Features:
-
-Chatroom details are added on top of each page: room title, JID,
+Room details are added on top of each page: room title, JID,
author, subject and configuration.
-
-The room JID in the generated HTML is a link to join the chatroom (using
+The room JID in the generated HTML is a link to join the room (using
XMPP URI).
-
- Subject and chatroom configuration changes are tracked and displayed.
+
- Subject and room configuration changes are tracked and displayed.
- Joins, leaves, nick changes, kicks, bans and ‘/me’ are tracked and
displayed, including the reason if available.
- Generated HTML files are XHTML 1.0 Transitional and CSS compliant.
@@ -2151,7 +2178,7 @@ displayed, including the reason if available.
Options:
-
access_log
-
-This option restricts which users are allowed to enable or disable chatroom
+This option restricts which occupants are allowed to enable or disable room
logging. The default value is muc_admin. Note for this default setting
you need to have an access rule for muc_admin in order to take effect.
- cssfile
-
@@ -2161,34 +2188,46 @@ file or if they need to use the embedded CSS file. Allowed values are
include the embedded CSS code. With the latter, you can specify the URL of the
custom CSS file (for example: ‘http://example.com/my.css’). The default value
is false.
+
- dirname
-
+Allows to configure the name of the room directory.
+Allowed values are room_jid and room_name.
+With the first value, the room directory name will be the full room JID.
+With the latter, the room directory name will be only the room name,
+not including the MUC service name.
+The default value is room_jid.
- dirtype
-
The type of the created directories can be specified with this option. Allowed
values are subdirs and plain. With the first value,
subdirectories are created for each year and month. With the latter, the
names of the log files contain the full date, and there are no subdirectories.
The default value is subdirs.
+
- file_format
-
+Define the format of the log files:
+html stores in HTML format,
+plaintext stores in plain text.
+The default value is html.
- outdir
-
This option sets the full path to the directory in which the HTML files should
be stored. Make sure the ejabberd daemon user has write access on that
directory. The default value is "www/muc".
-
- timezone
-
-The time zone for the logs is configurable with this option. Allowed values
-are local and universal. With the first value, the local time,
-as reported to Erlang by the operating system, will be used. With the latter,
-GMT/UTC time will be used. The default value is local.
- spam_prevention
-
To prevent spam, the spam_prevention option adds a special attribute
to links that prevent their indexation by search engines. The default value
is true, which mean that nofollow attributes will be added to user
submitted links.
+
- timezone
-
+The time zone for the logs is configurable with this option. Allowed values
+are local and universal. With the first value, the local time,
+as reported to Erlang by the operating system, will be used. With the latter,
+GMT/UTC time will be used. The default value is local.
- top_link
-
With this option you can customize the link on the top right corner of each
log file. The syntax of this option is {"URL", "Text"}. The default
value is {"/", "Home"}.
Examples:
-
-In the first example any chatroom owner can enable logging, and a
-custom CSS file will be used (http://example.com/my.css). Further, the names
+In the first example any room owner can enable logging, and a
+custom CSS file will be used (http://example.com/my.css). The names
of the log files will contain the full date, and there will be no
subdirectories. The log files will be stored in /var/www/muclogs, and the
time zone will be GMT/UTC. Finally, the top link will be
@@ -2202,6 +2241,7 @@ time zone will be GMT/UTC. Finally, the top link will be
{access_log, muc},
{cssfile, "http://example.com/my.css"},
{dirtype, plain},
+ {dirname, room_jid},
{outdir, "/var/www/muclogs"},
{timezone, universal},
{spam_prevention, true},
@@ -2211,7 +2251,7 @@ time zone will be GMT/UTC. Finally, the top link will be
]}.
- In the second example only admin1@example.org and
admin2@example.net can enable logging, and the embedded CSS file will be
-used. Further, the names of the log files will only contain the day (number),
+used. The names of the log files will only contain the day (number),
and there will be subdirectories for each year and month. The log files will
be stored in /var/www/muclogs, and the local time will be used. Finally, the
top link will be the default
<a href="/">Home</a>
.
@@ -2324,8 +2364,8 @@ The simpliest configuration of the module:
{access, proxy65_access, [{allow, proxy_users}, {deny, all}]}.
{acl, admin, {user, "admin", "example.org"}}.
-{shaper, normal, {maxrate, 10240}}. %% 10 Kbytes/sec
-{access, proxy65_shaper, [{none, admin}, {normal, all}]}.
+{shaper, proxyrate, {maxrate, 10240}}. %% 10 Kbytes/sec
+{access, proxy65_shaper, [{none, admin}, {proxyrate, proxy_users}]}.
{modules,
[
@@ -2652,7 +2692,9 @@ and that all virtual hosts will be searched instead of only the current one:
ejabberd can map LDAP attributes to vCard fields. This behaviour is
implemented in the mod_vcard_ldap module. This module does not depend on the
-authentication method (see 3.2.5).
The mod_vcard_ldap module has
+authentication method (see 3.2.5).
Note that ejabberd treats LDAP as a read-only storage:
+it is possible to consult data, but not possible to
+create accounts, change password or edit vCard that is stored in LDAP.
The mod_vcard_ldap module has
its own optional parameters. The first group of parameters has the same
meaning as the top-level LDAP parameters to set the authentication method:
ldap_servers, ldap_port, ldap_rootdn,
@@ -3221,7 +3263,15 @@ so it is important to use it with extremely care.
There are some simple and safe examples in the article
Interconnecting Erlang Nodes
To exit the shell, close the window or press the keys: control+c control+c.
-
All built-in modules support the xml:lang attribute inside IQ queries.
+
The source code of ejabberd supports localization.
+The translators can edit the
+gettext .po files
+using any capable program (KBabel, Lokalize, Poedit...) or a simple text editor.
Then gettext
+is used to extract, update and export those .po files to the .msg format read by ejabberd.
+To perform those management tasks, in the src/ directory execute make translations.
+The translatable strings are extracted from source code to generate the file ejabberd.pot.
+This file is merged with each .po file to produce updated .po files.
+Finally those .po files are exported to .msg files, that have a format easily readable by ejabberd.
All built-in modules support the xml:lang attribute inside IQ queries.
Figure A.1, for example, shows the reply to the following query:
<iq id='5'
to='example.org'
@@ -3262,7 +3312,7 @@ Alexey Shchepin (xmpp:aleksey@jabber.ru- Vsevolod Pelipas (xmpp:vsevoload@jabber.ru)
Ejabberd Installation and Operation Guide.
-Copyright © 2003 — 2008 Process-one
This document is free software; you can redistribute it and/or
+Copyright © 2003 — 2008 ProcessOne
This document is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This document is distributed in the hope that it will be useful,
diff --git a/doc/guide.tex b/doc/guide.tex
index 17cfbeb80..7d5631f9c 100644
--- a/doc/guide.tex
+++ b/doc/guide.tex
@@ -5,7 +5,7 @@
\usepackage{graphics}
\usepackage{hevea}
\usepackage[pdftex,colorlinks,unicode,urlcolor=blue,linkcolor=blue,
- pdftitle=Ejabberd\ Installation\ and\ Operation\ Guide,pdfauthor=Process-one,pdfsubject=ejabberd,pdfkeywords=ejabberd,
+ pdftitle=Ejabberd\ Installation\ and\ Operation\ Guide,pdfauthor=ProcessOne,pdfsubject=ejabberd,pdfkeywords=ejabberd,
pdfpagelabels=false]{hyperref}
\usepackage{makeidx}
%\usepackage{showidx} % Only for verifying the index entries.
@@ -208,9 +208,9 @@ ejabberd Development Team
\makesection{install.binary}{Installing \ejabberd{} with Binary Installer}
Probably the easiest way to install an \ejabberd{} instant messaging server
-is using the binary installer published by Process-one.
+is using the binary installer published by ProcessOne.
The binary installers of released \ejabberd{} versions
-are available in the Process-one \ejabberd{} downloads page:
+are available in the ProcessOne \ejabberd{} downloads page:
\ahrefurl{http://www.process-one.net/en/ejabberd/downloads}
The installer will deploy and configure a full featured \ejabberd{}
@@ -241,6 +241,22 @@ On a *nix system, if you want ejabberd to be started as daemon at boot time,
copy \term{ejabberd.init} from the 'bin' directory to something like \term{/etc/init.d/ejabberd}
(depending on your distribution) and call \term{/etc/inid.d/ejabberd start} to start it.
+If \term{ejabberd} doesn't start correctly in Windows,
+try to start it using the shortcut in desktop or start menu.
+If the window shows error 14001, the solution is to install:
+"Microsoft Visual C++ 2005 SP1 Redistributable Package".
+You can download it from
+\footahref{http://www.microsoft.com/}{www.microsoft.com}.
+Then uninstall \ejabberd{} and install it again.
+
+If \term{ejabberd} doesn't start correctly and a crash dump is generated,
+there was a severe problem.
+You can try starting \term{ejabberd} with
+the script \term{bin/live.bat} in Windows,
+or with the command \term{bin/ejabberdctl live} in other Operating Systems.
+This way you see the error message provided by Erlang
+and can identify what is exactly the problem.
+
The \term{ejabberdctl} administration script is included in the \term{bin} directory.
Please refer to the section~\ref{ejabberdctl} for details about \term{ejabberdctl},
and configurable options to fine tune the Erlang runtime system.
@@ -294,7 +310,7 @@ To compile \ejabberd{} on a `Unix-like' operating system, you need:
\makesubsection{download}{Download Source Code}
\ind{install!download}
-Released versions of \ejabberd{} are available in the Process-one \ejabberd{} downloads page:
+Released versions of \ejabberd{} are available in the ProcessOne \ejabberd{} downloads page:
\ahrefurl{http://www.process-one.net/en/ejabberd/downloads}
\ind{Subversion repository}
@@ -415,6 +431,13 @@ ejabberd is running
ejabberdctl stop
\end{verbatim}
+If \term{ejabberd} doesn't start correctly and a crash dump is generated,
+there was a severe problem.
+You can try starting \term{ejabberd} with
+the command \term{ejabberdctl live}
+to see the error message provided by Erlang
+and can identify what is exactly the problem.
+
Please refer to the section~\ref{ejabberdctl} for details about \term{ejabberdctl},
and configurable options to fine tune the Erlang runtime system.
@@ -727,7 +750,7 @@ The available modules, their purpose and the options allowed by each one are:
Handles incoming s2s connections.\\
Options: \texttt{inet6}, \texttt{ip}, \texttt{max\_stanza\_size}
\titem{\texttt{ejabberd\_service}}
- Interacts with \footahref{http://www.ejabberd.im/tutorials-transports}{external components}
+ Interacts with an \footahref{http://www.ejabberd.im/tutorials-transports}{external component}
(as defined in the Jabber Component Protocol (\xepref{0114}).\\
Options: \texttt{access}, \texttt{hosts}, \texttt{inet6},
\texttt{ip}, \texttt{shaper}, \texttt{service\_check\_from}
@@ -749,9 +772,10 @@ This is a detailed description of each option allowed by the listening modules:
external components. The option can be either \term{true} or
\term{false}. The default value is \term{true} which conforms to \xepref{0114}.
\titem{\{hosts, [Hostnames], [HostOptions]\}} \ind{options!hosts}
- This option of \term{ejabberd\_service} allows to define one or more hostnames
- of external Jabber components that provide a service.
- In \term{HostOptions} it is possible to define the password required to those components
+ The external Jabber component that connects to this \term{ejabberd\_service}
+ can serve one or more hostnames.
+ In \term{HostOptions} you can define options for the component;
+ currently the only allowed option is the password required to the component
when attempt to connect to ejabberd: \poption{\{password, Secret\}}.
Note that you cannot define in a single \term{ejabberd\_service} components of
different services: add an \term{ejabberd\_service} for each service,
@@ -1159,8 +1183,14 @@ version, you can \term{kill(1)} \term{epam} process periodically to reduce its m
consumption: \ejabberd{} will restart this process immediately.
\item \term{epam} program tries to turn off delays on authentication failures.
However, some PAM modules ignore this behavior and rely on their own configuration options.
-The example configuration file \term{ejabberd.pam} shows how to turn off delays in
-\term{pam\_unix.so} module. It is not a ready to use configuration file: you must use it
+You can create a configuration file \term{ejabberd.pam}.
+This example shows how to turn off delays in \term{pam\_unix.so} module:
+\begin{verbatim}
+#%PAM-1.0
+auth sufficient pam_unix.so likeauth nullok nodelay
+account sufficient pam_unix.so
+\end{verbatim}
+That is not a ready to use configuration file: you must use it
as a hint when building your own PAM configuration instead. Note that if you want to disable
delays on authentication failures in the PAM configuration file, you have to restrict access
to this file, so a malicious user can't use your configuration to perform brute-force
@@ -1371,7 +1401,7 @@ Examples:
\ind{options!language}\ind{language}
The option \option{language} defines the default language of server strings that
-can be seen by \Jabber{} clients. If a \Jabber{} client do not support
+can be seen by \Jabber{} clients. If a \Jabber{} client does not support
\option{xml:lang}, the specified language is used. The default value is
\term{en}. In order to take effect there must be a translation file
\term{.msg} in \ejabberd{}'s \term{msgs} directory.
@@ -1388,6 +1418,9 @@ Examples:
\end{verbatim}
\end{itemize}
+Appendix \ref{i18ni10n} provides more details about internationalization and localization.
+
+
\makesubsection{includeconfigfile}{Include Additional Configuration Files}
\ind{options!includeconfigfile}\ind{includeconfigfile}
@@ -1890,6 +1923,11 @@ module loaded!
server and use LDAP directory as vCard storage. Shared rosters are not supported
yet.
+Note that \ejabberd{} treats LDAP as a read-only storage:
+it is possible to consult data, but not possible to
+create accounts, change password or edit vCard that is stored in LDAP.
+
+
\makesubsubsection{ldapconnection}{Connection}
Parameters:
@@ -2534,31 +2572,28 @@ Options:
\makesubsection{modmuc}{\modmuc{}}
\ind{modules!\modmuc{}}\ind{protocols!XEP-0045: Multi-User Chat}\ind{conferencing}
-With this module enabled, your server will support Multi-User Chat
-(\xepref{0045}). End users will be able to join text conferences.
+This module provides a Multi-User Chat (\xepref{0045}) service.
+Users can discover existing rooms, join or create them.
+Occupants of a room can chat in public or have private chats.
Some of the features of Multi-User Chat:
\begin{itemize}
-\item Sending private messages to room participants.
-\item Inviting users.
-\item Setting a conference topic.
+\item Sending public and private messages to room occupants.
+\item Inviting other users to a room.
+\item Setting a room subject.
\item Creating password protected rooms.
-\item Kicking and banning participants.
+\item Kicking and banning occupants.
\end{itemize}
The MUC service allows any Jabber ID to register a nickname,
so nobody else can use that nickname in any room in the MUC service.
To register a nickname, open the Service Discovery in your
-Jabber client and Register in the MUC service.
-
-The MUC service allows the service administrator to send a message
-to all existing chatrooms.
-To do so, send the message to the Jabber ID of the MUC service.
+Jabber client and register in the MUC service.
This module supports clustering and load
balancing. One module can be started per cluster node. Rooms are
distributed at creation time on all available MUC module
-instances. The multi-user chat module is clustered but the room
+instances. The multi-user chat module is clustered but the rooms
themselves are not clustered nor fault-tolerant: if the node managing a
set of rooms goes down, the rooms disappear and they will be recreated
on an available node on first connection attempt.
@@ -2567,19 +2602,19 @@ Module options:
\begin{description}
\hostitem{conference}
\titem{access} \ind{options!access}You can specify who is allowed to use
- the Multi-User Chat service (by default, everyone is allowed to use it).
+ the Multi-User Chat service. By default everyone is allowed to use it.
\titem{access\_create} \ind{options!access\_create}To configure who is
allowed to create new rooms at the Multi-User Chat service, this option
- can be used (by default, everybody is allowed to create rooms).
+ can be used. By default everybody is allowed to create rooms.
\titem{access\_persistent} \ind{options!access\_persistent}To configure who is
- allowed to modify the 'persistent' chatroom option
- (by default, everybody is allowed to modify that option).
+ allowed to modify the 'persistent' room option.
+ By default everybody is allowed to modify that option.
\titem{access\_admin} \ind{options!access\_admin}This option specifies
- who is allowed to administrate the Multi-User Chat service (the default
+ who is allowed to administrate the Multi-User Chat service. The default
value is \term{none}, which means that only the room creator can
- administer his room).
+ administer his room.
The administrators can send a normal message to the service JID,
- and it will be shown in every active room as a service message.
+ and it will be shown in all active rooms as a service message.
The administrators can send a groupchat message to the JID of an active room,
and the message will be shown in the room as a service message.
\titem{history\_size} \ind{options!history\_size}A small history of
@@ -2589,44 +2624,43 @@ Module options:
integer. Setting the value to \term{0} disables the history feature
and, as a result, nothing is kept in memory. The default value is
\term{20}. This value is global and thus affects all rooms on the
- server.
+ service.
\titem{max\_users} \ind{options!max\_users} This option defines at
- the server level, the maximum number of users allowed per MUC
+ the service level, the maximum number of users allowed per
room. It can be lowered in each room configuration but cannot be
- increased in individual MUC room configuration. The default value is
+ increased in individual room configuration. The default value is
200.
\titem{max\_users\_admin\_threshold}
\ind{options!max\_users\_admin\_threshold} This option defines the
- number of MUC admins or owners to allow to enter the room even if
- the maximum number of allowed users is reached. The default limits
- is 5. In most cases this default value is the best setting.
+ number of service admins or room owners allowed to enter the room when
+ the maximum number of allowed occupants was reached. The default limit
+ is 5.
\titem{max\_user\_conferences}
- \ind{options!max\_user\_conferences} This option define the maximum
- number of chat room any given user will be able to join. The default
+ \ind{options!max\_user\_conferences} This option defines the maximum
+ number of rooms that any given user can join. The default value
is 10. This option is used to prevent possible abuses. Note that
- this is a soft limits: Some users can sometime join more conferences
+ this is a soft limit: some users can sometimes join more conferences
in cluster configurations.
\titem{min\_message\_interval} \ind{options!min\_message\_interval}
This option defines the minimum interval between two messages send
- by a user in seconds. This option is global and valid for all chat
+ by an occupant in seconds. This option is global and valid for all
rooms. A decimal value can be used. When this option is not defined,
message rate is not limited. This feature can be used to protect a
- MUC service from users abuses and limit number of messages that will
+ MUC service from occupant abuses and limit number of messages that will
be broadcasted by the service. A good value for this minimum message
- interval is 0.4 second. If a user tries to send messages faster, an
- error is send back explaining that the message have been discarded
+ interval is 0.4 second. If an occupant tries to send messages faster, an
+ error is send back explaining that the message has been discarded
and describing the reason why the message is not acceptable.
\titem{min\_presence\_interval}
\ind{options!min\_presence\_interval} This option defines the
- minimum of time between presence changes coming from a given user in
- seconds. This option is global and valid for all chat rooms. A
+ minimum of time between presence changes coming from a given occupant in
+ seconds. This option is global and valid for all rooms. A
decimal value can be used. When this option is not defined, no
restriction is applied. This option can be used to protect a MUC
- service for users abuses, as fastly changing a user presence will
- result in possible large presence packet broadcast. If a user tries
+ service for occupants abuses. If an occupant tries
to change its presence more often than the specified interval, the
presence is cached by \ejabberd{} and only the last presence is
- broadcasted to all users in the room after expiration of the
+ broadcasted to all occupants in the room after expiration of the
interval delay. Intermediate presence packets are silently
discarded. A good value for this option is 4 seconds.
\titem{default\_room\_options} \ind{options!default\_room\_options}
@@ -2639,7 +2673,15 @@ Module options:
\titem{\{allow\_private\_messages, true\}} Occupants can send private messages to other occupants.
\titem{\{allow\_query\_users, true\}} Occupants can send IQ queries to other occupants.
\titem{\{allow\_user\_invites, false\}} Allow occupants to send invitations.
- \titem{\{anonymous, true\}} Occupants are allowed to see the real JIDs of other occupants.
+ \titem{\{allow\_visitor\_nickchange, true\}} Allow visitors to
+ change nickname.
+ \titem{\{allow\_visitor\_status, true\}} Allow visitors to send
+ status text in presence updates. If disallowed, the \term{status}
+ text is stripped before broadcasting the presence update to all
+ the room occupants.
+ \titem{\{anonymous, true\}} The room is anonymous:
+ occupants don't see the real JIDs of other occupants.
+ Note that the room moderators can always see the real JIDs of the occupants.
\titem{\{logging, false\}} The public messages are logged using \term{mod\_muc\_log}.
\titem{\{max\_users, 200\}} Maximum number of occupants in the room.
\titem{\{members\_by\_default, true\}} The occupants that enter the room are participants by default, so they have 'voice'.
@@ -2715,8 +2757,8 @@ Examples:
]}.
\end{verbatim}
-\item In the following example, MUC anti abuse options are used. A
-user cannot send more than one message every 0.4 seconds and cannot
+\item In the following example, MUC anti abuse options are used. An
+occupant cannot send more than one message every 0.4 seconds and cannot
change its presence more than once every 4 seconds. No ACLs are
defined, but some user restriction could be added as well:
@@ -2731,7 +2773,7 @@ defined, but some user restriction could be added as well:
\end{verbatim}
\item This example shows how to use \option{default\_room\_options} to make sure
- newly created chatrooms have by default those options.
+ the newly created rooms have by default those options.
\begin{verbatim}
{modules,
[
@@ -2756,19 +2798,19 @@ defined, but some user restriction could be added as well:
\makesubsection{modmuclog}{\modmuclog{}}
\ind{modules!\modmuclog{}}
-This module enables optional logging of Multi-User Chat (MUC) conversations to
-HTML. Once you enable this module, users can join a chatroom using a MUC capable
+This module enables optional logging of Multi-User Chat (MUC) public conversations to
+HTML. Once you enable this module, users can join a room using a MUC capable
Jabber client, and if they have enough privileges, they can request the
-configuration form in which they can set the option to enable chatroom logging.
+configuration form in which they can set the option to enable room logging.
Features:
\begin{itemize}
-\item Chatroom details are added on top of each page: room title, JID,
+\item Room details are added on top of each page: room title, JID,
author, subject and configuration.
\item \ind{protocols!RFC 5122: Internationalized Resource Identifiers (IRIs) and Uniform Resource Identifiers (URIs) for the Extensible Messaging and Presence Protocol (XMPP)}
- The room JID in the generated HTML is a link to join the chatroom (using
+ The room JID in the generated HTML is a link to join the room (using
\footahref{http://www.xmpp.org/rfcs/rfc5122.html}{XMPP URI}).
-\item Subject and chatroom configuration changes are tracked and displayed.
+\item Subject and room configuration changes are tracked and displayed.
\item Joins, leaves, nick changes, kicks, bans and `/me' are tracked and
displayed, including the reason if available.
\item Generated HTML files are XHTML 1.0 Transitional and CSS compliant.
@@ -2783,7 +2825,7 @@ Features:
Options:
\begin{description}
\titem{access\_log}\ind{options!access\_log}
- This option restricts which users are allowed to enable or disable chatroom
+ This option restricts which occupants are allowed to enable or disable room
logging. The default value is \term{muc\_admin}. Note for this default setting
you need to have an access rule for \term{muc\_admin} in order to take effect.
\titem{cssfile}\ind{options!cssfile}
@@ -2793,26 +2835,38 @@ Options:
include the embedded CSS code. With the latter, you can specify the URL of the
custom CSS file (for example: `http://example.com/my.css'). The default value
is \term{false}.
+\titem{dirname}\ind{options!dirname}
+ Allows to configure the name of the room directory.
+ Allowed values are \term{room\_jid} and \term{room\_name}.
+ With the first value, the room directory name will be the full room JID.
+ With the latter, the room directory name will be only the room name,
+ not including the MUC service name.
+ The default value is \term{room\_jid}.
\titem{dirtype}\ind{options!dirtype}
The type of the created directories can be specified with this option. Allowed
values are \term{subdirs} and \term{plain}. With the first value,
subdirectories are created for each year and month. With the latter, the
names of the log files contain the full date, and there are no subdirectories.
The default value is \term{subdirs}.
+\titem{file\_format}\ind{options!file\_format}
+ Define the format of the log files:
+ \term{html} stores in HTML format,
+ \term{plaintext} stores in plain text.
+ The default value is \term{html}.
\titem{outdir}\ind{options!outdir}
This option sets the full path to the directory in which the HTML files should
be stored. Make sure the \ejabberd{} daemon user has write access on that
directory. The default value is \term{"www/muc"}.
-\titem{timezone}\ind{options!timezone}
- The time zone for the logs is configurable with this option. Allowed values
- are \term{local} and \term{universal}. With the first value, the local time,
- as reported to Erlang by the operating system, will be used. With the latter,
- GMT/UTC time will be used. The default value is \term{local}.
\titem{spam\_prevention}\ind{options!spam\_prevention}
To prevent spam, the \term{spam\_prevention} option adds a special attribute
to links that prevent their indexation by search engines. The default value
is \term{true}, which mean that nofollow attributes will be added to user
submitted links.
+\titem{timezone}\ind{options!timezone}
+ The time zone for the logs is configurable with this option. Allowed values
+ are \term{local} and \term{universal}. With the first value, the local time,
+ as reported to Erlang by the operating system, will be used. With the latter,
+ GMT/UTC time will be used. The default value is \term{local}.
\titem{top\_link}\ind{options!top\_link}
With this option you can customize the link on the top right corner of each
log file. The syntax of this option is \term{\{"URL", "Text"\}}. The default
@@ -2821,8 +2875,8 @@ Options:
Examples:
\begin{itemize}
-\item In the first example any chatroom owner can enable logging, and a
- custom CSS file will be used (http://example.com/my.css). Further, the names
+\item In the first example any room owner can enable logging, and a
+ custom CSS file will be used (http://example.com/my.css). The names
of the log files will contain the full date, and there will be no
subdirectories. The log files will be stored in /var/www/muclogs, and the
time zone will be GMT/UTC. Finally, the top link will be
@@ -2837,6 +2891,7 @@ Examples:
{access_log, muc},
{cssfile, "http://example.com/my.css"},
{dirtype, plain},
+ {dirname, room_jid},
{outdir, "/var/www/muclogs"},
{timezone, universal},
{spam_prevention, true},
@@ -2847,7 +2902,7 @@ Examples:
\end{verbatim}
\item In the second example only \jid{admin1@example.org} and
\jid{admin2@example.net} can enable logging, and the embedded CSS file will be
- used. Further, the names of the log files will only contain the day (number),
+ used. The names of the log files will only contain the day (number),
and there will be subdirectories for each year and month. The log files will
be stored in /var/www/muclogs, and the local time will be used. Finally, the
top link will be the default \verb|Home|.
@@ -2986,8 +3041,8 @@ Examples:
{access, proxy65_access, [{allow, proxy_users}, {deny, all}]}.
{acl, admin, {user, "admin", "example.org"}}.
-{shaper, normal, {maxrate, 10240}}. %% 10 Kbytes/sec
-{access, proxy65_shaper, [{none, admin}, {normal, all}]}.
+{shaper, proxyrate, {maxrate, 10240}}. %% 10 Kbytes/sec
+{access, proxy65_shaper, [{none, admin}, {proxyrate, proxy_users}]}.
{modules,
[
@@ -3411,6 +3466,10 @@ Examples:
implemented in the \modvcardldap{} module. This module does not depend on the
authentication method (see~\ref{ldapauth}).
+Note that \ejabberd{} treats LDAP as a read-only storage:
+it is possible to consult data, but not possible to
+create accounts, change password or edit vCard that is stored in LDAP.
+
The \modvcardldap{} module has
its own optional parameters. The first group of parameters has the same
meaning as the top-level LDAP parameters to set the authentication method:
@@ -4052,6 +4111,7 @@ following steps:
\begin{verbatim}
erl -sname ejabberd \
+ -mnesia dir "/var/lib/ejabberd/" \
-mnesia extra_db_nodes "['ejabberd@first']" \
-s mnesia
\end{verbatim}
@@ -4060,6 +4120,11 @@ erl -sname ejabberd \
You can check this by running the command `\verb|mnesia:info().|'. You
should see a lot of remote tables and a line like the following:
+ Note: the Mnesia directory may be different in your system.
+ To know where does ejabberd expect Mnesia to be installed by default,
+ call \ref{ejabberdctl} without options and it will show some help,
+ including the Mnesia database spool dir.
+
\begin{verbatim}
running db nodes = [ejabberd@first, ejabberd@second]
\end{verbatim}
@@ -4227,6 +4292,18 @@ To exit the shell, close the window or press the keys: control+c control+c.
\makechapter{i18ni10n}{Internationalization and Localization}
\ind{xml:lang}\ind{internationalization}\ind{localization}\ind{i18n}\ind{l10n}
+The source code of \ejabberd{} supports localization.
+The translators can edit the
+\footahref{http://www.gnu.org/software/gettext/}{gettext} .po files
+using any capable program (KBabel, Lokalize, Poedit...) or a simple text editor.
+
+Then gettext
+is used to extract, update and export those .po files to the .msg format read by \ejabberd{}.
+To perform those management tasks, in the \term{src/} directory execute \term{make translations}.
+The translatable strings are extracted from source code to generate the file \term{ejabberd.pot}.
+This file is merged with each .po file to produce updated .po files.
+Finally those .po files are exported to .msg files, that have a format easily readable by \ejabberd{}.
+
All built-in modules support the \texttt{xml:lang} attribute inside IQ queries.
Figure~\ref{fig:discorus}, for example, shows the reply to the following query:
\begin{verbatim}
@@ -4284,7 +4361,7 @@ Thanks to all people who contributed to this guide:
\makechapter{copyright}{Copyright Information}
Ejabberd Installation and Operation Guide.\\
-Copyright \copyright{} 2003 --- 2008 Process-one
+Copyright \copyright{} 2003 --- 2008 ProcessOne
This document is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/doc/release_notes_2.0.2.txt b/doc/release_notes_2.0.2.txt
new file mode 100644
index 000000000..767ae1367
--- /dev/null
+++ b/doc/release_notes_2.0.2.txt
@@ -0,0 +1,34 @@
+
+ Release Notes
+ ejabberd 2.0.2
+ 28 August 2008
+
+ ejabberd 2.0.2 is the second bug fix release for ejabberd 2.0.x branch.
+
+ ejabberd 2.0.2 includes many bugfixes and a few improvements.
+ A complete list of changes can be retrieved from:
+ http://redir.process-one.net/ejabberd-2.0.2
+
+ The new code can be downloaded from ejabberd download page:
+ http://www.process-one.net/en/ejabberd/
+
+
+ Recent changes include:
+
+- Anti-abuse feature: client blacklist support by IP.
+- Guide: new section Securing ejabberd; improved usability.
+- LDAP filter optimisation: ability to filter user in ejabberd and not LDAP.
+- MUC improvements: room options to restrict visitors; broadcast reasons.
+- Privacy rules: fix MySQL storage.
+- Pub/Sub and PEP: many improvements in implementation and protocol compliance.
+- Proxy65: send valid SOCKS5 reply (removed support for Psi < 0.10).
+- Web server embedded: better support for HTTPS.
+- Binary installers: SMP on Windows; don't remove config when uninstalling.
+
+
+ Bug reports
+
+ You can officially report bugs on ProcessOne support site:
+ http://support.process-one.net/
+
+END
diff --git a/src/Makefile.in b/src/Makefile.in
index 5dabf5431..93d29fc60 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -157,6 +157,9 @@ $(ERLSHLIBS): %.so: %.c
-o $@ \
$(DYNAMIC_LIB_CFLAGS)
+translations:
+ ../contrib/extract_translations/prepare-translation.sh -updateall
+
install: all
#
# Configuration files
diff --git a/src/acl.erl b/src/acl.erl
index 21bacf618..c21e62488 100644
--- a/src/acl.erl
+++ b/src/acl.erl
@@ -5,7 +5,7 @@
%%% Created : 18 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/adhoc.erl b/src/adhoc.erl
index 0382062b0..26ea5a7c2 100644
--- a/src/adhoc.erl
+++ b/src/adhoc.erl
@@ -5,7 +5,7 @@
%%% Created : 31 Oct 2005 by Magnus Henoch
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/adhoc.hrl b/src/adhoc.hrl
index 5dbc515bc..ab8a6f163 100644
--- a/src/adhoc.hrl
+++ b/src/adhoc.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/configure.erl b/src/configure.erl
index b9447c28d..379c79a82 100644
--- a/src/configure.erl
+++ b/src/configure.erl
@@ -5,7 +5,7 @@
%%% Created : 27 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/cyrsasl.erl b/src/cyrsasl.erl
index e942aa3e8..7813df772 100644
--- a/src/cyrsasl.erl
+++ b/src/cyrsasl.erl
@@ -5,7 +5,7 @@
%%% Created : 8 Mar 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/cyrsasl_anonymous.erl b/src/cyrsasl_anonymous.erl
index 4f1219882..fb033b3a7 100644
--- a/src/cyrsasl_anonymous.erl
+++ b/src/cyrsasl_anonymous.erl
@@ -6,7 +6,7 @@
%%% Created : 23 Aug 2005 by Magnus Henoch
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/cyrsasl_plain.erl b/src/cyrsasl_plain.erl
index c0ca708d8..1533c463d 100644
--- a/src/cyrsasl_plain.erl
+++ b/src/cyrsasl_plain.erl
@@ -5,7 +5,7 @@
%%% Created : 8 Mar 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd.erl b/src/ejabberd.erl
index de2727ca0..86113d97b 100644
--- a/src/ejabberd.erl
+++ b/src/ejabberd.erl
@@ -5,7 +5,7 @@
%%% Created : 16 Nov 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd.hrl b/src/ejabberd.hrl
index d7b16f1e2..658037274 100644
--- a/src/ejabberd.hrl
+++ b/src/ejabberd.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_admin.erl b/src/ejabberd_admin.erl
index 44b7213ea..a0f101703 100644
--- a/src/ejabberd_admin.erl
+++ b/src/ejabberd_admin.erl
@@ -9,7 +9,7 @@
%%% Created : 7 May 2006 by Mickael Remond
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl
index 8f335ad5b..e64c58635 100644
--- a/src/ejabberd_app.erl
+++ b/src/ejabberd_app.erl
@@ -5,7 +5,7 @@
%%% Created : 31 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -152,7 +152,7 @@ stop_modules() ->
Modules ->
lists:foreach(
fun({Module, _Args}) ->
- gen_mod:stop_module(Host, Module)
+ gen_mod:stop_module_keep_config(Host, Module)
end, Modules)
end
end, ?MYHOSTS).
diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl
index 358d44ae0..33a575e30 100644
--- a/src/ejabberd_auth.erl
+++ b/src/ejabberd_auth.erl
@@ -5,7 +5,7 @@
%%% Created : 23 Nov 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -127,9 +127,12 @@ check_password_with_authmodule(User, Server, Password, StreamID, Digest) ->
[AuthMod | _] -> {true, AuthMod}
end.
-%% We do not allow empty password:
+%% @spec (User::string(), Server::string(), Password::string()) ->
+%% ok | {error, ErrorType}
+%% where ErrorType = empty_password | not_allowed | invalid_jid
set_password(_User, _Server, "") ->
- {error, not_allowed};
+ %% We do not allow empty password
+ {error, empty_password};
set_password(User, Server, Password) ->
lists:foldl(
fun(M, {error, _}) ->
@@ -138,8 +141,8 @@ set_password(User, Server, Password) ->
Res
end, {error, not_allowed}, auth_modules(Server)).
-%% We do not allow empty password:
try_register(_User, _Server, "") ->
+ %% We do not allow empty password
{error, not_allowed};
try_register(User, Server, Password) ->
case is_user_exists(User,Server) of
diff --git a/src/ejabberd_auth_anonymous.erl b/src/ejabberd_auth_anonymous.erl
index 8ba4d7336..955a0dc06 100644
--- a/src/ejabberd_auth_anonymous.erl
+++ b/src/ejabberd_auth_anonymous.erl
@@ -5,7 +5,7 @@
%%% Created : 17 Feb 2006 by Mickael Remond
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_auth_external.erl b/src/ejabberd_auth_external.erl
index 9684944a6..b86a94bb8 100644
--- a/src/ejabberd_auth_external.erl
+++ b/src/ejabberd_auth_external.erl
@@ -5,7 +5,7 @@
%%% Created : 12 Dec 2004 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -61,7 +61,10 @@ check_password(User, Server, Password, _StreamID, _Digest) ->
check_password(User, Server, Password).
set_password(User, Server, Password) ->
- extauth:set_password(User, Server, Password).
+ case extauth:set_password(User, Server, Password) of
+ true -> ok;
+ _ -> {error, unknown_problem}
+ end.
try_register(_User, _Server, _Password) ->
{error, not_allowed}.
diff --git a/src/ejabberd_auth_internal.erl b/src/ejabberd_auth_internal.erl
index 71d9086d7..cec18b319 100644
--- a/src/ejabberd_auth_internal.erl
+++ b/src/ejabberd_auth_internal.erl
@@ -5,7 +5,7 @@
%%% Created : 12 Dec 2004 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -98,6 +98,8 @@ check_password(User, Server, Password, StreamID, Digest) ->
false
end.
+%% @spec (User::string(), Server::string(), Password::string()) ->
+%% ok | {error, invalid_jid}
set_password(User, Server, Password) ->
LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server),
@@ -110,7 +112,8 @@ set_password(User, Server, Password) ->
mnesia:write(#passwd{us = US,
password = Password})
end,
- mnesia:transaction(F)
+ {atomic, ok} = mnesia:transaction(F),
+ ok
end.
try_register(User, Server, Password) ->
diff --git a/src/ejabberd_auth_ldap.erl b/src/ejabberd_auth_ldap.erl
index d576a82fd..303300e48 100644
--- a/src/ejabberd_auth_ldap.erl
+++ b/src/ejabberd_auth_ldap.erl
@@ -5,7 +5,7 @@
%%% Created : 12 Dec 2004 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_auth_odbc.erl b/src/ejabberd_auth_odbc.erl
index 06ae695ea..26eca6ab3 100644
--- a/src/ejabberd_auth_odbc.erl
+++ b/src/ejabberd_auth_odbc.erl
@@ -5,7 +5,7 @@
%%% Created : 12 Dec 2004 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -103,13 +103,18 @@ check_password(User, Server, Password, StreamID, Digest) ->
false
end.
+%% @spec (User::string(), Server::string(), Password::string()) ->
+%% ok | {error, invalid_jid}
set_password(User, Server, Password) ->
try
LUser = exmpp_stringprep:nodeprep(User),
Username = ejabberd_odbc:escape(LUser),
Pass = ejabberd_odbc:escape(Password),
LServer = exmpp_stringprep:nameprep(Server),
- catch odbc_queries:set_password_t(LServer, Username, Pass)
+ case catch odbc_queries:set_password_t(LServer, Username, Pass) of
+ {atomic, ok} -> ok;
+ Other -> {error, Other}
+ end
catch
_ ->
{error, invalid_jid}
diff --git a/src/ejabberd_auth_pam.erl b/src/ejabberd_auth_pam.erl
index 810ab7cf5..f26296d33 100644
--- a/src/ejabberd_auth_pam.erl
+++ b/src/ejabberd_auth_pam.erl
@@ -5,7 +5,7 @@
%%% Created : 5 Jul 2007 by Evgeniy Khramtsov
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index 6c86d1149..5b00509f3 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -5,7 +5,7 @@
%%% Created : 16 Nov 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -37,6 +37,7 @@
send_element/2,
socket_type/0,
get_presence/1,
+ get_subscribed/1,
get_subscribed_and_online/1]).
%% gen_fsm callbacks
@@ -201,6 +202,9 @@ init([{SockMod, Socket}, Opts]) ->
%% Return list of all available resources of contacts,
%% in form [{JID, Caps}].
+get_subscribed(FsmRef) ->
+ gen_fsm:sync_send_all_state_event(
+ FsmRef, get_subscribed, 1000).
get_subscribed_and_online(FsmRef) ->
gen_fsm:sync_send_all_state_event(
FsmRef, get_subscribed_and_online, 1000).
@@ -932,6 +936,20 @@ handle_sync_event({get_presence}, _From, StateName, StateData) ->
Reply = {User, Resource, atom_to_list(Show), Status},
fsm_reply(Reply, StateName, StateData);
+handle_sync_event(get_subscribed, _From, StateName, StateData) ->
+ Subscribed = StateData#state.pres_f,
+ Online = StateData#state.pres_available,
+ Pred = fun(User, _Caps) ->
+ ?SETS:is_element(jlib:jid_remove_resource(User),
+ Subscribed) orelse
+ ?SETS:is_element(User, Subscribed)
+ end,
+ SubscribedAndOnline = ?DICT:filter(Pred, Online),
+ SubscribedWithCaps = ?SETS:fold(fun(User, Acc) ->
+ [{User, undefined}|Acc]
+ end, ?DICT:to_list(SubscribedAndOnline), Subscribed),
+ {reply, SubscribedWithCaps, StateName, StateData};
+
handle_sync_event(get_subscribed_and_online, _From, StateName, StateData) ->
Subscribed = StateData#state.pres_f,
Online = StateData#state.pres_available,
diff --git a/src/ejabberd_c2s_config.erl b/src/ejabberd_c2s_config.erl
index 35fa5a82d..4c1dae8fc 100644
--- a/src/ejabberd_c2s_config.erl
+++ b/src/ejabberd_c2s_config.erl
@@ -6,7 +6,7 @@
%%% Created : 2 Nov 2007 by Mickael Remond
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_check.erl b/src/ejabberd_check.erl
index 16aa78c68..260c54175 100644
--- a/src/ejabberd_check.erl
+++ b/src/ejabberd_check.erl
@@ -5,7 +5,7 @@
%%% Created : 27 Feb 2008 by Mickael Remond
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -39,19 +39,21 @@
libs() ->
ok.
-%% Consistency check on ejabberd configuration
+%% @doc Consistency check on ejabberd configuration
config() ->
check_database_modules().
check_database_modules() ->
[check_database_module(M)||M<-get_db_used()].
+check_database_module(odbc) ->
+ check_modules(odbc, [odbc, odbc_app, odbc_sup, ejabberd_odbc, ejabberd_odbc_sup, odbc_queries]);
check_database_module(mysql) ->
check_modules(mysql, [mysql, mysql_auth, mysql_conn, mysql_recv]);
check_database_module(pgsql) ->
check_modules(pgsql, [pgsql, pgsql_proto, pgsql_tcp, pgsql_util]).
-%% Issue a critical error and throw an exit if needing module is
+%% @doc Issue a critical error and throw an exit if needing module is
%% missing.
check_modules(DB, Modules) ->
case get_missing_modules(Modules) of
@@ -63,7 +65,7 @@ check_modules(DB, Modules) ->
end.
-%% Return the list of undefined modules
+%% @doc Return the list of undefined modules
get_missing_modules(Modules) ->
lists:filter(fun(Module) ->
case catch Module:module_info() of
@@ -73,7 +75,7 @@ get_missing_modules(Modules) ->
end
end, Modules).
-%% Return the list of databases used
+%% @doc Return the list of databases used
get_db_used() ->
%% Retrieve domains with a database configured:
Domains =
@@ -86,14 +88,22 @@ get_db_used() ->
case check_odbc_option(
ejabberd_config:get_local_option(
{auth_method, Domain})) of
- true -> [element(1, DB)|Acc];
+ true -> [get_db_type(DB)|Acc];
_ -> Acc
end
end,
[], Domains),
lists:usort(DBs).
-%% Return true if odbc option is used
+%% @doc Depending in the DB definition, return which type of DB this is.
+%% Note that MSSQL is detected as ODBC.
+%% @spec (DB) -> mysql | pgsql | odbc
+get_db_type(DB) when is_tuple(DB) ->
+ element(1, DB);
+get_db_type(DB) when is_list(DB) ->
+ odbc.
+
+%% @doc Return true if odbc option is used
check_odbc_option(odbc) ->
true;
check_odbc_option(AuthMethods) when is_list(AuthMethods) ->
diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl
index c18cfe6de..182b4a216 100644
--- a/src/ejabberd_config.erl
+++ b/src/ejabberd_config.erl
@@ -5,7 +5,7 @@
%%% Created : 14 Dec 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -95,10 +95,14 @@ get_plain_terms_file(File1) ->
case file:consult(File) of
{ok, Terms} ->
include_config_files(Terms);
- {error, Reason} ->
- ExitText = lists:flatten(File ++ ": around line "
+ {error, {_LineNumber, erl_parse, _ParseMessage} = Reason} ->
+ ExitText = lists:flatten(File ++ " approximately in the line "
++ file:format_error(Reason)),
- ?ERROR_MSG("Problem loading ejabberd config file:~n~s", [ExitText]),
+ ?ERROR_MSG("Problem loading ejabberd config file ~n~s", [ExitText]),
+ exit(ExitText);
+ {error, Reason} ->
+ ExitText = lists:flatten(File ++ ": " ++ file:format_error(Reason)),
+ ?ERROR_MSG("Problem loading ejabberd config file ~n~s", [ExitText]),
exit(ExitText)
end.
diff --git a/src/ejabberd_config.hrl b/src/ejabberd_config.hrl
index aa783ea5e..982bbe23f 100644
--- a/src/ejabberd_config.hrl
+++ b/src/ejabberd_config.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl
index 9a84b592e..c66b93a38 100644
--- a/src/ejabberd_ctl.erl
+++ b/src/ejabberd_ctl.erl
@@ -5,7 +5,7 @@
%%% Created : 11 Jan 2004 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -16,7 +16,7 @@
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%%% General Public License for more details.
-%%%
+%%%
%%% You should have received a copy of the GNU General Public License
%%% along with this program; if not, write to the Free Software
%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
@@ -99,6 +99,9 @@ process(["restart"]) ->
process(["reopen-log"]) ->
ejabberd_hooks:run(reopen_log_hook, []),
+ lists:foreach(fun(Host) ->
+ ejabberd_hooks:run(reopen_log_hook, Host, [Host])
+ end, ?MYHOSTS),
%% TODO: Use the Reopen log API for logger_h ?
ejabberd_logger_h:reopen_log(),
?STATUS_SUCCESS;
@@ -158,7 +161,7 @@ process(["load", Path]) ->
end;
process(["restore", Path]) ->
- case ejabberd_admin:restore(Path) of
+ case ejabberd_admin:restore(Path) of
{atomic, _} ->
?STATUS_SUCCESS;
{error, Reason} ->
@@ -384,7 +387,7 @@ dump_to_textfile(yes, {ok, F}) ->
end, Tabs1),
Defs = lists:map(
fun(T) -> {T, [{record_name, mnesia:table_info(T, record_name)},
- {attributes, mnesia:table_info(T, attributes)}]}
+ {attributes, mnesia:table_info(T, attributes)}]}
end,
Tabs),
io:format(F, "~p.~n", [{tables, Defs}]),
diff --git a/src/ejabberd_ctl.hrl b/src/ejabberd_ctl.hrl
index e8daef90b..9b5ec0a4b 100644
--- a/src/ejabberd_ctl.hrl
+++ b/src/ejabberd_ctl.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_frontend_socket.erl b/src/ejabberd_frontend_socket.erl
index 5874afa6d..320968f70 100644
--- a/src/ejabberd_frontend_socket.erl
+++ b/src/ejabberd_frontend_socket.erl
@@ -5,7 +5,7 @@
%%% Created : 23 Aug 2006 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_hooks.erl b/src/ejabberd_hooks.erl
index 7fc2f07f0..0609e20d4 100644
--- a/src/ejabberd_hooks.erl
+++ b/src/ejabberd_hooks.erl
@@ -5,7 +5,7 @@
%%% Created : 8 Aug 2004 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl
index b65a33785..e8bddf00e 100644
--- a/src/ejabberd_listener.erl
+++ b/src/ejabberd_listener.erl
@@ -5,7 +5,7 @@
%%% Created : 16 Nov 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_local.erl b/src/ejabberd_local.erl
index d77eb6968..232ce8415 100644
--- a/src/ejabberd_local.erl
+++ b/src/ejabberd_local.erl
@@ -5,7 +5,7 @@
%%% Created : 30 Nov 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_logger_h.erl b/src/ejabberd_logger_h.erl
index a3af991bc..2e750ca34 100644
--- a/src/ejabberd_logger_h.erl
+++ b/src/ejabberd_logger_h.erl
@@ -5,7 +5,7 @@
%%% Created : 23 Oct 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_loglevel.erl b/src/ejabberd_loglevel.erl
index 0f482b6fe..59c415196 100644
--- a/src/ejabberd_loglevel.erl
+++ b/src/ejabberd_loglevel.erl
@@ -9,7 +9,7 @@
%%% Created : 29 Nov 2006 by Mickael Remond
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_node_groups.erl b/src/ejabberd_node_groups.erl
index 6386a7e93..d5d8ce068 100644
--- a/src/ejabberd_node_groups.erl
+++ b/src/ejabberd_node_groups.erl
@@ -5,7 +5,7 @@
%%% Created : 1 Nov 2006 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_rdbms.erl b/src/ejabberd_rdbms.erl
index 540ffce0b..0eff6c3ca 100644
--- a/src/ejabberd_rdbms.erl
+++ b/src/ejabberd_rdbms.erl
@@ -5,7 +5,7 @@
%%% Created : 31 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_receiver.erl b/src/ejabberd_receiver.erl
index 5fdad76af..6d5b30ec3 100644
--- a/src/ejabberd_receiver.erl
+++ b/src/ejabberd_receiver.erl
@@ -5,7 +5,7 @@
%%% Created : 10 Nov 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_router.erl b/src/ejabberd_router.erl
index 04bc76285..658f674fc 100644
--- a/src/ejabberd_router.erl
+++ b/src/ejabberd_router.erl
@@ -5,7 +5,7 @@
%%% Created : 27 Nov 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -161,9 +161,9 @@ unregister_route(Domain) ->
mnesia:transaction(F);
_ ->
F = fun() ->
- case mnesia:match(#route{domain = LDomain,
- pid = Pid,
- _ = '_'}) of
+ case mnesia:match_object(#route{domain=LDomain,
+ pid = Pid,
+ _ = '_'}) of
[R] ->
I = R#route.local_hint,
mnesia:write(
diff --git a/src/ejabberd_s2s.erl b/src/ejabberd_s2s.erl
index 492484c31..53cc65e28 100644
--- a/src/ejabberd_s2s.erl
+++ b/src/ejabberd_s2s.erl
@@ -5,7 +5,7 @@
%%% Created : 7 Dec 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_s2s_in.erl b/src/ejabberd_s2s_in.erl
index 2fdcbac28..8ac32bf63 100644
--- a/src/ejabberd_s2s_in.erl
+++ b/src/ejabberd_s2s_in.erl
@@ -5,7 +5,7 @@
%%% Created : 6 Dec 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_s2s_out.erl b/src/ejabberd_s2s_out.erl
index bbd792a2f..b73336245 100644
--- a/src/ejabberd_s2s_out.erl
+++ b/src/ejabberd_s2s_out.erl
@@ -5,7 +5,7 @@
%%% Created : 6 Dec 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_service.erl b/src/ejabberd_service.erl
index 302211f07..8f16a6f6e 100644
--- a/src/ejabberd_service.erl
+++ b/src/ejabberd_service.erl
@@ -1,11 +1,11 @@
%%%----------------------------------------------------------------------
%%% File : ejabberd_service.erl
%%% Author : Alexey Shchepin
-%%% Purpose : External component management
+%%% Purpose : External component management (XEP-0114)
%%% Created : 6 Dec 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -147,11 +147,15 @@ init([{SockMod, Socket}, Opts]) ->
%% {stop, Reason, NewStateData}
%%----------------------------------------------------------------------
-wait_for_stream({xmlstreamstart, #xmlel{ns = NS}}, StateData) ->
- % TODO
+wait_for_stream({xmlstreamstart, #xmlel{ns = NS, attrs = Attrs}}, StateData) ->
case NS of
?NS_COMPONENT_ACCEPT ->
- Opening_Reply = exmpp_stream:opening_reply(?MYNAME,
+ %% Note: XEP-0114 requires to check that destination is a Jabber
+ %% component served by this Jabber server.
+ %% However several transports don't respect that,
+ %% so ejabberd doesn't check 'to' attribute (EJAB-717)
+ To = exmpp_stanza:get_recipient_from_attrs(Attrs),
+ Opening_Reply = exmpp_stream:opening_reply(xml:crypt(To),
?NS_COMPONENT_ACCEPT,
{0, 0}, StateData#state.streamid),
send_element(StateData, Opening_Reply),
diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl
index 3cec22f04..2d24d17a5 100644
--- a/src/ejabberd_sm.erl
+++ b/src/ejabberd_sm.erl
@@ -5,7 +5,7 @@
%%% Created : 24 Nov 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_socket.erl b/src/ejabberd_socket.erl
index 389b3a106..115ffc750 100644
--- a/src/ejabberd_socket.erl
+++ b/src/ejabberd_socket.erl
@@ -5,7 +5,7 @@
%%% Created : 23 Aug 2006 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_sup.erl b/src/ejabberd_sup.erl
index 596dd7fa6..01efbfd76 100644
--- a/src/ejabberd_sup.erl
+++ b/src/ejabberd_sup.erl
@@ -5,7 +5,7 @@
%%% Created : 31 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_system_monitor.erl b/src/ejabberd_system_monitor.erl
index eb1e305b2..e9a1a8ba3 100644
--- a/src/ejabberd_system_monitor.erl
+++ b/src/ejabberd_system_monitor.erl
@@ -5,7 +5,7 @@
%%% Created : 21 Mar 2007 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_tmp_sup.erl b/src/ejabberd_tmp_sup.erl
index 733af4c26..7438f6628 100644
--- a/src/ejabberd_tmp_sup.erl
+++ b/src/ejabberd_tmp_sup.erl
@@ -5,7 +5,7 @@
%%% Created : 18 Jul 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_update.erl b/src/ejabberd_update.erl
index 3f878337c..787f93fd7 100644
--- a/src/ejabberd_update.erl
+++ b/src/ejabberd_update.erl
@@ -5,7 +5,7 @@
%%% Created : 27 Jan 2006 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_zlib/ejabberd_zlib.erl b/src/ejabberd_zlib/ejabberd_zlib.erl
index 22bcaa8dd..18d5a3abf 100644
--- a/src/ejabberd_zlib/ejabberd_zlib.erl
+++ b/src/ejabberd_zlib/ejabberd_zlib.erl
@@ -5,7 +5,7 @@
%%% Created : 19 Jan 2006 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/ejabberd_zlib/ejabberd_zlib_drv.c b/src/ejabberd_zlib/ejabberd_zlib_drv.c
index abb3183c0..d1442d773 100644
--- a/src/ejabberd_zlib/ejabberd_zlib_drv.c
+++ b/src/ejabberd_zlib/ejabberd_zlib_drv.c
@@ -1,5 +1,5 @@
/*
- * ejabberd, Copyright (C) 2002-2008 Process-one
+ * ejabberd, Copyright (C) 2002-2008 ProcessOne
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
diff --git a/src/ejd2odbc.erl b/src/ejd2odbc.erl
index 2528e323d..c1399f987 100644
--- a/src/ejd2odbc.erl
+++ b/src/ejd2odbc.erl
@@ -5,7 +5,7 @@
%%% Created : 22 Aug 2005 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/eldap/eldap.hrl b/src/eldap/eldap.hrl
index 75f6f76ef..d006c14df 100644
--- a/src/eldap/eldap.hrl
+++ b/src/eldap/eldap.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/eldap/eldap_filter.erl b/src/eldap/eldap_filter.erl
index 771f909a6..2feed1083 100644
--- a/src/eldap/eldap_filter.erl
+++ b/src/eldap/eldap_filter.erl
@@ -6,7 +6,7 @@
%%% Author: Evgeniy Khramtsov
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/eldap/eldap_pool.erl b/src/eldap/eldap_pool.erl
index 13b45402a..7b9024de3 100644
--- a/src/eldap/eldap_pool.erl
+++ b/src/eldap/eldap_pool.erl
@@ -5,7 +5,7 @@
%%% Created : 12 Nov 2006 by Evgeniy Khramtsov
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/eldap/eldap_utils.erl b/src/eldap/eldap_utils.erl
index 465d9ffe5..1f6d156d3 100644
--- a/src/eldap/eldap_utils.erl
+++ b/src/eldap/eldap_utils.erl
@@ -5,7 +5,7 @@
%%% Created : 12 Oct 2006 by Mickael Remond
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/extauth.erl b/src/extauth.erl
index 3819fcddf..c4acb305d 100644
--- a/src/extauth.erl
+++ b/src/extauth.erl
@@ -5,7 +5,7 @@
%%% Created : 30 Jul 2004 by Leif Johansson
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/gen_iq_handler.erl b/src/gen_iq_handler.erl
index b3e3beca5..a1f100c45 100644
--- a/src/gen_iq_handler.erl
+++ b/src/gen_iq_handler.erl
@@ -5,7 +5,7 @@
%%% Created : 22 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/gen_mod.erl b/src/gen_mod.erl
index 29fbb1104..bbc4e860d 100644
--- a/src/gen_mod.erl
+++ b/src/gen_mod.erl
@@ -5,7 +5,7 @@
%%% Created : 24 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -30,6 +30,7 @@
-export([start/0,
start_module/3,
stop_module/2,
+ stop_module_keep_config/2,
get_opt/2,
get_opt/3,
get_opt_host/3,
@@ -72,22 +73,34 @@ start_module(Host, Module, Opts) ->
ok
end.
+%% @doc Stop the module in a host, and forget its configuration.
stop_module(Host, Module) ->
+ case stop_module_keep_config(Host, Module) of
+ error ->
+ error;
+ ok ->
+ del_module_mnesia(Host, Module)
+ end.
+
+%% @doc Stop the module in a host, but keep its configuration.
+%% As the module configuration is kept in the Mnesia local_config table,
+%% when ejabberd is restarted the module will be started again.
+%% This function is useful when ejabberd is being stopped
+%% and it stops all modules.
+stop_module_keep_config(Host, Module) ->
case catch Module:stop(Host) of
{'EXIT', Reason} ->
- ?ERROR_MSG("~p", [Reason]);
+ ?ERROR_MSG("~p", [Reason]),
+ error;
{wait, ProcList} when is_list(ProcList) ->
lists:foreach(fun wait_for_process/1, ProcList),
- del_module_mnesia(Host, Module),
ets:delete(ejabberd_modules, {Module, Host}),
ok;
{wait, Process} ->
wait_for_process(Process),
- del_module_mnesia(Host, Module),
ets:delete(ejabberd_modules, {Module, Host}),
ok;
_ ->
- del_module_mnesia(Host, Module),
ets:delete(ejabberd_modules, {Module, Host}),
ok
end.
diff --git a/src/idna.erl b/src/idna.erl
index 6ad8c54cb..319262349 100644
--- a/src/idna.erl
+++ b/src/idna.erl
@@ -5,7 +5,7 @@
%%% Created : 10 Apr 2004 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/jd2ejd.erl b/src/jd2ejd.erl
index 9fac9c11f..193566cde 100644
--- a/src/jd2ejd.erl
+++ b/src/jd2ejd.erl
@@ -5,7 +5,7 @@
%%% Created : 2 Feb 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/jlib.erl b/src/jlib.erl
index acf08a550..288e5f6c6 100644
--- a/src/jlib.erl
+++ b/src/jlib.erl
@@ -5,7 +5,7 @@
%%% Created : 23 Nov 2002 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/jlib.hrl b/src/jlib.hrl
index 3ea10b157..39731b14a 100644
--- a/src/jlib.hrl
+++ b/src/jlib.hrl
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_adhoc.erl b/src/mod_adhoc.erl
index ad255f827..b1a2a7bf7 100644
--- a/src/mod_adhoc.erl
+++ b/src/mod_adhoc.erl
@@ -5,7 +5,7 @@
%%% Created : 15 Nov 2005 by Magnus Henoch
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_announce.erl b/src/mod_announce.erl
index 5a744e6e0..e59e65fdb 100644
--- a/src/mod_announce.erl
+++ b/src/mod_announce.erl
@@ -5,7 +5,7 @@
%%% Created : 11 Aug 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_caps.erl b/src/mod_caps.erl
index 852ae7e48..d58b23587 100644
--- a/src/mod_caps.erl
+++ b/src/mod_caps.erl
@@ -5,7 +5,7 @@
%%% Created : 7 Oct 2006 by Magnus Henoch
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_configure.erl b/src/mod_configure.erl
index f960eb08e..b1cb0cced 100644
--- a/src/mod_configure.erl
+++ b/src/mod_configure.erl
@@ -5,7 +5,7 @@
%%% Created : 19 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_configure2.erl b/src/mod_configure2.erl
index 9acec3fc1..919927c38 100644
--- a/src/mod_configure2.erl
+++ b/src/mod_configure2.erl
@@ -5,7 +5,7 @@
%%% Created : 26 Oct 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_disco.erl b/src/mod_disco.erl
index 6907a4176..e1539fbd3 100644
--- a/src/mod_disco.erl
+++ b/src/mod_disco.erl
@@ -5,7 +5,7 @@
%%% Created : 1 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_echo.erl b/src/mod_echo.erl
index fc043370c..9e9748b55 100644
--- a/src/mod_echo.erl
+++ b/src/mod_echo.erl
@@ -5,7 +5,7 @@
%%% Created : 15 Jan 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_ip_blacklist.erl b/src/mod_ip_blacklist.erl
index 6a0cc3947..17280857e 100644
--- a/src/mod_ip_blacklist.erl
+++ b/src/mod_ip_blacklist.erl
@@ -7,7 +7,7 @@
%%% {mod_ip_blacklist, []}
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_irc/iconv.erl b/src/mod_irc/iconv.erl
index 9c500978e..77c1ea56c 100644
--- a/src/mod_irc/iconv.erl
+++ b/src/mod_irc/iconv.erl
@@ -5,7 +5,7 @@
%%% Created : 16 Feb 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_irc/iconv_erl.c b/src/mod_irc/iconv_erl.c
index 3cf82f4d5..3835aecbd 100644
--- a/src/mod_irc/iconv_erl.c
+++ b/src/mod_irc/iconv_erl.c
@@ -1,5 +1,5 @@
/*
- * ejabberd, Copyright (C) 2002-2008 Process-one
+ * ejabberd, Copyright (C) 2002-2008 ProcessOne
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
diff --git a/src/mod_irc/mod_irc.erl b/src/mod_irc/mod_irc.erl
index 4b2ae6adf..dd86037b9 100644
--- a/src/mod_irc/mod_irc.erl
+++ b/src/mod_irc/mod_irc.erl
@@ -5,7 +5,7 @@
%%% Created : 15 Feb 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_irc/mod_irc_connection.erl b/src/mod_irc/mod_irc_connection.erl
index f62d99bde..244f5300d 100644
--- a/src/mod_irc/mod_irc_connection.erl
+++ b/src/mod_irc/mod_irc_connection.erl
@@ -5,7 +5,7 @@
%%% Created : 15 Feb 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_last.erl b/src/mod_last.erl
index b35ea1150..cfdfa65e9 100644
--- a/src/mod_last.erl
+++ b/src/mod_last.erl
@@ -5,7 +5,7 @@
%%% Created : 24 Oct 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_last_odbc.erl b/src/mod_last_odbc.erl
index 76489b4c0..f2ac26114 100644
--- a/src/mod_last_odbc.erl
+++ b/src/mod_last_odbc.erl
@@ -5,7 +5,7 @@
%%% Created : 24 Oct 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -111,8 +111,6 @@ process_sm_iq(From, To, IQ) ->
get_last(IQ, LUser, LServer) ->
Username = ejabberd_odbc:escape(LUser),
case catch odbc_queries:get_last(LServer, Username) of
- {'EXIT', _Reason} ->
- exmpp_iq:error(IQ, 'internal-server-error');
{selected, ["seconds","state"], []} ->
exmpp_iq:error(IQ, 'service-unavailable');
{selected, ["seconds","state"], [{STimeStamp, Status}]} ->
@@ -127,7 +125,9 @@ get_last(IQ, LUser, LServer) ->
exmpp_iq:result(IQ, Response);
_ ->
exmpp_iq:error(IQ, 'internal-server-error')
- end
+ end;
+ _ ->
+ exmpp_iq:error(IQ, 'internal-server-error')
end.
on_presence_update(User, Server, _Resource, Status) ->
@@ -147,8 +147,6 @@ store_last_info(User, Server, TimeStamp, Status) ->
get_last_info(LUser, LServer) ->
Username = ejabberd_odbc:escape(LUser),
case catch odbc_queries:get_last(LServer, Username) of
- {'EXIT', _Reason} ->
- not_found;
{selected, ["seconds","state"], []} ->
not_found;
{selected, ["seconds","state"], [{STimeStamp, Status}]} ->
@@ -157,7 +155,9 @@ get_last_info(LUser, LServer) ->
{ok, TimeStamp, Status};
_ ->
not_found
- end
+ end;
+ _ ->
+ not_found
end.
remove_user(User, Server) ->
diff --git a/src/mod_muc/mod_muc.erl b/src/mod_muc/mod_muc.erl
index 90a74b70f..812c8de97 100644
--- a/src/mod_muc/mod_muc.erl
+++ b/src/mod_muc/mod_muc.erl
@@ -5,7 +5,7 @@
%%% Created : 19 Mar 2003 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_muc/mod_muc_log.erl b/src/mod_muc/mod_muc_log.erl
index 9ab8d4ce2..e76904193 100644
--- a/src/mod_muc/mod_muc_log.erl
+++ b/src/mod_muc/mod_muc_log.erl
@@ -5,7 +5,7 @@
%%% Created : 12 Mar 2006 by Alexey Shchepin
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 Process-one
+%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -52,6 +52,8 @@
-record(state, {host,
out_dir,
dir_type,
+ dir_name,
+ file_format,
css_file,
access,
lang,
@@ -113,6 +115,8 @@ check_access_log(Host, From) ->
init([Host, Opts]) ->
OutDir = gen_mod:get_opt(outdir, Opts, "www/muc"),
DirType = gen_mod:get_opt(dirtype, Opts, subdirs),
+ DirName = gen_mod:get_opt(dirname, Opts, room_jid),
+ FileFormat = gen_mod:get_opt(file_format, Opts, html), % Allowed values: html|plaintext
CSSFile = gen_mod:get_opt(cssfile, Opts, false),
AccessLog = gen_mod:get_opt(access_log, Opts, muc_admin),
Timezone = gen_mod:get_opt(timezone, Opts, local),
@@ -129,6 +133,8 @@ init([Host, Opts]) ->
{ok, #state{host = Host,
out_dir = OutDir,
dir_type = DirType,
+ dir_name = DirName,
+ file_format = FileFormat,
css_file = CSSFile,
access = AccessLog,
lang = Lang,
@@ -231,10 +237,10 @@ add_to_log2(kickban, {Nick, Reason, Code}, Room, Opts, State) ->
%%----------------------------------------------------------------------
%% Core
-build_filename_string(TimeStamp, OutDir, RoomJID, DirType) ->
+build_filename_string(TimeStamp, OutDir, RoomJID, DirType, DirName, FileFormat) ->
{{Year, Month, Day}, _Time} = TimeStamp,
- % Directory and file names
+ %% Directory and file names
{Dir, Filename, Rel} =
case DirType of
subdirs ->
@@ -248,55 +254,75 @@ build_filename_string(TimeStamp, OutDir, RoomJID, DirType) ->
[Year, Month, Day])),
{"", Date, "."}
end,
- Fd = filename:join([OutDir, RoomJID, Dir]),
- Fn = filename:join([Fd, Filename ++ ".html"]),
- Fnrel = filename:join([Rel, Dir, Filename ++ ".html"]),
+
+ RoomString = case DirName of
+ room_jid -> RoomJID;
+ room_name -> get_room_name(RoomJID)
+ end,
+ Extension = case FileFormat of
+ html -> ".html";
+ plaintext -> ".txt"
+ end,
+ Fd = filename:join([OutDir, RoomString, Dir]),
+ Fn = filename:join([Fd, Filename ++ Extension]),
+ Fnrel = filename:join([Rel, Dir, Filename ++ Extension]),
{Fd, Fn, Fnrel}.
-% calculate day before
+get_room_name(RoomJID) ->
+ JID = jlib:string_to_jid(RoomJID),
+ JID#jid.user.
+
+%% calculate day before
get_timestamp_daydiff(TimeStamp, Daydiff) ->
{Date1, HMS} = TimeStamp,
Date2 = calendar:gregorian_days_to_date(
calendar:date_to_gregorian_days(Date1) + Daydiff),
{Date2, HMS}.
-% Try to close the previous day log, if it exists
-close_previous_log(Fn, Images_dir) ->
+%% Try to close the previous day log, if it exists
+close_previous_log(Fn, Images_dir, FileFormat) ->
case file:read_file_info(Fn) of
{ok, _} ->
{ok, F} = file:open(Fn, [append]),
- %fw(F, "ejabberd/mod_muc log
"),
- fw(F, ""),
- fw(F, "
", [Images_dir]),
- fw(F, "
", [Images_dir]),
- fw(F, "
"),
- fw(F, " ", [Images_dir]),
- fw(F, " ", [Images_dir]),
- fw(F, "