epoc32/include/app/imclient.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 1 666f914201fb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Interface for Instant Messaging services
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef OPENAPI_IM_CLIENT_H
williamr@2
    20
#define OPENAPI_IM_CLIENT_H
williamr@2
    21
williamr@2
    22
// INCLUDES
williamr@2
    23
#include <e32base.h>
williamr@2
    24
#include <bamdesca.h>
williamr@2
    25
#include <cntdef.h>
williamr@2
    26
williamr@2
    27
// CONSTANTS
williamr@2
    28
williamr@2
    29
// FORWARD DECLARATIONS
williamr@2
    30
class MImObserver;
williamr@2
    31
class MImClientDetailedError;
williamr@2
    32
williamr@2
    33
// CLASS DECLARATION
williamr@2
    34
/**
williamr@2
    35
*  Instant Messaging interface class
williamr@2
    36
*  This interface class provides methods to send and receive instant messages.
williamr@2
    37
*  Application to be able to receive IMs it must register its own observer
williamr@2
    38
*  using this interface class.
williamr@2
    39
*  This interface can be obtained using a factory method from the CImConnection
williamr@2
    40
*  class.
williamr@2
    41
*
williamr@2
    42
*  @lib imclient.lib
williamr@2
    43
*  @since S60 3.0
williamr@2
    44
*/
williamr@2
    45
