Ignore:
Timestamp:
Aug 8, 2013, 2:32:12 PM (11 years ago)
Author:
Edward Z. Yang <ezyang@mit.edu>
Parents:
4f7b1f4 (diff), 5625001 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 5625001de63457b120505d283334cc38ed18d17a into 4f7b1f490980e1bd4ec7a48474a4598d447b2d5b
File:
1 edited

Legend:

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

    r5625001 r4f7b1f4  
    2323use Getopt::Long;
    2424use Encode;
     25use Text::Wrap;
    2526
    2627our $VERSION = 0.02;
     
    6566        description => 'If set, each (space-separated) message type ' .
    6667        'provided will be hidden and ignored if received.'
     68       });
     69
     70    BarnOwl::new_variable_int('irc:max-message-length', {
     71        default     => 450,
     72        summary     => 'Split messages to at most this many characters.' .
     73                       "If non-positive, don't split messages",
     74        description => 'If set to a positive number, any paragraph in an ' .
     75                       'IRC message will be split after this many characters.'
    6776       });
    6877
     
    433442    @msgs = split "\n\n", $fullbody;
    434443    map { tr/\n/ / } @msgs;
     444    # split each body at irc:max-message-length characters, if that number
     445    # is positive.  Only split at space boundaries.  Start counting a-fresh
     446    # at the beginning of each paragraph
     447    my $max_len = BarnOwl::getvar('irc:max-message-length');
     448    if ($max_len > 0) {
     449        local($Text::Wrap::columns) = $max_len;
     450        @msgs = split "\n", wrap("", "", join "\n", @msgs);
     451    }
    435452    for my $body (@msgs) {
    436453        if ($body =~ /^\/me (.*)/) {
     
    606623        }
    607624
    608         if(!$channel &&
     625        if(!defined($channel) &&
    609626           ($flags & CHANNEL_ARG) &&
    610627           !($flags & CHANNEL_OPTIONAL)) {
Note: See TracChangeset for help on using the changeset viewer.