User Control Panel
Advertisements

HELP US, HELP YOU!

MSN 2.1
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Bot Depot Forum Index -> MSN Protocol modules
View unanswered posts
Author Message
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Fri May 19, 2006 11:43 am    Post subject: Reply with quote

The ContactAddingUs handler doesn't need you to do anything complicated or even manually add the users.

If your handler sub returns 1, the contact is added. 0 and the add is denied.

Example:
Code:
sub ContactAddingUs {
   my ($self,$email,$name) = @_;

   # if this is a bad user...
   if ($email eq 'baduser@hotmail.com') {
      # don't allow him to contact us
      return 0;
   }
   else {
      # allow it
      return 1;
   }
}


You should add a print statement in your handler (if you don't have one yet) to tell you when somebody's adding the bot, it'll help with debugging. Wink

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
mattaustin
Sentinel
Sentinel


Joined: 19 Jul 2004
Posts: 556
Location: Los Angeles, CA
Reputation: 50.7
votes: 1

PostPosted: Fri May 19, 2006 5:37 pm    Post subject: Reply with quote

Just a quick programming note. You shouldn't have a sub return 0 for false. I try have it: return undef;. The reason is sometimes the result could be 0 but still be true. Lets say we want a function to return the result of a math function that could equal 0, or return the position of an array...or an index: return index('matt', 'm'); .

Just something to keep in mind.

_________________
[ matt ]
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Fri May 19, 2006 7:22 pm    Post subject: Reply with quote

Often times undef is saved for errors, 1= true, 0 = false, undef = error, but not always. Anyway the MSN module is calling that hook expecting it to say yes or no, and so the callback is responding with a yes or no.

Code:
print "YEA" if callback($x);


Code:
print "YEA" if defined callback($x);



Both are fairly readable but the first is very obvious.

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Fri May 19, 2006 8:03 pm    Post subject: Reply with quote

Yeah, if you're checking for defined versus not, then returning 0 would be defined anyway. if you're just checking, it would equate to "false"...

Code:
sub function {
   return 0;
}

my $result = function();

if ($result) { # false
   # not called
}
if (defined $result) { # true
   # this code is run
}


So it depends on the code calling the sub for what it expects to see (of course undef would always be good if you're not sure about this), I'm just going on what Mojave's told us about these callbacks. Wink

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Fri May 19, 2006 8:43 pm    Post subject: Reply with quote

"Yeah, if you're checking for defined versus not, then returning 0 would be defined anyway." Um no, if your checking for defined then 0 would be true instead of false. So while it would be defined ti wouldn't function correctly.

My two codes where meant to represent one expecting non 0 as true and the other expecting defined as true (or 0 as fasle, and undef as false respectivly if you prefer to think of it that way.). Since most code tends to check for truth to continue i figured that was the more basic example.

One of us missed the others point i'm sure....so just consider this a clarification of my previous post and on we go! Wink

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Teario
Member
Member


Joined: 25 Jun 2004
Posts: 130
Location: Liverpool(home) or Derby(uni), UK
Reputation: 59.8
votes: 3

PostPosted: Tue May 30, 2006 12:14 am    Post subject: Reply with quote

When I run the echobot, it manages to sign in, but then it closes displaying the following error:

Quote:
File does not exist: at lib/MSN/Notification.pm line 903


line 903 is:
Code:
my $data = $xml->XMLin($msg, suppressempty => '');


It seems weird, but then I havent used perl for quite some time so I may be missing something obvious. Anyone else had this problem? or know the reason and/or solution?

I have XML::Simple and it is fully up to date, and looking at the code I cant really see any other reason for the error.

Edit: Oops never mind I just noticed the part on the original post saying it doesnt work properly Embarassed
Back to top
JTW
God Like
God Like


Joined: 07 Mar 2004
Posts: 581
Location: Maidstone
Reputation: 73.2
votes: 4

PostPosted: Tue Jun 06, 2006 5:07 pm    Post subject: Reply with quote

Hi
When i use this module it would appear that it is not reciving any pongs from the server. from what i can see the pings are being sent fine
Code:
(3 NS) TX: PNG
(3 NS) TX: PNG
(3 NS) TX: PNG
Disconnected : No pong received from server
Disconnecting from Notification Server
(3 NS) TX: OUT
Disconnected
Which results in as you would expect the bot being disconected from the server.
Any ideas on what to do? ( I have no idea about the msn protocol so i really cant fix it myself)
Thanks very much in advance
JT

Edit: Oddly enough its working for me now Smile
Back to top
Sypher
Senior Member
Senior Member


Joined: 01 Jan 2004
Posts: 233
Location: The Netherlands
Reputation: 39.8Reputation: 39.8Reputation: 39.8Reputation: 39.8

PostPosted: Sun Nov 19, 2006 6:33 pm    Post subject: Reply with quote

Is the "contact list handling" problem fixed?
_________________
Sypher
Developer of Codera
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> MSN Protocol modules All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 



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