Changeset 9c7a701 for perl/modules/IRC


Ignore:
Timestamp:
Feb 15, 2008, 12:56:49 AM (16 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
18a54ee
Parents:
a6a4155
Message:
Initial select() changes.
stdin, zephyr, jabber, and irc are checked and have dispatch functions.
aim is hacked in -- not entirely pretty, but documented and isolated.
We still want timers.
Location:
perl/modules/IRC/lib/BarnOwl/Module
Files:
2 edited

Legend:

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

    rcab045b r9c7a701  
    6969}
    7070
    71 sub mainloop_hook {
     71#sub mainloop_hook {
     72#    return unless defined $irc;
     73#    eval {
     74#        $irc->do_one_loop();
     75#    };
     76#    return;
     77#}
     78
     79sub OwlProcess {
    7280    return unless defined $irc;
    7381    eval {
     
    7684    return;
    7785}
     86
    7887
    7988sub register_handlers {
     
    109118$BarnOwl::Hooks::startup->add(\&startup);
    110119$BarnOwl::Hooks::shutdown->add(\&shutdown);
    111 $BarnOwl::Hooks::mainLoop->add(\&mainloop_hook);
     120#$BarnOwl::Hooks::mainLoop->add(\&mainloop_hook);
    112121
    113122################################################################################
     
    165174        BarnOwl::admin_message("IRC", "Connected to $alias as $nick");
    166175        $ircnets{$alias} = $conn;
     176        my $fd = $conn->getSocket()->fileno();
     177        BarnOwl::add_dispatch($fd, \&OwlProcess);
     178        $conn->{FD} = $fd;
    167179    } else {
    168180        die("IRC::Connection->connect failed: $!");
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm

    r5ff830a r9c7a701  
    6969}
    7070
     71sub getSocket
     72{
     73    my $self = shift;
     74    return $self->conn->socket;
     75}
     76
    7177################################################################################
    7278############################### IRC callbacks ##################################
     
    168174    my $self = shift;
    169175    delete $BarnOwl::Module::IRC::ircnets{$self->alias};
    170 
     176    BarnOwl::remove_dispatch($self->{FD});
    171177    BarnOwl::admin_message('IRC',
    172178                           "[" . $self->alias . "] Disconnected from server");
Note: See TracChangeset for help on using the changeset viewer.