Changeset 9a34040 for perl


Ignore:
Timestamp:
Aug 16, 2017, 12:53:41 PM (7 years ago)
Author:
Jason Gross <jasongross9@gmail.com>
Branches:
master
Children:
dce72c1
Parents:
3374de9
git-author:
Jason Gross <jgross@mit.edu> (02/16/13 23:30:26)
git-committer:
Jason Gross <jasongross9@gmail.com> (08/16/17 12:53:41)
Message:
Add IRC logging filename generation

Based on asedeno's comment
"For IRC I'd probably want a combination of network and (channel or
nick)."
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/IRC/lib/BarnOwl/Message/IRC.pm

    r60b49a7 r9a34040  
    9292}
    9393
     94# logging
     95sub log_filenames {
     96    my ($m) = @_;
     97    die "IRC should not be handling non-IRC messages" if lc($m->type) ne "irc";
     98    BarnOwl::error("IRC message without a network") if !defined($m->network) || $m->network eq '';
     99    my $filename = lc($m->type) . ":" . lc($m->network);
     100    if ($m->is_personal) {
     101        if ($m->is_incoming) {
     102            $filename .= ":" . $m->sender;
     103        } elsif ($m->is_outgoing) {
     104            $filename .= ":" . $m->recipient;
     105        }
     106    } else {
     107        $filename .= ":" . $m->channel;
     108    }
     109    return ($filename);
     110}
     111
    941121;
Note: See TracChangeset for help on using the changeset viewer.