]> granicus.if.org Git - ejabberd/commitdiff
* src/ejabberd_service.erl: Proper handling of bad XML
authorAlexey Shchepin <alexey@process-one.net>
Thu, 29 May 2003 19:07:41 +0000 (19:07 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Thu, 29 May 2003 19:07:41 +0000 (19:07 +0000)
* src/mod_muc/mod_muc_room.erl: Append number of participants in
disco replies if requester allowed to see participant list

* src/mod_muc/mod_muc.erl (iq_disco_items): Pass requester JID to
room process

* src/mod_irc/mod_irc_connection.erl: Exit on receiving of
presence or message error

* src/mod_irc/mod_irc_connection.erl (handle_info): Return
"feature not implemented" on iq request with unknown namespace

SVN Revision: 111

ChangeLog
TODO
src/ejabberd_service.erl
src/mod_irc/mod_irc_connection.erl
src/mod_muc/mod_muc.erl
src/mod_muc/mod_muc_room.erl

index 705bdec340eed777b05800b4a603c9bfb58cea46..8780308f9d1898ed0d97ebf33f611d5b2fd09e87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-05-29  Alexey Shchepin  <alexey@sevcom.net>
+
+       * src/ejabberd_service.erl: Proper handling of bad XML
+
+       * src/mod_muc/mod_muc_room.erl: Append number of participants in
+       disco replies if requester allowed to see participant list
+
+       * src/mod_muc/mod_muc.erl (iq_disco_items): Pass requester JID to
+       room process
+
+       * src/mod_irc/mod_irc_connection.erl: Exit on receiving of
+       presence or message error
+
+       * src/mod_irc/mod_irc_connection.erl (handle_info): Return
+       "feature not implemented" on iq request with unknown namespace
+
 2003-05-18  Alexey Shchepin  <alexey@sevcom.net>
 
        * src/mod_muc/mod_muc.erl: Now body of message from admin to MUC
diff --git a/TODO b/TODO
index e5b2266d0dccff4aeca3cc3df9ae98a3303ccc15..90a7c40dbad6a8545e54be5e0059468f0c2463f7 100644 (file)
--- a/TODO
+++ b/TODO
@@ -8,15 +8,17 @@ admin interface
        backup management
 
 S2S:
-       * timeouts
-
        * rewrite S2S key validation
 
 more correctly work with SRV DNS records (priority, weight, etc...)
-SSL
-JEP-62,63 (?)
+TLS
+Privacy rules
 make roster set to work in one transaction
 add traffic shapers to c2s connection before authentification
 add traffic shapers to s2s connections
 more traffic shapers
 SNMP
+PubSub
+MUC: remove empty non-persistent conferences after timeout
+MUC: remove a lot of debugging output
+IRC: disconnect on receiving of error message or presence
index 1b1344bb3b8c89124593dfd43dec084112cfd6dd..bcd633d7eb63f85ef08416bd70306e6830d95ad3 100644 (file)
        "</stream:stream>"
        ).
 
+-define(INVALID_XML_ERR,
+       xml:element_to_string(?SERR_XML_NOT_WELL_FORMED)).
+-define(INVALID_NS_ERR,
+       xml:element_to_string(?SERR_INVALID_NAMESPACE)).
+
 %%%----------------------------------------------------------------------
 %%% API
 %%%----------------------------------------------------------------------
@@ -123,6 +128,13 @@ wait_for_stream({xmlstreamstart, Name, Attrs}, StateData) ->
            {stop, normal, StateData}
     end;
 
+wait_for_stream({xmlstreamerror, _}, StateData) ->
+    Header = io_lib:format(?STREAM_HEADER,
+                          ["none", ?MYNAME]),
+    send_text(StateData#state.socket,
+             Header ++ ?INVALID_XML_ERR ++ ?STREAM_TRAILER),
+    {stop, normal, StateData};
+
 wait_for_stream(closed, StateData) ->
     {stop, normal, StateData}.
 
@@ -148,6 +160,10 @@ wait_for_handshake({xmlstreamelement, El}, StateData) ->
 wait_for_handshake({xmlstreamend, Name}, StateData) ->
     {stop, normal, StateData};
 
