summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber_file.cpp23
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp7
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp15
-rwxr-xr-xprotocols/JabberG/src/stdafx.h2
4 files changed, 19 insertions, 28 deletions
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index fa0e5c98ac..69dc1778df 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -113,12 +113,12 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen)
}
else { // FT_INITIALIZING
if (str[0] == '\0') {
- wchar_t *s;
- if ((s = wcsrchr(ft->httpPath, '/')) != nullptr)
+ char *s;
+ if ((s = strrchr(ft->httpPath, '/')) != nullptr)
s++;
else
s = ft->httpPath;
- ft->std.szCurrentFile.w = mir_wstrdup(s);
+ ft->std.szCurrentFile.w = mir_utf8decodeW(s);
JabberHttpUrlDecode(ft->std.szCurrentFile.w);
if (ft->create() == -1) {
ft->state = FT_ERROR;
@@ -270,8 +270,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
for (int i = 0; i < ft->std.totalFiles && ft->state != FT_ERROR && ft->state != FT_DENIED; i++) {
ft->std.currentFileNumber = i;
ft->state = FT_CONNECTING;
- if (ft->httpPath) mir_free(ft->httpPath);
- ft->httpPath = nullptr;
+ replaceStr(ft->httpPath, nullptr);
wchar_t *p;
if ((p = wcschr(ft->std.pszFiles.w[i], '\\')) != nullptr)
@@ -366,8 +365,8 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i
for (t = str + 4; *t != '\0' && *t != ' '; t++);
*t = '\0';
for (t = str + 4; *t != '\0' && *t == '/'; t++);
- ft->httpPath = mir_a2u(t);
- JabberHttpUrlDecode(ft->httpPath);
+ ft->httpPath = mir_strdup(t);
+ mir_urlDecode(ft->httpPath);
ft->state = FT_INITIALIZING;
debugLogA("Change to FT_INITIALIZING");
}
@@ -386,11 +385,11 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i
else
t = ft->std.pszFiles.w[currentFile];
- if (ft->httpPath == nullptr || mir_wstrcmp(ft->httpPath, t)) {
+ if (ft->httpPath == nullptr || mir_strcmp(ft->httpPath, T2Utf(t))) {
if (ft->httpPath == nullptr)
debugLogA("Requested file name does not matched (httpPath == nullptr)");
else
- debugLogW(L"Requested file name does not matched ('%s' vs. '%s')", ft->httpPath, t);
+ debugLogA("Requested file name does not match ('%s' vs. '%S')", ft->httpPath, t);
ft->state = FT_ERROR;
break;
}
@@ -399,8 +398,7 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i
if ((fileId = _wopen(ft->std.pszFiles.w[currentFile], _O_BINARY | _O_RDONLY)) < 0) {
debugLogA("File cannot be opened");
ft->state = FT_ERROR;
- mir_free(ft->httpPath);
- ft->httpPath = nullptr;
+ replaceStr(ft->httpPath, nullptr);
break;
}
@@ -425,8 +423,7 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i
if (ft->state != FT_ERROR)
ft->state = FT_DONE;
debugLogA("Finishing this file...");
- mir_free(ft->httpPath);
- ft->httpPath = nullptr;
+ replaceStr(ft->httpPath, nullptr);
break;
} }
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 515219b8fb..4ebbcf9088 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -351,15 +351,12 @@ void CJabberProto::FtHandleSiRequest(const TiXmlElement *iqNode)
ft->std.szCurrentFile.w = mir_utf8decodeW(filename);
ft->std.totalBytes = ft->std.currentFileSize = filesize;
- Utf2T wszDescr(XmlGetChildText(fileNode, "desc"));
-
PROTORECVFILE pre = { 0 };
- pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
pre.timestamp = time(0);
- pre.files.w = (wchar_t**)&filename;
+ pre.files.a = &filename;
pre.lParam = (LPARAM)ft;
- pre.descr.w = wszDescr;
+ pre.descr.a = XmlGetChildText(fileNode, "desc");
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index e1c3bd9e49..d87b795700 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -343,6 +343,8 @@ BOOL CJabberProto::OnIqRequestOOB(const TiXmlElement*, CJabberIqInfo *pInfo)
}
ft->httpHostName = mir_strdup(text);
}
+ ft->httpPath = mir_strdup(q);
+ mir_urlDecode(ft->httpPath);
}
}
@@ -355,24 +357,19 @@ BOOL CJabberProto::OnIqRequestOOB(const TiXmlElement*, CJabberIqInfo *pInfo)
const char *desc = XmlGetChildText(pInfo->GetChildNode(), "desc");
debugLogA("description = %s", desc);
- wchar_t *str2;
- if ((str2 = wcsrchr(ft->httpPath, '/')) != nullptr)
+ const char *str2;
+ if ((str2 = strrchr(ft->httpPath, '/')) != nullptr)
str2++;
else
str2 = ft->httpPath;
- str2 = mir_wstrdup(str2);
- JabberHttpUrlDecode(str2);
- Utf2T wszDescr(desc);
PROTORECVFILE pre;
- pre.dwFlags = PRFF_UNICODE;
pre.timestamp = time(0);
- pre.descr.w = wszDescr;
- pre.files.w = &str2;
+ pre.descr.a = desc;
+ pre.files.a = &str2;
pre.fileCount = 1;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
- mir_free(str2);
}
else { // reject
XmlNodeIq iq("error", pInfo);
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index 1700c5f231..40b4963de4 100755
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -462,7 +462,7 @@ struct filetransfer
// Used by file receiving only
char* httpHostName;
WORD httpPort;
- wchar_t *httpPath;
+ char* httpPath;
unsigned __int64 dwExpectedRecvFileSize;
// Used by file sending only