X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXChannel.pm;h=9812037fce2ee1fa44255555fe6e63c09957c0d3;hb=679037f49e292b15a73dce96699c15b9e3049711;hp=b0208f103e0e6093df5b654c133420e110780419;hpb=b359511572b5dcd67dc17437e7ce4ca3574eada8;p=spider.git diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index b0208f10..9812037f 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -153,7 +153,8 @@ sub alloc if (defined $user) { $self->{user} = $user; $self->{lang} = $user->lang; - $user->new_group() if !$user->group; + $user->new_group unless $user->group; + $user->new_buddies unless $user->buddies; $self->{group} = $user->group; $self->{sort} = $user->sort; } @@ -493,7 +494,28 @@ sub closeall # sub tell_login { - my ($self, $m) = @_; + my ($self, $m, $call) = @_; + + $call ||= $self->{call}; + + # send info to all logged in thingies + my @dxchan = get_all_users(); + my $dxchan; + foreach $dxchan (@dxchan) { + next if $dxchan == $self; + next if $dxchan->{call} eq $main::mycall; + $dxchan->send($dxchan->msg($m, $call)) if $dxchan->{logininfo}; + } +} + +# +# Tell all the users if a buddy is logged or out +# +sub tell_buddies +{ + my ($self, $m, $call) = @_; + + $call ||= $self->{call}; # send info to all logged in thingies my @dxchan = get_all_users(); @@ -501,7 +523,7 @@ sub tell_login foreach $dxchan (@dxchan) { next if $dxchan == $self; next if $dxchan->{call} eq $main::mycall; - $dxchan->send($dxchan->msg($m, $self->{call})) if $dxchan->{logininfo}; + $dxchan->send($dxchan->msg($m, $call)) if grep $_ eq $call, @{$dxchan->user->buddies} ; } }