Changeset 4f7b1f4 for perl/modules


Ignore:
Timestamp:
Aug 8, 2013, 2:19:03 PM (11 years ago)
Author:
Edward Z. Yang <ezyang@mit.edu>
Branches:
master, release-1.10
Children:
a38becd, 8b2419c
Parents:
48c09d4
git-author:
Edward Z. Yang <ezyang@mit.edu> (01/03/13 13:15:23)
git-committer:
Edward Z. Yang <ezyang@mit.edu> (08/08/13 14:19:03)
Message:
Support channel-or-user IRC commands, and setup irc-msg to use it.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
File:
1 edited

Legend:

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

    r731e921 r4f7b1f4  
    138138argument listed above, and die if no channel argument can be found.
    139139
     140=item C<CHANNEL_OR_USER>
     141
     142Pass the channel argument, but accept it if it's a username (e.g.
     143has no hash).  Only relevant with C<CHANNEL_ARG>.
     144
    140145=item C<CHANNEL_OPTIONAL>
    141146
     
    154159use constant CHANNEL_ARG        => 1;
    155160use constant CHANNEL_OPTIONAL   => 2;
    156 
    157 use constant ALLOW_DISCONNECTED => 4;
     161use constant CHANNEL_OR_USER    => 4;
     162
     163use constant ALLOW_DISCONNECTED => 8;
    158164
    159165sub register_commands {
     
    197203
    198204    BarnOwl::new_command(
    199         'irc-msg' => mk_irc_command( \&cmd_msg ),
     205        'irc-msg' => mk_irc_command( \&cmd_msg, CHANNEL_OR_USER|CHANNEL_ARG|CHANNEL_OPTIONAL ),
    200206        {
    201207            summary => 'Send an IRC message',
     
    608614                    $conn ||= $c;
    609615                }
     616            } elsif (defined($channel) && ($flags & CHANNEL_OR_USER)) {
     617                shift @ARGV;
    610618            } elsif ($m && $m->type eq 'IRC' && !$m->is_private) {
    611619                $channel = $m->channel;
Note: See TracChangeset for help on using the changeset viewer.