+wait_for_handshake({xmlstreamerror, _}, StateData) ->
+    send_text(StateData#state.socket, ?INVALID_XML_ERR ++ ?STREAM_TRAILER),
+    {stop, normal, StateData};
+
 wait_for_handshake(closed, StateData) ->
     {stop, normal, StateData}.
 
@@ -184,6 +200,10 @@ stream_established({xmlstreamend, Name}, StateData) ->
     % TODO
     {stop, normal, StateData};
 
+stream_established({xmlstreamerror, _}, StateData) ->
+    send_text(StateData#state.socket, ?INVALID_XML_ERR ++ ?STREAM_TRAILER),
+    {stop, normal, StateData};
+
 stream_established(closed, StateData) ->
     % TODO
     {stop, normal, StateData}.
index 824e16f554c42caa23425746aad08422724d0b12..ddfd73276aed29a5f7bc46383f2957ef2e9f19a6 100644 (file)
@@ -184,6 +184,7 @@ handle_info({route_chan, Channel, Resource,
            "subscribed" -> StateData;
            "unsubscribe" -> StateData;
            "unsubscribed" -> StateData;
+           "error" -> stop;
            _ ->
                Nick = case Resource of
                           "" ->
@@ -204,11 +205,16 @@ handle_info({route_chan, Channel, Resource,
                                            S1#state.channels)}
                end
        end,
-    case length(dict:fetch_keys(NewStateData#state.channels)) of
-       0 ->
-           {stop, normal, NewStateData};
-       _ ->
-           {next_state, StateName, NewStateData}
+    if
+       NewStateData == stop ->
+           {stop, normal, StateData};
+       true ->
+           case length(dict:fetch_keys(NewStateData#state.channels)) of
+               0 ->
+                   {stop, normal, NewStateData};
+               _ ->
+                   {next_state, StateName, NewStateData}
+           end
     end;
 
 handle_info({route_chan, Channel, Resource,
@@ -265,10 +271,17 @@ handle_info({route_chan, Channel, Resource,
                                                [Resource, S])
                          end, Strings)),
                ?SEND(Res);
+           "error" ->
+               stop;
            _ ->
                StateData
        end,
-    {next_state, StateName, NewStateData};
+    if
+       NewStateData == stop ->
+           {stop, normal, StateData};
+       true ->
+           {next_state, StateName, NewStateData}
+    end;
 
 
 handle_info({route_chan, Channel, Resource,
@@ -285,7 +298,7 @@ handle_info({route_chan, Channel, Resource,
                     ID, XMLNS, Type, SubEl);
        _ ->
            Err = jlib:make_error_reply(
-                   El, ?ERR_SERVICE_UNAVAILABLE),
+                   El, ?ERR_FEATURE_NOT_IMPLEMENTED),
            ejabberd_router:route(To, From, Err)
     end,
     {next_state, StateName, StateData};
@@ -315,10 +328,17 @@ handle_info({route_nick, Nick,
                                                [Nick, S])
                          end, Strings)),
                ?SEND(Res);
+           "error" ->
+               stop;
            _ ->
                StateData
        end,
-    {next_state, StateName, NewStateData};
+    if
+       NewStateData == stop ->
+           {stop, normal, StateData};
+       true ->
+           {next_state, StateName, NewStateData}
+    end;
 
 handle_info({route_nick, Nick, Packet}, StateName, StateData) ->
     {next_state, StateName, StateData};
index d3ec273971d6a5df833719dca43b57987a4fcbe7..42d6c8d1400b316045f3571f4e8ba9ce242042d8 100644 (file)
@@ -276,7 +276,7 @@ process_iq_disco_items(Host, From, To, ID, SubEl) ->
 iq_disco_items(Host, From) ->
     lists:zf(fun(#muc_online_room{name = Name, pid = Pid}) ->
                     case catch gen_fsm:sync_send_all_state_event(
-                                 Pid, get_disco_item, 100) of
+                                 Pid, {get_disco_item, From}, 100) of
                         {item, Desc} ->
                             {true,
                              {xmlelement, "item",
index 92d111b85497208e850cf80cd2bd5ba800ba3eea..37f07afb0d351e58d1eefddfd10d8f13998ed13a 100644 (file)
@@ -552,10 +552,23 @@ handle_event(Event, StateName, StateData) ->
 %%          {stop, Reason, NewStateData}                          |
 %%          {stop, Reason, Reply, NewStateData}                    
 %%----------------------------------------------------------------------
-handle_sync_event(get_disco_item, From, StateName, StateData) ->
+handle_sync_event({get_disco_item, JID}, From, StateName, StateData) ->
+    FAffiliation = get_affiliation(JID, StateData),
+    FRole = get_role(JID, StateData),
+    Tail =
+       case ((StateData#state.config)#config.public_list == true) orelse
+           (FRole /= none) orelse
+           (FAffiliation == admin) orelse
+           (FAffiliation == owner) of
+           true ->
+               Len = length(?DICT:to_list(StateData#state.users)),
+               " (" ++ integer_to_list(Len) ++ ")";
+           _ ->
+               ""
+       end,
     Reply = case (StateData#state.config)#config.public of
                true ->
-                   {item, get_title(StateData)};
+                   {item, get_title(StateData) ++ Tail};
                _ ->
                    false
            end,