User Control Panel
Advertisements

HELP US, HELP YOU!

chatroom leave

 
Post new topic   Reply to topic    Bot Depot Forum Index -> General Programming Questions
View unanswered posts
Author Message
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Thu Apr 07, 2005 12:34 pm    Post subject: Reply with quote

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
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Thu Apr 07, 2005 6:31 pm    Post subject: Reply with quote

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
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Fri Apr 08, 2005 10:30 am    Post subject: Reply with quote

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
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Sun Apr 10, 2005 2:59 am    Post subject: Reply with quote

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
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Sun Apr 10, 2005 4:48 am    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> General Programming Questions All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group