summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/JabberG/src/jabber_api.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.cpp30
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp4
-rw-r--r--protocols/JabberG/src/jabber_notes.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp14
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.h15
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_userinfo.cpp2
8 files changed, 35 insertions, 38 deletions
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp
index ea3628328c..df3d97a563 100644
--- a/protocols/JabberG/src/jabber_api.cpp
+++ b/protocols/JabberG/src/jabber_api.cpp
@@ -318,7 +318,7 @@ int CJabberProto::RemoveFeatures(LPCTSTR szFeatures)
LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid)
{
- JabberCapsBits jcb = GetResourceCapabilites(jid, true);
+ JabberCapsBits jcb = GetResourceCapabilities(jid);
if (jcb & JABBER_RESOURCE_CAPS_ERROR)
return nullptr;
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index baf87bfce2..801d8dacd7 100755
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -119,7 +119,7 @@ void CJabberProto::AddDefaultCaps()
void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
{
- pResourceStatus r(ResourceInfoFromJID(pInfo->GetFrom()));
+ pResourceStatus r((JABBER_RESOURCE_STATUS*)pInfo->GetUserData());
HXML query = pInfo->GetChildNode();
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT && query) {
@@ -196,7 +196,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
}
}
-JabberCapsBits CJabberProto::GetTotalJidCapabilites(const wchar_t *jid)
+JabberCapsBits CJabberProto::GetTotalJidCapabilities(const wchar_t *jid)
{
if (jid == nullptr)
return JABBER_RESOURCE_CAPS_NONE;
@@ -212,7 +212,8 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const wchar_t *jid)
// get bare jid info only if where is no resources
if (!item || (item && !item->arResources.getCount())) {
- jcbToReturn = GetResourceCapabilites(szBareJid, false);
+ pResourceStatus r(ResourceInfoFromJID(szBareJid));
+ jcbToReturn = GetResourceCapabilities(szBareJid, r);
if (jcbToReturn & JABBER_RESOURCE_CAPS_ERROR)
jcbToReturn = JABBER_RESOURCE_CAPS_NONE;
}
@@ -221,7 +222,8 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const wchar_t *jid)
for (int i = 0; i < item->arResources.getCount(); i++) {
wchar_t szFullJid[JABBER_MAX_JID_LEN];
mir_snwprintf(szFullJid, L"%s/%s", szBareJid, item->arResources[i]->m_tszResourceName);
- JabberCapsBits jcb = GetResourceCapabilites(szFullJid, false);
+ pResourceStatus r(item->arResources[i]);
+ JabberCapsBits jcb = GetResourceCapabilities(szFullJid, r);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
jcbToReturn |= jcb;
}
@@ -229,15 +231,17 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const wchar_t *jid)
return jcbToReturn;
}
-JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, bool appendBestResource)
+JabberCapsBits CJabberProto::GetResourceCapabilities(const wchar_t *jid)
{
wchar_t fullJid[JABBER_MAX_JID_LEN];
- if (appendBestResource)
- GetClientJID(jid, fullJid, _countof(fullJid));
- else
- wcsncpy_s(fullJid, jid, _TRUNCATE);
+ GetClientJID(jid, fullJid, _countof(fullJid));
pResourceStatus r(ResourceInfoFromJID(fullJid));
+ return GetResourceCapabilities(fullJid, r);
+}
+
+JabberCapsBits CJabberProto::GetResourceCapabilities(const wchar_t *jid, pResourceStatus &r)
+{
if (r == nullptr)
return JABBER_RESOURCE_CAPS_ERROR;
@@ -253,7 +257,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, bool app
if (jcbMainCaps == JABBER_RESOURCE_CAPS_UNINIT) {
// send disco#info query
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE, -1, r);
pInfo->SetTimeout(JABBER_RESOURCE_CAPS_QUERY_TIMEOUT);
pCaps->SetCaps(JABBER_RESOURCE_CAPS_IN_PROGRESS, pInfo->GetIqId());
r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
@@ -299,7 +303,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, bool app
return r->m_jcbCachedCaps;
case 0:
- RequestOldCapsInfo(r, fullJid);
+ RequestOldCapsInfo(r, jid);
break;
}
return JABBER_RESOURCE_CAPS_IN_PROGRESS;
@@ -307,7 +311,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, bool app
void CJabberProto::RequestOldCapsInfo(pResourceStatus &r, const wchar_t *fullJid)
{
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE, -1, r);
pInfo->SetTimeout(JABBER_RESOURCE_CAPS_QUERY_TIMEOUT);
r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
@@ -546,7 +550,7 @@ CJabberClientPartialCaps* CJabberClientCapsManager::SetClientCaps(const wchar_t
CJabberClientPartialCaps *res = pClient->SetPartialCaps(szHash, szVer, jcbCaps, nIqId);
lck.unlock();
- ppro->debugLogW(L"CAPS: set caps %I64x for: %s, %s", jcbCaps, szNode, szVer);
+ ppro->debugLogW(L"CAPS: set caps %I64x for: %s#%s => [%s]", jcbCaps, szHash, szNode, szVer);
return res;
}
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 7b1e6f86c4..c37e63b50a 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -410,7 +410,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
if (jid == nullptr)
return 0;
- JabberCapsBits jcb = GetTotalJidCapabilites(jid);
+ JabberCapsBits jcb = GetTotalJidCapabilities(jid);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == nullptr)
return 0;
@@ -971,7 +971,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
if (r && r->m_bMessageSessionActive) {
r->m_bMessageSessionActive = FALSE;
- if (GetResourceCapabilites(jid, true) & JABBER_CAPS_CHATSTATES)
+ if (GetResourceCapabilities(jid) & JABBER_CAPS_CHATSTATES)
m_ThreadInfo->send(XmlNode(L"message") << XATTR(L"to", jid) << XATTR(L"type", L"chat") << XATTRID(SerialNext()) << XCHILDNS(L"gone", JABBER_FEAT_CHATSTATES));
}
}
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp
index 30dc16426d..4467b392f7 100644
--- a/protocols/JabberG/src/jabber_notes.cpp
+++ b/protocols/JabberG/src/jabber_notes.cpp
@@ -730,7 +730,7 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok)
mir_snwprintf(buf, L"Incoming note: %s\n\n%s\nTags: %s",
pNote->GetTitle(), pNote->GetText(), pNote->GetTagsStr());
- JabberCapsBits jcb = GetResourceCapabilites(pNote->GetFrom(), true);
+ JabberCapsBits jcb = GetResourceCapabilities(pNote->GetFrom());
if (jcb & JABBER_RESOURCE_CAPS_ERROR)
jcb = JABBER_RESOURCE_CAPS_NONE;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index e6a7ab5ba3..47823f8003 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -540,7 +540,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact)
case PFLAG_MAXCONTACTSPERPACKET:
wchar_t szClientJid[JABBER_MAX_JID_LEN];
if (GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
- JabberCapsBits jcb = GetResourceCapabilites(szClientJid, true);
+ JabberCapsBits jcb = GetResourceCapabilities(szClientJid);
return ((~jcb & JABBER_CAPS_ROSTER_EXCHANGE) ? 0 : 50);
}
}
@@ -598,7 +598,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
mir_snwprintf(tmp, L"%s/%s", szBareJid, r->m_tszResourceName);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
- XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
+ XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT, -1, r));
iq5 << XQUERY(JABBER_FEAT_DISCO_INFO);
m_ThreadInfo->send(iq5);
}
@@ -768,7 +768,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC
if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
- JabberCapsBits jcb = GetResourceCapabilites(szClientJid, true);
+ JabberCapsBits jcb = GetResourceCapabilities(szClientJid);
if (~jcb & JABBER_CAPS_ROSTER_EXCHANGE)
return 0;
@@ -809,10 +809,10 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri
if (item->ft != nullptr)
return 0;
- JabberCapsBits jcb = GetResourceCapabilites(item->jid, true);
+ JabberCapsBits jcb = GetResourceCapabilities(item->jid);
if (jcb == JABBER_RESOURCE_CAPS_IN_PROGRESS) {
Sleep(600);
- jcb = GetResourceCapabilites(item->jid, true);
+ jcb = GetResourceCapabilities(item->jid);
}
// fix for very smart clients, like gajim
@@ -972,7 +972,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const c
if (r)
r->m_bMessageSessionActive = true;
- JabberCapsBits jcb = GetResourceCapabilites(szClientJid, true);
+ JabberCapsBits jcb = GetResourceCapabilities(szClientJid);
if (jcb & JABBER_RESOURCE_CAPS_ERROR)
jcb = JABBER_RESOURCE_CAPS_NONE;
@@ -1226,7 +1226,7 @@ int __cdecl CJabberProto::UserIsTyping(MCONTACT hContact, int type)
if (item == nullptr)
return 0;
- JabberCapsBits jcb = GetResourceCapabilites(szClientJid, true);
+ JabberCapsBits jcb = GetResourceCapabilities(szClientJid);
if (jcb & JABBER_RESOURCE_CAPS_ERROR)
jcb = JABBER_RESOURCE_CAPS_NONE;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index ea113f5b3a..963a385232 100755
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -314,8 +314,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void RequestOldCapsInfo(pResourceStatus &r, const wchar_t *fullJid);
void GetCachedCaps(const wchar_t *szNode, const wchar_t *szVer, class pResourceStatus &r);
- JabberCapsBits GetTotalJidCapabilites(const wchar_t *jid);
- JabberCapsBits GetResourceCapabilites(const wchar_t *jid, bool appendBestResource);
+ JabberCapsBits GetTotalJidCapabilities(const wchar_t *jid);
+ JabberCapsBits GetResourceCapabilities(const wchar_t *jid);
+ JabberCapsBits GetResourceCapabilities(const wchar_t *jid, pResourceStatus &r);
//---- jabber_captcha.cpp ------------------------------------------------------------
@@ -329,10 +330,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus &user, TJabberGcLogInfoType type);
void GcQuit(JABBER_LIST_ITEM* jid, int code, HXML reason);
- void FilterList(HWND hwndList);
- void ResetListOptions(HWND hwndList);
- void InviteUser(wchar_t *room, wchar_t *pUser, wchar_t *text);
-
void AdminSet(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal);
void AdminGet(const wchar_t *to, const wchar_t *ns, const wchar_t *var, const wchar_t *varVal, JABBER_IQ_HANDLER foo);
void AdminSetReason(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal, const wchar_t *rsn);
@@ -341,6 +338,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* jid);
//---- jabber_omemo.cpp --------------------------------------------------------------
+
void OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime);
void OmemoPutMessageToOutgoingQueue(MCONTACT hContact, int, const char* pszSrc);
void OmemoPutMessageToIncommingQueue(HXML node, LPCTSTR jid, time_t msgTime);
@@ -379,7 +377,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo *pInfo);
- void OnIqResultServiceDiscoveryRoot(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInfo *pInfo);
BOOL SendInfoRequest(CJabberSDNode *pNode, HXML parent);
BOOL SendBothRequests(CJabberSDNode *pNode, HXML parent);
@@ -389,8 +386,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
BOOL SyncTree(HTREELISTITEM hIndex, CJabberSDNode *pNode);
void ServiceDiscoveryShowMenu(CJabberSDNode *node, HTREELISTITEM hItem, POINT pt);
- int SetupServiceDiscoveryDlg(wchar_t* jid);
-
void OnIqResultCapsDiscoInfo(HXML iqNode, CJabberIqInfo *pInfo);
void RegisterAgent(HWND hwndDlg, wchar_t* jid);
@@ -400,8 +395,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
int FileReceiveParse(filetransfer *ft, char* buffer, int datalen);
int FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, int datalen);
- void UpdateChatUserStatus(wchar_t* chat_jid, wchar_t* jid, wchar_t* nick, int role, int affil, int status, BOOL update_nick);
-
void GroupchatJoinRoomByJid(HWND hwndParent, wchar_t *jid);
void RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *oldNick, HXML itemNode);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index e8e0e2c381..07f2b0209a 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1256,7 +1256,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_MESSAGE_EVENTS)) {
// set events support only if we discovered caps and if events not already set
- JabberCapsBits jcbCaps = GetResourceCapabilites(from, true);
+ JabberCapsBits jcbCaps = GetResourceCapabilities(from);
if (jcbCaps & JABBER_RESOURCE_CAPS_ERROR)
jcbCaps = JABBER_RESOURCE_CAPS_NONE;
// FIXME: disabled due to expired XEP-0022 and problems with bombus delivery checks
@@ -1473,7 +1473,7 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node, pResourceStatus &r)
if (r->m_pCaps == nullptr) {
r->m_pCaps = m_clientCapsManager.SetClientCaps(szNode, szVer, L"", JABBER_RESOURCE_CAPS_UNINIT);
- GetResourceCapabilites(from, false);
+ GetResourceCapabilities(from, r);
}
}
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index a9e09aee42..33dff7e34f 100755
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -275,7 +275,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
// caps
mir_snwprintf(buf, L"%s/%s", item->jid, r->m_tszResourceName);
- JabberCapsBits jcb = ppro->GetResourceCapabilites(buf, TRUE);
+ JabberCapsBits jcb = ppro->GetResourceCapabilities(buf, r);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR)) {
HTREEITEM htiCaps = sttFillInfoLine(hwndTree, htiResource, ppro->LoadIconEx("main"), nullptr, TranslateT("Client capabilities"), sttInfoLineId(resource, INFOLINE_CAPS));