Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Split really long messages on multiple lines
  • Loading branch information
abh committed Jun 9, 2010
1 parent ee9e184 commit 19690a4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion httpirc.pl
Expand Up @@ -48,7 +48,22 @@


for my $channel (@channels) { for my $channel (@channels) {
$con->send_srv("JOIN", $channel); $con->send_srv("JOIN", $channel);
$con->send_chan($channel, 'PRIVMSG', $channel, $msg); my @msg;
while (length $msg > 300) {
$msg =~ s/^(.{300})//sm;
my $m = $1;
last unless $m;
$m =~ s/\n/ /smg;
push @msg, $m;
}
# whatever is remaining
push @msg, $msg;

#warn Data::Dumper->Dump([\@msg], [qw(msg)]);

for my $m (@msg) {
$con->send_chan($channel, 'PRIVMSG', $channel, $m);
}
} }


my $response = {channels => \@channels, msg => $msg}; my $response = {channels => \@channels, msg => $msg};
Expand Down

0 comments on commit 19690a4

Please sign in to comment.