Im trying to get the other users last message, Ive tried with the history but then I get all text and there is no separators
Is there any event or someway to get a text with separators?
(this is what I got so far:
code:
IMessengerConversationWnd *convWnd;
pParam->iConversationWnd->QueryInterface(IID_IMessengerConversationWnd,(void**)&convWnd);
if(convWnd != NULL)
{
BSTR historyB = NULL;
convWnd->get_History(&historyB);
string history;
if(historyB)
{
//Convert the string from BSTR to char*
history = string((char*)_bstr_t(historyB));
SysFreeString(historyB);
}
//msgplus will do this when plugin ends but..
convWnd->Release();
char *len;
_ui64toa(history.length(), len, 10);
MessageBox(GetActiveWindow(), len, "hist length", MB_OK);
size_t latestMsg = history.find_last_of("T");
_ui64toa(latestMsg, len, 10);
MessageBox(NULL, len, "latest", MB_OK);
MessageBox(NULL, history.substr(history.length() - 500).c_str(), "substr", MB_OK);
if(latestMsg != string::npos)
result += history.substr(latestMsg);
}
)