This file is indexed.

/usr/include/gloox/rostermanager.h is in libgloox-dev 1.0.11-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/*
  Copyright (c) 2004-2014 by Jakob Schroeter <js@camaya.net>
  This file is part of the gloox library. http://camaya.net/gloox

  This software is distributed under a license. The full license
  agreement can be found in the file LICENSE in this distribution.
  This software may not be copied, modified, sold or distributed
  other than expressed in the named license agreement.

  This software is distributed without any warranty.
*/


#ifndef ROSTERMANAGER_H__
#define ROSTERMANAGER_H__

#include "subscriptionhandler.h"
#include "privatexmlhandler.h"
#include "iqhandler.h"
#include "presencehandler.h"
#include "rosterlistener.h"

#include <map>
#include <string>
#include <list>

namespace gloox
{

  class ClientBase;
  class Stanza;
  class PrivateXML;
  class RosterItem;

  /**
   * @brief This class implements Jabber/XMPP roster handling in the @b jabber:iq:roster namespace.
   *
   * It takes care of changing presence, subscriptions, etc.
   * You can modify any number of RosterItems within the Roster at any time. These changes must be
   * synchronized with the server by calling @ref synchronize(). Note that incoming Roster pushes
   * initiated by other resources may overwrite changed values.
   * Additionally, @xep{0083} (Nested Roster Groups) is implemented herein.
   *
   * @author Jakob Schroeter <js@camaya.net>
   * @since 0.3
   */
   class GLOOX_API RosterManager : public IqHandler, public PresenceHandler, public SubscriptionHandler,
                                   public PrivateXMLHandler
  {
    public:
      /**
       * Creates a new RosterManager.
       * @param parent The ClientBase which is used for communication.
       */
      RosterManager( ClientBase* parent );

      /**
       * Virtual destructor.
       */
      virtual ~RosterManager();

      /**
       * This function does the initial filling of the roster with
       * the current server-side roster.
       */
      void fill();

      /**
       * This function returns the roster.
       * @return Returns a map of JIDs with their current presence.
       */
      Roster* roster();

      /**
       * Use this function to subscribe to a new JID. The contact is added to the roster automatically
       * (by compliant servers, as required by RFC 3921).
       * @param jid The address to subscribe to.
       * @param name The displayed name of the contact.
       * @param groups A list of groups the contact belongs to.
       * @param msg A message sent along with the request.
       */
      void subscribe( const JID& jid, const std::string& name = EmptyString,
                      const StringList& groups = StringList(),
                      const std::string& msg = EmptyString );

      /**
       * Synchronizes locally modified RosterItems back to the server.
       */
      void synchronize();

      /**
       * Use this function to add a contact to the roster. No subscription request is sent.
       * @note Use @ref unsubscribe() to remove an item from the roster.
       * @param jid The JID to add.
       * @param name The displayed name of the contact.
       * @param groups A list of groups the contact belongs to.
       */
      void add( const JID& jid, const std::string& name, const StringList& groups );

      /**
       * Use this function to unsubscribe from a contact's presence. You will no longer
       * receive presence from this contact.
       * @param jid The address to unsubscribe from.
       * @param msg A message to send along with the request.
       * @since 0.9
       * @note Use remove() to remove a contact from the roster and to cancel its subscriptions.
       */
      void unsubscribe( const JID& jid, const std::string& msg = EmptyString );

      /**
       * Use this function to cancel the contact's subscription to your presence. The contact will
       * no longer receive presence from you.
       * @param jid The contact's JID.
       * @param msg A message to send along with the request.
       * @since 0.9
       * @note Use remove() to remove a contact from the roster and to cancel its subscriptions.
       */
      void cancel( const JID& jid, const std::string& msg = EmptyString );

      /**
       * Use this function to remove a contact from the roster. Subscription is implicitely
       * cancelled.
       * @param jid The contact's JID.
       * @since 0.9
       */
      void remove( const JID& jid );

      /**
       * Use this function to acknowledge a subscription request if you requested asynchronous
       * subscription request handling.
       * @param to The JID to authorize/decline.
       * @param ack Whether to authorize or decline the contact's request.
       */
      void ackSubscriptionRequest( const JID& to, bool ack );

      /**
       * Use this function to retrieve the delimiter of Nested Roster Groups (@xep{0083}).
       * @return The group delimiter.
       * @since 0.7
       */
      const std::string& delimiter() const { return m_delimiter; }

      /**
       * Use this function to set the group delimiter (@xep{0083}).
       * @param delimiter The group delimiter.
       * @since 0.7
       */
      void setDelimiter( const std::string& delimiter );

      /**
       * Lets you retrieve the RosterItem that belongs to the given JID.
       * @param jid The JID to return the RosterItem for.
       */
      RosterItem* getRosterItem( const JID& jid );

      /**
       * Register @c rl as object that receives updates on roster operations.
       * For GUI applications it may be necessary to display a dialog or whatever to
       * the user without blocking. If you want that, use asynchronous subscription
       * requests. If you want to answer a request right away, make it synchronous.
       * @param rl The object that receives roster updates.
       * @param syncSubscribeReq Indicates whether (Un)SubscriptionRequests shall
       * be handled synchronous (@b true) or asynchronous (@b false). Default: synchronous.
       */
      void registerRosterListener( RosterListener* rl, bool syncSubscribeReq = true );

      /**
       * Complementary function to @ref registerRosterListener. Removes the current RosterListener.
       * Roster events will not be delivered anywhere.
       */
      void removeRosterListener();

      // reimplemented from IqHandler.
      virtual bool handleIq( const IQ& iq );

      // reimplemented from IqHandler.
      virtual void handleIqID( const IQ& iq, int context );

      // reimplemented from PresenceHandler.
      virtual void handlePresence( const Presence& presence );

      // reimplemented from SubscriptionHandler.
      virtual void handleSubscription( const Subscription& subscription );

      // reimplemented from PrivateXMLHandler
      virtual void handlePrivateXML( const Tag* xml );

      // reimplemented from PrivateXMLHandler
      virtual void handlePrivateXMLResult( const std::string& uid, PrivateXMLResult pxResult );

    private:
#ifdef ROSTERMANAGER_TEST
    public:
#endif
      typedef std::list<RosterItemData*> RosterData;

      /**
       * @brief An implementation of StanzaExtension that helps in roster management.
       *
       * @author Jakob Schroeter <js@camaya.net>
       * @since 1.0
       */
      class Query : public StanzaExtension
      {
        public:
          /**
           * Constructs a new object that can be used to add a contact to the roster.
           * @param jid The contact's JID.
           * @param name The contact's optional user-defined name.
           * @param groups An optional list of groups the contact belongs to.
           */
          Query( const JID& jid, const std::string& name, const StringList& groups );

          /**
           * Constructs a new object that can be used to remove a contact from the roster.
           * @param jid The contact's JID.
           */
          Query( const JID& jid );

          /**
           * Creates a new Query object from teh given Tag.
           * @param tag The Tag to parse.
           */
          Query( const Tag* tag = 0 );

          /**
           * Destructor.
           */
          ~Query();

          /**
           * Retruns the internal roster that was created by the ctors (either from an
           * incoming packet or passed arguments).
           * This is not necessarily the full roster, but may be a single item.
           * @return The (possibly partial) roster).
           */
          const RosterData& roster() const { return m_roster; }

          // reimplemented from StanzaExtension
          virtual const std::string& filterString() const;

          // reimplemented from StanzaExtension
          virtual StanzaExtension* newInstance( const Tag* tag ) const
          {
            return new Query( tag );
          }

          // reimplemented from StanzaExtension
          virtual Tag* tag() const;

          // reimplemented from StanzaExtension
          virtual StanzaExtension* clone() const;

        private:
          RosterData m_roster;

      };

      void mergePush( const RosterData& data );
      void mergeRoster( const RosterData& data );

      RosterListener* m_rosterListener;
      Roster m_roster;
      ClientBase* m_parent;
      PrivateXML* m_privateXML;
      RosterItem* m_self;

      std::string m_delimiter;
      bool m_syncSubscribeReq;

      enum RosterContext
      {
        RequestRoster,
        AddRosterItem,
        RemoveRosterItem,
        SynchronizeRoster
      };

  };

}

#endif // ROSTER_H__