summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-02 14:50:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-02 14:50:13 +0300
commit69dd602796a84509f922cb621416e92a340842b1 (patch)
tree76afb27b62d81fd255c3efbbfc81bf71a3e6f475 /protocols/JabberG
parent503e47ec741d4dd2df83798965c61b5b5391b1e4 (diff)
fixes #3363 (Jabber: добавить сообщение о том, что клиент собеседника не поддерживает звонки)
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_api.cpp1
-rw-r--r--protocols/JabberG/src/jabber_list.cpp10
-rw-r--r--protocols/JabberG/src/jabber_proto.h1
-rw-r--r--protocols/JabberG/src/jabber_voip.cpp15
4 files changed, 23 insertions, 4 deletions
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp
index 775102599e..70c94ead16 100644
--- a/protocols/JabberG/src/jabber_api.cpp
+++ b/protocols/JabberG/src/jabber_api.cpp
@@ -64,6 +64,7 @@ char* CJabberProto::GetBestResourceName(const char *jid)
{
if (jid == nullptr)
return nullptr;
+
const char *p = strchr(jid, '/');
if (p == nullptr) {
mir_cslock lck(m_csLists);
diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp
index da6cfb955d..12c56fc6cb 100644
--- a/protocols/JabberG/src/jabber_list.cpp
+++ b/protocols/JabberG/src/jabber_list.cpp
@@ -371,6 +371,16 @@ JABBER_RESOURCE_STATUS* JABBER_LIST_ITEM::getTemp()
return m_pItemResource;
}
+pResourceStatus CJabberProto::ListGetBestResource(const char *jid)
+{
+ mir_cslock lck(m_csLists);
+ JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, jid);
+ if (LI == nullptr)
+ return nullptr;
+
+ return pResourceStatus(LI->getBestResource());
+}
+
char* CJabberProto::ListGetBestClientResourceNamePtr(const char *jid)
{
mir_cslock lck(m_csLists);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index f10a4866ba..50415aef70 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -649,6 +649,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
int ListFindNext(JABBER_LIST list, int fromOffset);
pResourceStatus ListFindResource(JABBER_LIST list, const char *jid);
+ pResourceStatus ListGetBestResource(const char *jid);
bool ListAddResource(JABBER_LIST list, const char *jid, int status, const char *statusMessage, int priority = 0, const char *nick = nullptr);
void ListRemoveResource(JABBER_LIST list, const char *jid);
diff --git a/protocols/JabberG/src/jabber_voip.cpp b/protocols/JabberG/src/jabber_voip.cpp
index 27147af5f0..85d8ad3f12 100644
--- a/protocols/JabberG/src/jabber_voip.cpp
+++ b/protocols/JabberG/src/jabber_voip.cpp
@@ -484,12 +484,19 @@ bool CJabberProto::VOIPCallIinitiate(MCONTACT hContact)
if (!hasJingle())
return false;
- CMStringA jid(ptrA(getUStringA(hContact, "jid")));
+ CMStringA jid(getMStringA(hContact, "jid"));
if (jid.IsEmpty())
return false;
- ptrA szResource(GetBestResourceName(jid));
- if (szResource)
- jid = MakeJid(jid, szResource);
+
+ auto r = ListGetBestResource(jid);
+ if (r) {
+ if (!(r->m_pCaps->GetCaps() & JABBER_CAPS_JINGLE)) {
+ MsgPopup(hContact, TranslateT("Client's program does not support voice calls"), TranslateT("Error"));
+ return false;
+ }
+
+ jid = MakeJid(jid, r->m_szResourceName);
+ }
unsigned char tmp[16];
Utils_GetRandom(tmp, sizeof(tmp));