[LinuxDC++][Mod] Multiple clients/shares

Don´t be shy, Linux is fun! =)
Post Reply
User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

[LinuxDC++][Mod] Multiple clients/shares

Post by ayu »

This method has proven to be ineffective, if you wish for another solution, just post and say so, and I will create another tutorial that works, I will do it anyway, but right now it's not one of my priorities

I use LinuxDC++ a lot, and I am not allowed to share certain stuff on the private servers that I am on. So I thought that I could have 2 clients with 2 different configurations at once, but apparently LinuxDC++ is hard coded to only have one specific configuration folder. So I made some minor quick changes to the source to make it work like I want to.

Anyway, let's get started ...

Start with opening a terminal and download the latest LinuxDC++ source at

Code: Select all

https://code.launchpad.net/linuxdcpp
navigate to the desktop first with

Code: Select all

cd /home/$USER/Desktop
Then download the source (not certain to be the newest, get the newest from the link above)

Code: Select all

wget http://code.launchpad.net/linuxdcpp/1.0/1.0.3/+download/linuxdcpp-1.0.3.tar.bz2
And unpack it to the desktop

Code: Select all

tar jxf linuxdcpp-1.0.3.tar.bz2
Then navigate to the client folder

Code: Select all

cd linuxdcpp-1.0.3/client
Open up the file "Util.cpp" with your favorite editor (nano, Vi, Vim, Emacs, GEdit...etc)

Code: Select all

nano Util.cpp
The code starts on row 92 and should look like this

Code: Select all

#else
	systemPath = "/etc/";
	char* home = getenv("HOME");
	configPath = home ? Text::toUtf8(home) + "/.dc++/" : "/tmp/";
	dataPath = configPath; // dataPath in linux is usually prefix + /share/app_name, so we can't represent it here
Change it to

Code: Select all

#else
	systemPath = ".";
	//char* home = getenv("HOME");
	configPath = "."; //home ? Text::toUtf8(home) + "/.dc++/" : "/tmp/";
	dataPath = configPath; // dataPath in linux is usually prefix + /share/app_name, so we can't represent it here
Now, save the file and exit the editor.

Now you have to edit another file, so navigate to the "linux" folder which is located one step back from your current position in the folder tree (cd ../linux).
You have to open up the file "WulforUtil.cc" and goto row 309, it should look like this

Code: Select all

string configPath = home ? string(home) + "/.dc++/" : "/tmp/";
string profileLockingFile = configPath + "profile.lck";
Change it to

Code: Select all

string configPath = ".";//home ? string(home) + "/.dc++/" : "/tmp/";
string profileLockingFile = configPath + "profile.lck";
Save the file and exit the editor. Now you have to compile the source and install it. I created a folder on the Desktop called "LinuxDC0" (as the client 0, then I created a LinuxDC1 as well), so you can do so as well. Anyway, make sure you are in the linuxdcpp-1.0.3 folder (as in if you are still in the client/linux folder, you have to issue the "cd .." command).

Now, to install you have to make sure you have a bunch of libraries, and that you have "scons". If you do not have scons, you have to install it, and if you have Debian/Ubuntu you can do so by issuing "apt-get install scons".

Now you need to make sure you meet the following requirements:
scons >= 0.96
pkg-config
g++ >= 3.4
gtk+-2.0 >= 2.10
gthread-2.0 >= 2.4
libglade-2.0 >= 2.4
pthread
zlib
libbz2
libssl
When you meet these requirements, you can start the compilation by typing

Code: Select all

scons /path/to/install
or in my case

Code: Select all

scons /home/$USER/Desktop/LinuxDC0
When (and if) the compilation was a success, you can install it with

Code: Select all

scons install
EDIT: Due to some more changes that has to be made to the code there is a little issue that follows with doing this. You can NOT move the application once it has been installed in one place. If you want more clients, then you have to set the installation PREFIX to one location and install it, and redo it all and install it to another location. I will fix this issue if I get the time for it.
Last edited by ayu on 17 Aug 2009, 13:04, edited 1 time in total.
"The best place to hide a tree, is in a forest"

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Post by ayu »

Minor (but important) change has been made to the code.

Change this

Code: Select all

systemPath = ""; 
To this

Code: Select all

systemPath = "."; 
If you just add an empty string and make a launcher on your desktop, then the launcher runs it from the home folder it seems, making the Linuxdcpp binary use the home folder for it's files, which gets kind of messy. The dot tells the program to place the stuff in the same folder as the binary, should work, although I haven't tried it out yet. Will recompile in a couple of days and test it. I'm recompiling a kernel now, and then I have to get ready to get back home from my vacation ^^
"The best place to hide a tree, is in a forest"

User avatar
leetnigga
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 447
Joined: 28 Jul 2009, 16:00
14

Post by leetnigga »

So basically you're changing all the paths to be the current working directory so you can have two separate installations with different configurations?

I don't know the source but wouldn't it be possible to let the configuration directory/file be specified by a command line flag? Two separate installations for just alternative configurations doesn't seem right to me.

Also, a good way to represent changes in code is the diff format.

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Post by ayu »

Yeah, one of the coders for the project suggested something similar, although I did not think about that before ^^

Besides, it was a good opportunity to check out the code. And it was fun looking for the right piece of code and change it, and see it work (I don't usually play around with other code then my own), not a perfect fix, and a very small one at that, but still ^^

diff, good suggestion ... thanks : - )
"The best place to hide a tree, is in a forest"

Post Reply