summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_ft.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-19 15:21:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-19 19:24:17 +0300
commitfc8f2a3b692878aa581bf3fcd5c1c3c2295bbcb5 (patch)
tree17ed9d45de9d7f293578150081b5e7e4617290eb /protocols/JabberG/src/jabber_ft.cpp
parentc9e483e0fb1566d210530339d13a0e6e91260200 (diff)
Jabber:
- XmlGetChildText / XmlGetChildInt - new handy helpers for tinyxml2; - Unicode logging replaced with ANSI when appropriate; - JabberErrorMsg rewritten to be more useful
Diffstat (limited to 'protocols/JabberG/src/jabber_ft.cpp')
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 8095a97b65..515219b8fb 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -187,7 +187,7 @@ BOOL CJabberProto::FtSend(HNETLIBCONN hConn, filetransfer *ft)
debugLogW(L"Sending [%s]", ft->std.pszFiles.w[ft->std.currentFileNumber]);
_wstat64(ft->std.pszFiles.w[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
if ((fd = _wopen(ft->std.pszFiles.w[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) {
- debugLogW(L"File cannot be opened");
+ debugLogA("File cannot be opened");
return FALSE;
}
@@ -319,12 +319,10 @@ void CJabberProto::FtHandleSiRequest(const TiXmlElement *iqNode)
if (!bIbbOnly) {
for (auto *it : TiXmlFilter(fieldNode, "option")) {
- if (auto *n = it->FirstChildElement("value")) {
- if (!mir_strcmp(n->GetText(), JABBER_FEAT_BYTESTREAMS)) {
- optionNode = it;
- ftType = FT_BYTESTREAM;
- break;
- }
+ if (!mir_strcmp(XmlGetChildText(it, "value"), JABBER_FEAT_BYTESTREAMS)) {
+ optionNode = it;
+ ftType = FT_BYTESTREAM;
+ break;
}
}
}
@@ -332,12 +330,10 @@ void CJabberProto::FtHandleSiRequest(const TiXmlElement *iqNode)
// try IBB only if bytestreams support not found or BsOnlyIBB flag exists
if (bIbbOnly || !optionNode) {
for (auto *it : TiXmlFilter(fieldNode, "option")) {
- if (auto *n = it->FirstChildElement("value")) {
- if (!mir_strcmp(n->GetText(), JABBER_FEAT_IBB)) {
- optionNode = it;
- ftType = FT_IBB;
- break;
- }
+ if (!mir_strcmp(XmlGetChildText(it, "value"), JABBER_FEAT_IBB)) {
+ optionNode = it;
+ ftType = FT_IBB;
+ break;
}
}
}
@@ -355,7 +351,7 @@ void CJabberProto::FtHandleSiRequest(const TiXmlElement *iqNode)
ft->std.szCurrentFile.w = mir_utf8decodeW(filename);
ft->std.totalBytes = ft->std.currentFileSize = filesize;
- CMStringW wszDescr;
+ Utf2T wszDescr(XmlGetChildText(fileNode, "desc"));
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
@@ -363,10 +359,7 @@ void CJabberProto::FtHandleSiRequest(const TiXmlElement *iqNode)
pre.timestamp = time(0);
pre.files.w = (wchar_t**)&filename;
pre.lParam = (LPARAM)ft;
- if (auto *n = fileNode->FirstChildElement("desc"))
- wszDescr = Utf2T(n->GetText());
- pre.descr.w = wszDescr.GetBuffer();
-
+ pre.descr.w = wszDescr;
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
}