gloox  1.0.27
rosterlistener.h
1 /*
2  Copyright (c) 2004-2023 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #ifndef ROSTERLISTENER_H__
15 #define ROSTERLISTENER_H__
16 
17 #include "rosteritem.h"
18 
19 #include <string>
20 #include <map>
21 
22 namespace gloox
23 {
24 
25  class IQ;
26  class Presence;
27 
31  typedef std::map<const std::string, RosterItem*> Roster;
32 
43  class GLOOX_API RosterListener
44  {
45  public:
49  virtual ~RosterListener() {}
50 
59  virtual void handleItemAdded( const JID& jid ) = 0;
60 
66  virtual void handleItemSubscribed( const JID& jid ) = 0;
67 
75  virtual void handleItemRemoved( const JID& jid ) = 0;
76 
87  virtual void handleItemUpdated( const JID& jid ) = 0;
88 
94  virtual void handleItemUnsubscribed( const JID& jid ) = 0;
95 
104  virtual void handleRoster( const Roster& roster ) = 0;
105 
116  virtual void handleRosterPresence( const RosterItem& item, const std::string& resource,
117  Presence::PresenceType presence, const std::string& msg ) = 0;
118 
130  virtual void handleSelfPresence( const RosterItem& item, const std::string& resource,
131  Presence::PresenceType presence, const std::string& msg ) = 0;
132 
143  virtual bool handleSubscriptionRequest( const JID& jid, const std::string& msg ) = 0;
144 
155  virtual bool handleUnsubscriptionRequest( const JID& jid, const std::string& msg ) = 0;
156 
162  virtual void handleNonrosterPresence( const Presence& presence ) = 0;
163 
168  virtual void handleRosterError( const IQ& iq ) = 0;
169  };
170 
171 }
172 
173 #endif // ROSTERLISTENER_H__
An abstraction of an IQ stanza.
Definition: iq.h:34
An abstraction of a JID.
Definition: jid.h:31
An abstraction of a presence stanza.
Definition: presence.h:33
An abstraction of a roster item.
Definition: rosteritem.h:41
A virtual interface which can be reimplemented to receive roster updates.
virtual bool handleSubscriptionRequest(const JID &jid, const std::string &msg)=0
virtual void handleItemUnsubscribed(const JID &jid)=0
virtual void handleItemRemoved(const JID &jid)=0
virtual void handleRoster(const Roster &roster)=0
virtual void handleItemSubscribed(const JID &jid)=0
virtual void handleNonrosterPresence(const Presence &presence)=0
virtual void handleItemAdded(const JID &jid)=0
virtual void handleItemUpdated(const JID &jid)=0
virtual void handleRosterPresence(const RosterItem &item, const std::string &resource, Presence::PresenceType presence, const std::string &msg)=0
virtual void handleSelfPresence(const RosterItem &item, const std::string &resource, Presence::PresenceType presence, const std::string &msg)=0
virtual bool handleUnsubscriptionRequest(const JID &jid, const std::string &msg)=0
virtual void handleRosterError(const IQ &iq)=0
The namespace for the gloox library.
Definition: adhoc.cpp:28
std::map< const std::string, RosterItem * > Roster