--- btg-1.0.0/daemon/ipfilter/emule.cpp.orig 2010-06-04 00:23:27.217870889 +0200
+++ btg-1.0.0/daemon/ipfilter/emule.cpp 2010-06-04 00:24:34.785426517 +0200
@@ -30,7 +30,7 @@
#include <fstream>
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
# include <boost/asio/ip/address_v4.hpp>
#else
# include <asio/ip/address_v4.hpp>
@@ -146,7 +146,7 @@
boost::array<unsigned char, 4u> const ip2 = {{ipa1[0], ipa1[1], ipa1[2], ipa1[3]}};
try
{
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
boost::asio::ip::address_v4 address1(ip1);
boost::asio::ip::address_v4 address2(ip2);
#else
--- btg-1.0.0/daemon/ipfilter/levelone.cpp.orig 2010-06-04 00:25:18.228692754 +0200
+++ btg-1.0.0/daemon/ipfilter/levelone.cpp 2010-06-04 00:26:11.468754496 +0200
@@ -30,7 +30,7 @@
#include <fstream>
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
# include <boost/asio/ip/address_v4.hpp>
#else
# include <asio/ip/address_v4.hpp>
@@ -133,7 +133,7 @@
boost::array<unsigned char, 4u> const ip2 = {{ipa1[0], ipa1[1], ipa1[2], ipa1[3]}};
try
{
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
boost::asio::ip::address_v4 address1(ip1);
boost::asio::ip::address_v4 address2(ip2);
#else
--- btg-1.0.0/daemon/lt_version.h.orig 2010-06-03 23:56:41.134698301 +0200
+++ btg-1.0.0/daemon/lt_version.h 2010-06-04 00:15:18.003628154 +0200
@@ -25,11 +25,13 @@
#include <libtorrent/version.hpp>
+#define BTG_LT_0_15 ((LIBTORRENT_VERSION_MAJOR == 0) && (LIBTORRENT_VERSION_MINOR == 15))
#define BTG_LT_0_14 ((LIBTORRENT_VERSION_MAJOR == 0) && (LIBTORRENT_VERSION_MINOR == 14))
#define BTG_LT_0_13 ((LIBTORRENT_VERSION_MAJOR == 0) && (LIBTORRENT_VERSION_MINOR == 13))
#define BTG_LT_0_12 ((LIBTORRENT_VERSION_MAJOR == 0) && (LIBTORRENT_VERSION_MINOR == 12))
-#if BTG_LT_0_14
+#if BTG_LT_0_15
+#elif BTG_LT_0_14
#elif BTG_LT_0_13
#elif BTG_LT_0_12
#else
--- btg-1.0.0/daemon/daemonhandler.cpp.orig 2010-06-04 00:26:37.178685664 +0200
+++ btg-1.0.0/daemon/daemonhandler.cpp 2010-06-04 00:27:06.161255753 +0200
@@ -631,7 +631,7 @@
vrc->setOption(versionResponseCommand::UPNP);
#endif
-#if (BTG_LT_0_13 || BTG_LT_0_14)
+#if (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
vrc->setOption(versionResponseCommand::DHT);
vrc->setOption(versionResponseCommand::ENCRYPTION);
vrc->setOption(versionResponseCommand::SELECTIVE_DL);
--- btg-1.0.0/daemon/btgdaemon.cpp.orig 2010-06-04 00:27:20.921181255 +0200
+++ btg-1.0.0/daemon/btgdaemon.cpp 2010-06-04 00:27:45.382075527 +0200
@@ -81,7 +81,7 @@
# include "upnp/cyberlink.h"
# endif // BTG_OPTION_USECYBERLINK
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
# include "upnp/ltupnpif.h"
#endif
--- btg-1.0.0/daemon/context_file.cpp.orig 2010-06-04 00:28:32.305340940 +0200
+++ btg-1.0.0/daemon/context_file.cpp 2010-06-04 00:30:38.028725659 +0200
@@ -66,7 +66,7 @@
"Attempt to move '" << filename << "' to " << _destination_dir << " failed.");
result = false;
}
-#elif (BTG_LT_0_13 || BTG_LT_0_14)
+#elif (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
ti->handle.move_storage(_destination_dir);
#endif // lt version
BTG_MEXIT(logWrapper(), "moveToDirectory", result);
@@ -485,7 +485,7 @@
BTG_MNOTICE(logWrapper(), "wrote fast resume data for '" << filename << "'");
out.close();
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
// The actual writting is done using a callback.
// TODO: implement this!
ti->handle.save_resume_data();
@@ -522,7 +522,7 @@
return status;
}
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
bool Context::torrentInfoToFiles(libtorrent::torrent_info const& _tinfo,
std::vector<std::string> & _output) const
{
@@ -594,7 +594,7 @@
}
#endif
-#if (BTG_LT_0_14)
+#if (BTG_LT_0_14 || BTG_LT_0_15)
void Context::bitfieldToVector(libtorrent::bitfield const& _input,
std::vector<bool> & _output) const
{
--- btg-1.0.0/daemon/context.h.orig 2010-06-04 00:30:48.621160387 +0200
+++ btg-1.0.0/daemon/context.h 2010-06-04 00:32:10.674559090 +0200
@@ -444,7 +444,7 @@
/// Handle libtorrent alert.
void handlePeerError(libtorrent::peer_error_alert* _alert);
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
void handleTrackerAlert(libtorrent::tracker_error_alert* _alert);
#else
/// Handle libtorrent alert.
@@ -602,7 +602,7 @@
/// Enable/disable using the torrent name from the
/// tracker.
bool const useTorrentName_;
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
/// Allocation mode used.
libtorrent::storage_mode_t allocation_mode_;
#endif
@@ -665,7 +665,7 @@
std::vector<std::string> & _output) const;
#endif
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
bool torrentInfoToFiles(libtorrent::torrent_info const& _tinfo,
std::vector<std::string> & _output) const;
#endif
@@ -709,7 +709,7 @@
/// Convert an enum to a string, for debugging.
std::string toString(addResult const _addresult) const;
-#if (BTG_LT_0_14)
+#if (BTG_LT_0_14 || BTG_LT_0_15)
/// Convert a libtorrent bitfield into a vector of bits.
///
/// Libtorrent 0.14 changed the way a torrent's pieces
--- btg-1.0.0/daemon/context.cpp.orig 2010-06-04 00:33:56.738641809 +0200
+++ btg-1.0.0/daemon/context.cpp 2010-06-04 00:41:47.447774562 +0200
@@ -57,12 +57,12 @@
#include "lt_version.h"
-#if (BTG_LT_0_13 || BTG_LT_0_14)
+#if (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
#include <libtorrent/extensions/metadata_transfer.hpp>
#include <libtorrent/extensions/ut_pex.hpp>
#endif
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
#include <libtorrent/alert.hpp>
#endif
@@ -156,7 +156,7 @@
#endif // BTG_OPTION_EVENTCALLBACK
, progress_(),
useTorrentName_(_useTorrentName)
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
,
allocation_mode_(libtorrent::storage_mode_sparse)
#endif
@@ -168,7 +168,7 @@
"Constructor", "_clientAttached = " << _clientAttached);
portMgr->get(listen_port_range_);
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
switch (config_->getAllocationMode())
{
case daemonConfiguration::SPARSE:
@@ -228,7 +228,7 @@
{
// Libtorrent created its threads.
//
-#if (BTG_LT_0_13 || BTG_LT_0_14)
+#if (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
// Add the available extensions.
torrent_session->add_extension(&libtorrent::create_ut_pex_plugin);
#endif
@@ -258,7 +258,7 @@
#if (BTG_LT_0_12 || BTG_LT_0_13)
torrent_session->set_severity_level(libtorrent::alert::info);
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
{
int amask =
libtorrent::alert::error_notification |
@@ -486,7 +486,7 @@
}
}
-#if (BTG_LT_0_13 || BTG_LT_0_14)
+#if (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
// Enable encryption.
if (useEncryption_)
{
@@ -561,7 +561,7 @@
BTG_MEXIT(logWrapper(), "add", status);
return status;
}
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
status = Context::ERR_OK;
#endif
@@ -571,7 +571,7 @@
#elif BTG_LT_0_13
boost::intrusive_ptr<libtorrent::torrent_info> tinfo(new libtorrent::torrent_info);
if (!entryToInfo(torrent_entry, *tinfo))
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
boost::intrusive_ptr<libtorrent::torrent_info> tinfo;
bool gotInfo = true;
try
@@ -619,7 +619,7 @@
BTG_MEXIT(logWrapper(), "add", status);
return status;
}
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
if (!torrentInfoToFiles(*tinfo, contained_files))
{
filetrack_->remove(tempDir_, fileTrackFilename);
@@ -652,7 +652,7 @@
torrentStorage ts = tsWork;
#if BTG_LT_0_12
if (dataPresentInSeedDir(tinfo))
-#elif (BTG_LT_0_13 || BTG_LT_0_14)
+#elif (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
if (dataPresentInSeedDir(*tinfo))
#endif
{
@@ -676,7 +676,7 @@
in.unsetf(std::ios_base::skipws);
#if (BTG_LT_0_12 || BTG_LT_0_13)
libtorrent::entry fastResumeEntry;
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
std::vector<char>* resumeData = new std::vector<char>;
#endif
try
@@ -686,7 +686,7 @@
std::istream_iterator<char>(in),
std::istream_iterator<char>()
);
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
std::copy(std::istream_iterator<char>(in),
std::istream_iterator<char>(),
std::back_inserter(*resumeData));
@@ -705,7 +705,7 @@
handle = torrent_session->add_torrent(torrent_entry, dataPath, fastResumeEntry);
#elif BTG_LT_0_13
handle = torrent_session->add_torrent(tinfo, dataPath, fastResumeEntry);
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
libtorrent::add_torrent_params atp;
atp.name = 0; // "default name";
atp.ti.swap(tinfo);
@@ -726,7 +726,7 @@
handle = torrent_session->add_torrent(torrent_entry, dataPath);
#elif BTG_LT_0_13
handle = torrent_session->add_torrent(tinfo, dataPath);
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
libtorrent::add_torrent_params atp;
atp.name = 0; // "default name";
atp.ti.swap(tinfo);
@@ -1243,7 +1243,7 @@
switch (status.state)
{
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
case libtorrent::torrent_status::allocating:
#endif
case libtorrent::torrent_status::queued_for_checking:
@@ -1254,7 +1254,7 @@
break;
#if (BTG_LT_0_12) || (BTG_LT_0_13)
case libtorrent::torrent_status::connecting_to_tracker:
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
case libtorrent::torrent_status::downloading_metadata:
#endif
ts = Status::ts_connecting;
@@ -1555,7 +1555,7 @@
libtorrent::torrent_info t_i = ti->handle.get_torrent_info();
#if (BTG_LT_0_12 || BTG_LT_0_13)
const std::vector<bool>* pieces = status.pieces;
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
/// !!!
std::vector<bool> piecevector;
bitfieldToVector(status.pieces, piecevector);
@@ -1660,7 +1660,7 @@
for (iter = peerinfolist.begin(); iter != peerinfolist.end(); iter++)
{
// Convert the peer ip from the libtorrent implementation to 4 bytes.
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> endp = iter->ip;
boost::asio::ip::address_v4 addr = endp.address().to_v4();
#else
@@ -1706,14 +1706,14 @@
}
for(t_uint i = *_peerExOffset, endi = *_peerExOffset + *_peerExCount; i < endi; ++i)
{
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
std::vector<bool> fpieces;
bitfieldToVector(peerinfolist[i].pieces, fpieces);
#endif
PeerEx peerEx(
peerinfolist[i].flags,
-#if BTG_LT_0_13 || BTG_LT_0_14
+#if BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15
peerinfolist[i].source,
#elif BTG_LT_0_12
0,
@@ -1726,7 +1726,7 @@
peerinfolist[i].total_upload,
#if BTG_LT_0_12 || BTG_LT_0_13
peerinfolist[i].pieces,
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
fpieces,
#endif
peerinfolist[i].download_limit,
@@ -1745,7 +1745,7 @@
peerinfolist[i].downloading_total,
peerinfolist[i].client,
peerinfolist[i].connection_type,
-#if BTG_LT_0_13 || BTG_LT_0_14
+#if BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15
libtorrent::total_seconds(peerinfolist[i].last_request),
libtorrent::total_seconds(peerinfolist[i].last_active),
peerinfolist[i].num_hashfails,
@@ -1915,7 +1915,7 @@
case libtorrent::torrent_status::checking_files:
#if (BTG_LT_0_12) || (BTG_LT_0_13)
case libtorrent::torrent_status::connecting_to_tracker:
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
case libtorrent::torrent_status::downloading_metadata:
#endif
case libtorrent::torrent_status::downloading:
@@ -1977,7 +1977,7 @@
btg::core::selectedFileEntryList const& _input)
{
BTG_MENTER(logWrapper(), "applySelectedFiles", "torrent info");
-#if (BTG_LT_0_13 || BTG_LT_0_14)
+#if (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
enum lt_file_priority
{
LTF_NO = 0,
@@ -2069,7 +2069,7 @@
libtorrent::torrent_status status = ti->handle.status();
#if (BTG_LT_0_12) || (BTG_LT_0_13)
if ((status.state == libtorrent::torrent_status::connecting_to_tracker)
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
if ((status.state == libtorrent::torrent_status::downloading_metadata)
#endif
||
@@ -2372,7 +2372,7 @@
MVERBOSE_LOG(logWrapper(), verboseFlag_, "Using WAN (announce ip): " << announceIp);
#if (BTG_LT_0_13)
session_settings_.announce_ip = asio::ip::address(asio::ip::address_v4::from_string(announceIp));
-#elif BTG_LT_0_14
+#elif (BTG_LT_0_14 || BTG_LT_0_15)
session_settings_.announce_ip = boost::asio::ip::address(boost::asio::ip::address_v4::from_string(announceIp));
#endif
}
@@ -2396,7 +2396,7 @@
void Context::setProxyHttpSettings(btg::core::addressPort const& _proxy)
{
BTG_MNOTICE(logWrapper(), "setting session settings: proxy");
-#if (BTG_LT_0_13 || BTG_LT_0_14)
+#if (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
libtorrent::proxy_settings ps;
ps.hostname = _proxy.getIp();
ps.port = _proxy.getPort();
@@ -2528,7 +2528,7 @@
void Context::enableEncryption()
{
-#if (BTG_LT_0_13 || BTG_LT_0_14)
+#if (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
try
{
libtorrent::pe_settings enc_settings;
--- btg-1.0.0/daemon/context_session.cpp.orig 2010-06-04 00:32:53.007815608 +0200
+++ btg-1.0.0/daemon/context_session.cpp 2010-06-04 00:33:42.437830589 +0200
@@ -130,7 +130,7 @@
libtorrent::peer_id pid;
#if BTG_LT_0_12
pid = 0;
-#elif (BTG_LT_0_13 || BTG_LT_0_14)
+#elif (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
pid = torrent_session->id();
#endif
std::string peerid = btg::core::convertToString<libtorrent::peer_id>(pid);
@@ -313,7 +313,7 @@
if (_version >= 0x89)
{
bool asfr = applySelectedFiles(ti,aSelectedFileEntryList);
-#if (BTG_LT_0_13 || BTG_LT_0_14)
+#if (BTG_LT_0_13 || BTG_LT_0_14 || BTG_LT_0_15)
BTG_CDC(!asfr, "call applySelectedFiles");
#elif BTG_LT_0_12
// Selecting files is not supported by 0.12.x, so ignore this.
--- btg-1.0.0/daemon/context_alert.cpp.orig 2010-06-04 00:43:02.937753224 +0200
+++ btg-1.0.0/daemon/context_alert.cpp 2010-06-04 00:45:11.414475333 +0200
@@ -25,7 +25,7 @@
#include <bcore/trackerstatus.h>
#include <bcore/logmacro.h>
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
# include <boost/asio/ip/address_v4.hpp>
#else
# include <asio/ip/address_v4.hpp>
@@ -48,7 +48,7 @@
void Context::handleBannedHost(libtorrent::peer_ban_alert* _alert)
{
// A peer was banned.
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> endp = _alert->ip;
boost::asio::ip::address_v4 banned_ip = endp.address().to_v4();
#else
@@ -116,7 +116,7 @@
void Context::handlePeerError(libtorrent::peer_error_alert* _alert)
{
// A peer generates errors.
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> endp = _alert->ip;
boost::asio::ip::address_v4 banned_ip = endp.address().to_v4();
#else
@@ -125,7 +125,7 @@
#endif
BTG_NOTICE(logWrapper(), "Errors from peer: " << banned_ip.to_string() << ".");
}
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
void Context::handleTrackerAlert(libtorrent::tracker_error_alert* _alert)
#else
void Context::handleTrackerAlert(libtorrent::tracker_alert* _alert)
@@ -142,7 +142,7 @@
verboseFlag_, "Tracker alert: filename '" <<
filename << "', status = " <<
_alert->status_code << ", message '" <<
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
_alert->message()
#else
_alert->msg()
@@ -161,7 +161,7 @@
}
ti->trackerStatus.setSerial(ti->serial);
ti->trackerStatus.setMessage(
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
_alert->message()
#else
_alert->msg()
@@ -215,7 +215,7 @@
getFilename(torrent_id, filename);
VERBOSE_LOG(logWrapper(), verboseFlag_, "Tracker warning alert: filename '" <<
filename << "', message '" <<
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
_alert->message()
#else
_alert->msg()
@@ -226,7 +226,7 @@
ti->trackerStatus.setStatus(trackerStatus::warning);
ti->trackerStatus.setSerial(ti->serial);
ti->trackerStatus.setMessage(
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
_alert->message()
#else
_alert->msg()
@@ -274,7 +274,7 @@
{
handlePeerError(dynamic_cast<libtorrent::peer_error_alert*>(alert));
}
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
else if (typeid(*alert) == typeid(libtorrent::tracker_error_alert))
{
handleTrackerAlert(dynamic_cast<libtorrent::tracker_error_alert*>(alert));
@@ -297,7 +297,7 @@
{
// Log other alerts.
BTG_NOTICE(logWrapper(), "Alert: " <<
-#if BTG_LT_0_14
+#if (BTG_LT_0_14 || BTG_LT_0_15)
alert->message()
#else
alert->msg()