Changeset 3a6277a for perl/lib/BarnOwl


Ignore:
Timestamp:
Aug 20, 2009, 2:46:46 AM (12 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
362c932
Parents:
c854e74
git-author:
Anders Kaseorg <andersk@mit.edu> (08/20/09 02:17:47)
git-committer:
Anders Kaseorg <andersk@mit.edu> (08/20/09 02:46:46)
Message:
BarnOwl::Message::Zephyr: Use multi-argument quote.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl/Message/Zephyr.pm

    r30e7ffd r3a6277a  
    8383    my $mclass = shift;
    8484    my $minstance = shift;
    85     my $class = "";
     85    my @class;
    8686    if (lc($mclass) ne "message") {
    87         $class = "-c " . BarnOwl::quote($mclass);
    88     }
    89     my $instance = "";
     87        @class = ('-c', $mclass);
     88    }
     89    my @instance;
    9090    if (lc($minstance) ne "personal") {
    91         $instance = "-i " . BarnOwl::quote($minstance);
    92     }
    93     if (($class eq "") or  ($instance eq "")) {
    94         return $class . $instance;
    95     } else {
    96         return $class . " " . $instance;
    97     }
     91        @instance = ('-i', $minstance);
     92    }
     93    return (@class, @instance);
    9894}
    9995
    10096sub personal_context {
    10197    my ($m) = @_;
    102     return context_reply_cmd($m->class, $m->instance);
     98    return BarnOwl::quote(context_reply_cmd($m->class, $m->instance));
    10399}
    104100
     
    178174    }
    179175
    180     my $cmd;
     176    my @cmd;
    181177    if(lc $self->opcode eq 'crypt' and ( not $sender or $self->is_private)) {
    182178        # Responses to zcrypted messages should be zcrypted, so long as we
    183179        # aren't switching to personals
    184         $cmd = 'zcrypt';
     180        @cmd = ('zcrypt');
    185181    } else {
    186         $cmd = 'zwrite';
    187     }
    188 
    189     my $context_part = context_reply_cmd($class, $instance);
    190     $cmd .= " " . $context_part unless ($context_part eq '');
     182        @cmd = ('zwrite');
     183    }
     184
     185    push @cmd, context_reply_cmd($class, $instance);
    191186    if ($to ne '') {
    192187        $to = strip_realm($to);
     
    196191            delete $cc{strip_realm(BarnOwl::zephyr_getsender())};
    197192            @cc = keys %cc;
    198             $cmd .= " -C " . join(" ", @cc);
     193            push @cmd, '-C', @cc;
    199194        } else {
    200195            if(BarnOwl::getvar('smartstrip') eq 'on') {
    201196                $to = BarnOwl::zephyr_smartstrip_user($to);
    202197            }
    203             $cmd .= " $to";
     198            push @cmd, $to;
    204199        }
    205200    }
    206     return $cmd;
     201    return BarnOwl::quote(@cmd);
    207202}
    208203
Note: See TracChangeset for help on using the changeset viewer.