Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
Posted: Fri Apr 02, 2004 7:49 pm Post subject:
Ok, so first of all, thanks for letting me in, I hope we can get some good coding work done . I have experience with P2P mostly (if it comes to non-standart protocol stuff that is), DP's CE's, Ink etc.
First of all, I would like to know which of the MSN.pm around here is the latest , so I can look over it and check it out. I think P2P won't be that hard to implent, and I'll make some free time today/this night to get some basics started (-:
Joined: 03 May 2006 Posts: 2292 Location: Colorado
Posted: Fri Apr 02, 2004 8:16 pm Post subject:
1.3.10 the one just released beta to the public is the newest. I have a couple of changes but i'm waiting to see if they work. I can add them in to any version without trouble though.
Realy I would love to see spliting it into seperate modules as the next step.
Perhaps Net::MSN,Net::MSN::NameServer,Net::MSN::SwitchBoard, and perhpas Net::MSN::File and Net::MSN::P2P. The Net::MSN would be what the bots talk to. It would handle registering events etc. It would store the user name and create the Initial connection to Ne::MSN::NameServer. The Net::MSN module would also allwo the other modules to register sockets so we have all socket watching done in one central location. So Net::MSN has a do_one_loop that checks all the sockets and sends the appropriate data to the appropriate objects and closes or creates objects as needed. So if you send a file request it would goto the Net::MSN::SwitchBoard (isn't that the chatting one?) and then that could spawn a new Net::MSN::File object. The File object registers the socket it creates with the main so that any time there is new data there it can get called.
I hope that makes some sense. I know that an older version of MSN.pm that i released in this forum is already split out like that. Of course it never got adopted yet so it maybe be easier to re split these out. Could definitly be far easier. _________________ Eric256
Proud previous owner and current admin of Bot-depot.com
Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
Posted: Fri Apr 02, 2004 10:27 pm Post subject:
Ok, let me see. I've got the MSNObject sorted, and I'm now ready to implent the P2P transfers.. But I need to get the <*lazy*>raw*lazy*> message from the server, any ideas? I've looked in CMD_MSG, but I can't really make up how to get the raw message.. Hm.
Edit: Nevermind, I got it sorted. Apparantly $header would do aswel *goes back to work*
Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
Posted: Sat Apr 03, 2004 12:06 am Post subject:
Well, here goes I've done my best to make it as simple as possible, and this should be about it for DP transfers. Let me know if you find bugs, so I can solve them .
At the moment a DP is set using "$self->display_picture("");". This ofcourse can be changed, but I think we can keep it this way since then the user can decide whether to take a DP or not.
Thanks to Eric for his uberleet ( ) andromeda to test this
Quote:
- Two new modules (standart): MIME::Base64 Digest::SHA1 qw(sha1 sha1_hex sha1_base64);
- New variables: my ($DPData, $MSNObject); my %p2ptransfers = ();
- set_status has changed: sub set_status { my $self = shift || croak(strMethodOnly); my $status = shift || 'NLN 536870964'; $self->GetMaster->send('CHG', $status.' '.$MSNObject) }
- New sub 'display_picture': =head2 display_picture
Sets your display picture
$msn->display_picture("path/to/file.png");
=cut
sub display_picture { my $self = shift || croak(strMethodOnly); my $file = shift;
- New sub p2p_transfer: sub p2p_transfer { my $self = shift || croak(strMethodOnly); my $user = shift; my $data = shift;
# Grab parameters if this is an invitation my ($euf, $sessid, $callid, $branch, $context); if(index($data, "INVITE MSNMSGR:") > 0) { my @lines = split("\n", $data); foreach my $param (@lines) { if($param) { my @value = split(' ', $param); my $cmd = $value[0];
# Check if this a start of a new transfer if($euf) { # Make a unique BID MakeBaseID: my $bid = 1000 + int(rand(10000000)); if($p2ptransfers{$bid}{SessionID}) { goto MakeBaseID; }
# Then send the BaseID message my $bin = (chr(0)x4).MakeDWord($bid).(chr(0)x.$fields{4}.(chr(0)x4).MakeDWord(2).$fields{2}.$fields{7}.$fields{4}.(chr(0)x4); $bin = "MIME-Version: 1.0\*lazy*\nContent-Type: application/x-msnmsgrp2p\*lazy*\nP2P-Dest: $user\*lazy*\n\*lazy*\n$bin"; $self->_send("MSG 99 D ".length($bin)."\*lazy*\n$bin");
# Check if this is a Emote/DP/FTP if ($euf eq '{A4268EEC-FEC5-49E5-95C3-F126696BDBF6}') { # DP or Emote if($context =~ /msnpm\.tmp/) { # DP # Store information we need later on $p2ptransfers{$bid}{SessionID} = $sessid;
} else { my $bid = GetDWord($fields{7}); my $process = GetDWord($fields{8}); if($process == 100) { # Send the DataPrep message $bid+=3; my $bin = MakeDWord($p2ptransfers{$bid}{SessionID}).MakeDWord($bid-2).(chr(0)x.MakeDWord(4).(chr(0)x4).MakeDWord(4).(chr(0)x4).MakeDWord(101).(chr(0)x.(chr(0)x.MakeDWord(4, 1); $bin = "MIME-Version: 1.0\*lazy*\nContent-Type: application/x-msnmsgrp2p\*lazy*\nP2P-Dest: $user\*lazy*\n\*lazy*\n$bin"; $self->_send("MSG 99 D ".length($bin)."\*lazy*\n$bin");
} elsif($process == 101) { # Send the actual DP data $bid+=2;
# Predefined values (this saves time instead of having to create them in each loop) my $L = 1; my $FileL = MakeDWord(length($DPData)); my $BID = MakeDWord($bid-1); my $SID = MakeDWord($p2ptransfers{$bid}{SessionID});
do { my $TFileD = substr($DPData, $L-1, 1202); my $bin = $SID.$BID.MakeDWord($L-1).(chr(0)x4).$FileL.(chr(0)x4).MakeDWord(length($TFileD)).(chr(0)x4).MakeDWord(102).(chr(0)x4).(chr(0)x.$TFileD.MakeDWord(4, 1); $bin = "MIME-Version: 1.0\*lazy*\nContent-Type: application/x-msnmsgrp2p\*lazy*\nP2P-Dest: $user\*lazy*\n\*lazy*\n$bin"; $self->_send("MSG 99 D ".length($bin)."\*lazy*\n$bin"); $L += length($TFileD); } while ($L < length($DPData));
# Remove object from p2ptransfers hash # We are done *big smile* delete $p2ptransfers{$bid};
}
} }
PS. Bit of a problem here, you all have a 3 letter code, but I only have one name lol. "st" would do
Joined: 03 May 2006 Posts: 2292 Location: Colorado
Posted: Sat Apr 03, 2004 1:29 am Post subject:
Do you have a DP i could use? Or at least what restrictions are there on the pic you choose? _________________ Eric256
Proud previous owner and current admin of Bot-depot.com