DC++ at the local Bazaar

The latest news about the developing of DC++ are about the change of the repository from Subversion to Bazaar.

How does this affect the normal DC++ user ? The answer is, with nothing at all. It just affects the more advanced users that can compile their own binaries from the latest source code, or the people that want to contribute with patches or something.

Bazaar is a new version control system similar to CVS and Subversion that presumably has more advantages than the other two. You can still use the old svn repository from sourceforge, because the new bazaar one and this one will be auto synchronized ( with some few days delay, the most ), the sole difference is that the commits are now made first to the bazaar and then they appear into the svn repository.

To have access to the bazaar, you need the bazaar client, available from here. Also , to install bzr you need Python 2.4 the least.
Once you have it installed and in your path, you can simply checkout the repository by :
bzr branch http://bazaar.launchpad.net/~dcplusplus-team/dcplusplus/trunk dcplusplus
This will checkout the entire repository into the dcplusplus folder.
First difference from subversion : the initial checkout lasts much longer , because all the revisions are being downloaded ( diffs between them anyway ), so after the checkout you don’t need internet connection to update to any older revision or see the diffs . It took here about 5-8 minutes to complete, so be patient.
Don’t worry about the space this all thing is taking, even if it’s branching all the revisions, I heard it still uses less space than the svn checkout ( hi arne =).

If you had commit access to the repository or you are in the dcplusplus-team, I can explain how to gain ssh access to the repository.
If you use linux, you need a ssh tool that can create a key and use it as login ( standard ssh I think it works…)
For windows, I used PuTTY. You can get it from here. You need PuTTY.exe, Pageant.exe, Plink.exe and PuTTYgen.exe.

Start up PuTTYgen.exe and generate new key (Notice the nice randomness generation =).
Save both the public and private keys.
Go to the launchpad site and into your profile go to Add SSH key and paste the public key information from PuttyGen ( some strings that puttygen puts in some box where it says : “Public key for pasting into authorized files… “)

Now open up PuTTY.exe, and connect to bazaar.launchpad.net using SSH. You will be asked to add into Putty’s cache the server’s fingerprint. Pick “Yes” so that the fingerprint is being added permanently. ( This is required so that you can connect using plink, otherwise it can’t connect because it doesn’t recognize the fingerprint as “safe” ).

Open up pageant.exe and load your private key into it ( the one generated with puttygen ).

Now, add a new variable to your system ( Right click my computer, advanced, environment variables ) named BZR_SSH and set the value to plink.

Open up console and try
bzr branch bzr+ssh://<name>@bazaar.launchpad.net/~dcplusplus-team/dcplusplus/trunk dcplusplus
Where <name> is your launchpad nickname.
There you go.

What arne suggests about commiting : “then in the dcplusplus folder “bzr reconfigure –checkout”. That’ll configure bzr to work just like svn, committing each revision you make to the main repository when you do “bzr commit”. Alternatively, you don’t do the reconfigure thing, and all your “bzr commit” commits will be local until you do a bzr push”

I’ve been reluctant about this whole Bazaar since I don’t see any real advantage about it over svn. Maybe time will tell.
I’m also waiting for feedback or help requests if my post wasn’t explanatory enough.

Note to translators

The next release is drawing near and if you speak any language apart from English you can help by translating DC++ into your language. All old language files have now been imported (well, at least those that could be salvaged), so all you need to do is to go over to launchpad and start translating! If you don’t like the web interface, I suggest you download the language template and use an app such as poEdit to edit the translations (remember to import the existing translations to your language from launchpad before starting!). There’s a nice introduction to translation using gettext here.

DC++ 0.701 crashes on startup?

It may happen that your freshly installed/downloaded DC++ 0.701 crashes as soon as you start it (or die without any error message, just it simply doesn’t start). This is caused by an unhandled exception which is going to be handled in the upcoming releases. To workaround this problem, create a Certificates folder in your DC++ installation directory.

Note that this workaround also won’t let your System Stability Index to drop :P

Cross-compiling DC++ on Linux

