Changeset 4274


Ignore:
Timestamp:
Dec 22, 2007, 3:13:54 AM (14 years ago)
Author:
livings124
Message:

use the new ctor function in torrent creation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r4229 r4274  
    14671467    }
    14681468   
    1469     NSString * currentDownloadFolder;
     1469    //set libT settings
     1470    tr_ctor * ctor = tr_ctorNew(fLib);
     1471    tr_ctorSetPaused(ctor, TR_FORCE, YES);
     1472   
    14701473    tr_info info;
    14711474    int error;
    14721475    if (hashString)
    14731476    {
    1474         if (tr_torrentParseHash(fLib, [hashString UTF8String], NULL, &info) == TR_OK)
     1477        tr_ctorSetMetainfoFromHash(ctor, [hashString UTF8String]);
     1478        if (tr_torrentParseFromCtor(fLib, ctor, &info) == TR_OK)
    14751479        {
    1476             currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
     1480            NSString * currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
    14771481                                        ? fIncompleteFolder : fDownloadFolder;
    1478             fHandle = tr_torrentInitSaved(fLib, [hashString UTF8String], [currentDownloadFolder UTF8String], YES, &error);
     1482            tr_ctorSetDestination(ctor, TR_FORCE, [currentDownloadFolder UTF8String]);
     1483           
     1484            fHandle = tr_torrentNew(fLib, ctor, &error);
    14791485        }
    14801486        tr_metainfoFree(&info);
     
    14821488    if (!fHandle && path)
    14831489    {
    1484         if (tr_torrentParse(fLib, [path UTF8String], NULL, &info) == TR_OK)
     1490        tr_ctorSetMetainfoFromFile(ctor, [path UTF8String]);
     1491        if (tr_torrentParseFromCtor(fLib, ctor, &info) == TR_OK)
    14851492        {
    1486             currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
     1493            NSString * currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
    14871494                                        ? fIncompleteFolder : fDownloadFolder;
    1488             fHandle = tr_torrentInit(fLib, [path UTF8String], [currentDownloadFolder UTF8String], YES, &error);
     1495            tr_ctorSetDestination(ctor, TR_FORCE, [currentDownloadFolder UTF8String]);
     1496           
     1497            fHandle = tr_torrentNew(fLib, ctor, &error);
    14891498        }
    14901499        tr_metainfoFree(&info);
    14911500    }
     1501    tr_ctorFree(ctor);
     1502   
    14921503    if (!fHandle)
    14931504    {
Note: See TracChangeset for help on using the changeset viewer.