Changeset 5f3168a for perl/modules


Ignore:
Timestamp:
Feb 18, 2008, 9:07:22 PM (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:
b70d24f
Parents:
680ed23 (diff), 9d2f010 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merged revisions 928-950 via svnmerge from 
file:///afs/sipb.mit.edu/project/barnowl/src/svn/trunk

........
  r937 | nelhage | 2008-02-11 23:09:54 -0500 (Mon, 11 Feb 2008) | 2 lines
  
  Bind M-left and M-right by default in the editor
........
  r947 | nelhage | 2008-02-18 16:45:22 -0500 (Mon, 18 Feb 2008) | 2 lines
  
  We need to stick modules on the beginning of @INC, not the end
........
  r949 | asedeno | 2008-02-18 19:43:09 -0500 (Mon, 18 Feb 2008) | 1 line
  
  Merging in the select branch.
........
  r950 | asedeno | 2008-02-18 20:54:45 -0500 (Mon, 18 Feb 2008) | 1 line
  
  Merging in the select branch, part 2. select.c
........
Location:
perl/modules
Files:
8 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");
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    ree310eb r5f3168a  
    118118            BarnOwl::error("Connection for $jid undefined -- error in reload?");
    119119        }
    120 
     120        # We keep this in the mainloop hook for keep-alives
    121121        my $status = $client->Process(0);
    122122        if ( !defined($status) ) {
     
    126126        if ($::shutdown) {
    127127            do_logout($jid);
    128             return;
    129         }
     128            next;
     129        }
     130
    130131        if ($vars{status_changed}) {
    131132            my $p = new Net::Jabber::Presence;
     
    389390                $conn->renameConnection($jidStr, $fullJid);
    390391                queue_admin_msg("Connected to jabber as $fullJid");
     392                # The remove_dispatch() method is called from the
     393                # ConnectionManager's removeConnection() method.
     394                $client->{fileno} = $client->getSocket()->fileno();
     395                #queue_admin_msg("Connected to jabber as $fullJid ($client->{fileno})");
     396                BarnOwl::add_dispatch($client->{fileno}, sub { $client->OwlProcess() });
    391397            }
    392398        }
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm

    re0ffe77 r5f3168a  
    111111
    112112
     113=head2 getSID
     114
     115Returns the StreamID for this connection.
     116
     117=cut
     118
     119sub getStreamID {
     120    my $self = shift;
     121    return $self->{SESSION}->{id} || "";
     122}
     123
     124=head2 getSocket
     125
     126Returns the IO::Socket for this connection.
     127
     128=cut
     129
     130sub getSocket {
     131    my $self = shift;
     132    my $sid = getStreamID($self);
     133    return $self->{STREAM}->GetSock($sid) || -1;
     134}
     135
     136=head2 OwlProcess
     137
     138Non-blocking connection processing. For use in a select loop.
     139
     140=cut
     141
     142sub OwlProcess {
     143    my $self = shift;
     144    my $status = $self->Process(0);
     145    if ( !defined($status) ) {
     146        my $jid = $self->{SESSION}->{FULLJID};
     147        BarnOwl::error("Jabber account $jid disconnected!");
     148        BarnOwl::Module::Jabber::do_logout($jid);
     149    }
     150}
     151
    113152=head1 SEE ALSO
    114153
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm

    r7f33c18 r6b580b0  
    3737    return 0 unless exists $self->{$jidStr};
    3838
     39    BarnOwl::remove_dispatch($self->{$jidStr}->{Client}->{fileno}) if $self->{$jidStr}->{Client}->{fileno};
    3940    $self->{$jidStr}->{Client}->Disconnect()
    4041      if $self->{$jidStr}->{Client};
     
    5152    return 0 if $oldJidStr eq $newJidStr;
    5253
    53     $self->{$newJidStr} = $self->{$oldJidStr}; 
     54    $self->{$newJidStr} = $self->{$oldJidStr};
    5455    delete $self->{$oldJidStr};
    5556    return 1;
  • perl/modules/Jabber/lib/Net/XMPP/Debug.pm

    rc2bed55 rb7b2a76  
    189189                        {
    190190                            $self->{HANDLE}->autoflush(1);
     191                            binmode $self->{HANDLE}, ":utf8";
    191192                            $Net::XMPP::Debug::HANDLES{$args{file}} = $self->{HANDLE};
    192193                        }
  • perl/modules/Jabber/lib/Net/XMPP/Message.pm

    rc2bed55 r8574801  
    135135                            $Mess->SetMessage(TO=>"bob\@jabber.org",
    136136                                              Subject=>"Lunch",
    137                                               BoDy=>"Let's do lunch!");
     137                                              Body=>"Let's do lunch!");
    138138                            $Mess->SetMessage(to=>"bob\@jabber.org",
    139139                                              from=>"jabber.org",
  • perl/modules/Jabber/lib/XML/Stream.pm

    r5073972 ra8d5a39  
    16591659    {
    16601660        $self->debug(3,"Send: can_write");
    1661        
     1661
    16621662        $self->{SENDSTRING} = Encode::encode_utf8(join("",@_));
    16631663
Note: See TracChangeset for help on using the changeset viewer.