summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-07-15 18:54:58 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-07-15 18:54:58 +0300
commit7dccdb7fa7acd2de4bd9dc6dd4558968c1be0599 (patch)
tree4707403e5df11f44f57b20fd49d59a70d1b85d51 /protocols/JabberG
parent1b9b12484af65dbae34eb59baea6c8dc9c685c28 (diff)
Jabber: no need to pass jid inside SendGetVcard()
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_events.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_misc.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.h2
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp2
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp12
7 files changed, 15 insertions, 13 deletions
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 5e0751fb10..936d97c7e9 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -149,7 +149,7 @@ void __cdecl CJabberProto::OnAddContactForever(MCONTACT hContact)
xPresence << XCHILD("nick", myNick) << XATTR("xmlns", JABBER_FEAT_NICK);
m_ThreadInfo->send(xPresence);
- SendGetVcard(jid);
+ SendGetVcard(hContact);
db_unset(hContact, "CList", "Hidden");
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 8c9ecf530e..d390839d85 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -207,12 +207,12 @@ void CJabberProto::OnLoggedIn()
ptrA szServerName(getStringA("LastLoggedServer"));
if (szServerName == nullptr || mir_strcmp(m_ThreadInfo->conn.server, szServerName)) {
setString("LastLoggedServer", m_ThreadInfo->conn.server);
- SendGetVcard();
+ SendGetVcard(0);
}
else {
time_t lastReadVcard(getDword("LastGetVcard"));
if (time(0) - lastReadVcard > 84600) // read vcard on login once a day
- SendGetVcard();
+ SendGetVcard(0);
}
m_pepServices.ResetPublishAll();
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index ec2f534740..9395d2b6a5 100755
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -88,7 +88,7 @@ MCONTACT CJabberProto::DBCreateContact(const char *jid, const char *nick, bool t
if (temporary)
db_set_b(hNewContact, "CList", "NotOnList", 1);
else
- SendGetVcard(szJid);
+ SendGetVcard(hNewContact);
if (JABBER_LIST_ITEM *pItem = ListAdd(LIST_ROSTER, jid, hNewContact))
pItem->bUseResource = strchr(szJid, '/') != nullptr;
@@ -192,7 +192,7 @@ void CJabberProto::ResolveTransportNicks(const char *jid)
*p = 0;
if (!mir_strcmp(jid, p + 1) && !mir_strcmp(dbJid, dbNick)) {
*p = '@';
- m_ThreadInfo->resolveID = SendGetVcard(dbJid);
+ m_ThreadInfo->resolveID = SendGetVcard(hContact);
m_ThreadInfo->resolveContact = hContact;
return;
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index d881a839b6..296f12e516 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -660,7 +660,7 @@ int CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/)
}
}
- SendGetVcard(jid);
+ SendGetVcard(hContact);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index bcd444066c..2065956f35 100755
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -818,7 +818,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
wchar_t m_szPhotoFileName[MAX_PATH];
void OnUserInfoInit_VCard(WPARAM, LPARAM);
- int SendGetVcard(const char *jid = nullptr);
+ int SendGetVcard(MCONTACT hContact);
void AppendVcardFromDB(TiXmlElement *n, char* tag, char* key);
void SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName);
void SaveVcardToDB(HWND hwndPage, int iPage);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 25e4a43315..64ea91d5b4 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1659,7 +1659,7 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info)
if (saved == nullptr || mir_strcmp(saved, txt)) {
debugLogA("Vcard was changed, let's read it");
setString(hContact, "VCardHash", txt);
- SendGetVcard(from);
+ SendGetVcard(hContact);
}
}
}
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index 75c916b176..8133b31746 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -31,17 +31,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
-int CJabberProto::SendGetVcard(const char *jid)
+int CJabberProto::SendGetVcard(MCONTACT hContact)
{
if (!m_bJabberOnline) return 0;
- if (jid == nullptr) {
+ CMStringA jid;
+ if (hContact == 0) {
jid = m_szJabberJID;
setDword("LastGetVcard", time(0));
}
else {
- char szBareJid[JABBER_MAX_JID_LEN];
- jid = JabberStripJid(jid, szBareJid, sizeof(szBareJid));
+ jid = getMStringA(hContact, "jid");
+ if (jid.IsEmpty())
+ return -1;
}
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultGetVcard, JABBER_IQ_TYPE_GET, jid);
@@ -1217,5 +1219,5 @@ void CJabberProto::OnUserInfoInit_VCard(WPARAM wParam, LPARAM)
odp.szTab.w = LPGENW("Note");
g_plugin.addUserInfo(wParam, &odp);
- SendGetVcard();
+ SendGetVcard(0);
}