class MImClient
williamr@2
    46
    {
williamr@2
    47
williamr@2
    48
    public:
williamr@2
    49
williamr@2
    50
        virtual ~MImClient() {}
williamr@2
    51
williamr@2
    52
        /**
williamr@2
    53
        * Method for registering the IM client to the WV Engine.
williamr@2
    54
        * This method is synchronous.
williamr@2
    55
        * @since S60 3.0
williamr@2
    56
        * @param aObserver observer object used for notifying the user
williamr@2
    57
        *        software
williamr@2
    58
        * @leave KImApiErrAlreadyRegistered if it was registered already or other system wide error code
williamr@2
    59
        */
williamr@2
    60
        virtual void RegisterObserverL(
williamr@2
    61
            MImObserver* aObserver ) = 0;
williamr@2
    62
williamr@2
    63
        /**
williamr@2
    64
        * Method for unregistering the IM Sender from the WV Engine.
williamr@2
    65
        * This method is synchronous method.
williamr@2
    66
        * @since S60 3.0
williamr@2
    67
        */
williamr@2
    68
        virtual void UnregisterObserver( ) = 0;
williamr@2
    69
williamr@2
    70
        /**
williamr@2
    71
        * Method for sending person-to-person text message (UNICODE) using
williamr@2
    72
        * Contact Model IDs. This method is asynchronous and it’s completion
williamr@2
    73
        * is signaled in HandleMessageSentL() method.
williamr@2
    74
        * The method will leave on error. The API specific error codes are
williamr@2
    75
        * in imerrors.h file
williamr@2
    76
        * @since S60 3.0
williamr@2
    77
        * @param aContactItem Contact Model ID of the recipient
williamr@2
    78
        * @param aContent The content of the message in UNICODE
williamr@2
    79
        * @return operation code
williamr@2
    80
        * @leave KImApiErrNotRegistered observer was not registered
williamr@2
    81
        * @leave KImApiErrInvalidContactId the contact ID does not have a corresponding User ID
williamr@2
    82
        */
williamr@2
    83
        virtual TInt SendPToPMessageL(
williamr@2
    84
            const TContactItemId& aContactItem,
williamr@2
    85
            const TDesC16& aContent ) = 0;
williamr@2
    86
williamr@2
    87
        /**
williamr@2
    88
        * Method for sending person-to-person text message (UNICODE) using
williamr@2
    89
        * Contact Model IDs. This method is asynchronous and its completion
williamr@2
    90
        * is signaled in HandleMessageSentL() method.
williamr@2
    91
        * The method will leave on error. The API specific error codes are
williamr@2
    92
        * in imerrors.h file
williamr@2
    93
        * Please note that one contact can have more than one assigned IM user
williamr@2
    94
        * ID. Sending IM to those contacts will result in partial success.
williamr@2
    95
        * @since S60 3.0
williamr@2
    96
        * @param aContactIds Contact Model Ids of the recipient(s)
williamr@2
    97
        * @param aContent The content of the message in UNICODE
williamr@2
    98
        * @return operation code
williamr@2
    99
        * @leave KImApiErrNotRegistered observer was not registered
williamr@2
   100
        * @leave KImApiErrInvalidContactId the contact ID does not have a corresponding User ID
williamr@2
   101
        */
williamr@2
   102
        virtual TInt SendPToPMessageL(
williamr@2
   103
            const CContactIdArray& aContactIds,
williamr@2
   104
            const TDesC16& aContent ) = 0;
williamr@2
   105
williamr@2
   106
        /**
williamr@2
   107
        * Method for sending person-to-person binary (or 8bit text) message
williamr@2
   108
        * using Contact Model IDs. This method is asynchronous and its
williamr@2
   109
        * completion is signaled in HandleMessageSentL() method.
williamr@2
   110
        * The method will leave on error. The API specific error codes are
williamr@2
   111
        * in imerrors.h file
williamr@2
   112
        * Please note that one contact can have more than one assigned IM user
williamr@2
   113
        * ID. Sending IM to those contacts will result in partial success.
williamr@2
   114
        * @since S60 3.0
williamr@2
   115
        * @param aContactIds Contact Model Ids of the recipient(s)
williamr@2
   116
        * @param aContentType MIME type of the content
williamr@2
   117
        * @param aContent The content of the message
williamr@2
   118
        * @return operation code
williamr@2
   119
        *
williamr@2
   120
        * NOTE: Not yet supported!
williamr@2
   121
        */
williamr@2
   122
        virtual TInt SendPToPMessageL(
williamr@2
   123
            const CContactIdArray& aContactIds,
williamr@2
   124
            const TDesC& aContentType,
williamr@2
   125
            const TDesC8& aContent ) = 0;
williamr@2
   126
williamr@2
   127
        /**
williamr@2
   128
        * Method for sending person-to-person text message using
williamr@2
   129
        * directly the User IDs.
williamr@2
   130
        * This method is asynchronous and its completion is signaled
williamr@2
   131
        * in HandleMessageSentL() method.
williamr@2
   132
        * The method will leave on error. The API specific error codes are
williamr@2
   133
        * in imerrors.h file
williamr@2
   134
        * @since S60 3.0
williamr@2
   135
        * @param aUserId the recipient of the message
williamr@2
   136
        * @param aContent the message in UNICODE
williamr@2
   137
        * @return operation code.
williamr@2
   138
        * @leave KImApiErrNotRegistered observer was not registered
williamr@2
   139
        * @leave KImApiErrInvalidUserId wrong User ID
williamr@2
   140
        */
williamr@2
   141
        virtual TInt SendPToPMessageL(
williamr@2
   142
            const TDesC& aUserId,
williamr@2
   143
            const TDesC16& aContent ) = 0;
williamr@2
   144
williamr@2
   145
        /**
williamr@2
   146
        * Method for sending person-to-person text message using
williamr@2
   147
        * directly the User IDs.
williamr@2
   148
        * This method is asynchronous and its completion is signaled
williamr@2
   149
        * in HandleMessageSentL() method.
williamr@2
   150
        * The method will leave on error. The API specific error codes are
williamr@2
   151
        * in imerrors.h file
williamr@2
   152
        * @since S60 3.0
williamr@2
   153
        * @param aUserIds recipient(s) of the message
williamr@2
   154
        * @param aContent the message in UNICODE
williamr@2
   155
        * @return operation code.
williamr@2
   156
        * @leave KImApiErrNotRegistered observer was not registered
williamr@2
   157
        * @leave KImApiErrInvalidUserId wrong User ID
williamr@2
   158
        */
williamr@2
   159
        virtual TInt SendPToPMessageL(
williamr@2
   160
            const MDesCArray& aUserIds,
williamr@2
   161
            const TDesC16& aContent ) = 0;
williamr@2
   162
williamr@2
   163
        /**
williamr@2
   164
        * Method for sending person-to-person binary (or 8 bit text) message
williamr@2
   165
        * using directly the User IDs.
williamr@2
   166
        * This method is asynchronous and its completion is signaled
williamr@2
   167
        * in HandleMessageSentL() method.
williamr@2
   168
        * The method will leave on error. The API specific error codes are
williamr@2
   169
        * in imerrors.h file
williamr@2
   170
        * @since S60 3.0
williamr@2
   171
        * @param aUserIds recipient(s) of the message
williamr@2
   172
        * @param aContentType MIME type of the message
williamr@2
   173
        * @param aContent the message
williamr@2
   174
        * @return operation code.
williamr@2
   175
        *
williamr@2
   176
        * NOTE: Not yet supported!
williamr@2
   177
        */
williamr@2
   178
        virtual TInt SendPToPMessageL(
williamr@2
   179
            const MDesCArray& aUserIds,
williamr@2
   180
            const TDesC& aContentType,
williamr@2
   181
            const TDesC8& aContent ) = 0;
williamr@2
   182
williamr@2
   183
    };
williamr@2
   184
williamr@2
   185
williamr@2
   186
// CLASS DECLARATION
williamr@2
   187
/**
williamr@2
   188
*  Observer interface for Instant Messaging
williamr@2
   189
*  The user shall implement this interface and register it through the MImClient
williamr@2
   190
*  interface to the API to be able to receive IMs
williamr@2
   191
*
williamr@2
   192
*  @lib imclient.lib
williamr@2
   193
*  @since S60 3.0
williamr@2
   194
*/
williamr@2
   195
