Protocols/MSNP/Activities/SDK/Techref/Developing/Devsingle: Difference between revisions
Animadoria (talk | contribs) (Created automatically by Anima Importer) |
Animadoria (talk | contribs) (Created automatically by Anima Importer) |
||
Line 1: | Line 1: | ||
<!-- Generated @ 08/12/2022 23: | <!-- Generated @ 08/12/2022 23:36:17 +01:00 using Anima's CHM converter based on techref/developing/devsingle.htm --> | ||
{{Protocols/MSNP|section=Activities}} | {{Protocols/MSNP|section=Activities}} | ||
__NOTOC__= Single-User Application = | __NOTOC__= Single-User Application = | ||
Line 26: | Line 26: | ||
An application that can receive instant messages must have an event handler called <span class="clsEvent">Channel.OnIMReceived</span>. This event fires when the client receives an instant message. | An application that can receive instant messages must have an event handler called <span class="clsEvent">Channel.OnIMReceived</span>. This event fires when the client receives an instant message. | ||
Special permissions are required to use the instant message features. For more information on special permissions, see [[ | Special permissions are required to use the instant message features. For more information on special permissions, see [[Protocols/MSNP/Activities/SDK/Sandbox|Standard vs. Advanced Applications]]. | ||
<span id="error-handling"></span> | <span id="error-handling"></span> |
Revision as of 22:36, 12 August 2022
Single-User Application
A single-user MSN® Messenger Activity does not need event handlers for connection- or data-related events, because no invitation needs to be sent, and there is no connection.
If an application is granted one of the special permissions for instant messaging, it can participate in the exchange of instant messages. This feature may be useful for an application that translates incoming messages for display in the Messenger Conversation window.
The following processes are available to a single-user Activity:
- Sending and receiving instant messages (with appropriate permission flags)
- Error handling
Sending and Receiving Instant Messages
A single-user application can interact with instant messages by using the methods Channel.EnterIM, Channel.SendIM, or Channel.SendIMAsUser.
The methods Channel.SendIM and Channel.SendIMAsUser can be used to send instant messages.
An application that can receive instant messages must have an event handler called Channel.OnIMReceived. This event fires when the client receives an instant message.
Special permissions are required to use the instant message features. For more information on special permissions, see Standard vs. Advanced Applications.
Error Handling
An application should have an event handler for Channel.OnDataError. This event fires if Channel.SendIM or Channel.SendIMAsUser fails. When the event OnDataError is fired, the property Channel.Error.Type is set to an integer representing the type of error, and the property Channel.Error.Data provides a copy of the data. Typically, an application should try to send the data again, in case the error was an isolated communication problem.
Applications should also employ other error handling techniques, such as wrapping any method that sends instant messages in an error handling block. These could include a try-catch block in JavaScript or an ON ERROR GOTO statement in Microsoft® Visual Basic® Scripting Edition (VBScript).