Changeset 9a023d0 for perl/modules
- Timestamp:
- Feb 6, 2010, 6:11:26 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 3f18ad5
- Parents:
- c3a47c9
- git-author:
- Joshua Oreman <oremanj@mit.edu> (02/06/10 18:11:26)
- git-committer:
- Geoffrey Thomas <geofft@mit.edu> (02/06/10 18:11:26)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r416241f r9a023d0 453 453 my $conn = shift; 454 454 my $to = shift; 455 my $body = shift; 456 # Strip whitespace. In the future -- send one message/line? 457 $body =~ tr/\n\r/ /; 458 if ($body =~ /^\/me (.*)/) { 459 $conn->conn->me($to, Encode::encode('utf-8', $1)); 460 $body = '* '.$conn->nick.' '.$1; 461 } else { 462 $conn->conn->privmsg($to, Encode::encode('utf-8', $body)); 463 } 464 my $msg = BarnOwl::Message->new( 465 type => 'IRC', 466 direction => is_private($to) ? 'out' : 'in', 467 server => $conn->server, 468 network => $conn->alias, 469 recipient => $to, 470 body => $body, 471 sender => $conn->nick, 472 is_private($to) ? 473 (isprivate => 'true') : (channel => $to), 474 replycmd => BarnOwl::quote('irc-msg', '-a', $conn->alias, $to), 475 replysendercmd => BarnOwl::quote('irc-msg', '-a', $conn->alias, $to), 476 ); 477 BarnOwl::queue_message($msg); 455 my $fullbody = shift; 456 my @msgs; 457 # Require the user to send in paragraphs (double-newline between) to 458 # actually send multiple PRIVMSGs, in order to play nice with autofill. 459 $fullbody =~ s/\r//g; 460 @msgs = split "\n\n", $fullbody; 461 map { tr/\n/ / } @msgs; 462 for my $body (@msgs) { 463 if ($body =~ /^\/me (.*)/) { 464 $conn->conn->me($to, Encode::encode('utf-8', $1)); 465 $body = '* '.$conn->nick.' '.$1; 466 } else { 467 $conn->conn->privmsg($to, Encode::encode('utf-8', $body)); 468 } 469 my $msg = BarnOwl::Message->new( 470 type => 'IRC', 471 direction => is_private($to) ? 'out' : 'in', 472 server => $conn->server, 473 network => $conn->alias, 474 recipient => $to, 475 body => $body, 476 sender => $conn->nick, 477 is_private($to) ? 478 (isprivate => 'true') : (channel => $to), 479 replycmd => BarnOwl::quote('irc-msg', '-a', $conn->alias, $to), 480 replysendercmd => BarnOwl::quote('irc-msg', '-a', $conn->alias, $to), 481 ); 482 BarnOwl::queue_message($msg); 483 } 478 484 return; 479 485 }
Note: See TracChangeset
for help on using the changeset viewer.