Just some notes:

  • If you use a binary-based distribution, don’t use the default STLport – that’ll have been compiled for the native platform, not Win32. Compile your own copy from source, however you do it.
  • Your distribution might have a MinGW cross-compiler already packaged and available. Debian, Ubuntu, and possibly RPM distributions (I don’t use any and thus can’t verify that). The Gentoo site is down, so I didn’t check.
  • The default MinGW filename prefix in build_util.py is i386-mingw32. You might need to adjust that, either by setting the MINGW_PREFIX variable or just editing build_util.py. For example, the correct prefix on my development system is i586-mingw32msvc.
  • On at least the versions of the MinGW runtime packaged with the Linux distribution I use, commdlg.h lacks the OPENFILENAME_SIZE_VERSION_400 constant (it’s 76 decimal) and winuser.h XBUTTON1/XBUTTON2 (VK_* and MK_* aren’t the same). Get the corrected header files from the official MinGW download site if necessary; they’re as portable as necessary.
  • Certain older versions of SCons on MinGW are vulnerable to a bug which DC++’s build system triggers. Either update SCons or apply the patch available if you experience that bug.
  • Finally, regardless of platform, using SCons’s —implicit-deps-unchanged option can dramatically speed up compiles if not too much has changed.

Don’t forget that you can make topic suggestions for blog posts in our “Blog Topic Suggestion Box!”

How to generate CID taken?

Or rather, how not to generate CID taken?

I guess most of you already know that on ADC the clients are identified by their CID. Which means that two clients with the same CID cannot enter to the hub at the same time.

And a lot of hubowners, website maintainers, etc provide clients with some basic settings for download to ease the start for the users. Which means that you start a clean new client, set up some common things you’d like to (like a default nick, coloring, timestamp, add some hubs as a favorite etc.), then rar/zip the whole thing and put it on your website.

What happens if you do that? Since the clients your users are going to download includes the PID setting too, all users will have the same CID, so they can’t enter to the same hub while the other users are in, they are going to get “CID taken”; and I’m not sure that an inexperienced user can figure out what should he change in the settings to get rid of that.

So I ask anyone who distributes clients with some settings preset in them, edit DCPlusPlus.xml before publishing and remove the <CID>…</CID> from the xml. Or rather, distribute the clients without the xml file.

A footnote: you may notice that the settings xml contains a CID tag instead of a PID tag. That’s historical and haven’t changed yet, but that’s the PID. So please don’t distribute it otherwise everyone’s CID’s going to be taken.

Help the file!

Since I’ve been posting a bunch of “how to compile this and that” posts lately, I am going to do that today as well.

And this time, with DC++’s help file.

It’s an easy task, requiring basically only one program from Microsoft; HTML Help Workshop.

Download HTML Help Workshop and install it in C:/Program Files. (Or wherever the %ProgramFiles% system variable point to.)

Now go in the help/ directory in DC++’s source and run compile.cmd. This will automatically generate a new ‘version’ of the changelog in the helpfile, and (temporarily) copy res/users.bmp so one of the FAQs can take advantage of it. The help file will now appear in app/ (extension .chm).
If you want to change the language of the help file, feel free to do that. It’s just to open the .html files in an editor and change the text. (Remember? It’s HTML Help Workshop.)

If you want to add or remove a file from the help file;

  1.   Open toc.hhc in a text editor and add the file in an appropriate LI/object-tag.
  2. Open help.vcproj in a text editor and add the file in an appropriate File-tag.
  3. Open DCPlusPlus.hhp in a text editor and add the file in the [FILES] part. If you want it to have an alias, and be “call-able” from DC++, add it as well under the [ALIAS] part.
  4. Modify index.html (or whatever other file you want to point to your new file).
  5. Run compile.cmd.

If you want to upload it so others can take advantage of your change, feel free to upload it to the Language tracker.
Something many may not know about, is that the help file require one other program to be viewable. It is Internet Explorer. Yes. So, while the .chm is initially constructed by platform independent HTML files, the end help file is not.

Compiling DC++ with Visual Studio 2003

