# OpalIMContext Class Reference

`#include <im.h>`

Inheritance diagram for OpalIMContext:

[legend]
Collaboration diagram for OpalIMContext:
[legend]

## Message transmit

typedef PNotifierTemplate< DispositionInfo > | MessageDispositionNotifier
| Type for disposition notifiers.
| P_DECLARE_STREAMABLE_ENUM (MessageDisposition, DispositionPending, DispositionAccepted, DeliveryOK, DisplayConfirmed, ProcessedNotification, StorageNotification, DispositionErrors, GenericError, UnacceptableContent, InvalidContent, DestinationUnknown, DestinationUnavailable, TransmissionTimeout, TransportFailure, ConversationClosed, UnsupportedFeature, DeliveryFailed)
virtual MessageDisposition | Send (OpalIM *message)
virtual void | OnMessageDisposition (const DispositionInfo &info)
void | SetMessageDispositionNotifier (const MessageDispositionNotifier &notifier)
| Set the notifier for the OnMessageDisposition() function.

## Message receipt

typedef PNotifierTemplate< OpalIM > | MessageReceivedNotifier
| Type for message received notifiers.
virtual MessageDisposition | OnMessageReceived (const OpalIM &message)
void | SetMessageReceivedNotifier (const MessageReceivedNotifier &notifier)
| Set the notifier for the OnMessageReceived() function.

## Message composition

typedef PNotifierTemplate< CompositionInfo > | CompositionIndicationNotifier
| Type for composition indication notifiers.
virtual bool | SendCompositionIndication (const CompositionInfo &info)
virtual void | OnCompositionIndication (const CompositionInfo &info)
void | SetCompositionIndicationNotifier (const CompositionIndicationNotifier &notifier)
| Set the notifier for the OnCompositionIndication() function.
static const PCaselessString & | CompositionIndicationActive ()
| CompositionIndication active status.
static const PCaselessString & | CompositionIndicationIdle ()
| CompositionIndication idle status.

## Construction

| ~OpalIMContext ()
| Destroy context.
virtual bool | Open (bool byRemote)
virtual void | Close ()
| OpalIMContext ()
| Construct base for context.

## Support functions

virtual bool | CheckContentType (const PString &contentType) const
| Check that the context type is valid for protocol.
virtual PStringArray | GetContentTypes () const
| Return array of all valid content types.
static PString | CreateKey (const PURL &from, const PURL &to)
| Calculate a key based on the from an to addresses.

## Public Member Functions

Member variables
const PString & | GetID () const
| Get conversation ID.
const PString & | GetKey () const
| Get key for context based on to/from addresses.
const PURL & | GetRemoteURL () const
| Get remote URL for conversation.
const PString & | GetRemoteName () const
| Get remote display name for conversation.
const PURL & | GetLocalURL () const
| Get local URL for conversation.
const PString & | GetLocalName () const
| Get local display for conversation.
void | SetLocalName (const PString &name)
| Set local display for conversation.
PStringOptions & | GetAttributes ()
| Get the attributes for this presentity.
const PStringOptions & | GetAttributes () const

## Protected Member Functions

void | ResetLastUsed ()
virtual MessageDisposition | InternalSend ()
virtual MessageDisposition | InternalSendOutsideCall (OpalIM &message)
virtual MessageDisposition | InternalSendInsideCall (OpalIM &message)
virtual void | InternalOnMessageSent (const DispositionInfo &info)

## Protected Attributes

OpalIMEndPoint * | m_endpoint
PStringOptions | m_attributes
PSafePtr< OpalCall > | m_call
bool | m_weStartedCall
PMutex | m_notificationMutex
MessageDispositionNotifier | m_messageDispositionNotifier
MessageReceivedNotifier | m_messageReceivedNotifier
CompositionIndicationNotifier | m_compositionIndicationNotifier
PMutex | m_outgoingMessagesMutex
OpalIM * | m_currentOutgoingMessage
PQueue< OpalIM > | m_outgoingMessages
PMutex | m_lastUsedMutex
PTime | m_lastUsed
PString | m_conversationId
PURL | m_localURL
PString | m_localName
PURL | m_remoteURL
PString | m_remoteName
PString | m_key

## Friends

class | OpalIMEndPoint
class | OpalIMConnection

## Data Structures

struct | CompositionInfo
struct | ConversationInfo
struct | DispositionInfo

