|
| Author |
Message |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Thu Apr 07, 2005 12:34 pm Post subject: |
|
|
My p4 chatroom using simchat works except for the leave feature.
leave command:
| Code: | | if( $msg =~ /^leave/i )<br /> {<br /> $chats->leaveChat( $chat, $username);<br /> print "$username has left the chatroom";<br /> <br /> } |
leave sub(from module):
| Code: | | sub leaveChat<br />{<br /> my $self = shift;<br /> my $chatname = shift;<br /> my @users = @_;<br /> <br /> if (!defined $self->{chats}->{$chatname})<br /> {<br /> warn "No such chat: $chatname. Could not leave chat.";<br /> return;<br /> }<br /> <br /> if (defined $chatname) {<br /> foreach my $u (@users)<br /> {<br /> if (exists $self->{chats}->{$chatname}->{$_})<br /> {<br /> #tell the users they left.<br /> $self->sendChat($chatname, undef, "$u left the chat.") if $self->{notify};<br /> delete $self->{chats}->{$chatname}->{$_};<br /> }<br /> }<br /> }<br /> else<br /> {<br /> $self->leaveChat($_, @users) for (keys %{$self->{chats}});<br /> }<br /> return 1;<br />} |
error: | Quote: | | Use of uninitialized value in exists at Lib/MSN/SimChat.pm line 102. |
102: if (exists $self->{chats}->{$chatname}->{$_})
any ideas? |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Thu Apr 07, 2005 6:31 pm Post subject: |
|
|
It looks like maybe you weren't having the user join the room properly to begin with, because $self->{chats}->{$chatname}->{$_} would be the user's name you were dropping, and if it doesn't exist then that user may not have even entered the chat properly to begin with (or the values of $username aren't consistent from Point A--entering--to Point B--exiting). _________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Fri Apr 08, 2005 10:30 am Post subject: |
|
|
| Tried simchat.pl, a basic chatroom bot that comes with the simchat module, and it didn't work either! |
|
| Back to top |
|
 |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Sun Apr 10, 2005 2:59 am Post subject: |
|
|
| it all works, except the leave command, which doesn't, the error when you use it is above. |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Sun Apr 10, 2005 4:48 am Post subject: |
|
|
I didn't see the (from module) part and thought that was your code and not the SimChat code.
thomashp hasn't been around much. Maybe I'll rewrite this module to work better. |
|
| Back to top |
|
 |
|