Some new accessors for libtransmission...I don't see what harm these can do

This commit is contained in:
Mitchell Livingston 2006-08-12 00:38:26 +00:00
parent e6d81110d9
commit 2a36da8b60
6 changed files with 29 additions and 4 deletions

View File

@ -255,7 +255,7 @@
4DA6FDC4091141AD00450CB1 /* ResumeOn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeOn.png; path = macosx/Images/ResumeOn.png; sourceTree = "<group>"; };
4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = "<group>"; };
4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = "<group>"; };
4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = "<group>"; };
4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = "<group>"; };
4DDFDD21099A5D8E00189D81 /* UploadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = UploadBadge.png; path = macosx/Images/UploadBadge.png; sourceTree = "<group>"; };

View File

@ -295,6 +295,16 @@ uint64_t tr_peerDate( tr_peer_t * peer )
return peer->date;
}
/***********************************************************************
* tr_peerId
***********************************************************************
*
**********************************************************************/
uint8_t * tr_peerId( tr_peer_t * peer )
{
return & peer->id[0];
}
/***********************************************************************
* tr_peerHash
***********************************************************************

View File

@ -25,8 +25,6 @@
#ifndef TR_PEER_H
#define TR_PEER_H 1
typedef struct tr_peer_s tr_peer_t;
void tr_peerAddOld ( tr_torrent_t *, char *, int );
void tr_peerAddCompact ( tr_torrent_t *, struct in_addr, in_port_t );
tr_peer_t * tr_peerInit ( struct in_addr, in_port_t, int );
@ -35,6 +33,7 @@ void tr_peerDestroy ( tr_fd_t *, tr_peer_t * );
void tr_peerRem ( tr_torrent_t *, int );
int tr_peerRead ( tr_torrent_t *, tr_peer_t * );
uint64_t tr_peerDate ( tr_peer_t * );
uint8_t * tr_peerId ( tr_peer_t * );
uint8_t * tr_peerHash ( tr_peer_t * );
void tr_peerPulse ( tr_torrent_t * );
int tr_peerIsConnected ( tr_peer_t * );

View File

@ -405,6 +405,13 @@ int tr_getFinished( tr_torrent_t * tor )
return 0;
}
tr_peer_t * tr_getPeer( tr_torrent_t * tor, int peerNum)
{
if (peerNum < 0 || peerNum >= tor->peerCount)
return NULL;
return tor->peers[peerNum];
}
tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
{
tr_stat_t * s;

View File

@ -197,6 +197,15 @@ void tr_torrentStop( tr_torrent_t * );
**********************************************************************/
int tr_getFinished( tr_torrent_t * );
/***********************************************************************
* tr_getPeer
***********************************************************************
* Returns the peer at peerNum. Returns NULL if peerNum is not greater
* than 0 and less than peerCount.
**********************************************************************/
typedef struct tr_peer_s tr_peer_t;
tr_peer_t * tr_getPeer( tr_torrent_t *, int peerNum );
/***********************************************************************
* tr_torrentStat
***********************************************************************

View File

@ -1273,7 +1273,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
else
shouldBeOn = hour < offHour || hour >= onHour;
if ((!fSpeedLimitEnabled && shouldBeOn) || (fSpeedLimitEnabled && !shouldBeOn))
if (fSpeedLimitEnabled != shouldBeOn)
{
[self toggleSpeedLimit: nil];