what can be used to send the message to all interfaces, if my global SIM variable is $sim (ie, $sim->connect;)?
As Thomas asked, send to whom? MSN has a concept of open conversations, so you can broadcast to all of them. But, as far as I know, AIM, Jabber, etc. don't have this concept, so there is no way to send messages to all of AIM or Jabber, it's a meaningless idea.
You could create a list of contacts you want to send a message to, then loop through and use tellUser.
Well, either sending to all open conversations on all mediums, or having a global variable which will determine the medium and then send to that. So instead of returning a value or having:
As I said, AIM and Jabber don't have the concept of an open conversation. The only thing you could do would be to get all contacts on your contact list and send a message to all of them.
EDIT: Sorry, didn't see your edit.
You don't have to know what medium a message is coming from, so you don't need the if test. In fact, you don't even need the sendmsg. The Message handler you write for Sonora simply returns the message and Sonora knows where to send it.
Ok, but is there any way to send the message through "sendmsg" or such? My problem is that I want to quickly convert my old script, and changing the $self->sendmsg to $something->something is the only way it is possible, due to wierd spacing and extra variables I added. I was just wondering if it is possible or if I should just stick with the return.
Thanks for your help _________________ ~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
OK, Eric might have clued me in on what you're asking.
If you want to send a message to a specific service (medium) regardless of where the message came from, you would use tellUser. You need to get the specific interface first. So, you would do:
Code:
my $interface = $sim->getInterface( 'KEY' );<br />$interface->tellUser( 'username', 'message' );
where KEY is the key for the interface you want, which you included when you created the interface:
Code:
my $msn1 = new Sonora::Interface::MSN( 'Key' => 'MSN1', 'Username' => 'botname', 'Password' => 'botpassword' );
You could also use the $msn1 interface object directly:
Code:
$msn1->tellUser( 'username', 'message' );
Some examples of why you might want to do this:
- you want to notify an admin on AIM anytime you get a message on your MSN interface
- you want to do some cross-medium chat
EDIT: To respond to your last message. If you are simply replying normally to a message that came to your Message handler, then you should use return. That's the standard way to do it.
Where are these methods? I don't see them in my version.
Looks like I was getting ahead of myself. These methods are in MY current version of Sonora and I thought they were in the current posted one, but guess not.
Now that I am done with the latest MSN revision, I will update Sonora and fix the biggest outstanding issues.