## Detailed Description

Class representing an Instant Messaging "conversation". This keeps the context for Instant Messages between two entities. It is an abstract class whose concrete classes are dependant on the individual protocol being used for the messages. The URL "scheme" field is usually used to distinguish the protocol.

## Member Typedef Documentation

typedef PNotifierTemplate<CompositionInfo> OpalIMContext::CompositionIndicationNotifier

Type for composition indication notifiers.

typedef PNotifierTemplate<DispositionInfo> OpalIMContext::MessageDispositionNotifier

Type for disposition notifiers.

typedef PNotifierTemplate<OpalIM> OpalIMContext::MessageReceivedNotifier

Type for message received notifiers.

## Constructor & Destructor Documentation

OpalIMContext::OpalIMContext | ( |  | ) | `[protected]`

Construct base for context.

OpalIMContext::~OpalIMContext | ( |  | ) |

Destroy context.

## Member Function Documentation

virtual bool OpalIMContext::CheckContentType | ( | const PString & | contentType | ) | const`[virtual]`

Check that the context type is valid for protocol.

Parameters:

  contentType | MIME Content type to check

virtual void OpalIMContext::Close | ( |  | ) | `[virtual]`

Close the context (conversation) Default behaviour removes the context from the OpalIMEndPoint

static const PCaselessString& OpalIMContext::CompositionIndicationActive | ( |  | ) | `[static]`

CompositionIndication active status.

static const PCaselessString& OpalIMContext::CompositionIndicationIdle | ( |  | ) | `[static]`

CompositionIndication idle status.

static PString OpalIMContext::CreateKey | ( | const PURL & | from,
|  | const PURL & | to |
| ) |  |  | `[static]`

Calculate a key based on the from an to addresses.

const PStringOptions& OpalIMContext::GetAttributes | ( |  | ) | const`[inline]`

PStringOptions& OpalIMContext::GetAttributes | ( |  | ) | `[inline]`

Get the attributes for this presentity.

virtual PStringArray OpalIMContext::GetContentTypes | ( |  | ) | const`[virtual]`

Return array of all valid content types.

const PString& OpalIMContext::GetID | ( |  | ) | const`[inline]`

Get conversation ID.

const PString& OpalIMContext::GetKey | ( |  | ) | const`[inline]`

Get key for context based on to/from addresses.

const PString& OpalIMContext::GetLocalName | ( |  | ) | const`[inline]`

Get local display for conversation.

const PURL& OpalIMContext::GetLocalURL | ( |  | ) | const`[inline]`

Get local URL for conversation.

const PString& OpalIMContext::GetRemoteName | ( |  | ) | const`[inline]`

Get remote display name for conversation.

const PURL& OpalIMContext::GetRemoteURL | ( |  | ) | const`[inline]`

Get remote URL for conversation.

virtual void OpalIMContext::InternalOnMessageSent | ( | const DispositionInfo & | info | ) | `[protected, virtual]`

virtual MessageDisposition OpalIMContext::InternalSend | ( |  | ) | `[protected, virtual]`

virtual MessageDisposition OpalIMContext::InternalSendInsideCall | ( | OpalIM & | message | ) | `[protected, virtual]`

Reimplemented in OpalSIPIMContext.

virtual MessageDisposition OpalIMContext::InternalSendOutsideCall | ( | OpalIM & | message | ) | `[protected, virtual]`

Reimplemented in OpalSIPIMContext.

virtual void OpalIMContext::OnCompositionIndication | ( | const CompositionInfo & | info | ) | `[virtual]`

Called when the remote composition indication changes state. The default behaviour checks for a notifier and calls that if set.

Parameters:

  info | New composition state information

virtual void OpalIMContext::OnMessageDisposition | ( | const DispositionInfo & | info | ) | `[virtual]`

Callback indicating the dispostion of a messagesent via Send(). The default behaviour checks for a notifier and calls that if set.

Parameters:

  info | Information on the message disposition

virtual MessageDisposition OpalIMContext::OnMessageReceived | ( | const OpalIM & | message | ) | `[virtual]`

Called when an incoming message arrives for this context. Default implementation checks for valid MIME content and then calls the notifier, if set. If no notifier is set, then the OpalManager::OnMessageReceived() function is called.

Parameters:

  message | Received message

Reimplemented in OpalSIPIMContext.

