The class provides access to a message which is intended for the user.
Method/Use |
Prerequisites |
IO2GMessagesTableResponseReader .getRow
This method is used to get an initial message after a session with the trading server is established.
This method provides access to a single message. To get multiple messages, call this method in a loop. |
The Messages table is always loaded by the server automatically during the login process.
You can get the message information by using the IO2GLoginRules .getTableRefreshResponse method.
The returned IO2GResponse object is of the O2GResponseType .GetMessages type.
You must parse this object by using the IO2GMessagesTableResponseReader object.
For details, see the example below. |
IO2GTablesUpdatesReader .getMessageRow
This method is used to get information about a message received during a session lifetime.
This method provides access to a single message. To track multiple messages, call this method in a loop. |
To receive the message information, you must implement the IO2GResponseListener .onTablesUpdates method.
The received IO2GResponse object is of the O2GResponseType .TablesUpdates type.
You must parse this object by using the IO2GTablesUpdatesReader object.
For details, see the example below. |
Get Messages information [hide]
// Get Messages information
void getMessages(IO2GSession *session, ResponseListener *responseListener)
{
O2G2Ptr<IO2GLoginRules> loginRules = session->getLoginRules();
// Check if Messages table is loaded automatically
if (loginRules && loginRules->isTableLoadedByDefault(Messages))
{
// If table is loaded, use getTableRefreshResponse method
O2G2Ptr<IO2GResponse> messagesResponse = loginRules->getTableRefreshResponse(Messages);
O2G2Ptr<IO2GResponseReaderFactory> responseFactory = session->getResponseReaderFactory();
if (responseFactory)
{
O2G2Ptr<IO2GMessagesTableResponseReader> messagesReader = responseFactory->createTradesTableReader(messagesResponse);
for (int i = 0; i < messagesReader->size(); i++)
{
O2G2Ptr<IO2GMessageRow> message = messagesReader->getRow(i);
std::cout << " This is a live message: \nFrom = " << message->getFrom() <<
" Subject = " << message->getSubject() <<
" Text= " << message->getText() << std::endl;
}
}
}
}
// Implementation of IO2GResponseListener interface public method onTablesUpdates
void ResponseListener::onTablesUpdates(IO2GResponse *response)
{
O2G2Ptr<IO2GResponseReaderFactory> factory = mSession->getResponseReaderFactory();
if (factory)
{
O2G2Ptr<IO2GTablesUpdatesReader> updatesReader = factory->createTablesUpdatesReader(response);
for (int i = 0; i < updatesReader->size(); i++)
{
if (updatesReader->getUpdateTable(i) == Messages)
{
O2G2Ptr<IO2GMessageRow> message = updatesReader->getMessageRow(i);
std::cout << " This is a live message: \nFrom = " << message->getFrom() <<
" Subject = " << message->getSubject() <<
" Text= " << message->getText() << std::endl;
}
}
}
}
Public Methods |
columns
|
Gets the columns of the table.
|
getCell
|
Gets value of a table cell.
|
getFeature
|
Gets the type of the message content.
|
getFrom
|
Gets the login of the message sender.
|
getHTMLFragmentFlag
|
Gets the flag indicating whether the message is in the HTML format or not.
|
getMsgID
|
Gets the unique identification number of the message.
|
getSubject
|
Gets the subject of the message.
|
getTableType
|
Gets the type of the table.
|
getText
|
Gets a text body of the message.
|
getTime
|
Gets the date and time when the recipient receives the message.
|
getType
|
Gets the message container.
|
isCellChanged
|
Gets a flag indicating whether the value of the cell is changed.
|