Re: problems with auto subcription.
From: Chris Fernandez <cfernandez@xxxxxxxxxxxxxxx>
Date: Fri, 23 Mar 2007 02:35:48 +0100 (CET)
Jakob Schroeter wrote:
On Fri Mar 23 2007, Chris Fernandez wrote:
Hi, I am having some problems getting to work with auto subscription I
am using
rosterlistener.h  etc like some people mention to me last week,  I got
my code to compile with no error but I think  is not doing nothing at all.
I am attaching the code, please someone take a look and let me know what
I'm doing wrong, please be patience I am a  newbee.

Thanks so much

Besides #including rosterlistener.h you'll have to derive Bot from RosterListener, implement the virtuals, and call
  client->rosterManager()->registerRosterListener( this ).
Or something similar to that effect.

cheers,
Jakob
Hi, thanks for the response, I was trying to do that.. I think... I did this
class Bot : public ConnectionListener, MessageHandler, RosterListener {

public:

....



but I get this when I compile:

g++ -lgloox bot.cpp -o bot
bot.cpp: In function ‘int main()’:
bot.cpp:132: error: cannot allocate an object of abstract type ‘Bot’
bot.cpp:16: note: because the following virtual functions are pure within ‘Bot’: /usr/include/gloox/rosterlistener.h:56: note: virtual void gloox::RosterListener::itemAdded(const std::string&) /usr/include/gloox/rosterlistener.h:63: note: virtual void gloox::RosterListener::itemSubscribed(const std::string&) /usr/include/gloox/rosterlistener.h:72: note: virtual void gloox::RosterListener::itemRemoved(const std::string&) /usr/include/gloox/rosterlistener.h:84: note: virtual void gloox::RosterListener::itemUpdated(const std::string&) /usr/include/gloox/rosterlistener.h:91: note: virtual void gloox::RosterListener::itemUnsubscribed(const std::string&) /usr/include/gloox/rosterlistener.h:101: note: virtual void gloox::RosterListener::roster(const std::map<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, gloox::RosterItem*, std::less<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, gloox::RosterItem*> > >&) /usr/include/gloox/rosterlistener.h:112: note: virtual void gloox::RosterListener::presenceUpdated(const gloox::RosterItem&, int, const std::string&) /usr/include/gloox/rosterlistener.h:123: note: virtual void gloox::RosterListener::itemAvailable(const gloox::RosterItem&, const std::string&, const gloox::JID&) /usr/include/gloox/rosterlistener.h:132: note: virtual void gloox::RosterListener::itemUnavailable(const gloox::RosterItem&, const std::string&, const gloox::JID&) /usr/include/gloox/rosterlistener.h:156: note: virtual bool gloox::RosterListener::unsubscriptionRequest(const std::string&, const std::string&) /usr/include/gloox/rosterlistener.h:163: note: virtual void gloox::RosterListener::nonrosterPresenceReceived(const gloox::JID&)