]> granicus.if.org Git - ejabberd/commitdiff
* src/mod_muc/mod_muc_room.erl: Include <body/> in MUC invitations
authorAlexey Shchepin <alexey@process-one.net>
Tue, 26 Jun 2007 18:00:36 +0000 (18:00 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Tue, 26 Jun 2007 18:00:36 +0000 (18:00 +0000)
for older clients (thanks to Michael Scherer)

SVN Revision: 796

ChangeLog
src/mod_muc/mod_muc_room.erl

index cc33ee84f34e9bea8648991a1427b11f2f8b1283..21ebe3dca24521c811a6cc4b4e86311da9d2d377 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-26  Alexey Shchepin  <alexey@sevcom.net>
+
+       * src/mod_muc/mod_muc_room.erl: Include <body/> in MUC invitations
+       for older clients (thanks to Michael Scherer)
+
 2007-06-25  Mickael Remond  <mickael.remond@process-one.net>
 
        * doc/guide.tex: Typos
index ef4657680d427c565e1532ca4ad8a5759e3db91a..4aa65521fa723623794f2d94c26779b3fe132ef6 100644 (file)
@@ -205,7 +205,7 @@ normal_state({route, From, "",
                      From, Err),
                    {next_state, normal_state, StateData};
                Type when (Type == "") or (Type == "normal") ->
-                   case catch check_invitation(From, Els, StateData) of
+                   case catch check_invitation(From, Els, Lang, StateData) of
                        {error, Error} ->
                            Err = jlib:make_error_reply(
                                    Packet, Error),
@@ -2625,7 +2625,7 @@ get_title(StateData) ->
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Invitation support
 
-check_invitation(From, Els, StateData) ->
+check_invitation(From, Els, Lang, StateData) ->
     FAffiliation = get_affiliation(From, StateData),
     CanInvite = (StateData#state.config)#config.allow_user_invites
        orelse (FAffiliation == admin) orelse (FAffiliation == owner),
@@ -2675,6 +2675,32 @@ check_invitation(From, Els, StateData) ->
                    _ ->
                        []
                end,
+           Body =
+               {xmlelement, "body", [],
+                [{xmlcdata,
+                  lists:flatten(
+                    io_lib:format(
+                      translate:translate(
+                        Lang,
+                        "You have been invited to ~s by ~s"),
+                      [jlib:jid_to_string({StateData#state.room,
+                                           StateData#state.host,
+                                           ""}),
+                       jlib:jid_to_string(From)])) ++
+                  case (StateData#state.config)#config.password_protected of
+                      true ->
+                          ", " ++
+                              translate:translate(Lang, "the password is") ++
+                              " '" ++
+                              (StateData#state.config)#config.password ++ "'";
+                      _ ->
+                          ""
+                  end ++
+                  case Reason of
+                      "" -> "";
+                      _ -> " (" ++ Reason ++ ") "
+                  end
+                 }]},
            Msg =
                {xmlelement, "message",
                 [{"type", "normal"}],
@@ -2685,7 +2711,8 @@ check_invitation(From, Els, StateData) ->
                              {StateData#state.room,
                               StateData#state.host,
                               ""})}],
-                  [{xmlcdata, Reason}]}]},
+                  [{xmlcdata, Reason}]},
+                 Body]},
            ejabberd_router:route(StateData#state.jid, JID, Msg),
            JID
     end.