This file is indexed.

/usr/include/ptclib/xmpp_roster.h is in libpt-1.10.10-dev 1.10.10-3.1ubuntu1.

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
/*
 * xmpp_roster.h
 *
 * Extensible Messaging and Presence Protocol (XMPP) IM
 * Roster management classes
 *
 * Portable Windows Library
 *
 * Copyright (c) 2004 Reitek S.p.A.
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Portable Windows Library.
 *
 * The Initial Developer of the Original Code is Post Increment
 *
 * Contributor(s): ______________________________________.
 *
 * $Log: xmpp_roster.h,v $
 * Revision 1.2  2004/05/09 07:23:46  rjongbloed
 * More work on XMPP, thanks Federico Pinna and Reitek S.p.A.
 *
 * Revision 1.1  2004/04/26 01:51:57  rjongbloed
 * More implementation of XMPP, thanks a lot to Federico Pinna & Reitek S.p.A.
 *
 *
 */

#ifndef _XMPP_ROSTER
#define _XMPP_ROSTER

#ifdef P_USE_PRAGMA
#pragma interface
#endif

#include <ptclib/xmpp_c2s.h>

#if P_EXPAT

///////////////////////////////////////////////////////

namespace XMPP
{
  class Roster : public PObject
  {
    PCLASSINFO(Roster, PObject);
  public:

    enum ItemType { // Subscription type
      None,
      To,
      From,
      Both,
      Unknown = 999
    };

    class Item : public PObject
    {
      PCLASSINFO(Item, PObject);
      PDICTIONARY(PresenceInfo, PString, Presence);

    public:
      Item(PXMLElement * item = 0);
      Item(PXMLElement& item);
      Item(const JID& jid, ItemType type, const PString& group, const PString& name = PString::Empty());

      const JID&          GetJID() const        { return m_JID; }
      ItemType            GetType() const       { return m_Type; }
      const PString&      GetName() const       { return m_Name; }
      const PStringSet&   GetGroups() const     { return m_Groups; }
      const PresenceInfo& GetPresence() const   { return m_Presence; }

      virtual void  SetJID(const JID& jid, BOOL dirty = TRUE)
                                                { m_JID = jid; if (dirty) SetDirty(); }
      virtual void  SetType(ItemType type, BOOL dirty = TRUE)
                                                { m_Type = type; if (dirty) SetDirty(); }
      virtual void  SetName(const PString& name, BOOL dirty = TRUE) 
                                                { m_Name = name; if (dirty) SetDirty(); }

      virtual void  AddGroup(const PString& group, BOOL dirty = TRUE);
      virtual void  RemoveGroup(const PString& group, BOOL dirty = TRUE);

      virtual void  SetPresence(const Presence& p);

      void SetDirty(BOOL b = TRUE) { m_IsDirty = b; }

      /** This operator will set the dirty flag
       */
      Item & operator=(
        const PXMLElement& item
      );

      virtual PXMLElement * AsXML(PXMLElement * parent) const;

    protected:
      BareJID     m_JID;
      ItemType    m_Type;
      PString     m_Name;
      PStringSet  m_Groups;

      // The item's presence state: for each resource (the key to the dictionary) a
      // a presence stanza if kept.
      PDictionary<PString, Presence> m_Presence;

      BOOL        m_IsDirty; // item modified locally, server needs to be updated
    };
    PLIST(ItemList, Item);

  public:
    Roster(XMPP::C2S::StreamHandler * handler = 0);
    ~Roster();

    const ItemList& GetItems() const    { return m_Items; }

    virtual Item * FindItem(const PString& jid);

    virtual BOOL SetItem(Item * item, BOOL localOnly = FALSE);
    virtual BOOL RemoveItem(const PString& jid, BOOL localOnly = FALSE);
    virtual BOOL RemoveItem(Item * item, BOOL localOnly = FALSE);

    virtual void  Attach(XMPP::C2S::StreamHandler * handler);
    virtual void  Detach();
    virtual void  Refresh(BOOL sendPresence = TRUE);

    virtual PNotifierList& ItemChangedHandlers()    { return m_ItemChangedHandlers; }
    virtual PNotifierList& RosterChangedHandlers()  { return m_RosterChangedHandlers; }

  protected:
    PDECLARE_NOTIFIER(XMPP::C2S::StreamHandler, Roster, OnSessionEstablished);
    PDECLARE_NOTIFIER(XMPP::C2S::StreamHandler, Roster, OnSessionReleased);
    PDECLARE_NOTIFIER(XMPP::Presence, Roster, OnPresence);
    PDECLARE_NOTIFIER(XMPP::IQ, Roster, OnIQ);

    ItemList m_Items;
    XMPP::C2S::StreamHandler * m_Handler;
    PNotifierList m_ItemChangedHandlers;
    PNotifierList m_RosterChangedHandlers;
  };

} // namespace XMPP


#endif  // P_EXPAT

#endif  // _XMPP_ROSTER

// End of File ///////////////////////////////////////////////////////////////