User Tools

Site Tools


var:ktorrent_trick

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

var:ktorrent_trick [2013/03/16 17:41] (current)
Line 1: Line 1:
 +==== KTorrent - trick client identity ====
 +01.11.2009
 +
 +//(Note: this will not modify your ratio or so)//
 +
 +If you use KTorrent as a preferred application for torrents, you might be in need at some point to trick client identification to tracker, in order to still connect to those trackers who have a "​whitelist"​ applications (without Ktorrent, of course :) )
 +
 +Because KTorrent doesn'​t have an inside option for this, you'll need to modify the sources and reinstall from them.\\
 +This howto assumes you already downloaded the ktorrent sources and unpack them in a directory of choice (at time time, ktorrent stable is 3.2.5).\\ ​
 +Below is the solution (not necessarily elegant but a working one)
 +
 +
 +=== 1. Files to be modified ===
 + 
 +
 +**ktorrent/​main.cpp** \\ 
 +(add new options to command line)
 +
 +inside main function, around line 81, find out the following line and comment it out:
 +<code cpp>
 +// bt::​SetClientInfo("​KTorrent",​kt::​MAJOR,​kt::​MINOR,​kt::​RELEASE,​kt::​VERSION_TYPE,"​KT"​);​
 +</​code>​
 +
 +then, a little bit below that, look for:
 +
 +<code cpp>
 +KCmdLineOptions options;
 + options.add("​+[Url]",​ ki18n("​Document to open"​));​
 + options.add("​silent",​ ki18n("​Silently open torrent given on URL"​));​
 +</​code>​
 +
 +and add right after (and before the //​KCmdLineArgs::​addCmdLineOptions(options);//​ line ) the following:
 +
 +<code cpp>
 +        options.add("​client <​clientString>",​ki18n("​Indentify application string sent to the tracker (e.g:​UTorrent)"​),​ "​KTorrent"​);​
 +        options.add("​clientcode <​clientCode>",​ki18n("​Indentify application code sent to the tracker (e.g:​UT)"​),"​KT"​);​
 +        options.add("​clientver <​clientVersion>",​ki18n("​Put here client version as major:​minor:​release (e.g. 1:​8:​0)"​),"​3:​5:​2"​);​
 +</​code>​
 +
 +
 +**ktorrent/​app.cpp** \\ 
 +(process the new options)
 +
 +Inside //int App::​newInstance()// ​
 +between \\ 
 +//kt::GUI *widget = 0;// \\ 
 +and \\ 
 +//if (!main_widget)//​ \\
 +add the following code:
 +
 +<code cpp>
 +                // here is the part that trick the client identification to tracker
 +                QString clientStr = args->​getOption("​client"​);​
 +                QString clientCode = args->​getOption("​clientcode"​);​
 +                QString version = args->​getOption("​clientver"​);​
 +                QStringList mmr = version.split(":"​);​
 +
 +                bool ok;
 +
 +                bt::​SetClientInfo( ​ clientStr, ​
 +                                    mmr[0].toInt(&​ok),​
 +                                    mmr[1].toInt(&​ok),​
 +                                    mmr[2].toInt(&​ok),​
 +                                    kt::​VERSION_TYPE,​
 +                                    clientCode);​
 +</​code>​
 +
 +
 +=== 2. Compile the modified code and install as usual ===
 +
 +
 +<​code>​
 +cd directory_where_ktorrent_source_code_is
 +mkdir build
 +cd build
 +cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ..
 +make
 +sudo make install
 +</​code>​
 +
 +
 +=== 3. Call the Ktorrent with the new args ===
 +
 +If you installed successfully the new ktorrent, then it's time to fire it up like this:
 +
 +<​code>​
 +ktorrent --client UTorrent --clientcode UT --clientver 1:8:0
 +</​code>​
 +
 +
 +This will report to tracker as UTorrent (code UT) and version 1.8.0. Pretty nice, huh?
 +
 +Check [[http://​wiki.theory.org/​BitTorrentSpecification#​peer_id | here]] for a list with client names and codes. \\ 
 +Check also how to [[var:​deluge_trick|DELUGE - trick client identity]]
 +
  
var/ktorrent_trick.txt ยท Last modified: 2013/03/16 17:41 (external edit)