virtual bool OpalIMContext::Open | ( | bool | byRemote | ) | `[virtual]`

Open the context (conversation) Default behaviour simply returns true.

Parameters:

  byRemote | Context was created by remote (incoming message)

Reimplemented in OpalSIPIMContext.

OpalIMContext::P_DECLARE_STREAMABLE_ENUM | ( | MessageDisposition | ,
|  | DispositionPending | ,
|  | DispositionAccepted | ,
|  | DeliveryOK | ,
|  | DisplayConfirmed | ,
|  | ProcessedNotification | ,
|  | StorageNotification | ,
|  | DispositionErrors | ,
|  | GenericError | ,
|  | UnacceptableContent | ,
|  | InvalidContent | ,
|  | DestinationUnknown | ,
|  | DestinationUnavailable | ,
|  | TransmissionTimeout | ,
|  | TransportFailure | ,
|  | ConversationClosed | ,
|  | UnsupportedFeature | ,
|  | DeliveryFailed |  |
| ) |  |  |

Disposition of message transmission. Get the status of the sent message throughout its life, including how it is handled by teh network, and how it is handled by the remote entity, such as described in RFC5438.

void OpalIMContext::ResetLastUsed | ( |  | ) | `[protected]`

virtual MessageDisposition OpalIMContext::Send | ( | OpalIM * | message | ) | `[virtual]`

Send message in this conversation. This is generally asynchronous and will return quickly with the message procesing happening inthe background.

The eventual disposition of the message transmission is indicated via the OnMessageDisposition() function and it's notifier.

The `message` parameter should be allocated by the caller and will be destroyed by the context when it is finished with.

Parameters:

  message | Message to be sent

virtual bool OpalIMContext::SendCompositionIndication | ( | const CompositionInfo & | info | ) | `[virtual]`

Send a composition indication to remote. The text is usually either CompositionIndicationActive() or CompositionIndicationIdle(), howver other extension values may be possible.

Parameters:

  info | Composition information

void OpalIMContext::SetCompositionIndicationNotifier | ( | const CompositionIndicationNotifier & | notifier | ) |

Set the notifier for the OnCompositionIndication() function.

Parameters:

  notifier | Notifier to be called by protocol

void OpalIMContext::SetLocalName | ( | const PString & | name | ) | `[inline]`

Set local display for conversation.

void OpalIMContext::SetMessageDispositionNotifier | ( | const MessageDispositionNotifier & | notifier | ) |

Set the notifier for the OnMessageDisposition() function.

Parameters:

  notifier | Notifier to be called by protocol

void OpalIMContext::SetMessageReceivedNotifier | ( | const MessageReceivedNotifier & | notifier | ) |

Set the notifier for the OnMessageReceived() function.

Parameters:

  notifier | Notifier to be called by protocol

## Friends And Related Function Documentation

friend class OpalIMConnection `[friend]`

friend class OpalIMEndPoint `[friend]`

## Field Documentation

PStringOptions OpalIMContext::m_attributes `[protected]`

PSafePtr<OpalCall> OpalIMContext::m_call `[protected]`

CompositionIndicationNotifier OpalIMContext::m_compositionIndicationNotifier `[protected]`

PString OpalIMContext::m_conversationId `[protected]`

OpalIM* OpalIMContext::m_currentOutgoingMessage `[protected]`

OpalIMEndPoint* OpalIMContext::m_endpoint `[protected]`

PString OpalIMContext::m_key `[protected]`

PTime OpalIMContext::m_lastUsed `[protected]`

PMutex OpalIMContext::m_lastUsedMutex `[protected]`

PString OpalIMContext::m_localName `[protected]`

PURL OpalIMContext::m_localURL `[protected]`

MessageDispositionNotifier OpalIMContext::m_messageDispositionNotifier `[protected]`

MessageReceivedNotifier OpalIMContext::m_messageReceivedNotifier `[protected]`

PMutex OpalIMContext::m_notificationMutex `[protected]`

PQueue<OpalIM> OpalIMContext::m_outgoingMessages `[protected]`

PMutex OpalIMContext::m_outgoingMessagesMutex `[protected]`

PString OpalIMContext::m_remoteName `[protected]`

PURL OpalIMContext::m_remoteURL `[protected]`

bool OpalIMContext::m_weStartedCall `[protected]`

The documentation for this class was generated from the following file:

- im.h