mod_multicast没有向接收者提供正确的地址节

时间:2016-03-07 18:38:04

标签: ejabberd

多播服务未向地址节的所有收件人提供所有“到”属性。

UserA将数据包发送给UserB和UserC

<message type="chat" to="multicast.example.com" id="">
  <addresses xmlns="http://jabber.org/protocol/address">
    <address type="to" jid="UserB@example.com"/>
    <address type="to" jid="UserC@example.com"/>
  </addresses>
  <body>One</body>
  <active xmlns="http://jabber.org/protocol/chatstates"/>
</message>

然而,UserB收到

<message xmlns="jabber:client" from="UserA@example.com/iPhone" to="UserB@example.com" type="chat" id="">
  <addresses xmlns="http://jabber.org/protocol/address">
    <address type="to" jid="UserB@example.com"/>
  </addresses>
  <body>One</body>
  <active xmlns="http://jabber.org/protocol/chatstates"/>
</message>

UserC收到

<message xmlns="jabber:client" from="UserA@example.com/iPhone" to="UserC@example.com" type="chat" id="">
  <addresses xmlns="http://jabber.org/protocol/address">
    <address type="to" jid="UserC@example.com"/>
  </addresses>
  <body>One</body>
  <active xmlns="http://jabber.org/protocol/chatstates"/>
</message>

因此,UserB和UserC在地址节中相互缺少'到'属性。

我使用ejabberd 16.01并使用https://docs.ejabberd.im/admin/guide/configuration/#modmulticast配置

1 个答案:

答案 0 :(得分:1)

尝试此更改。这很奇怪,因为这些线路自多年前就没有变化。也许这个bug在别的地方,这只是一个解决方法:

--- a/src/mod_multicast.erl
+++ b/src/mod_multicast.erl
@@ -599,7 +599,7 @@ add_addresses(Delivereds, Groups) ->
 add_addresses2(_, [], Res, _, []) -> Res;
 add_addresses2(Delivereds, [Group | Groups], Res, Pa,
               [Pi | Pz]) ->
-    Addresses = lists:append([Delivereds] ++ Pa ++ Pz),
+    Addresses = lists:append([Delivereds] ++ Pa ++ [Pi] ++ Pz),
     Group2 = Group#group{addresses = Addresses},
     add_addresses2(Delivereds, Groups, [Group2 | Res],
                   [Pi | Pa], Pz).
@@ -655,7 +655,7 @@ route_packet_multicast(From, ToS, Packet, AAttrs, Dests,
 route_packet2(From, ToS, Dests, Packet, AAttrs,
              Addresses) ->
     #xmlel{name = T, attrs = A, children = C} = Packet,
-    C2 = case append_dests(Dests, Addresses) of
+    C2 = case Addresses of
           [] -> C;
           ACs ->
               [#xmlel{name = <<"addresses">>, attrs = AAttrs,