Changeset 2b14303 for examples


Ignore:
Timestamp:
Jan 28, 2003, 12:55:37 PM (22 years ago)
Author:
Erik Nygren <nygren@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ddb8252
Parents:
5a35ae8e
Message:
* Updated owlconf.simple to handle outgoing message formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/owlconf.simple

    r1770f30 r2b14303  
    3434### and when owl::format_msg() and owl::receive_msg() are run.
    3535###
    36 ###     $owl::class, $owl::instance, $owl::recipient,
     36###     $owl::class, $owl::instance, $owl::recipient, $owl::direction,
    3737###     $owl::sender, $owl::opcode, $owl::zsig,
    3838###     $owl::msg, $owl::time, $owl::host, @owl::fields, $owl::id
     
    165165    $owl::sender=~s/\@ATHENA\.MIT\.EDU$//;
    166166    $owl::sender=~s/\@local-realm$//;
     167    $owl::recipient=~s/\@ATHENA\.MIT\.EDU$//;
     168    $owl::recipient=~s/\@local-realm$//;
    167169
    168170    ## Format ping, login, and mail messages.
     
    189191
    190192    ## The remainder formats normal messages (eg, to classes and instances).
     193    ## Outgoing messages have different headers than incoming messages.
    191194    ## Note that:
    192195    ##   $out .= "foo";  appends "foo" to the end of the variable $out.
     
    196199    ##   "foo"."bar" will append the two strings together.
    197200
    198     $out = sprintf "[mit,%s,%s] / %s / %s", lc($owl::class),
    199                    lc($owl::instance), $owl::time, lc($owl::host);
    200     if ($owl::opcode ne "") {$out.=" op:$owl::opcode";}
    201     $out.="\n";
    202     $out.= "  \@bold($owl::sender)> ";
    203     if ($owl::zsig ne "") {
    204         my $zsig = $owl::zsig;
    205         $zsig =~ s/(\n.*)+$/ [...]/;
    206         if (length($zsig)+5+length($owl::sender) > 70) {
    207             $out.="# ...";
    208         } else {
    209             $out.="# $zsig";
     201
     202    if ($owl::direction eq "out") {
     203        # Outgoing messages
     204
     205        $out .= sprintf "[outgoing to %s] / %s", $owl::recipient, $owl::time;
     206        if ($owl::opcode ne "") {$out.=" op:$owl::opcode";}
     207        $out.="\n";
     208        $out.= "  \@bold($owl::sender)> ";
     209        if ($owl::zsig ne "") {
     210            my $zsig = $owl::zsig;
     211            $zsig =~ s/(\n.*)+$/ [...]/;
     212            if (length($zsig)+5+length($owl::sender) > 70) {
     213                $out.="# ...";
     214            } else {
     215                $out.="# $zsig";
     216            }
     217        }
     218    } else {
     219        # Incoming messages
     220
     221        $out .= sprintf "[mit,%s,%s] / %s / %s", lc($owl::class),
     222                        lc($owl::instance), $owl::time, lc($owl::host);
     223        if ($owl::opcode ne "") {$out.=" op:$owl::opcode";}
     224        $out.="\n";
     225        $out.= "  \@bold($owl::sender)> ";
     226        if ($owl::zsig ne "") {
     227            my $zsig = $owl::zsig;
     228            $zsig =~ s/(\n.*)+$/ [...]/;
     229            if (length($zsig)+5+length($owl::sender) > 70) {
     230                $out.="# ...";
     231            } else {
     232                $out.="# $zsig";
     233            }
    210234        }
    211235    }
     
    220244    # This makes personal messages bold.
    221245    if (uc($owl::class) eq "MESSAGE" &&
    222         uc($owl::instance) eq "PERSONAL") {
     246        uc($owl::instance) eq "PERSONAL" &&
     247       $owl::direction eq "in") {
    223248        $out="\@bold{".$out."}";
    224249    }
Note: See TracChangeset for help on using the changeset viewer.