Index: src/misc.cpp =================================================================== --- src/misc.cpp (revision 10319) +++ src/misc.cpp (working copy) @@ -17,6 +17,18 @@ #include "stdafx.h" +CMStringW CVkProto::HtmlDecode(CMStringW str) +{ + str.Replace(_T("
"),_T("\n")); + str.Replace(_T("&"),_T("&")); + str.Replace(_T("&pos;"),_T("\'")); + str.Replace(_T(">"),_T(">")); + str.Replace(_T("<"),_T("<")); + str.Replace(_T("""),_T("\"")); + return str; +} + + TCHAR* CVkProto::GetUserStoredPassword() { ptrA szRawPass( getStringA("Password")); @@ -51,6 +63,7 @@ CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hNewContact, (LPARAM)m_szModuleName); setDword(hNewContact, "ID", dwUserid); db_set_ts(hNewContact, "CList", "Group", m_defaultGroup); + RetrieveUserInfo(dwUserid); return hNewContact; } Index: src/vk_chats.cpp =================================================================== --- src/vk_chats.cpp (revision 10319) +++ src/vk_chats.cpp (working copy) @@ -335,9 +335,15 @@ TCHAR *buf = NEWTSTR_ALLOCA(gch->ptszText); rtrimt(buf); UnEscapeChatTags(buf); - - Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.send.json", true, &CVkProto::OnSendChatMsg) - << INT_PARAM("type", 1) << INT_PARAM("chat_id", cc->m_chatid) << TCHAR_PARAM("message", buf)); + + AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendChatMsg) + << INT_PARAM("type", 1) << INT_PARAM("chat_id", cc->m_chatid); + pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded"); + + CMStringA szBody(FORMAT, "message=%s", ptrA(mir_urlEncode(mir_utf8encodeT(buf)))); + pReq->pData = mir_strdup(szBody); + pReq->dataLength = szBody.GetLength(); + Push(pReq); } case GC_USER_LOGMENU: Index: src/vk_proto.cpp =================================================================== --- src/vk_proto.cpp (revision 10319) +++ src/vk_proto.cpp (working copy) @@ -335,8 +335,11 @@ int CVkProto::GetInfo(MCONTACT hContact, int infoType) { - // TODO: Most probably some ProtoAck should be here instead - return 1; + LONG userID = getDword(hContact, "ID", -1); + if (userID == -1) + return 1; + RetrieveUserInfo(userID); + return 0; } HWND CVkProto::SearchAdvanced(HWND owner) Index: src/vk_proto.h =================================================================== --- src/vk_proto.h (revision 10319) +++ src/vk_proto.h (working copy) @@ -188,6 +188,7 @@ //==== Misc ========================================================================== + CMStringW HtmlDecode(CMStringW str); TCHAR* GetUserStoredPassword(void); void RetrieveMyInfo(void); Index: src/vk_thread.cpp =================================================================== --- src/vk_thread.cpp (revision 10319) +++ src/vk_thread.cpp (working copy) @@ -464,6 +464,8 @@ int uid = json_as_int(json_get(pMsg, "uid")); int isRead = json_as_int(json_get(pMsg, "read_state")); + + JSONNODE *pAttachments = json_get(pMsg, "attachments"); if (pAttachments != NULL) ptszBody = mir_tstrdup(CMString(ptszBody) + GetAttachmentDescr(pAttachments)); @@ -479,13 +481,14 @@ recv.timestamp = datetime; CMStringW szBody = ptszBody; - szBody.Replace(_T("
"),_T("\n")); + szBody = HtmlDecode(szBody); recv.tszMessage = (TCHAR *) szBody.c_str(); recv.lParam = isOut; recv.pCustomData = szMid; recv.cbCustomDataSize = (int)strlen(szMid); - ProtoChainRecvMsg(hContact, &recv); + if (!CheckMid(mid)) + ProtoChainRecvMsg(hContact, &recv); } MarkMessagesRead(mids);