User Control Panel
Advertisements

HELP US, HELP YOU!

Sonora Interface Manager
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Bot Depot Forum Index -> Modules & Add-ons
View unanswered posts
Author Message
thomashp
Member
Member


Joined: 22 Feb 2004
Posts: 121
Location: Richmond, VA
Reputation: 29.3Reputation: 29.3Reputation: 29.3

PostPosted: Mon Nov 22, 2004 8:08 pm    Post subject: Reply with quote

send to who in all interfaces? this is kind of an interface specific command.
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Mon Nov 22, 2004 8:34 pm    Post subject: Reply with quote

Quote:
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.
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Mon Nov 22, 2004 10:15 pm    Post subject: Reply with quote

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:

if ($interface eq 'AIM1'){ $aim->sendmsg("hello"); } elsif ($interface eq 'MSN1'){ $msn->sendmsg("hello"); }

etc, just have:

$sim->sendmsg("hello"); # For instance

and it determine the medium.

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Mon Nov 22, 2004 10:20 pm    Post subject: Reply with quote

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.
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Mon Nov 22, 2004 10:29 pm    Post subject: Reply with quote

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 Smile

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Mon Nov 22, 2004 10:29 pm    Post subject: Reply with quote

OK, Eric might have clued me in on what you're asking. Razz

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' );


OR, all in one line:

Code:
$sim->getInterface( 'KEY' )->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.
Back to top
thomashp
Member
Member


Joined: 22 Feb 2004
Posts: 121
Location: Richmond, VA
Reputation: 29.3Reputation: 29.3Reputation: 29.3

PostPosted: Tue Nov 23, 2004 2:44 am    Post subject: Reply with quote

I think a method to return all the interfaces would be good.
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Tue Nov 23, 2004 3:18 am    Post subject: Reply with quote

There is a method to return all the interface keys:

Code:
my @keys = $sim->getInterfaceList();


and there is a method that returns a list of strings in the form KEY (connected) and KEY (disconnected):

Code:
my @list = $sim->getInterfaceStatusList();


But you want one that returns a list of the actual interfaces, right?
Back to top
eric256
The Keymaker
The Keymaker


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

PostPosted: Tue Nov 23, 2004 5:08 am    Post subject: Reply with quote

Code:
<br />my @interfaces = map { $sim->getInterface($_) } <br />                               @{$sim->getInterfaceList()};<br /><br />my @online = map { $sim->getInterface($_) } <br />                     map { s/(\s+\(.*\))// }<br />                     grep { /(connected)/  }<br />                     @{$sim->getInterfaceStatusList()};<br />

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


Joined: 22 Feb 2004
Posts: 121
Location: Richmond, VA
Reputation: 29.3Reputation: 29.3Reputation: 29.3

PostPosted: Tue Nov 23, 2004 8:03 am    Post subject: Reply with quote

QUOTE(Mojave @ Nov 22 2004, 07:18 PM)
There is a method to return all the interface keys:

Code:
my @keys = $sim->getInterfaceList();


and there is a method that returns a list of strings in the form KEY (connected) and KEY (disconnected):

Code:
my @list = $sim->getInterfaceStatusList();


But you want one that returns a list of the actual interfaces, right?

Where are these methods? I don't see them in my version.
My test script doesn't find them either:
Code:
use Sonora::InterfaceManager;<br />use Sonora::Interface::Oscar;<br />use Sonora::Interface::MSN;<br />use Sonora::Interface::Jabber;<br /><br /># create the Sonora::InterfaceMananger object<br />my $sim = new Sonora::InterfaceManager();<br /><br /># create and add an Oscar interface<br />my $oscar1 = new Sonora::Interface::Oscar( 'Key' => 'OSC1', 'Username' => 'screenname', 'Password' => 'password', 'Debug' => 0 );<br />$sim->addInterface( $oscar1 );<br /><br /># create and add an MSN interface<br />my $msn1 = new Sonora::Interface::MSN( 'Key' => 'MSN1', 'Username' => 'handle@domain.com', 'Password' => 'password', 'Debug' => 0 );<br />$sim->addInterface( $msn1 );<br /><br /># create and add a Jabber interface<br />my $jab1 = new Sonora::Interface::Jabber( 'Key' => 'JAB1', 'Hostname' => 'jabber.com', 'Username' => 'username', 'Password' => 'password', 'Resource' => 'name', 'Debug' => 0 );<br />$sim->addInterface( $jab1 );<br /><br />#test these "methods"<br />my @keys = $sim->getInterfaceList();<br />my @list = $sim->getInterfaceStatusList();<br /><br />print "@keys\n@list\n";<br />exit 0;


returns:
Quote:
MSN 2.0 (11/01/2004) - Checksum: 19760-NS19056-SB12533 Rev: 78

0
0


i was suggesting this:
Code:
sub getInterfaces<br />{<br />   my $this = shift;<br />   <br />   return $this->{'interfaces'};<br />}

but those other methods would be good too.
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Tue Nov 23, 2004 8:20 am    Post subject: Reply with quote

Alright! Thanks for your help Mojave, Thomas and Eric Smile

I was intending to do a cross-network chat as well as having commands, so you were spot on Wink

This is what I was looking for:

Code:
my $interface = $sim->getInterface( 'KEY' );<br />$interface->tellUser( 'username', 'message' );

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Tue Nov 23, 2004 8:30 am    Post subject: Reply with quote

Quote:
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.
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Tue Nov 23, 2004 1:33 pm    Post subject: Reply with quote

Gimme Sonara!
_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Morgan
Newbie
Newbie


Joined: 11 May 2006
Posts: 5

Reputation: 1.7

PostPosted: Thu May 11, 2006 7:51 pm    Post subject: Reply with quote

Well done man, thank you many many times
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Modules & Add-ons All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 



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