summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-05-30 09:19:33 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-05-30 09:19:33 +0000
commit868edd81fb052448f102ec7e606c6939c54a4f9a (patch)
treeb4986d47aee77dc2a06235ab26455b756d702303 /protocols
parent42e4b4f3f694f788d8c3273b23bb79e7e0809e19 (diff)
code cleaning for YAHOO file receiving
git-svn-id: http://svn.miranda-ng.org/main/trunk@16886 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Yahoo/src/file_transfer.cpp44
1 files changed, 14 insertions, 30 deletions
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp
index 058086921e..aac588cf74 100644
--- a/protocols/Yahoo/src/file_transfer.cpp
+++ b/protocols/Yahoo/src/file_transfer.cpp
@@ -477,18 +477,14 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url,
if (fname != NULL)
mir_strncpy(fn, fname, 1024);
else {
- char *start, *end;
-
/* based on how gaim does this */
- start = (char*)strrchr(url, '/');
+ char *start = (char*)strrchr(url, '/');
if (start)
start++;
- end = (char*)strrchr(url, '?');
-
- if (start && *start && end) {
+ char *end = (char*)strrchr(url, '?');
+ if (start && *start && end)
mir_strncpy(fn, start, end - start + 1);
- }
else
mir_strcpy(fn, "filename.ext");
}
@@ -506,26 +502,20 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url,
return;
}
- TCHAR* ptszFileName = mir_a2t(fn);
+ char *szFileName = fn;
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = mir_a2t(msg);
- pre.files.t = &ptszFileName;
+ pre.descr.a = (char*)msg;
+ pre.files.a = &szFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
-
- mir_free(pre.descr.t);
- mir_free(ptszFileName);
}
void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_token, int y7, YList* files)
{
- char fn[4096];
- int fc = 0;
-
LOG(("[ext_yahoo_got_files] ident:%s, who: %s, ftoken: %s ", me, who, ft_token == NULL ? "NULL" : ft_token));
MCONTACT hContact = getbuddyH(who);
@@ -538,26 +528,20 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_
return;
}
- fn[0] = '\0';
- for (YList *f = files; f; f = y_list_next(f)) {
- char z[1024];
- yahoo_file_info *fi = (yahoo_file_info *) f->data;
+ int fc = 0;
+ LIST<char> arNames(1);
- mir_snprintf(z, "%s (%lu)\r\n", fi->filename, fi->filesize);
- mir_strcat(fn, z);
+ for (YList *f = files; f; f = y_list_next(f)) {
+ yahoo_file_info *fi = (yahoo_file_info *)f->data;
+ arNames.insert(fi->filename);
fc++;
}
- if (fc > 1) {
- /* multiple files */
-
- }
-
PROTORECVFILET pre = { 0 };
- pre.fileCount = 1;
+ pre.fileCount = fc;
pre.timestamp = time(NULL);
pre.descr.a = "";
- pre.files.a = (char**)&fn;
+ pre.files.a = arNames.getArray();
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->hContact, &pre);
}
@@ -636,7 +620,7 @@ void CYahooProto::ext_ft7_send_file(const char *me, const char *who, const char*
return;
}
- _sfs *s = (_sfs *) malloc(sizeof(_sfs));
+ _sfs *s = (_sfs *)malloc(sizeof(_sfs));
s->me = strdup(me);
s->token = strdup(token);