This file is indexed.

/usr/include/mimetic/rfc822/header.h is in libmimetic-dev 0.9.7-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
/***************************************************************************
    copyright            : (C) 2002-2008 by Stefano Barbato
    email                : stefano@codesink.org

    $Id: header.h,v 1.16 2008-10-07 11:06:27 tat Exp $
 ***************************************************************************/
#ifndef _MIMETIC_RFC822_HEADER_H_
#define _MIMETIC_RFC822_HEADER_H_
#include <string>
#include <deque>
#include <cassert>
#include <functional>
#include <iostream>
#include <mimetic/strutils.h>
#include <mimetic/utils.h>
#include <mimetic/rfc822/field.h>
#include <mimetic/rfc822/mailbox.h>
#include <mimetic/rfc822/messageid.h>
#include <mimetic/rfc822/mailboxlist.h>
#include <mimetic/rfc822/addresslist.h>

namespace mimetic
{


/// RFC822 header class object
/*!
    Use this class to build or parse message header fields.
    This is a STL container so you can browse fields using iterators(see ex. below).

    \sa <a href="../RFC/rfc822.txt">RFC822</a>
 */
class Rfc822Header: public std::deque<Field>
{
public:
    struct find_by_name: 
        public std::unary_function<const Field, bool>
    {
        find_by_name(const std::string&);
        bool operator()(const Field&) const;
    private:
        const istring m_name;
    };

    bool hasField(const std::string&) const;
    
    const Field& field(const std::string&) const;
    Field& field(const std::string&);

    const Mailbox& sender() const;
    Mailbox& sender();
    void sender(const Mailbox&);

    const MailboxList& from() const;
    MailboxList& from();
    void from(const MailboxList&);

    const AddressList& to() const;
    AddressList& to();
    void to(const AddressList&);

    const std::string& subject() const;
    std::string& subject();
    void subject(const std::string&);

    const AddressList& replyto() const;
    AddressList& replyto();
    void replyto(const AddressList&);

    const AddressList& cc() const;
    AddressList& cc();
    void cc(const AddressList&);

    const AddressList& bcc() const;
    AddressList& bcc();
    void bcc(const AddressList&);

    const MessageId& messageid() const;
    MessageId& messageid();
    void messageid(const MessageId&);
protected:
    template<typename T>
    const T& getField(const std::string&) const;
    template<typename T>
    T& getField(const std::string&);
    template<typename T>
    void setField(const std::string&, const T&);
};


// template member functions
template<typename T>
const T& Rfc822Header::getField(const std::string& name) const
{
    const_iterator it;
    it = find_if(begin(), end(), find_by_name(name));
    if(it != end())
    {
        // cast away constness
        Field& f = const_cast<Field&>(*it);
        // to be sure that it's the correct type
        FieldValue* pFv = f.m_pValue;
        if(!pFv->typeChecked())
        {
            std::string val = pFv->str();
            delete pFv;
            pFv = new T(val);
            f.m_pValue = pFv;
        }
        return static_cast<const T&>(*pFv);
    } else {
        static const T null;
        return null;
    }
}
template<typename T>
T& Rfc822Header::getField(const std::string& name)
{    
    iterator it;
    it = find_if(begin(), end(), find_by_name(name));
    if(it != end())
    {
        FieldValue* pFv = it->m_pValue;
        if(pFv == 0)
        {
            pFv = new T;
            assert(pFv);
            it->m_pValue = pFv;
        }
        // be sure that it's the correct type
        else if(!pFv->typeChecked())
        {
            std::string val = pFv->str();
            delete pFv;
            pFv = new T(val);
            it->m_pValue = pFv;
        }
        return static_cast<T&>(*pFv);
    } else {
        // insert and get the reference of the actual 
        // obj in the container, then modify its fields
        Field f;
        it = insert(end(), f);
        it->name(name);
        T* pT = new T;
        assert(pT);
        it->m_pValue = pT;
        assert(it->m_pValue->typeChecked());
        return *pT;
    }
}

template<typename T>
void Rfc822Header::setField(const std::string& name, const T& obj) 
{
    // remove if already exists
    iterator bit = begin(), eit = end();
    iterator found = find_if(bit, eit, find_by_name(name));
    if(found != eit)
        erase(found);
    // add field
    Field f;
    iterator it;
    it = insert(end(), f);
    it->name(name);
    it->m_pValue = new T(obj);
}

}

#endif