This file is indexed.

/usr/lib/ruby/1.8/gurgitate/mailmessage.rb is in gurgitate-mail 1.10.0-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
#------------------------------------------------------------------------
# Handles a complete mail message
#------------------------------------------------------------------------

require 'gurgitate/headers'

module Gurgitate

    # A complete mail message.
    class Mailmessage

        Fromregex=/([^ ]+@[^ ]+) \(.*\)|[^<][<](.*@.*)[>]|([^ ]+@[^ ]+)/;

        # The headers of the message
        attr_reader :headers
        # The body of the message
        attr_accessor :body

        # The envelope sender and recipient, if anyone thought to
        # mention them to us.
        attr_accessor :sender
        attr_accessor :recipient

        # Creates a new mail message with headers built from the options hash,
        # and the body of the message in a string.
        def self.create(*args)
            options = body = nil

            if String === args[0]
                options = args[1]
                body = args[0]
            elsif Hash === args[0]
                options = args[0]
            else
                options = {}
            end

            message = self.new

            message.instance_eval do
                if body
                    @body=body
                end

                %w/sender recipient body/.each do |key|
                    if options.has_key? key.to_sym
                        instance_variable_set("@#{key}", options[key.to_sym])
                        options.delete key.to_sym
                    end
                end

                @headers = Headers.new(options)
            end

            message
        end

        def initialize(text=nil, recipient=nil, sender=nil)

            @recipient = recipient
            @sender = sender

            if text
                (@headertext,@body)=text.split(/\n\n/,2)
                @headers=Headers.new(@headertext);
                Fromregex.match(@headers["From"][0].contents);
                @from=$+
            else
                @headers = Headers.new
                @body = ""
            end
        end

        # Returns the header +name+
        def header(name)
            @headers[name].each { |h| h.contents }.join(", ")
        end

        # custom accessors
    
        # Returns the message's sender
        def from; @sender || @headers.from; end

        # Returns all the candidates for a recipient
        def to; @recipient || @headers["To", "Cc"][0].contents; end

        # Returns the formatted mail message
        def to_s; @headers.to_s + "\n\n" + ( @body || ""); end

        # Returns the mail message formatted for mbox
        def to_mbox; @headers.to_mbox + "\n\n" + @body; end
    end
end