diff options
author | George Hazan <ghazan@miranda.im> | 2019-04-04 21:33:45 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-04-04 21:33:45 +0300 |
commit | c3e67a3b4e74a65c4a7d200ae6b24a386c2ad656 (patch) | |
tree | 56629d675871322b9fc140767a7c681f86f59675 /protocols/JabberG/src/jabber_rc.cpp | |
parent | 68ce4cecf6a93af18370383e504f09856cea5d5a (diff) |
the stronger type check the better, also some large static arrays considered useless
Diffstat (limited to 'protocols/JabberG/src/jabber_rc.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_rc.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 979d7b9a8d..1ea31f39a0 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -539,8 +539,8 @@ int CJabberProto::AdhocForwardHandler(const TiXmlElement*, CJabberIqInfo *pInfo, int nEventsSent = 0;
for (auto &hContact : AccContacts()) {
- ptrA tszJid(getUStringA(hContact, "jid"));
- if (tszJid == nullptr)
+ ptrA szJid(getUStringA(hContact, "jid"));
+ if (szJid == nullptr)
continue;
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
@@ -567,13 +567,12 @@ int CJabberProto::AdhocForwardHandler(const TiXmlElement*, CJabberIqInfo *pInfo, TiXmlElement *addressesNode = msg << XCHILDNS("addresses", JABBER_FEAT_EXT_ADDRESSING);
- char szOFrom[JABBER_MAX_JID_LEN];
+ CMStringA szOFrom;
size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob) + 1;
- if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource
- ptrW szOResource(mir_utf8decodeW((LPSTR)dbei.pBlob + cbBlob + 1));
- mir_snprintf(szOFrom, "%s/%s", tszJid, szOResource);
- }
- else strncpy_s(szOFrom, tszJid, _TRUNCATE);
+ if (cbBlob < dbei.cbBlob) // rest of message contains a sender's resource
+ szOFrom = MakeJid(szJid, (LPSTR)dbei.pBlob + cbBlob + 1);
+ else
+ szOFrom = szJid;
addressesNode << XCHILD("address") << XATTR("type", "ofrom") << XATTR("jid", szOFrom);
addressesNode << XCHILD("address") << XATTR("type", "oto") << XATTR("jid", m_ThreadInfo->fullJID);
|