1

I am writing an xmpp-based chat client using gloox 1.0. I can not find out the way to use gloox to get active rooms list on the server (rooms that other users have created). I use openfire as my local server. How can I do that?

Thuyen Thi
  • 11
  • 1

1 Answers1

0

You need to create a Disco object, and a custom class that inherits DiscoHandler.

To query the list you call getDiscoItems(muc_server_jid, ...). Your DiscoHandler should implement handleDiscoItems(), which receives a Disco::Items object, items.

You can use items.itemList() to get a std::list of pointers to Disco::Item objects. For each Disco::Item you can call item.jid() and item.name() to get the address and (optional) name of the room.

MattJ
  • 7,924
  • 1
  • 28
  • 33
  • I have my class: ChatBotDiscoHandler_cl: public DiscoHandler implementing handleDiscoItems( const JID& from, const Disco::Items& items, int context );. Then I call m_pClient->disco()->getDiscoItems(m_pClient->jid().server(), EmptyString, new ChatBotDiscoHandler_cl(), 0);. However, when I debug, it does not run into my derived method. Please show me where I am wrong? – Thuyen Thi Apr 25 '12 at 03:36