const double dn = tr_sessionGetRawSpeed_KBps (mySession, TR_DOWN);
if (up>0 || dn>0)
- sd_notifyf (0, "STATUS=Uploading %.2f KBps, Downloading %.2f KBps.\n", up, dn);
+ sd_notifyf (0, "STATUS=Uploading %.2f KBps, Downloading %.2f KBps.\n", up, dn);
else
- sd_notify (0, "STATUS=Idle.\n");
+ sd_notify (0, "STATUS=Idle.\n");
}
static void
exit (1);
}
- sd_notifyf (0, "MAINPID=%d\n", (int)getpid());
+ sd_notifyf (0, "MAINPID=%d\n", (int)getpid());
/* setup event state */
ev_base = event_base_new();
if (event_base_dispatch(ev_base) == -1)
{
tr_logAddError("Failed to launch daemon event loop: %s", tr_strerror(errno));
- goto cleanup;
+ goto cleanup;
}
cleanup:
if (UseSSL)
{
curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0); /* do not verify subject/hostname */
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0); /* since most certs will be self-signed, do not verify against CA */
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0); /* since most certs will be self-signed, do not verify against CA */
}
if (sessionId) {
char * h = tr_strdup_printf ("%s: %s", TR_RPC_SESSION_ID_HEADER, sessionId);
icon_DATA = transmission.png
icondir = $(datadir)/pixmaps
-UI_FILES = transmission-ui.xml
+UI_FILES = transmission-ui.xml
-transmission-resources.c: transmission.gresource.xml $(UI_FILES)
+transmission-resources.c: transmission.gresource.xml $(UI_FILES)
$(AM_V_GEN)glib-compile-resources --target=$@ --sourcedir=$(srcdir) \
- --generate-source --c-name transmission $<
+ --generate-source --c-name transmission $<
-transmission-resources.h: transmission.gresource.xml $(UI_FILES)
+transmission-resources.h: transmission.gresource.xml $(UI_FILES)
$(AM_V_GEN)glib-compile-resources --target=$@ --sourcedir=$(srcdir) \
- --generate-header --c-name transmission $<
+ --generate-header --c-name transmission $<
CLEANFILES += \
transmission-resources.c \
#define SHOW_LICENSE
static const char * LICENSE =
"Copyright 2005-2014. All code is copyrighted by the respective authors.\n"
- "\n"
+ "\n"
"Transmission can be redistributed and/or modified under the terms of the "
"GNU GPL versions 2 or 3 or by any future license endorsed by Mnemosyne LLC.\n"
"\n"
data->type = type;
data->torrent_id = tr_torrentId (tor);
gdk_threads_add_idle (on_rpc_changed_idle, data);
-
+
return TR_RPC_NOREMOVE;
}
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Categories=Network;FileTransfer;P2P;GTK;
X-Ubuntu-Gettext-Domain=transmission
-X-AppInstall-Keywords=torrent
+X-AppInstall-Keywords=torrent
Actions=Pause;Minimize;
[Desktop Action Pause]
\
return q; \
}
-#endif
+#endif
/* macro to shut up "unused parameter" warnings */
if (!response->did_connect)
{
on_scrape_error (session, tier, _("Could not connect to tracker"));
- }
+ }
else if (response->did_timeout)
{
on_scrape_error (session, tier, _("Tracker did not respond"));
tr_torrent * tor;
tr_ctor * ctor;
- /*
+ /*
1048576 files-filled-with-zeroes/1048576
4096 files-filled-with-zeroes/4096
512 files-filled-with-zeroes/512
assert (path != NULL);
err = errno;
assert (tr_sys_path_exists (path, NULL));
- errno = err;
+ errno = err;
tr_free (path);
}
seconds = tv.tv_sec;
tr_localtime_r (&seconds, &now_tm);
- strftime (tmp, sizeof (tmp), "%Y-%m-%d %H:%M:%S.%%03d %Z", &now_tm);
+ strftime (tmp, sizeof (tmp), "%Y-%m-%d %H:%M:%S.%%03d %Z", &now_tm);
milliseconds = tv.tv_usec / 1000;
tr_snprintf (buf, buflen, tmp, milliseconds);
size_t totalSize;
size_t i;
char* tmpstr;
-
+
/* set up our local test sandbox */
sandbox = libtest_sandbox_create();
return 0;
}
-
+
static int
test_single_directory_random_payload_impl (const tr_tracker_info * trackers,
const size_t trackerCount,
return 0;
}
-
+
int
main (void)
{
tr_torrentGotBlock (data->tor, data->block);
data->done = true;
}
-
+
static int
test_incomplete_dir_impl (const char * incomplete_dir, const char * download_dir)
{
session = libttest_session_init (NULL);
target_dir = tr_buildPath (tr_sessionGetConfigDir (session), "target", NULL);
tr_sys_dir_create (target_dir, TR_SYS_DIR_CREATE_PARENTS, 0777, NULL);
-
+
/* init a torrent. */
tor = libttest_zero_torrent_init (session);
libttest_zero_torrent_populate (tor, true);
#if defined (_WIN32) && !defined (QT_DLL)
/* The QT exclusion is because something clashes whith the next include */
-#include <ws2tcpip.h> /* socklen_t */
+#include <ws2tcpip.h> /* socklen_t */
#endif
/* penalize peers that were unreachable the last time we tried */
if (unreachable)
step += 2;
-
+
switch (step)
{
case 0: sec = 0; break;
void tr_peerMgrPieceCompleted (tr_torrent * tor,
tr_piece_index_t pieceIndex);
-
+
/* @} */
**** ACTIVE
***/
-static bool
+static bool
tr_peerMsgsCalculateActive (const tr_peerMsgs * msgs, tr_direction direction)
{
bool is_active;
/* honor the session limits, if enabled */
if (tr_torrentUsesSessionLimits (torrent) &&
- tr_sessionGetActiveSpeedLimit_Bps (torrent->session, TR_PEER_TO_CLIENT, &irate_Bps))
+ tr_sessionGetActiveSpeedLimit_Bps (torrent->session, TR_PEER_TO_CLIENT, &irate_Bps))
rate_Bps = MIN (rate_Bps, irate_Bps);
/* use this desired rate to figure out how
static bool
peermsgs_is_transferring_pieces (const struct tr_peer * peer,
uint64_t now,
- tr_direction direction,
+ tr_direction direction,
unsigned int * setme_Bps)
{
unsigned int Bps = 0;
if (quotactl(device, QCMD(Q_GETQUOTA, USRQUOTA), getuid(), (caddr_t) &dq) == 0)
{
#elif defined(__sun)
- struct quotctl op;
- int fd = open(device, O_RDONLY);
- if (fd < 0)
- return -1;
- op.op = Q_GETQUOTA;
- op.uid = getuid();
- op.addr = (caddr_t) &dq;
+ struct quotctl op;
+ int fd = open(device, O_RDONLY);
+ if (fd < 0)
+ return -1;
+ op.op = Q_GETQUOTA;
+ op.uid = getuid();
+ op.addr = (caddr_t) &dq;
if (ioctl(fd, Q_QUOTACTL, &op) == 0)
{
close(fd);
return ret;
}
-
+
const char *
tr_quark_get_string (tr_quark q, size_t * len)
{
assert (!err);
/* cleanup */
- tr_free (metainfo);
+ tr_free (metainfo);
return tor;
}
**** Now try a rename that should succeed
***/
- tmpstr = tr_buildPath (tor->currentDir, "hello-world.txt", NULL);
+ tmpstr = tr_buildPath (tor->currentDir, "hello-world.txt", NULL);
check (tr_sys_path_exists (tmpstr, NULL));
check_streq ("hello-world.txt", tr_torrentName(tor));
check_int_eq (0, torrentRenameAndWait (tor, tor->info.name, "foobar"));
check_streq ("foobar", tr_torrentName(tor)); /* confirm the torrent's name is now 'foobar' */
check_streq ("foobar", tor->info.files[0].name); /* confirm the file's name is now 'foobar' in our struct */
check (strstr (tor->info.torrent, "foobar") == NULL); /* confirm the name in the .torrent file hasn't changed */
- tmpstr = tr_buildPath (tor->currentDir, "foobar", NULL);
+ tmpstr = tr_buildPath (tor->currentDir, "foobar", NULL);
check (tr_sys_path_exists (tmpstr, NULL)); /* confirm the file's name is now 'foobar' on the disk */
tr_free (tmpstr);
check (testFileExistsAndConsistsOfThisString (tor, 0, "hello, world!\n")); /* confirm the contents are right */
**** ...and rename it back again
***/
- tmpstr = tr_buildPath (tor->currentDir, "foobar", NULL);
+ tmpstr = tr_buildPath (tor->currentDir, "foobar", NULL);
check (tr_sys_path_exists (tmpstr, NULL));
check_int_eq (0, torrentRenameAndWait (tor, "foobar", "hello-world.txt"));
check (!tr_sys_path_exists (tmpstr, NULL));
const char * strings[3];
/***
- **** create our test torrent with an incomplete .part file
+ **** create our test torrent with an incomplete .part file
***/
tor = libttest_zero_torrent_init (session);
{
const char * str = tr_quark_get_string (q, NULL);
tr_logAddNamedError (MY_NAME, _("Couldn't find settings key \"%s\""), str);
-}
+}
tr_rpc_server *
tr_rpcInit (tr_session * session, tr_variant * settings)
return NULL;
}
-static int
-compareTorrentByQueuePosition (const void * va, const void * vb)
-{
- const tr_torrent * a = * (const tr_torrent **) va;
- const tr_torrent * b = * (const tr_torrent **) vb;
+static int
+compareTorrentByQueuePosition (const void * va, const void * vb)
+{
+ const tr_torrent * a = * (const tr_torrent **) va;
+ const tr_torrent * b = * (const tr_torrent **) vb;
- return a->queuePosition - b->queuePosition;
-}
+ return a->queuePosition - b->queuePosition;
+}
static const char*
torrentStart (tr_session * session,
assert (idle_data == NULL);
torrents = getTorrents (session, args_in, &torrentCount);
- qsort (torrents, torrentCount, sizeof (tr_torrent *), compareTorrentByQueuePosition);
+ qsort (torrents, torrentCount, sizeof (tr_torrent *), compareTorrentByQueuePosition);
for (i=0; i<torrentCount; ++i)
{
tr_torrent * tor = torrents[i];
assert (idle_data == NULL);
torrents = getTorrents (session, args_in, &torrentCount);
- qsort (torrents, torrentCount, sizeof (tr_torrent *), compareTorrentByQueuePosition);
+ qsort (torrents, torrentCount, sizeof (tr_torrent *), compareTorrentByQueuePosition);
for (i=0; i<torrentCount; ++i)
{
tr_torrent * tor = torrents[i];
torrents[i] = tor = tr_torrentNext (session, tor);
return torrents;
-}
+}
static int
compareTorrentByCur (const void * va, const void * vb)
{
char * path;
char * load = NULL;
-
+
if (name[0] == '.') /* ignore dotfiles */
continue;
}
void
-tr_torrentFree (tr_torrent * tor)
+tr_torrentFree (tr_torrent * tor)
{
- if (tr_isTorrent (tor))
- {
- tr_session * session = tor->session;
- assert (tr_isSession (session));
- tr_sessionLock (session);
+ if (tr_isTorrent (tor))
+ {
+ tr_session * session = tor->session;
+ assert (tr_isSession (session));
+ tr_sessionLock (session);
- tr_torrentClearCompletenessCallback (tor);
- tr_runInEventThread (session, closeTorrent, tor);
+ tr_torrentClearCompletenessCallback (tor);
+ tr_runInEventThread (session, closeTorrent, tor);
- tr_sessionUnlock (session);
- }
+ tr_sessionUnlock (session);
+ }
}
struct remove_data
{
struct remove_data * data = vdata;
tr_session * session = data->tor->session;
- tr_sessionLock (session);
+ tr_sessionLock (session);
if (data->deleteFlag)
tr_torrentDeleteLocalData (data->tor, data->deleteFunc);
closeTorrent (data->tor);
tr_free (data);
- tr_sessionUnlock (session);
+ tr_sessionUnlock (session);
}
void
tr_free (tmp);
}
-
+
if (!strcmp (file->name, name))
{
tr_free (name);
}
else
- {
+ {
tr_free (file->name);
file->name = name;
file->is_renamed = true;
: tor->blockSize;
}
-static inline void tr_torrentLock (const tr_torrent * tor)
-{
- tr_sessionLock (tor->session);
-}
+static inline void tr_torrentLock (const tr_torrent * tor)
+{
+ tr_sessionLock (tor->session);
+}
static inline bool tr_torrentIsLocked (const tr_torrent * tor)
{
return tr_sessionIsLocked (tor->session);
#ifdef _WIN32
#include <inttypes.h>
#include <ws2tcpip.h>
- typedef uint16_t in_port_t; /* all missing */
+ typedef uint16_t in_port_t; /* all missing */
#else
#include <sys/time.h>
#include <unistd.h> /* close () */
case WSAEWOULDBLOCK:
errno = EAGAIN;
break;
- case WSAECONNRESET:
- /* EOF on the pipe! (win32 socket based implementation) */
- ret = 0;
- /* fall through */
+ case WSAECONNRESET:
+ /* EOF on the pipe! (win32 socket based implementation) */
+ ret = 0;
+ /* fall through */
default:
errno = werror;
break;
#if (MINIUPNPC_API_VERSION >= 10) /* adds remoteHost arg */
- err = UPNP_GetSpecificPortMappingEntry (handle->urls.controlURL,
- handle->data.first.servicetype,
+ err = UPNP_GetSpecificPortMappingEntry (handle->urls.controlURL,
+ handle->data.first.servicetype,
portStr,
proto,
- NULL /*remoteHost*/,
+ NULL /*remoteHost*/,
intClient,
intPort,
- NULL /*desc*/,
+ NULL /*desc*/,
NULL /*enabled*/,
NULL /*duration*/);
UTF8 str8_buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
UTF8 * str8_walk = str8_buf;
UTF8 * str8_end = str8_buf + 8;
-
+
if (ConvertUTF32toUTF8 (&str32_walk, str32_end, &str8_walk, str8_end, 0) == 0)
{
const size_t len = str8_walk - str8_buf;
evbuffer_add (buf, str8_buf, len);
unescaped = true;
}
-
+
in += 6;
break;
}
#define __LIBTRANSMISSION_VARIANT_MODULE___
#include "transmission.h"
-#include "ConvertUTF.h"
+#include "ConvertUTF.h"
#include "error.h"
#include "file.h"
#include "log.h"
size_t len;
union { char buf[16]; const char * str; } str;
};
-
+
/* these are PRIVATE IMPLEMENTATION details that should not be touched.
* I'll probably change them just to break your code! HA HA HA!
bool tr_variantGetStr (const tr_variant * variant,
const char ** setme_str,
size_t * setme_len);
-
+
void tr_variantInitStr (tr_variant * initme,
const void * str,
int str_len);
while (session->web == NULL)
tr_wait_msec (20);
}
-
+
task = tr_new0 (struct tr_web_task, 1);
task->session = session;
task->torrentId = torrentId;
that will be needed when writing the block in a different thread */
evbuffer_remove_buffer (task->content, data->content,
block_size * completed);
-
+
tr_runInEventThread (w->session, write_block_func, data);
task->blocks_done += completed;
}
- Qt developers and translators are needed
- If you find a bug, please report it at http://trac.transmissionbt.com/
-
+
ABOUT TRANSMISSION-QT
Transmission-qt is a GUI for Transmission loosely based on the GTK+ client.
4. In the qt/ directory, type "make"
5. In the qt/ directory, as root, type "INSTALL_ROOT=/usr make install"
(Feel free to replace /usr with /usr/local or /opt or whatever)
-
+
onNewTorrentChanged (id);
if (!tor->isSeed ())
- connect (tor, SIGNAL (torrentCompleted (int)), this, SLOT (onTorrentCompleted (int)));
+ connect (tor, SIGNAL (torrentCompleted (int)), this, SLOT (onTorrentCompleted (int)));
}
}
}
DHT_LIBS = @DHT_LIBS_QT@
LIBB64_LIBS = @LIBB64_LIBS_QT@
-LIBUTP_LIBS = @LIBUTP_LIBS_QT@
+LIBUTP_LIBS = @LIBUTP_LIBS_QT@
LIBUPNP_LIBS = @LIBUPNP_LIBS_QT@
LIBNATPMP_LIBS = @LIBNATPMP_LIBS_QT@
QString
FileTreeItem::sizeString () const
{
- QString str;
+ QString str;
if (myChildren.isEmpty())
{
FileTreeItem *
FileTreeModel::itemFromIndex (const QModelIndex& index) const
{
- return static_cast<FileTreeItem*>(index.internalPointer());
+ return static_cast<FileTreeItem*>(index.internalPointer());
}
QVariant
break;
case COL_PRIORITY:
- data.setValue (tr("Priority"));
+ data.setValue (tr("Priority"));
break;
default:
item = findItemForFileIndex (fileIndex);
- if (item) // this file is already in the tree, we've added this
+ if (item) // this file is already in the tree, we've added this
{
QModelIndex indexWithChangedParents;
while (!tokens.isEmpty())
hig->addSectionDivider ();
hig->addSectionTitle (tr ("Download Queue"));
-
+
hig->addRow (tr ("Ma&ximum active downloads:"), spinBoxNew (Prefs::DOWNLOAD_QUEUE_SIZE, 1, INT_MAX, 1));
hig->addRow (tr ("Downloads sharing data in the last &N minutes are active:"), spinBoxNew (Prefs::QUEUE_STALLED_MINUTES, 1, INT_MAX, 10));
TRANSMISSION_TOP = ..
-include(config.pri)
+include(config.pri)
INCLUDEPATH = $${EVENT_TOP}/include $${INCLUDEPATH}
INCLUDEPATH += $${TRANSMISSION_TOP}
}
void Session::pauseTorrents (const QSet<int>& ids) { sendTorrentRequest ("torrent-stop", ids); }
-void Session::startTorrents (const QSet<int>& ids) { sendTorrentRequest ("torrent-start", ids); }
+void Session::startTorrents (const QSet<int>& ids) { sendTorrentRequest ("torrent-start", ids); }
void Session::startTorrentsNow (const QSet<int>& ids) { sendTorrentRequest ("torrent-start-now", ids); }
-void Session::queueMoveTop (const QSet<int>& ids) { sendTorrentRequest ("queue-move-top", ids); }
-void Session::queueMoveUp (const QSet<int>& ids) { sendTorrentRequest ("queue-move-up", ids); }
-void Session::queueMoveDown (const QSet<int>& ids) { sendTorrentRequest ("queue-move-down", ids); }
-void Session::queueMoveBottom (const QSet<int>& ids) { sendTorrentRequest ("queue-move-bottom", ids); }
+void Session::queueMoveTop (const QSet<int>& ids) { sendTorrentRequest ("queue-move-top", ids); }
+void Session::queueMoveUp (const QSet<int>& ids) { sendTorrentRequest ("queue-move-up", ids); }
+void Session::queueMoveDown (const QSet<int>& ids) { sendTorrentRequest ("queue-move-down", ids); }
+void Session::queueMoveBottom (const QSet<int>& ids) { sendTorrentRequest ("queue-move-bottom", ids); }
void
Session::refreshActiveTorrents ()
std::fill_n (setmeCounts, static_cast<std::size_t>(FilterMode::NUM_MODES), 0);
for (int row(0); ; ++row)
- {
+ {
QModelIndex index (sourceModel()->index(row, 0));
if (!index.isValid())
break;
for (int m = 1; m < n; m++)
if ((c[m] & 0xc0) != 0x80)
return false;
- }
+ }
return true;
}
break;
case 's':
- if (optarg)
- {
+ if (optarg)
+ {
char * endptr = NULL;
piecesize_kib = strtoul (optarg, &endptr, 10);
if (endptr && *endptr=='M')
- piecesize_kib *= KiB;
+ piecesize_kib *= KiB;
}
break;