This guide is about compiling DC++ on Windows, with Visual studio 2003.

To compile DC++, you will need a few things.

First, download the DC++ source, and unpack it in C:\dcplusplus\dcplusplus696\. (So you got C:\dcplusplus\dcplusplus696\windows, C:\dcplusplus\dcplusplus696\client etc.)

Download STLport, and unpack it in C:\dcplusplus\STL so you got C:\dcplusplus\STL\config etc.

Download WTL and unpack it in C:\dcplusplus\WTL so you got C:\dcplusplus\WTL\include etc.

Download the latest SDK, or get the natupnp.h file from Bugzilla. Place it in C:\dcplusplus\natupnp\. (I think I have it in some Visual Studio include path, but this should work fine too.)

Download YaSSL and unpack it in C:\dcplusplus\YaSSL so you got C:\dcplusplus\YaSSL\certs etc.

Download Python and install it. (I got mine in the default folder)

Enter C:\dcplusplus\dcplusplus696\. Open up DCPlusPlus.rc and change the line #include “wtl\\atlres.h” to #include “atlres.h”

Open up the workspace (DCPlusPlus.sln)

Under the Tools menu, press Options.

Go to Projects and then VC++ Directories.

Under ‘Show directories for’ select ‘Include files’.

Add the STL folder, WTL\include folder, YaSSL folder and then the natupnp folder. (They should be in the top.)

Under the Build menu, press Build solution and Visual Studio should compile you an executable that is located in C:\dcplusplus\dcplusplus696\app\.

To change Python path, go to client->Header Files->StringDefs.h->Properties->Custom build step and change the appropriate values.

Compiling ADCH++ with Mingw on Windows

And another how-to on compiling ADCH++. This time with Mingw on Windows. Check out the previous POSIX and Visual Studio 2005 (Windows) tutorials.

Credit for this tutorial goes to Pothead.

  1. Install Python
  2. Install scons
  3. Install swig
  4. Install boost (copy the contents of boost_1_33_1\boost to C:\Boost\include\boost-1_33_1\boost )
  5. Install mingw (not sure what parts are needed, but i got the gcc-core gcc-g++ binutils runtime utilities and w32api, and it works with all of them)
  6. Install Msys (part of mingw)
  7. Download and place Stlport 5.0.2 in the STLPort directory in Adchpp’s root directory
  8. Ensure Pyton, Swig and Mingw’s paths are available in %PATH%
  9. Compile STLPort
    1. Load up Msys
    2. Navigate to the STLPort\build\lib directory
    3. Type: make -f gcc.mak depend
    4. Type: make -f gcc.mak install
    5. Close Msys
  10. Compile Adchpp
    1. Goto adchpp directory
    2. To build in debug mode Type: scons to build in debug mode
    3. To build in release mode Type: scons mode=release

(To find links to the other programs, look in the previous posts or use a search engine.)

Compiling ADCH++ on POSIX

This is a how-to to compile ADCH++ on POSIX, specifically Linux Ubuntu 6.06 LTS. If you are on Windows, check out the previous post.

An early disclaimer; I am not a experienced POSIX user, and I’m certainly no expert at compiling ADCH++, but it’ll have to do.

The following libraries/commands are what I experienced I had to do when trying to compile ADCH++.

Create the directory ~/adch++/. (Or wherever/whatever you want to call it.)

Enter the directory, and download ADCH++ by doing “svn checkout https://svn.sourceforge.net/svnroot/adchpp/ –username anonymous”

Download the following; Boost 1.33.1, swig 1.3.29, STLport.
Download and install bjam (I used 3.1.11-1 and downloaded it through Synaptic.)

Extract STLport in ~/adch++/, so you have ~/adch++/STLport/. Enter ~/adch++/STLport/build/lib and do ./configure, then do “make -f gcc.mak depend” and then “make -f gcc.mak install”.

Extract boost_1_33_1 so you have ~/adch++/boost_1_33_1/. Do ./configure, then “make” and then “make install”.

