Boucherot::Connection::DccAble - Mother class for ones that are able to DCC
use Boucherot::Connection::DccAble;
package Foo;
use Boucherot::Connection::DccAble;
use base qw( Bar Boucherot::Connection::DccAble );
# ...
# Now, Foo inherit from Bar, but can also contains some DCC Connections. # Now, Foo inherit from Bar, but can also contains some DCC Connections.
package main;
use Foo; use Boucherot::Connection::DCC; use IO::Socket;
my $foo=new Foo; my $dccget=new Boucherot::Connection::DCC::Get( $foo, # This is the container, note that $foo MUST be linked to a # SetOfConnection, and must be identifiable with ->id method. '}Aldur{', # The nick unpack("NNNN",inet_aton('1.2.3.4')), # Get from 1.2.3.4 5006, # Port number 4522, # The size of the file (bytes) 'moppy.txt' # The file name );
This will create a DCC Get from 1.2.3.4:5006 that will try to retrieve the file moppy.txt, which size is 4522 bytes.
Note that the DCC Get, as a connection, will auto-register to the $foo's SetOfConnection, and this one should have been started, elsewhere, the file will never be download.
Note also that you can just do a ``new'', because you won't have to use the instance anymore. (but if you really want to use it...)
This is a simple class to implement the basic method for class who can contains DCC connections. In fact, only Boucherot::Connection::Irc is able to, but you can imagine that a ``private'' connection (like eggdrop ones) can contains its owns DCC.
class Boucherot::Connection::DccAble
Attributs:
- dcc : { '_send' => { port1 : SCALAR => Boucherot::Connection::DCC::Send, port2 : SCALAR => Boucherot::Connection::DCC::Send, ... } '_get' => { port3 : SCALAR => Boucherot::Connection::DCC::Get, port4 : SCALAR => Boucherot::Connection::DCC::Get, ... } '_chat' => { nick1 : SCALAR => Boucherot::Connection::DCC::Chat, nick2 : SCALAR => Boucherot::Connection::DCC::Chat, ... } }
Methods:
+ dccsend ( port : SCALAR ) : Boucherot::Connection::DCC::Send + add_dccsend ( dccsend : Boucherot::Connection::DCC::Send ) : + remove_dccsend ( dccsend : Boucherot::Connection::DCC::Send ) + list_dccsend () : ( port1 : SCALAR , port2 : SCALAR , ... ) : ARRAY
+ dccget ( port : SCALAR ) : Boucherot::Connection::DCC::Get + add_dccget ( dccget : Boucherot::Connection::DCC::Get ) : + remove_dccget ( dccget : Boucherot::Connection::DCC::Get ) : + list_dccget () : ( port1 : SCALAR , port2 : SCALAR , ... ) : ARRAY
+ dccchat ( nick : SCALAR ) : Boucherot::Connection::DCC::Chat + add_dccchat ( nick : SCALAR, dcc : Boucherot::Connection::DCC::Chat) : Boolean + remove_dccchat ( nick : SCALAR ) : + list_dccchat () : ( nick1, nick2, nick3 ) : ARRAY
Note that each time there is a Boucherot::Connection::DCC::Chat, you can find a Boucherot::Connection::DCC::ChatServer::Client because Boucherot::Connection::DCC::ChatServer::Client inherit from Boucherot::Connection::DCC::Chat.
+ dccsend ( port : SCALAR ) : Boucherot::Connection::DCC::Send
Search for a DCC Send connection. Return the one associated with the port, or return a false value.
+ add_dccsend ( dccsend : Boucherot::Connection::DCC::Send ) :
Add a DCC Send connection.
+ remove_dccsend ( dccsend : Boucherot::Connection::DCC::Send )
Remove a DCC Send connection.
+ list_dccsend () : ( port1 : SCALAR , port2 : SCALAR , ... ) : ARRAY
Return a list of ports associated with all the DCC Send connections.
+ dccget ( port : SCALAR ) : Boucherot::Connection::DCC::Get
Search for a DCC Get connection. Return the one associated with the port, or return a false value.
+ add_dccget ( dccget : Boucherot::Connection::DCC::Get ) :
Add a DCC Get connection.
+ remove_dccget ( dccget : Boucherot::Connection::DCC::Get ) :
Remove a DCC Get connection.
+ list_dccget () : ( port1 : SCALAR , port2 : SCALAR , ... ) : ARRAY
Return a list of ports associated with all the DCC Get connections.
+ dccchat ( nick : SCALAR ) : Boucherot::Connection::DCC::Chat
Search for a DCC Chat connection. Return the one associated with the nick, or return a false value.
+ add_dccchat ( nick : SCALAR, dcc : Boucherot::Connection::DCC::Chat) : Boolean
Add a DCC Chat connection for a nick.
+ remove_dccchat ( nick : SCALAR ) :
Remove a DCC Chat connection.
+ list_dccchat () : ( nick1, nick2, nick3 ) : ARRAY
Return a list of nicks associated with all the DCC Chat connections.
This class was written by Arthibus Gissehel <gissehel@vachefolle.com> in 2000.
This class is part of the Boucherot project.