문제

I am building an XMPP chat application using strophe.js (javascript) and openfire as server.

The application is working fine; however, I cannot manage to display the name attribute for the Rosters gathered. Either the name is undifined or it displays the jid of the Roster.

Where is the name stored in the XMPP database and how could I change it? Should I add the name in the memeber table where all xmpp users are store?

도움이 되었습니까?

해결책

Here it is in Javascript:

var iq = $iq({type: 'set'}).c('query', {xmlns: 'jabber:iq:roster'}).c("item",  {jid:'romeo@example.net',name:'MyRomeo'});
con.sendIQ(iq);

con.send($pres({to: 'test@test.com', type: "subscribe"}))

다른 팁

You can set your contact's name using strophe.js. Just send this query:

<iq from='juliet@example.com/balcony'
       id='gb3sv487'
       type='set'>
     <query xmlns='jabber:iq:roster'>
       <item jid='romeo@example.net'
             name='MyRomeo'/>
     </query>
   </iq>

Strophe.js:

var query = $iq({type: 'set'}).c('query', {xmlns: 'jabber:iq:roster'}).c('item', jid: 'jid@domain.com', name: 'JoeDoe')     
        connection.sendIQ(query, function success(response) {
            console.log(response); // for debugging purposes
        });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top