IMessengerAddIn Interface

Creates and configures an add-in instance.

Syntax

public void Initialize(MessengerClient client);

Parameters

client

Reference to the add-in's MessengerClient instance.

Return Value

None

Remarks

The add-in must inherit the Initialize method from the IMessengerAddIn interface. Your implementation of the Initialize method should do the following:

·         Start and configure the add-in.

·         Subscribe to any events you intend to use with your add-in.

·         Create a class-level variable to serve as a reference for the Messenger client.

Use the AddInProperties class to set identity data for the add-in. You should at least declare a friendly name for your add-in, which will be displayed in Messenger's user interface.

Example

Copy Code

public void Initialize(MessengerClient client) {

//initialize

m_client = client;

//Add EventHandlers

 ...

//Change friendly name of local user

m_client.AddInProperties.FriendlyName = “My Super Cool Bot”;

}

Messenger Add-In Classes

The following Classes are supported by the Windows Live Messenger Add-Ins API:

Class

Description

MessengerClient.AddInProperties Class

Contains attributes of the add-in.

MessengerClient.IncomingTextMessageEventArgs Class

Stores data for an IncomingTextMessage event.

MessengerClient.OutgoingTextMessageEventArgs Class

Stores data for an OutgoingTextMessage event.

MessengerClient Class

Contains information pertaining to the add-in and its associated Messenger client instance.

MessengerClient.StatusChangedEventArgs Class

Stores data for a StatusChanged event.

MessengerClient.User Class

Contains properties of either local or remote users.

MessengerClient Class

Stores information pertaining to the add-in and its associated functions, and also exposes the Messenger API elements to the add-in.

Syntax

public sealed class MessengerClient : System.MarshalByRefObject

Parameters

MessengerClient

Reference to the MessengerClient class.

AddInProperties

AddInProperties object. Object that contains the properties of the current add-in.

LocalUser

User object. Object that contains the properties of the current local user (operating the add-in).

SavedState

String. Used to get or set the saved state, so the add-in can save data beyond a re-start of the Messenger process.

SendActionMessage

SendActionMessage method.

SendNudgeMessage

SendNudgeMessage method.

SendTextMessage

SendTextMessage method.

IncomingTextMessage

IncomingTextMessage event.

OutgoingTextMessage

OutgoingTextMessage event.

ShowOptionsDialog

ShowOptionsDialog event.

ShutDown

Shutdown event.

StatusChanged

StatusChanged event.

MessengerClient.AddInProperties Class

An AddInProperties object stores attributes of the add-in.

Syntax

public class AddInProperties

Parameters

AddInProperties

Reference to the AddInProperties class.

Creator

String.

Description

String. Description of the add-in, explaining what the add-in does and why a user should use it.

FriendlyName

String. Name of the add-in.

PersonalStatusMessage

String. Status message associated with the add-in.

Status

UserStatus object. Object that identifies the user's current status.

URL

URI object. Not currently used.

UserTile

Image.

MessengerClient.IncomingTextMessageEventArgs Class

An IncomingTextMessageEventArgs object stores data for an IncomingTextMessage event.

Syntax

public class IncomingTextMessageEventArgs : System.EventArgs

Parameters

IncomingTextMessageEventArgs

Reference to the IncomingTextMessageEventArgs class.

TextMessage

String. Text of the message.

UserFrom

User object. Object that contains the properties of the user who sent the message.

MessengerClient.OutgoingTextMessageEventArgs Class

An OutgoingTextMessageEventArgs object stores data for an OutgoingTextMessage event.

Syntax

public class OutgoingTextMessageEventArgs : System.ComponentModel.CancelEventArgs

Parameters

OutgoingTextMessageEventArgs

Reference to the OutgoingTextMessageEventArgs class.

TextMessage

String. Text of the message.

UserTo

User object. Object that contains the properties of the user to which a message is addressed.

MessengerClient.StatusChangedEventArgs Class

A StatusChangedEventArgs object stores data for a StatusChanged event.

Syntax

public class StatusChangedEventArgs : System.EventArgs

Parameters

StatusChangedEventArgs

Reference to the StatusChangedEventArgs class.

User

User object. Object that contains the properties of the user whose status has changed.

MessengerClient.User Class

The User class stores properties of either local or remote users.

Syntax

public sealed class User

Parameters

GetGroupNames

Method that returns a string array (a list of the groups to which the user belongs).

Email

String

FriendlyName

String. The user's friendly name.

PersonalStatusMessage

String. Status message associated with the user.

Status

UserStatus object. Object that identifies the user's current status.

UniqueID

String. Unique identification of the user.

MessengerClient.UserStatus Enumeration

Set of constants that represent the status of the user.

Syntax

public enum UserStatus

Enumeration

Enumerator

Integer Value

Hexadecimal Value

Away

34

0x0022

BeRightBack

14

0x000E

Busy

10

0x000A

Idle

18

0x0012

Offline

1

0x0001

Online

2

0x0002

OnthePhone

50

0x0032

OuttoLunch

66

0x0042

Unknown

0

0x0000

Messenger Add-In Events

The following Events are supported by the Windows Live Messenger Add-Ins API:

Event

Description

MessengerClient.IncomingTextMessage Event

Fires when an add-in receives a text message.

MessengerClient.OutgoingTextMessage Event

Fires when a local user sends a text message to a buddy.

MessengerClient.ShowOptionsDialog Event

Fires when the user accesses Messenger's Options dialog box.

MessengerClient.Shutdown Event

Fires when the Messenger client unloads the add-in.

MessengerClient.StatusChanged Event

Fires when the local user's status or a buddy's status changes.

Messenger Add-In Methods

The following Methods are supported by the Windows Live Messenger Add-Ins API:

Method

Description

MessengerClient.SendActionMessage Method

Sends an action message to a specified user or buddy.

MessengerClient.SendNudgeMessage Method

Sends a nudge message to a specified user or buddy.

MessengerClient.SendTextMessage Method

Sends a text message to a specified user or buddy.

posted on 2007-08-27 21:25  小生杂谈  阅读(1548)  评论(0编辑  收藏  举报