class MImObserver
williamr@2
   196
    {
williamr@2
   197
williamr@2
   198
    public:
williamr@2
   199
williamr@2
   200
        /**
williamr@2
   201
        * This method is called when the SendPToPMessageL succeeded
williamr@2
   202
        * @since S60 3.0
williamr@2
   203
        * @param aOpCode operation code matching the called functions.
williamr@2
   204
        * @param aErrorCode error codes.
williamr@2
   205
        */
williamr@2
   206
        virtual void HandleMessageSentL(
williamr@2
   207
            const TInt aOpCode,
williamr@2
   208
            const TInt aErrorCode ) = 0;
williamr@2
   209
williamr@2
   210
        /**
williamr@2
   211
        * This method is called when the SendPToPMessageL failed for some reason.
williamr@2
   212
        * If the IM was sent to more recipients the error can be a partial
williamr@2
   213
        * success. In that case the detailed error codes for each user can
williamr@2
   214
        * fetched separately. Please note that the aDetailedError is valid
williamr@2
   215
        * during the function call. After that it gets destroyed in the API.
williamr@2
   216
        * @since S60 3.0
williamr@2
   217
        * @param aOpCode operation code matching the called functions.
williamr@2
   218
        * @param aErrorCode error codes.
williamr@2
   219
        * @param aDetailedError list of errors for each failed user ID.
williamr@2
   220
        */
williamr@2
   221
        virtual void HandleSendErrorL(
williamr@2
   222
            const TInt aOpCode,
williamr@2
   223
            const TInt aErrorCode,
williamr@2
   224
            MImClientDetailedError* aDetailedError ) = 0;
williamr@2
   225
williamr@2
   226
        /**
williamr@2
   227
        * This method is called when a new point-to-point text message
williamr@2
   228
        * has arrived.
williamr@2
   229
        * @since S60 3.0
williamr@2
   230
        * @param aErrorCode error codes (to be defined)
williamr@2
   231
        * @param aContactId Contact model ID of the sender
williamr@2
   232
        * @param aUserId UserID of the message sender
williamr@2
   233
        * @param aMessageType MIME type of the received message
williamr@2
   234
        * @param aContent the message in UNICODE
williamr@2
   235
        */
williamr@2
   236
        virtual void HandleNewPToPMessageL(
williamr@2
   237
            const TInt aErrorCode,
williamr@2
   238
            const TContactItemId  aContactId,
williamr@2
   239
            const TDesC& aUserId,
williamr@2
   240
            const TDesC& aMessageType,
williamr@2
   241
            const TDesC16& aContent ) = 0;
williamr@2
   242
williamr@2
   243
        /**
williamr@2
   244
        * This method is called when a new point-to-point message (8bit)
williamr@2
   245
        * has arrived. The message can be text or binary data.
williamr@2
   246
        * @since S60 3.0
williamr@2
   247
        * @param aErrorCode error codes (to be defined)
williamr@2
   248
        * @param aContactId Contact model ID of the sender
williamr@2
   249
        * @param aUserId UserID of the message sender
williamr@2
   250
        * @param aMessageType MIME type of the received message
williamr@2
   251
        * @param aContent the message
williamr@2
   252
        *
williamr@2
   253
        * NOTE: Not yet supported!
williamr@2
   254
        */
williamr@2
   255
        virtual void HandleNewPToPMessageL(
williamr@2
   256
            const TInt aErrorCode,
williamr@2
   257
            const TContactItemId  aContactId,
williamr@2
   258
            const TDesC& aUserId,
williamr@2
   259
            const TDesC& aMessageType,
williamr@2
   260
            const TDesC8& aContent ) = 0;
williamr@2
   261
williamr@2
   262
    };
williamr@2
   263
williamr@2
   264
// CLASS DECLARATION
williamr@2
   265
/**
williamr@2
   266
*  Detailed errors accessor class
williamr@2
   267
*  @lib imclient.lib
williamr@2
   268
*  @since S60 3.0
williamr@2
   269
*/
williamr@2
   270
class MImClientDetailedError
williamr@2
   271
    {
williamr@2
   272
williamr@2
   273
    public:
williamr@2
   274
        /**
williamr@2
   275
        * Gets the number of failed User IDs
williamr@2
   276
        * @since S60 3.0
williamr@2
   277
        * @return number of failed user IDs
williamr@2
   278
        */
williamr@2
   279
        virtual TInt Count() = 0;
williamr@2
   280
williamr@2
   281
        /**
williamr@2
   282
        * Gets the failed User ID
williamr@2
   283
        * @since S60 3.0
williamr@2
   284
        * @param aIndex index of the user in the list
williamr@2
   285
        * @return failed user ID
williamr@2
   286
        */
williamr@2
   287
        virtual const TDesC& UserId( TInt aIndex ) = 0;
williamr@2
   288
williamr@2
   289
        /**
williamr@2
   290
        * Gets the reason of the failure. The API specific error codes are
williamr@2
   291
        * defined in imerrors.h file.
williamr@2
   292
        * @since S60 3.0
williamr@2
   293
        * @param aIndex index of the user in the list
williamr@2
   294
        * @return the fail reason
williamr@2
   295
        */
williamr@2
   296
        virtual TInt ErrorCode( TInt aIndex ) = 0;
williamr@2
   297
williamr@2
   298
    };
williamr@2
   299
williamr@2
   300
#endif
williamr@2
   301
// End of File