Show
Ignore:
Timestamp:
05/14/09 03:10:09 (4 years ago)
Author:
topia
Message:

re-check channel status before send part-and-join.
(but test is not done...)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/tiarra/trunk/module/Channel/Rejoin.pm

    r11365 r33290  
    3838        if ($cmd eq 'PART') { 
    3939            foreach my $ch_fullname (split /,/,$msg->param(0)) { 
    40                 $this->check_channel( 
     40                $this->check_and_rejoin_channel( 
    4141                    scalar Multicast::detatch($ch_fullname), 
    4242                    $sender); 
     
    4646            # RFC2812によると、複数のチャンネルを持つKICKメッセージが 
    4747            # クライアントに届く事は無い。 
    48             $this->check_channel( 
     48            $this->check_and_rejoin_channel( 
    4949                scalar Multicast::detatch($msg->param(0)), 
    5050                $sender); 
     
    5353            # 註釈affected-channelsに影響のあったチャンネルのリストが入っているはず。 
    5454            foreach (@{$msg->remark('affected-channels')}) { 
    55                 $this->check_channel($_,$sender); 
     55                $this->check_and_rejoin_channel($_,$sender); 
    5656            } 
    5757        } 
     
    6060    } 
    6161    $msg; 
     62} 
     63 
     64sub check_and_rejoin_channel { 
     65    my ($this,$ch_name,$server) = @_; 
     66    if ($this->check_channel($ch_name,$server)) { 
     67        $this->rejoin($ch_name,$server); 
     68    } 
    6269} 
    6370 
     
    8794        return; 
    8895    } 
    89     $this->rejoin($ch_name,$server); 
     96    return 1; 
    9097} 
    9198 
     
    185192    my ($this,$session) = @_; 
    186193    $session->{got_oper} = 1; 
     194    if (!$this->check_channel($session->{ch_shortname}, $session->{server})) { 
     195        # 情報を取得している間に状況が変化した 
     196        RunLoop->shared->notify_msg( 
     197            "Channel::Rejoin is cancelled to rejoin to $session->{ch_fullname}."); 
     198        # part/join をやめたので発行すべきコマンドはない。 
     199        $session->{cmd_buf} = []; 
     200        # フラグ類のクリーンアップを行う 
     201        $this->revive($session); 
     202        return; 
     203    } 
    187204    foreach (qw/PART JOIN/) { 
    188205        $session->{server}->send_message(