summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/ICQ-WIM/src/ignore.cpp12
-rw-r--r--protocols/ICQ-WIM/src/proto.h4
-rw-r--r--protocols/ICQ-WIM/src/server.cpp18
3 files changed, 25 insertions, 9 deletions
diff --git a/protocols/ICQ-WIM/src/ignore.cpp b/protocols/ICQ-WIM/src/ignore.cpp
index ae7de463b4..53edac0c08 100644
--- a/protocols/ICQ-WIM/src/ignore.cpp
+++ b/protocols/ICQ-WIM/src/ignore.cpp
@@ -44,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) {
@@ -63,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/proto.h b/protocols/ICQ-WIM/src/proto.h
index 49943f39cc..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)
@@ -245,6 +245,8 @@ class CIcqProto : public PROTO<CIcqProto>
int m_unreadEmails = -1;
CMStringA m_szMailBox;
+ bool m_bIgnoreListEmpty = true;
+
////////////////////////////////////////////////////////////////////////////////////////
// group chats
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index e39467813e..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;
@@ -676,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;
@@ -782,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);