Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Display topic changes as events

  • Loading branch information...
commit 213207c047ab83efdfe5cd64e610f6b4989c479d 1 parent 43119bd
Lee authored
Showing with 22 additions and 1 deletion.
  1. +9 −0 lib/App/Colloqueer/Channel.pm
  2. +13 −1 script/colloqueer
View
9 lib/App/Colloqueer/Channel.pm
@@ -222,6 +222,15 @@ sub handle_input {
if ($string =~ /^\/clear/) {
$self->clear;
}
+ if ($string =~ /^\/topic\s?(.*)/) {
+ if ($1) {
+ $self->app->irc->yield(topic => $self->name => $1);
+ }
+ else {
+ my $topc = $self->app->irc->channel_topic($self->name);
+
+ }
+ }
elsif ($string =~ /^\/(.+)/) {
$self->app->handle_command($1);
}
View
14 script/colloqueer
@@ -19,7 +19,7 @@ my $app = App::Colloqueer->new(config => $config);
POE::Session->create(
package_states => [
main => [ qw/_start irc_001 irc_public irc_msg
- irc_join irc_part irc_quit/ ]],
+ irc_join irc_part irc_quit irc_topic/ ]],
heap => { app => $app });
$poe_kernel->run();
@@ -98,6 +98,18 @@ sub irc_part {
$channel->add_event($event);
}
+sub irc_topic {
+ my ($heap, $who, $to, $message) = @_[HEAP, ARG0 .. ARG2];
+ my $nick = ( split /!/, $who )[0];
+ return unless my $channel = $heap->{app}->channel_by_name($to);
+ my $event = App::Colloqueer::Event->new(
+ nick => $nick,
+ hostmask => $who,
+ message => " set the topic to \'$message\'",
+ );
+ $channel->add_event($event);
+}
+
sub irc_quit {
my ($heap, $who, $message, $channels) = @_[HEAP, ARG0, ARG1, ARG2];
my $nick = ( split /!/, $who )[0];
Please sign in to comment.
Something went wrong with that request. Please try again.