User Control Panel
Advertisements

HELP US, HELP YOU!

fileno error

 
Post new topic   Reply to topic    Bot Depot Forum Index -> MSN Protocol
View unanswered posts
Author Message
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Thu Jan 13, 2005 1:47 am    Post subject: Reply with quote

I'm using MSN.pm 2.0 revision 81, and anytime I try to have the bot leave a conversation, I get this error:

Code:
Can't call method "fileno" on an undefined value at libtwo/MSN/SwitchBoard.pm line 172.


I'm aware that this error would be caused if you leave a socket and then try to send a message to it, and I coded my bot to not send a reply after leaving a socket, and it gives that error anyway.

Some examples of my codes that cause this error:
QUOTE(Answer handler)
          if (scalar(@users) > 1) {
               $blockreply = "One of you is blocked from chatting with me, and I will not "
                    . "remain in this conversation. The block description is as follows:\n\n"
                    . "Username: $blockee\n"
                    . "$blockeeLevel";
               $self->sendMessage ($blockreply,
                    Font   => $font,
                    Color  => $color,
                    Effect => $style,
               );
               print "$stamp\n"
                    . "ChaosMSN: [$sn] $blockreply\n\n";

               sleep(1);
               $self->leave();
               return 1;
          }


QUOTE(!leave command)
sub leave {
     my ($self,$client,$msg) = @_;

     my ($listener,$nick) = split(/\-/, $client, 2);

     # Only applies to MSN.
     if ($listener eq 'MSN') {
          # Leave!
          $self->sendMessage ("Good-bye, room! Sad",
               Font   => 'Verdana',
               Color  => '990099',
               Effect => 'B',
          );
          sleep(1);
          $self->leave();
          sleep(1);
          return '';
     }
     else {
          return "This command only applies to MSN.";
     }
}


In the first code, in the Answer handler, the subroutine returns after leaving the socket, giving the bot no possible way of sending a message to the conversation later on.

In the second code, it returns '', and the bot is programmed not to send any message that contains in it.

However, my bot's !kill command always works just fine, it can force the bot out of whatever conversation it's in without crashing with that error:

Code:
sub kill {<br />     my ($self,$client,$msg) = @_;<br /><br />     # Must be an admin.<br />     return "This command may only be used by Administrators and higher!" unless &isAdmin($client);<br /><br />     # Get the messenger.<br />     my ($sender,$nick) = split(/\-/, $client, 2);<br /><br />     # MSN only.<br />     return "This command is only for MSN." unless $sender eq 'MSN';<br /><br />     my $sn = $self->{Msn}->{Handle};<br />     $sn = lc($sn);<br />     $sn =~ s/ //g;<br /><br />     my $msn = $chaos->{bots}->{$sn}->{client};<br /><br />     # List the sockets.<br />     my $socks = $msn->getConvoList();<br /><br />     my $found = 0;<br />     foreach my $id (keys %{$socks}) {<br />          if ($id eq $msg) {<br />               $found = 1;<br />          }<br />     }<br /><br />     if ($found == 1) {<br />          my $convo = $msn->getConvo ($msg);<br />          my $user = $client;<br />          $user =~ s/^MSN\-//i;<br /><br />          $convo->sendMessage ("I am leaving this conversation under orders of an Administrator.",<br />               Font   => 'Courier New',<br />               Color  => '0000FF',<br />               Effect => 'B',<br />          );<br />          sleep(1);<br />          $convo->leave;<br />     }<br />     else {<br />          return "That socket doesn't exist!";<br />     }<br /><br />     return "I have left socket #$msg.";<br />}


Any help will be appreciated! Smile

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> MSN Protocol 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