QuadLB is module for doing mirroring (or load-balancing) for MSN bots. The attached zip contains the module and a test bot.
QuadLB stands for Quick and dirty Load Balancing. From the name, you can guess that this module contains the bare minimum needed to have multiple MSN mirrors running. I plan to add more functionality over time, but I like the name and it will probably stick.
See the quadtext.pl file for an example of using the module. Set YOUR own email in the $admin variable. The bots will call this email when they connect. Set each of your bot's handles and passwords in the section where it says "add mirrors". You can add as many more mirrors here as you like. Each needs to have its own handle and password, so be sure to register those with MSN. This is the hard-coded way of doing things. For a more dynamic way of storing your mirrors, see this post, especially reading Cer's comments about 4 posts down.
When you call addMirror, it returns the MSN instance for that mirror. You can also use the methods remMirror, getMirror, connect and disconnect. The exit command in the bot shows how you can disconnect from ALL mirrors by calling $quad->disconnect();
Joined: 15 Mar 2004 Posts: 661 Location: Manchester, UK
Posted: Fri Sep 24, 2004 7:03 pm Post subject:
Thats ace, I can have mirrors now
I can't plus you either I plused your rep other day, when I can I will. _________________ MSN: gavin [at] gavinbrittain [dot] co [dot] uk
E-Portfolio: www.gavinbrittain.co.uk (New version comming soon)
The following are some ideas and examples for using your bot mirrors. I'll most likely add some of this functionality in future versions of QuadLB. They are off the top of my head and have <*lazy*>not been tested*lazy*>.
Hints for doing actual load balancing using this module:
Whenever a user adds your bot to his contact list, your bot will get the ContactAddingUs event. If your bot doesn't handle this event, the bot simply allows the user to see it. But you can use this event to check the current number or users this particular mirror has on its contact list and decide to add another mirror or to tell the user to use a different mirror, etc.
Here is an example of using ContactAddingUs to directly redirect the user to a different mirror:
Code:
sub ContactAddingUs<br />{<br /> my $self = shift;<br /> my $handle = shift;<br /><br /> my $al_count = scalar $self->{Msn}->getContactList( 'AL' );<br /><br /> if( $al_count > 100 )<br /> {<br /> ## pick a NEW mirror bot here<br /> ## and call the user from this the mirror bot<br /> $msn5->call( $handle, "Hi, please add me to your contact list" );<br /><br /> # return 0 means don't add this contact to THIS bot's allow list<br /> return 0;<br /> }<br /> else<br /> {<br /> return 1;<br /> }<br />}
Here is an example of using ContactAddingUs to indirectly redirect the user to a different mirror:
Code:
sub ContactAddingUs<br />{<br /> my $self = shift;<br /> my $handle = shift;<br /><br /> my $al_count = scalar $self->{Msn}->getContactList( 'AL' );<br /><br /> if( $al_count > 100 )<br /> {<br /> ## tell the user to add a different bot on his contact list<br /> $self->call( $handle, "I am full, please add bot5@domain.com to your contact list" );<br /><br /> # return 0 means don't add this contact to THIS bot's allow list<br /> return 0;<br /> }<br /> else<br /> {<br /> return 1;<br /> }<br />}
omfg mojave you have contributed more to the bot community in about 2 weeks than was contributed over about the past 2 months its really great to see this much progress being made after all the inactivity on bot depto well im rele tired an talkin sum shiety stuff but you mite get the idea
Joined: 15 Mar 2004 Posts: 661 Location: Manchester, UK
Posted: Sat Sep 25, 2004 8:44 am Post subject:
QUOTE(lawrence @ Sep 24 2004, 11:35 PM)
omfg mojave you have contributed more to the bot community in about 2 weeks than was contributed over about the past 2 months its really great to see this much progress being made after all the inactivity on bot depto well im rele tired an talkin sum shiety stuff but you mite get the idea
I know what you mean he's on fire lol, Mojave doing a hell of a lot and I am sure everyone on bot-depot is extremely thankful. _________________ MSN: gavin [at] gavinbrittain [dot] co [dot] uk
E-Portfolio: www.gavinbrittain.co.uk (New version comming soon)
Is this the msn module i cant seem to find the latest module for msn 2.0 one? i did have it but my bot went wrong when attempting to make it so i need it again (note my mate got the msn module for me)