Subversion Repositories tpanel

Rev

Rev 112 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 112 Rev 113
Line 31... Line 31...
31
#include "tfsfreader.h"
31
#include "tfsfreader.h"
32
#include "tsocket.h"
32
#include "tsocket.h"
33
#include "tconfig.h"
33
#include "tconfig.h"
34
#include "terror.h"
34
#include "terror.h"
35
#include "tresources.h"
35
#include "tresources.h"
-
 
36
#include "readtp4.h"
36
 
37
 
37
#define FTP_PORT    21
38
#define FTP_PORT    21
38
 
39
 
39
#define FTP_CMD_USER    0
40
#define FTP_CMD_USER    0
40
#define FTP_CMD_PASS    1
41
#define FTP_CMD_PASS    1
Line 83... Line 84...
83
    if (!param.empty())
84
    if (!param.empty())
84
        buf = mFtpCmds[cmd].cmd + "\r\n";
85
        buf = mFtpCmds[cmd].cmd + "\r\n";
85
    else
86
    else
86
        buf = mFtpCmds[cmd].cmd + " " + param + "\r\n";
87
        buf = mFtpCmds[cmd].cmd + " " + param + "\r\n";
87
 
88
 
88
    if (mFtp->send((char *)buf.c_str(), buf.length()) < 0)
89
    if (mFtp->send((char *)buf.c_str(), buf.length()) != TSocket::npos)
89
        return false;
90
        return false;
90
 
91
 
91
    char buffer[128];
92
    char buffer[128];
92
    size_t size;
93
    size_t size;
93
    memset(buffer, 0, sizeof(buffer));
94
    memset(buffer, 0, sizeof(buffer));
Line 281... Line 282...
281
 
282
 
282
    mFtp->close();
283
    mFtp->close();
283
    mFtpData->close();
284
    mFtpData->close();
284
    return true;
285
    return true;
285
}
286
}
-
 
287
 
-
 
288
bool TFsfReader::unpack(const string& fname, const string& path)
-
 
289
{
-
 
290
    DECL_TRACER("TFsfReader::unpack(const string& fname, const string& path)");
-
 
291
 
-
 
292
    if (fname.empty() || path.empty())
-
 
293
    {
-
 
294
        MSG_ERROR("Invalid parameters!");
-
 
295
        return false;
-
 
296
    }
-
 
297
 
-
 
298
    reader::ReadTP4 readtp4(fname, path);
-
 
299
    return readtp4.doRead();
-
 
300
}