Class: CARPS::Message
- Inherits:
-
Object
- Object
- CARPS::Message
- Defined in:
- lib/carps/protocol/message.rb
Overview
A message
Direct Known Subclasses
AcceptHandshake, Answers, ClientTurn, Handshake, Invite, PublicKey, Question, Sheet::NewSheet, StatusReport
Instance Method Summary collapse
-
#crypt ⇒ Object
Cryptography information.
-
#crypt=(sig) ⇒ Object
Set cryptography information.
-
#delete ⇒ Object
Delete the path.
-
#from ⇒ Object
Who we’re from.
-
#from=(addr) ⇒ Object
set who we’re from.
-
#parse(text) ⇒ Object
Parse.
-
#path=(path) ⇒ Object
Set the path.
-
#save(blob) ⇒ Object
Save a blob, associated with this mail.
-
#session ⇒ Object
Get the session.
-
#session=(session) ⇒ Object
Set the session.
Instance Method Details
#crypt ⇒ Object
Cryptography information
70 71 72 |
# File 'lib/carps/protocol/message.rb', line 70 def crypt @delayed_crypt end |
#crypt=(sig) ⇒ Object
Set cryptography information
65 66 67 |
# File 'lib/carps/protocol/message.rb', line 65 def crypt= sig @delayed_crypt = sig end |
#delete ⇒ Object
Delete the path
116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/carps/protocol/message.rb', line 116 def delete if @path if File.exists?(@path) begin FileUtils.rm @path rescue StandardError => e UI::put_error "Could not delete message: #{e}" end end end end |
#from ⇒ Object
Who we’re from
80 81 82 |
# File 'lib/carps/protocol/message.rb', line 80 def from @from end |
#from=(addr) ⇒ Object
set who we’re from
75 76 77 |
# File 'lib/carps/protocol/message.rb', line 75 def from= addr @from = addr end |
#parse(text) ⇒ Object
Parse.
The first parameter is the email address this text is from The second parameter is the text itself.
132 133 134 |
# File 'lib/carps/protocol/message.rb', line 132 def parse text nil end |
#path=(path) ⇒ Object
Set the path
95 96 97 |
# File 'lib/carps/protocol/message.rb', line 95 def path= path @path = path end |
#save(blob) ⇒ Object
Save a blob, associated with this mail
Only use once. Raises exception if called multiple times.
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/carps/protocol/message.rb', line 102 def save blob if @path raise StandardError, "#{self} has already been saved!" else begin @path = write_file_in ".mail/", blob rescue StandardError => e UI::put_error "Could not save #{self.class} in .mail/:\n#{e.}" end end @path end |
#session ⇒ Object
Get the session
90 91 92 |
# File 'lib/carps/protocol/message.rb', line 90 def session @session end |
#session=(session) ⇒ Object
Set the session
85 86 87 |
# File 'lib/carps/protocol/message.rb', line 85 def session= session @session = session end |