Extract swig anywhere, enter the directory it is in. Do ./configure, then “make” and then “make install”.
Enter ~/adch++/, and do “scons”.

Now, I should say that I encountered two problems. You may not experience them. Firstly; the variable ‘versionString’ was apparently unreachable, so I just removed it and put any string in quotes. So, s/versionString/”ADCH++”. Secondly; the variable ‘FULLVERSIONSTRING’ was also apparently unreachable, so I just removed it and put any string in quotes. So, s/FULLVERSIONSTRING/”ADCH++”.

Doing just “scons” will produce ADCH++ in ‘debug’ mode. If you want it in ‘release’ mode, do “scons mode=release”. (You can ofcourse specify ‘debug’ the same way.)

When scons is complete, enter ~/adch++/build. You will see either the debug or release directory (or both). Enter now ~/adch++/build/debug-default/bin/. And now do “./adchpp”. You should now have a working ADCH++!

The default port is 2780, but you can change that in ~/adch++/etc/. Open adchpp.xml and scroll down to the port, and enter whatever you want. (Remember, there is no default port in ADC.)

If you know something that isn’t necessary, please do tell. If you encounter any problems, I’d prefer the ADCH++ forum.

Compiling ADCH++ with Visual Studio 2005 on Windows

So, you’ve been trying to compile ADCH++, but have been failing? Well, here’s a nice guide on how to do it with Visual Studio 2005. (For your information, Trem, that little cutie pie, wrote it. I haven’t tried it, so if it doesn’t work, blame him. Well, you can blame him anyway for everything else but that’s besides the point.)

1. Download TortoiseSVN and install, let it reboot.

2. Create a folder for the project (c:\adchpp will be used throughout this guide).

3. In Windows Explorer, right click and select SVN checkout. In the resulting dialog box fill in https://svn.sourceforge.net/svnroot/adchpp/adchpp/trunk/ as the URL and click OK.

4. Download STLport and unpack it in c:\adchpp. This should give you a c:\adchpp\stlport\stlport folder.

5. Download Bjam and unpack the .exe to c:\windows\system32 (assuming Windows is installed on C:). Make sure the folder name isn’t extracted.

6. Download Boost and extract it to c:\adchpp, this should give a c:\adchpp\boost_1_33_1 folder.

7. Open Visual Studio (2005) and go to Tools->Options->Projects and Solutions->VC++ Directories. Select include files from the drop down box. Add c:\adchpp\stlport and c:\adchpp\boost_1_33_1 to the top of the list and save the settings.

8. Open Visual Studio’s command prompt from the start menu (regular cmd won’t work) and change to c:\adchpp\boost_1_33_1\

9. Run the command set: VC80_ROOT=%VCINSTALLDIR%

10. Run the command set: bjam “-sTOOLS=vc-8_0” install (this could take time)

11. In Visual Studio select File->New->Project from Existing code. Select Visual C++ project. Set project file location to c:\adchpp\ and project name to adchpp. In Add files box, remove c:\adchpp and add c:\adchpp\Windows and c:\adchpp\adchpp. Click next and select console application from the drop down box. Put BUILDING_ADCHPP in the preprocessor definitions box and in the Additional include box add c:\adchpp\ and click finish.

12. Right click the adchpp project and select Properties. Go to Linker->Input and input “ws2_32.lib Mswsock.lib” (without the quotes) to the Additional Dependencies box and click ok.

13. Open c:\adchpp\adchpp\config.h and scroll to line 59. It should look like

# if _MSC_VER == 1200 || _MSC_VER == 1300 || _MSC_VER == 1310

Change it to

# if _MSC_VER == 1200 || _MSC_VER == 1300 || _MSC_VER == 1310 || _MSC_VER == 1400 #define _CRT_SECURE_NO_DEPRECATE 1

14. Open c:\adchpp\adchpp\PluginManagerh and go to line 227. It should look like

ADCHPP_DLL static PluginManager* instance;

Change it to

static PluginManager* instance;

15. Go to Build->Build Solution and it should give you a finished adchpp for you to play around with =)