Changeset 7f463cf for perl/lib/BarnOwl/Message.pm
- Timestamp:
- Aug 16, 2017, 12:53:41 PM (7 years ago)
- Branches:
- master
- Children:
- da7341e
- Parents:
- a619eda
- git-author:
- Jason Gross <jgross@mit.edu> (07/12/11 12:34:46)
- git-committer:
- Jason Gross <jasongross9@gmail.com> (08/16/17 12:53:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl/Message.pm
r0adbce1 r7f463cf 115 115 } 116 116 return $s; 117 } 118 119 =head2 log MESSAGE 120 121 Returns the text that should be written to a file to log C<MESSAGE>. 122 123 =cut 124 125 sub log { 126 my ($m) = @_; 127 return $m->log_header . "\n\n" . $m->log_body . "\n\n"; 128 } 129 130 =head2 log_header MESSAGE 131 132 Returns the header of the message, for logging purposes. 133 If you override L<BarnOwl::Message::log>, this method is not called. 134 135 =cut 136 137 sub log_header { 138 my ($m) = @_; 139 my $sender = $m->sender; 140 my $recipient = $m->recipient; 141 my $timestr = $m->time; 142 return "From: <$sender> To: <$recipient>\n" 143 . "Time: $timestr"; 144 } 145 146 =head2 log_body MESSAGE 147 148 Returns the body of the message, for logging purposes. 149 If you override L<BarnOwl::Message::log>, this method is not called. 150 151 =cut 152 153 sub log_body { 154 my ($m) = @_; 155 if ($m->is_loginout) { 156 return uc($m->login) 157 . $m->login_type 158 . ($m->login_extra ? ' at ' . $m->login_extra : ''); 159 } else { 160 return $m->body; 161 } 117 162 } 118 163
Note: See TracChangeset
for help on using the changeset viewer.