diff options
author | George Hazan <ghazan@miranda.im> | 2019-04-17 22:43:05 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-04-17 22:43:05 +0300 |
commit | 52c70f4d3213b82a19e42310f046abd1ebb21cc4 (patch) | |
tree | f19e72522a550643e7185b36417868f7c6e2c0b7 /protocols/ICQ-WIM/src | |
parent | a455e6fe10fb1f60bc37b0585b9a55fc25597931 (diff) |
merge with trunk
Diffstat (limited to 'protocols/ICQ-WIM/src')
-rw-r--r-- | protocols/ICQ-WIM/src/http.cpp | 19 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/ignore.cpp | 154 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/main.cpp | 41 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/poll.cpp | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.cpp | 37 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.h | 9 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 26 |
7 files changed, 51 insertions, 237 deletions
diff --git a/protocols/ICQ-WIM/src/http.cpp b/protocols/ICQ-WIM/src/http.cpp index e8b616fb46..d365b6e06e 100644 --- a/protocols/ICQ-WIM/src/http.cpp +++ b/protocols/ICQ-WIM/src/http.cpp @@ -114,8 +114,14 @@ AsyncHttpRequest::AsyncHttpRequest(IcqConnection conn, int iType, const char *sz void AsyncHttpRequest::ReplaceJsonParam(const JSONNode &n) { + auto *szNodeName = n.name(); + JSONNode root = JSONNode::parse(m_szParam); - root[n.name()] = n; + JSONNode& old = root.at(szNodeName); + if (old) + old = n; + else + root.push_back(n); m_szParam = root.write().c_str(); replaceStr(pData, nullptr); @@ -147,12 +153,12 @@ bool CIcqProto::ExecuteRequest(AsyncHttpRequest *pReq) delete pReq; return false; } - - pReq->ReplaceJsonParam(JSONNode("clientId", m_iRClientId)); - pReq->ReplaceJsonParam(JSONNode("authToken", m_szRToken)); - pReq->dataLength = pReq->m_szParam.GetLength(); - pReq->pData = mir_strdup(pReq->m_szParam); } + + pReq->ReplaceJsonParam(JSONNode("clientId", m_iRClientId)); + pReq->ReplaceJsonParam(JSONNode("authToken", m_szRToken)); + pReq->dataLength = pReq->m_szParam.GetLength(); + pReq->pData = mir_strdup(pReq->m_szParam); } debugLogA("Executing request %s:\n%s", pReq->m_reqId, pReq->szUrl); @@ -191,7 +197,6 @@ bool CIcqProto::ExecuteRequest(AsyncHttpRequest *pReq) return false; } - pReq->ReplaceJsonParam(JSONNode("authToken", m_szRToken)); Push(pReq); return true; } diff --git a/protocols/ICQ-WIM/src/ignore.cpp b/protocols/ICQ-WIM/src/ignore.cpp index 66501858df..53edac0c08 100644 --- a/protocols/ICQ-WIM/src/ignore.cpp +++ b/protocols/ICQ-WIM/src/ignore.cpp @@ -21,148 +21,6 @@ #include "stdafx.h" -class CEditIgnoreListDlg : public CIcqDlgBase -{ - typedef CIcqDlgBase CSuper; - - CCtrlListView m_list; - -public: - CEditIgnoreListDlg(CIcqProto *ppro) : - CSuper(ppro, IDD_EDITIGNORE), - m_list(this, IDC_LIST) - { - m_list.OnClick = Callback(this, &CEditIgnoreListDlg::list_OnClick); - } - - bool OnInitDialog() override - { - HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 0); - ImageList_AddIcon(hImageList, Skin_LoadIcon(SKINICON_OTHER_DELETE)); - m_list.SetImageList(hImageList, LVSIL_SMALL); - - m_list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES | LVS_EX_GRIDLINES); - - RECT rc; - GetClientRect(m_list.GetHwnd(), &rc); - - LVCOLUMN lvc = {}; - lvc.mask = LVCF_WIDTH; - lvc.cx = rc.right; - m_list.InsertColumn(0, &lvc); - - auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/preference/getPermitDeny", &CIcqProto::OnRefreshEditIgnore); - pReq << AIMSID(m_proto); - pReq->pUserInfo = this; - m_proto->ExecuteRequest(pReq); - - Utils_RestoreWindowPosition(m_hwnd, 0, m_proto->m_szModuleName, "editIgnore_"); - return true; - } - - void OnDestroy() override - { - m_proto->m_pdlgEditIgnore = nullptr; - Utils_SaveWindowPosition(m_hwnd, 0, m_proto->m_szModuleName, "editIgnore_"); - } - - INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override - { - INT_PTR ret = CSuper::DlgProc(uMsg, wParam, lParam); - if (uMsg == WM_SIZE) { - RECT rc; - GetClientRect(m_list.GetHeader(), &rc); - m_list.SetColumnWidth(0, rc.right - rc.left); - } - - return ret; - } - - int Resizer(UTILRESIZECONTROL *urc) override - { - switch (urc->wId) { - case IDC_LIST: - return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT; - } - return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM; - } - - void Refresh(const JSONNode &pData) - { - LVITEM lvi = {}; - lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; - - for (auto &it : pData["ignores"]) { - CMStringW wszId(it.as_mstring()); - auto *p = m_proto->FindContactByUIN(wszId); - if (p) { - lvi.pszText = Clist_GetContactDisplayName(p->m_hContact); - lvi.lParam = p->m_hContact; - } - else { - lvi.pszText = wszId.GetBuffer(); - lvi.lParam = -1; - } - - m_list.InsertItem(&lvi); - lvi.iItem++; - } - } - - void list_OnClick(CCtrlListView::TEventInfo*) - { - LVHITTESTINFO hti; - hti.pt.x = (short)LOWORD(GetMessagePos()); - hti.pt.y = (short)HIWORD(GetMessagePos()); - ScreenToClient(m_list.GetHwnd(), &hti.pt); - if (m_list.SubItemHitTest(&hti) == -1) - return; - - if (!(hti.flags & LVHT_ONITEMICON)) - return; - - bool bCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0; - if (!bCtrl) - if (IDYES != MessageBoxW(m_hwnd, TranslateT("Do you really want to remove it from ignore list?"), m_proto->m_tszUserName, MB_YESNO)) - return; - - CMStringW userId; - INT_PTR data = m_list.GetItemData(hti.iItem); - if (data == -1) { - wchar_t buf[100]; - m_list.GetItemText(hti.iItem, 0, buf, _countof(buf)); - userId = buf; - } - else userId = m_proto->GetUserId((MCONTACT)data); - - m_proto->SetPermitDeny(userId, true); - m_list.DeleteItem(hti.iItem); - } -}; - -void CIcqProto::OnRefreshEditIgnore(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq) -{ - JsonReply root(pReply); - if (root.error() != 200) - return; - - auto *pDlg = (CEditIgnoreListDlg*)pReq->pUserInfo; - pDlg->Refresh(root.data()); -} - -INT_PTR CIcqProto::EditIgnoreList(WPARAM, LPARAM) -{ - if (m_pdlgEditIgnore == nullptr) { - m_pdlgEditIgnore = new CEditIgnoreListDlg(this); - m_pdlgEditIgnore->Show(); - } - else SetForegroundWindow(m_pdlgEditIgnore->GetHwnd()); - - return 0; -} - -///////////////////////////////////////////////////////////////////////////////////////// - void CIcqProto::GetPermitDeny() { Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/preference/getPermitDeny", &CIcqProto::OnGetPermitDeny) << AIMSID(this)); @@ -186,10 +44,13 @@ void CIcqProto::ProcessPermissions(const JSONNode &ev) p->m_iApparentMode = ID_STATUS_ONLINE; } + m_bIgnoreListEmpty = true; for (auto &it : ev["ignores"]) { auto *p = FindContactByUIN(it.as_mstring()); - if (p) + if (p) { p->m_iApparentMode = ID_STATUS_OFFLINE; + m_bIgnoreListEmpty = false; + } } for (auto &it: m_arCache) { @@ -205,6 +66,9 @@ void CIcqProto::ProcessPermissions(const JSONNode &ev) void CIcqProto::SetPermitDeny(const CMStringW &userId, bool bAllow) { - Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/preference/setPermitDeny") - << AIMSID(this) << WCHAR_PARAM((bAllow) ? "pdIgnoreRemove" : "pdIgnore", userId)); + auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/preference/setPermitDeny") + << AIMSID(this) << WCHAR_PARAM((bAllow) ? "pdIgnoreRemove" : "pdIgnore", userId); + if (!m_bIgnoreListEmpty) + pReq << CHAR_PARAM("pdMode", "denySome"); + Push(pReq); } diff --git a/protocols/ICQ-WIM/src/main.cpp b/protocols/ICQ-WIM/src/main.cpp index 44422837ae..af0248292b 100644 --- a/protocols/ICQ-WIM/src/main.cpp +++ b/protocols/ICQ-WIM/src/main.cpp @@ -77,22 +77,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC ///////////////////////////////////////////////////////////////////////////////////////// -static int OnContactMenu(WPARAM hContact, LPARAM lParam) -{ - Menu_ShowItem(g_plugin.m_hmiRoot, false); - - CIcqProto *proto = CMPlugin::getInstance(hContact); - return proto ? proto->OnContactMenu(hContact, lParam) : 0; -} - -static INT_PTR ICQPermitDeny(WPARAM hContact, LPARAM, LPARAM bAllow) -{ - CIcqProto *proto = CMPlugin::getInstance(hContact); - if (proto) - proto->SetPermitDeny(proto->GetUserId(hContact), bAllow != 0); - return 0; -} - static int ModuleLoad(WPARAM, LPARAM) { g_bSecureIM = ServiceExists("SecureIM/IsContactSecured"); @@ -103,31 +87,6 @@ static int ModuleLoad(WPARAM, LPARAM) static int OnModulesLoaded(WPARAM, LPARAM) { ModuleLoad(0, 0); - - // init menus - CMenuItem mi(&g_plugin); - - SET_UID(mi, 0x9cd3a933, 0x3bd5, 0x4d1c, 0xbd, 0xf1, 0xa8, 0xf9, 0xbf, 0xf0, 0xd7, 0x28); - mi.position = 100000; - mi.name.a = "ICQ"; - mi.hIcolibItem = Skin_LoadProtoIcon(g_plugin.getModule(), ID_STATUS_ONLINE); - g_plugin.m_hmiRoot = Menu_AddContactMenuItem(&mi); - - mi.flags = CMIF_UNMOVABLE; - mi.root = g_plugin.m_hmiRoot; - mi.name.a = LPGEN("Ignore"); - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REVOKE); - mi.pszService = "ICQ/Ignore"; - g_plugin.m_hmiIgnore = Menu_AddContactMenuItem(&mi); - CreateServiceFunctionParam(mi.pszService, ICQPermitDeny, 0); - - mi.name.a = LPGEN("Remove Ignore"); - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_ADD); - mi.pszService = "ICQ/RemoveIgnore"; - g_plugin.m_hmiAllow = Menu_AddContactMenuItem(&mi); - CreateServiceFunctionParam(mi.pszService, ICQPermitDeny, 1); - - HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnContactMenu); return 0; } diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp index 279e8ce0b2..01bc53200d 100644 --- a/protocols/ICQ-WIM/src/poll.cpp +++ b/protocols/ICQ-WIM/src/poll.cpp @@ -139,7 +139,7 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) auto *pReq = new AsyncHttpRequest(CONN_RAPI, REQUEST_POST, ICQ_ROBUST_SERVER, &CIcqProto::OnGetChatInfo); JSONNode request, params; params.set_name("params"); params << WCHAR_PARAM("sn", wszId) << INT_PARAM("memberLimit", 100) << CHAR_PARAM("aimSid", m_aimsid); - request << CHAR_PARAM("method", "getChatInfo") << CHAR_PARAM("reqId", pReq->m_reqId) << CHAR_PARAM("authToken", m_szRToken) << INT_PARAM("clientId", m_iRClientId) << params; + request << CHAR_PARAM("method", "getChatInfo") << CHAR_PARAM("reqId", pReq->m_reqId) << params; pReq->m_szParam = ptrW(json_write(&request)); pReq->pUserInfo = si; Push(pReq); diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 06e67ee280..ea9e7f21f9 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -159,13 +159,6 @@ void CIcqProto::OnBuildProtoMenu() mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP); m_hUploadGroups = Menu_AddProtoMenuItem(&mi, m_szModuleName); - mi.pszService = "/EditIgnore"; - CreateProtoService(mi.pszService, &CIcqProto::EditIgnoreList); - mi.name.a = LPGEN("Edit ignore list"); - mi.position++; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS); - Menu_AddProtoMenuItem(&mi, m_szModuleName); - Menu_ShowItem(m_hUploadGroups, false); } @@ -201,19 +194,6 @@ INT_PTR CIcqProto::GotoInbox(WPARAM, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// -int CIcqProto::OnContactMenu(WPARAM hContact, LPARAM) -{ - Menu_ShowItem(g_plugin.m_hmiRoot, true); - Menu_ModifyItem(g_plugin.m_hmiRoot, nullptr, Skin_GetProtoIcon(GetContactProto(hContact), ID_STATUS_ONLINE)); - - bool bIgnorable = getDword(hContact, "ApparentMode") != ID_STATUS_OFFLINE; - Menu_ShowItem(g_plugin.m_hmiAllow, !bIgnorable); - Menu_ShowItem(g_plugin.m_hmiIgnore, bIgnorable); - return 0; -} - -///////////////////////////////////////////////////////////////////////////////////////// - void CIcqProto::MarkReadTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD) { CIcqProto *ppro = (CIcqProto*)id; @@ -225,8 +205,7 @@ void CIcqProto::MarkReadTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD) auto *pReq = new AsyncHttpRequest(CONN_RAPI, REQUEST_POST, ICQ_ROBUST_SERVER); JSONNode request, params; params.set_name("params"); params << WCHAR_PARAM("sn", ppro->GetUserId(pUser->m_hContact)) << INT64_PARAM("lastRead", ppro->getId(pUser->m_hContact, DB_KEY_LASTMSGID)); - request << CHAR_PARAM("method", "setDlgStateWim") << CHAR_PARAM("reqId", pReq->m_reqId) - << CHAR_PARAM("authToken", ppro->m_szRToken) << INT_PARAM("clientId", ppro->m_iRClientId) << params; + request << CHAR_PARAM("method", "setDlgStateWim") << CHAR_PARAM("reqId", pReq->m_reqId) << params; pReq->m_szParam = ptrW(json_write(&request)); ppro->Push(pReq); @@ -327,7 +306,7 @@ INT_PTR CIcqProto::GetCaps(int type, MCONTACT) switch (type) { case PFLAGNUM_1: nReturn = PF1_IM | PF1_AUTHREQ | PF1_BASICSEARCH | PF1_ADDSEARCHRES | /*PF1_SEARCHBYNAME | TODO */ - PF1_VISLIST | PF1_INVISLIST | PF1_MODEMSG | PF1_FILE | PF1_CONTACT | PF1_SERVERCLIST; + PF1_VISLIST | PF1_MODEMSG | PF1_FILE | PF1_CONTACT | PF1_SERVERCLIST; break; case PFLAGNUM_2: @@ -368,8 +347,7 @@ HANDLE CIcqProto::SearchBasic(const wchar_t *pszSearch) JSONNode request, params; params.set_name("params"); params << WCHAR_PARAM("keyword", pszSearch); - request << CHAR_PARAM("method", "search") << CHAR_PARAM("reqId", pReq->m_reqId) << CHAR_PARAM("authToken", m_szRToken) - << INT_PARAM("clientId", m_iRClientId) << params; + request << CHAR_PARAM("method", "search") << CHAR_PARAM("reqId", pReq->m_reqId) << params; pReq->m_szParam = ptrW(json_write(&request)); Push(pReq); return pReq; @@ -523,7 +501,12 @@ int CIcqProto::UserIsTyping(MCONTACT hContact, int type) //////////////////////////////////////////////////////////////////////////////////////// // PS_SetApparentMode - sets the visibility status -int CIcqProto::SetApparentMode(MCONTACT, int) +int CIcqProto::SetApparentMode(MCONTACT hContact, int iMode) { - return 1; // Failure + int oldMode = getWord(hContact, "ApparentMode"); + if (oldMode != iMode) { + setWord(hContact, "ApparentMode", iMode); + SetPermitDeny(GetUserId(hContact), iMode != ID_STATUS_OFFLINE); + } + return 0; } diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index b560335ce0..7461dcdd6c 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -133,7 +133,7 @@ struct IcqFileTransfer : public MZeroedObject void FillHeaders(AsyncHttpRequest *pReq) { pReq->AddHeader("Content-Type", "application/octet-stream"); - pReq->AddHeader("Content-Disposition", CMStringA(FORMAT, "attachment; filename=\"%s\"", T2Utf(m_wszShortName))); + pReq->AddHeader("Content-Disposition", CMStringA(FORMAT, "attachment; filename=\"%s\"", T2Utf(m_wszShortName).get())); DWORD dwPortion = pfts.currentFileSize - pfts.currentFileProgress; if (dwPortion > 1000000) @@ -209,7 +209,6 @@ class CIcqProto : public PROTO<CIcqProto> void OnLoginViaPhone(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnNormalizePhone(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnReceiveAvatar(NETLIBHTTPREQUEST*, AsyncHttpRequest*); - void OnRefreshEditIgnore(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnSearchResults(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnSendMessage(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnStartSession(NETLIBHTTPREQUEST*, AsyncHttpRequest*); @@ -246,6 +245,8 @@ class CIcqProto : public PROTO<CIcqProto> int m_unreadEmails = -1; CMStringA m_szMailBox; + bool m_bIgnoreListEmpty = true; + //////////////////////////////////////////////////////////////////////////////////////// // group chats @@ -302,7 +303,6 @@ class CIcqProto : public PROTO<CIcqProto> INT_PTR __cdecl SetAvatar(WPARAM, LPARAM); INT_PTR __cdecl CreateAccMgrUI(WPARAM, LPARAM); - INT_PTR __cdecl EditIgnoreList(WPARAM, LPARAM); INT_PTR __cdecl GetEmailCount(WPARAM, LPARAM); INT_PTR __cdecl GotoInbox(WPARAM, LPARAM); INT_PTR __cdecl UploadGroups(WPARAM, LPARAM); @@ -365,7 +365,6 @@ public: { return time(0) - m_iTimeShift; } - int __cdecl OnContactMenu(WPARAM, LPARAM); void SetPermitDeny(const CMStringW &userId, bool bAllow); }; @@ -373,8 +372,6 @@ struct CMPlugin : public ACCPROTOPLUGIN<CIcqProto> { CMPlugin(); - HGENMENU m_hmiRoot, m_hmiIgnore, m_hmiAllow; - int Load() override; int Unload() override; }; diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index e7add0cec7..8f4e7c621e 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -233,10 +233,11 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact) hex2binW(wszCap, cap, sizeof(cap)); if (!memcmp(cap, "MiNG", 4)) { // Miranda int v[4]; - swscanf(wszCap.c_str() + 16, L"%04x%04x%04x%04x", &v[0], &v[1], &v[2], &v[3]); - szVer.Format("Miranda NG %d.%d.%d.%d (ICQ %d.%d.%d.%d)", v[0], v[1], v[2], v[3], cap[4], cap[5], cap[6], cap[7]); - setString(hContact, "MirVer", szVer); - bVersionDetected = true; + if (4 == swscanf(wszCap.c_str() + 16, L"%04x%04x%04x%04x", &v[0], &v[1], &v[2], &v[3])) { + szVer.Format("Miranda NG %d.%d.%d.%d (ICQ %d.%d.%d.%d)", v[0], v[1], v[2], v[3], cap[4], cap[5], cap[6], cap[7]); + setString(hContact, "MirVer", szVer); + bVersionDetected = true; + } } else if (wszCap == _A2W(NG_CAP_SECUREIM)) { bSecureIM = bVersionDetected = true; @@ -397,9 +398,8 @@ bool CIcqProto::RefreshRobustToken() bool bRet = false; auto *tmp = new AsyncHttpRequest(CONN_RAPI, REQUEST_POST, ICQ_ROBUST_SERVER "/genToken"); - time_t ts = TS(); - tmp << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", ICQ_APP_ID) - << CHAR_PARAM("nonce", CMStringA(FORMAT, "%d-%d", ts, rand() % 10)) << INT_PARAM("ts", TS()); + int ts = TS(); + tmp << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", ICQ_APP_ID) << CHAR_PARAM("nonce", CMStringA(FORMAT, "%d-%d", ts, rand() % 10)) << INT_PARAM("ts", TS()); CalcHash(tmp); tmp->flags |= NLHRF_PERSISTENT; tmp->nlc = m_ConnPool[CONN_RAPI].s; @@ -488,8 +488,7 @@ void CIcqProto::RetrieveUserHistory(MCONTACT hContact, __int64 startMsgId, __int if (endMsgId != -1) params << INT64_PARAM("tillMsgId", endMsgId); params << INT_PARAM("count", 1000) << CHAR_PARAM("aimSid", m_aimsid) << CHAR_PARAM("patchVersion", "1") << CHAR_PARAM("language", "ru-ru"); - request << CHAR_PARAM("method", "getHistory") << CHAR_PARAM("reqId", pReq->m_reqId) << CHAR_PARAM("authToken", m_szRToken) - << INT_PARAM("clientId", m_iRClientId) << params; + request << CHAR_PARAM("method", "getHistory") << CHAR_PARAM("reqId", pReq->m_reqId) << params; pReq->m_szParam = ptrW(json_write(&request)); Push(pReq); } @@ -678,7 +677,7 @@ void CIcqProto::OnFileContinue(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pOld JSONNode bundle, contents; contents.set_name("captionedContent"); contents << WCHAR_PARAM("caption", pTransfer->m_wszDescr) << WCHAR_PARAM("url", wszUrl); bundle << CHAR_PARAM("mediaType", "text") << CHAR_PARAM("text", "") << contents; - CMStringW wszParts(FORMAT, L"[%s]", ptrW(json_write(&bundle))); + CMStringW wszParts(FORMAT, L"[%s]", ptrW(json_write(&bundle)).get()); if (!pTransfer->m_wszDescr.IsEmpty()) wszUrl += L" " + pTransfer->m_wszDescr; @@ -784,6 +783,13 @@ void CIcqProto::OnStartSession(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *) case 200: break; + case 451: + // session forcibly closed from site + delSetting(DB_KEY_ATOKEN); + delSetting(DB_KEY_SESSIONKEY); + CheckPassword(); + return; + case 401: if (root.detail() == 1002) { // session expired delSetting(DB_KEY_ATOKEN); |