Ignore:
Timestamp:
Jul 23, 2008, 8:18:30 PM (16 years ago)
Author:
Geoffrey Thomas <geofft@mit.edu>
Branches:
master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
38cfdb5d
Parents:
0398d55
Message:
IRC: Add :irc-topic support and on_topic/on_topicinfo callbacks.
File:
1 edited

Legend:

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

    r3835ae8 r3ad15ff  
    6565    $self->conn->add_handler(nicknameinuse => sub { shift; $self->on_nickinuse(@_) });
    6666    $self->conn->add_handler(cping     => sub { shift; $self->on_ping(@_) });
     67    $self->conn->add_handler(topic     => sub { shift; $self->on_topic(@_) });
     68    $self->conn->add_handler(topicinfo => sub { shift; $self->on_topicinfo(@_) });
    6769
    6870    return $self;
     
    193195}
    194196
     197sub on_topic {
     198    my ($self, $evt) = @_;
     199    my @args = $evt->args;
     200    if (scalar @args > 1) {
     201        BarnOwl::admin_message("IRC",
     202                "Topic for $args[1] on " . $self->alias . " is $args[2]");
     203    } else {
     204        BarnOwl::admin_message("IRC",
     205                "Topic changed to $args[0]");
     206    }
     207}
     208
     209sub on_topicinfo {
     210    my ($self, $evt) = @_;
     211    my @args = $evt->args;
     212    BarnOwl::admin_message("IRC",
     213        "Topic for $args[1] set by $args[2] at " . localtime($args[3]));
     214}
     215
    195216sub on_event {
    196217    my ($self, $evt) = @_;
Note: See TracChangeset for help on using the changeset viewer.