Posted: Fri Nov 10, 2006 1:30 pm Post subject: Send message to 1 socket instead of all?
Hello,
I have a little question.
I searched thru the boards but I did'nt got the results I wanted....
I'm using White Warrior, a bit edited, but is it possible to.. change the !shout function so I can send a message to a socket instead it goes to everyone?
I want to do this so I can fake a user in group convo's
Hope someone can help me,
Greetings,
Rwesterh.
Ps. The current !shout command:
Code:
if($msg =~ /^!shout (.*)/i){
foreach my $id (keys %{$msn->{Socks}}) {
next unless defined $msn->{Socks}->{$id} and $msn->{Socks}->{$id}->{Type} eq 'SB';
$msn->{Socks}->{$id}->sendmsg("$1");
}
'SB' is 'SwitchBoard', the name of the particular MSN server that handles conversations between individual users. For each convo, MSN.pm (or more specifically, MSN::SwitchBoard) opens a new socket to the SB server for this conversation.
Your MSN connection involves several connections, one to the Notification server for example which sends notifications such as buddies signing on and off, and several connections to the SwitchBoard server for each conversation. Therefore, the code checks if the socket is to an SB so that it knows this is a conversation socket, before continuing.
Your code would work, assuming you know the socket fileno of the particular SB conversation you want. If you got the number wrong and it didn't exist under $msn->{Socks}->{$1}, your script would crash "Can't call method sendmsg on undefined object" so you'll want to do some sanity checking in there. _________________ Current Site (2008) http://www.cuvou.com/
'SB' is 'SwitchBoard', the name of the particular MSN server that handles conversations between individual users. For each convo, MSN.pm (or more specifically, MSN::SwitchBoard) opens a new socket to the SB server for this conversation.
Your MSN connection involves several connections, one to the Notification server for example which sends notifications such as buddies signing on and off, and several connections to the SwitchBoard server for each conversation. Therefore, the code checks if the socket is to an SB so that it knows this is a conversation socket, before continuing.
Your code would work, assuming you know the socket fileno of the particular SB conversation you want. If you got the number wrong and it didn't exist under $msn->{Socks}->{$1}, your script would crash "Can't call method sendmsg on undefined object" so you'll want to do some sanity checking in there.
Ahh.. Thanks for the info!
As for the script, I first take a look in the window of the bot ans then write the message.
Anyways, thanks for all the help