[ejabberd] Strange behaiviur presence round trip

Badlop badlop at gmail.com
Thu Apr 29 01:31:09 MSD 2010


2010/4/28 Pau Freixes <pfreixes at gmail.com>:
> To avoid this "unstable" state  - first sentence - i need to
> disconnect peer A and connect anothertime, after this ejabberd server
> begin to send presences from peer A to peer B


I can reproduce the problem thanks to your detailed steps.
Good news: this small patch solves it for me.
Try it and report if it works well for you, too.

===============================
--- src/mod_admin_extra.erl     (revisión: 1075)
+++ src/mod_admin_extra.erl     (copia de trabajo)
@@ -1111,9 +1111,11 @@
                  end, ejabberd_sm:get_user_resources(LU, LS)).

 push_roster_item(LU, LS, R, U, S, Action) ->
+    LJID = jlib:make_jid(LU, LS, R),
+    BroadcastEl = build_broadcast(U, S, Action),
+    ejabberd_router:route(LJID, LJID, BroadcastEl),
     Item = build_roster_item(U, S, Action),
     ResIQ = build_iq_roster_push(Item),
-    LJID = jlib:make_jid(LU, LS, R),
     ejabberd_router:route(LJID, LJID, ResIQ).

 build_roster_item(U, S, {add, Nick, Subs, Group}) ->
@@ -1140,6 +1142,16 @@
      ]
     }.

+build_broadcast(U, S, {add, _Nick, Subs, _Group}) ->
+    build_broadcast(U, S, list_to_atom(Subs));
+build_broadcast(U, S, remove) ->
+    build_broadcast(U, S, none);
+%% @spec (U::string(), S::string(), Subs::atom()) -> any()
+%% Subs = both | from | to | none
+build_broadcast(U, S, SubsAtom) when is_atom(SubsAtom) ->
+    {xmlelement, "broadcast", [],
+     [{item, {U, S, ""}, SubsAtom}]
+    }.

 %%%
 %%% Private Storage
===============================



---
Badlop
ProcessOne


More information about the ejabberd mailing list