ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/bin/kgsueme
(Generate patch)

Comparing kgsueme/bin/kgsueme (file contents):
Revision 1.27 by pcg, Sat May 31 03:47:26 2003 UTC vs.
Revision 1.28 by pcg, Sat May 31 04:35:39 2003 UTC

57{ 57{
58 #my $audioserver = new Audio::Play(0); 58 #my $audioserver = new Audio::Play(0);
59 my %sound; 59 my %sound;
60 $SIG{CHLD} = 'IGNORE'; 60 $SIG{CHLD} = 'IGNORE';
61 61
62 for (qw(alarm warning move)) { 62 for (qw(alarm warning move pass ring connect user_unknown)) {
63 local $/; 63 local $/;
64 open my $snd, "<", "$SNDDIR/$_" 64 open my $snd, "<", "$SNDDIR/$_"
65 or die "$SNDDIR: $!"; 65 or die "$SNDDIR/$_: $!";
66 binmode $snd; 66 binmode $snd;
67 67
68 $sound{$_} = new Audio::Data; 68 $sound{$_} = new Audio::Data;
69 $sound{$_}->Load($snd); 69 $sound{$_}->Load($snd);
70 } 70 }
71 71
72 sub play_sound { 72 sub play_sound {
73 my ($annoyancy, $sound) = @_;
74 # annoyany 1 => important, annoyance 2 => useful, annoyancy 3 => not useful
73 if (fork == 0) { 75 if (fork == 0) {
74 if (my $audioserver = new Audio::Play(1)) { 76 if (my $audioserver = new Audio::Play(1)) {
75 $audioserver->play ($sound{$_[0]}); 77 $audioserver->play ($sound{$sound});
76 } 78 }
77 Gtk->_exit(0); 79 Gtk->_exit(0);
78 } 80 }
79 } 81 }
80} 82}
308 310
309 if ($msg->{success}) { 311 if ($msg->{success}) {
310 for (keys %{$::config->{rooms}}) { 312 for (keys %{$::config->{rooms}}) {
311 $self->{roomlist}->join_room($_); 313 $self->{roomlist}->join_room($_);
312 } 314 }
315 ::play_sound 3, "connect";
316 } elsif ($msg->{result} eq "user unknown") {
317 ::play_sound 2, "user_unknown";
318 } else {
319 ::play_sound 2, "warning";
313 } 320 }
314} 321}
315 322
316sub event_disconnect { } 323sub event_disconnect { }
317 324
978} 985}
979 986
980sub event_part { 987sub event_part {
981 my ($self) = @_; 988 my ($self) = @_;
982 $self->SUPER::event_part; 989 $self->SUPER::event_part;
983 $self->{window}->destroy; # hmm.. why does this keep the object alive? puzzling.. ahh.. callback ;) 990 (delete $self->{window})->destroy; # hmm.. why does this keep the object alive? puzzling.. ahh.. the callbacks ;)
984 delete $self->{room}{game}{$self->{channel}}; 991 delete $self->{room}{game}{$self->{channel}};
985} 992}
986 993
987sub event_move { 994sub event_move {
988 my ($self, $pass) = @_; 995 my ($self, $pass) = @_;
989 ::play_sound $pass ? "pass" : "move"; 996 ::play_sound 1, $pass ? "pass" : "move";
990} 997}
991 998
992sub DESTROY {#d# 999sub DESTROY {#d#
993 warn "DESTROY(@_)\n";#d# 1000 warn "DESTROY(@_)\n";#d#
994} 1001}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines