Shoutbox

other users last message - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: other users last message (/showthread.php?tid=54262)

other users last message by thomasa88 on 12-26-2005 at 09:01 AM

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);
            }

)