Ignore:
Timestamp:
Mar 11, 2013, 2:53:52 PM (11 years ago)
Author:
Edward Z. Yang <ezyang@mit.edu>
Children:
8b2419c
Parents:
3496369
git-author:
Edward Z. Yang <ezyang@mit.edu> (01/03/13 13:15:23)
git-committer:
Edward Z. Yang <ezyang@mit.edu> (03/11/13 14:53:52)
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

    rb8a3e00 r5625001  
    129129argument listed above, and die if no channel argument can be found.
    130130
     131=item C<CHANNEL_OR_USER>
     132
     133Pass the channel argument, but accept it if it's a username (e.g.
     134has no hash).  Only relevant with C<CHANNEL_ARG>.
     135
    131136=item C<CHANNEL_OPTIONAL>
    132137
     
    145150use constant CHANNEL_ARG        => 1;
    146151use constant CHANNEL_OPTIONAL   => 2;
    147 
    148 use constant ALLOW_DISCONNECTED => 4;
     152use constant CHANNEL_OR_USER    => 4;
     153
     154use constant ALLOW_DISCONNECTED => 8;
    149155
    150156sub register_commands {
     
    188194
    189195    BarnOwl::new_command(
    190         'irc-msg' => mk_irc_command( \&cmd_msg ),
     196        'irc-msg' => mk_irc_command( \&cmd_msg, CHANNEL_OR_USER|CHANNEL_ARG|CHANNEL_OPTIONAL ),
    191197        {
    192198            summary => 'Send an IRC message',
     
    591597                    $conn ||= $c;
    592598                }
     599            } elsif (defined($channel) && ($flags & CHANNEL_OR_USER)) {
     600                shift @ARGV;
    593601            } elsif ($m && $m->type eq 'IRC' && !$m->is_private) {
    594602                $channel = $m->channel;
Note: See TracChangeset for help on using the changeset viewer.