MSN v2.0

Methods

new
Creates an instance of the MSN object used to communicate with MSN Servers.

connect
Connect to MSN. Call this after your object is created and your event handlers are set.

disconnect
Disconnect from MSN.

isConnected()
Checks if the connection is active.

uptime()
Get the current uptime in seconds (since the last connection).

setName
Set the display name.

setDisplayPicture($file)
Set the display picture. This must be passed a png file and resets your status to NLN so that your Display picture gets sent out.

setMessageStyle(%hash)
Set the default style information (font, effect, etc) for sending messages.

getMessageStyle()
Get the default style information (font, effect, etc) for sending messages.

setClientInfo(%hash)
Set the client info. This is the client id and flags that make up the cid.

getClientInfo()
Get the client info. This is the client id and flags that make up the cid.

setClientCaps(%hash)
Set the client caps. These are the x-clientcaps data.

getClientCaps()
Get the client caps. These are the x-clientcaps data.

setStatus
Set the status.

blockContact($email)
Puts $email on your block list.

unblockContact($email)
Removes $email from your block list.

addContact($email)
Puts $email on your contact list. This allows you to recieve status messages about this individual.

remContact($email)
Removes $email from your contact list.

allowContact($email)
Puts $email on your allow list. This is generaly automatic but there might be some cases where it is useful. If you do not want to automatically allow contacts to see you online, you can set a handler for the ``ContactAddingUs'' event and return 0.

disallowContact($email)
Removes $email from your allow list. They will no longer be able to see you or talk to you.

getContactList($list)
Expects $list to be one of FL, RL, AL, or BL. Returns the email addresses on said list.

getContact($email)
Returns a hash containing all known info for this contact.

getContactName($email)
Returns the friendly name used by this contact, if they are on your FL list.

getContactStatus($email)
Returns the status of this contact, if they are on your FL list.

getContactClientInfo($email)
Returns the client info of this contact, if they are on your FL list.

findMember($email)
Looks for a member in an active SwitchBoard and returns the SB or undef, if not found.

addEmoticon($shortcut, $filename)
Adds an emoticon to your connection. This loads the file and prepares it. Anytime you use the text form $shortcut in an outgoing message it will be replaced with the appropriate emoticon. You can only use 5 different emoticons per message.

broadcast($msg,%style)
Broadcasts the message to all open conversations.

call($email,$msg,%style)
Calls the contact, starting a conversation with them.

do_one_loop()
Process a single cycle's worth of incoming and outgoing messages. This should be done at a regular intervals, preferably under a second.

setHandler($event, $handler)
$event should be an event listed in the events section. These are called based on information sent by MSN, receiving a message is an event, status changes are events, getting a call is an event, etc.
         $msn->setHandler( Connected => \&connected );
         sub connected {
                 my $self = shift;
                 print "Yay we connected";
         }

setHandlers( $event1 => $handler1, $event2 => $handler2)
Expects a list of events and handlers.
          my $msn = new MSN;
          $msn->setHandlers( Connected    => \&connected,
                                                                 Disconnected => \&disconnected );

getNotification
Returns the MSN::Notification object if you have a need to interact with it directly.

getConvoList
Returns a hash of conversations (MSN::SwitchBoard objects) keyed by file number of the socket they are on.

getConvo
Returns a conversation (MSN::SwitchBoard object) found by socket number.