Lauri created VYSPER-351:
----------------------------

             Summary: NonAnonymous and SemiAnonymous rooms do not expose real 
jid on room join
                 Key: VYSPER-351
                 URL: https://issues.apache.org/jira/browse/VYSPER-351
             Project: VYSPER
          Issue Type: Bug
          Components: XEP-0045 MUC
    Affects Versions: 0.7, 0.8
            Reporter: Lauri
            Priority: Critical


This affects fetching vcard of a user in MUC.

Suggested patch (http://pastebin.com/2nMQ2Cbe):

{code:title=MUCPresenceHandler.java|borderStyle=solid}

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- 
a/server/extensions/xep0045-muc/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/handler/MUCPresenceHandler.java
+++ 
b/server/extensions/xep0045-muc/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/handler/MUCPresenceHandler.java
@@ -264,8 +264,9 @@
             }
             
             // relay presence of all existing room occupants to the now joined 
occupant
+            boolean includeJid = includeJidInItem(room, newOccupant);
             for (Occupant existingOccupant : room.getOccupants()) {
-                sendOccupantPresenceToNewOccupant(newOccupant, 
existingOccupant, room, serverRuntimeContext);
+                sendOccupantPresenceToNewOccupant(newOccupant, 
existingOccupant, room, serverRuntimeContext, includeJid);
             }
 
             // relay presence of the newly added occupant to all existing 
occupants
@@ -277,7 +278,6 @@
             room.updateLastActivity();
             
             // send discussion history to user
-            boolean includeJid = room.isRoomType(RoomType.NonAnonymous);
             List<Stanza> history = 
room.getHistory().createStanzas(newOccupant, includeJid, 
History.fromStanza(stanza));
             relayStanzas(newOccupantJid, history, serverRuntimeContext);
 
@@ -327,12 +327,12 @@
     }
 
     private void sendOccupantPresenceToNewOccupant(Occupant newOccupant, 
Occupant existingOccupant, Room room,
-                                                   ServerRuntimeContext 
serverRuntimeContext) {
+            ServerRuntimeContext serverRuntimeContext, boolean includeJid) {
         //            <presence
         //            from='[email protected]/firstwitch'
         //            to='[email protected]/pda'>
         //          <x xmlns='http://jabber.org/protocol/muc#user'>
-        //            <item affiliation='owner' role='moderator'/>
+        //            <item affiliation='owner' role='moderator' 
jid='[email protected]/pda'/>
         //          </x>
         //        </presence>
 
@@ -344,7 +344,7 @@
         final PresenceStanza latestPresence = 
room.getLatestPresence(existingOccupant.getJid());
 
         Entity roomAndOccupantNick = new EntityImpl(room.getJID(), 
existingOccupant.getNick());
-        final MucUserItem mucUserItem = new 
MucUserItem(existingOccupant.getAffiliation(), existingOccupant.getRole());
+        final MucUserItem mucUserItem = new MucUserItem(existingOccupant, 
includeJid, true);
         
         Stanza presenceToNewOccupant = 
createPresenceStanzaFromLatest(roomAndOccupantNick, newOccupant.getJid(),
                 null, null, latestPresence, NamespaceURIs.XEP0045_MUC_USER, 
mucUserItem);
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to