Archive for the ‘Source code’ Category

Translation update

April 14, 2008

There’s a new release coming in a few days and the translations templates on launchpad have been updated – if you want your language to be complete please have a look…

In the future I’ll only post these updates to http://sourceforge.net/mailarchive/forum.php?forum_name=dcplusplus-devel, so please subscribe if you’re interested in keeping your translation up to date…it’s a low-traffic list, so you don’t have to worry…

DC++ at the local Bazaar

March 29, 2008

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.

Coral network coming to a DC++ near you

November 8, 2007

The upcoming version of DC++ will include more hub list addresses than it already does. However, while these additions are technically pointing to different addresses, they reference the same hub lists as the current set does.

What DC++ is going to utilize is the Coral distributed network to download hub lists. It does that by appending “nyud.net” to the hub list host. What Coral will do is that it will download the hub list, cache it in the distributed network and when you try to use the hub list, you’re using the cached one. This will mean that hub list owners will be able to have a lower upload bandwidth to distrubute their file.

Coral will be able to catch newly updated material within 5 minutes. Beyond that, there’s an automatic expiry limit before the file will be discarded in the network, which is set to 12 hours.

(I don’t think it’s possibly to set the expiry limit if the lists are in .bz2. You might be able to pull it off in the XML file, but I don’t know if Coral will treat it properly. Use the HTTP directive HTTP-EQUIV=”EXPIRES” to set the expiry limit.)

(Yes, this update was intentionally timed after the 0.703 release.)

Note that this is just a testing phase. If successful, the Coral:d lists will completely replace the others.

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

Compiling DC++ in new format

September 4, 2007

It’s been a while since last release of DC++. What has been going on since? Well, a lot of changes are done, and this means that the compiling process changed too.

First of all, Microsoft’s Visual C++ is no longer required for the compile process. Instead of it, MinGW is used. MinGW stands for Minimalist Gnu for Windows, and it’s the gcc ( and g++ ) compiler, moved to Windows.

To install mingw, download from their site the following packages in tar.gz format ( not the sources ) w32api, binutils, mingw-runtime, gcc-core and gcc-g++. You need the 4.2+ version of gcc ( still appears as a technology preview ).

There are 2 variants of gcc, dw2 and sjlj, it is possible to work with the sjlj variant, but I used dw2 and it worked fine. Untar all those in a folder named MinGW by example, go to MinGW/bin and copy gcc-dw2.exe to gcc.exe and g++-dw2.exe to g++.exe . Now, add the MinGW/bin to your path.

Install SCons; and add it to your path ( SCons requires Python, so you will need to install that first).

Download HTML help workshop . Copy the include and library files to the respective directories in the htmlhelp folder. Make sure hhc.exe is in your PATH.

The installation of STLport is the main problem I faced while trying to compile. First, install CygWin. After that, get STLport ( version 5.1.3 , latest at this time ). Unzip the stlport to stlport folder in the DC++ source. Now, run cygwin, and browse to stlport/build/lib.

Now, type : make -f gcc.mak After it’s finished, type also

make -f gcc.mak install

make -f gcc.mak install-release-static
make -f gcc.mak install-dbg-static
make -f gcc.mak install-stldbg-static

Last three are required so that DC++ will run stand-alone ( with no required dlls).

Now, open a command prompt and run scons. Following options are available :

“tools=mingw” – Use mingw for building (default)
“tools=default” – Use msvc for building (yes, the option value is strange)
“mode=debug” – Compile a debug build (default)
“mode=release” – Compile an optimized release build

I used scons tools=mingw mode=release

If you get some error about uPnP or something like that, you need to get natupnp.h; and paste it to MinGW/include folder.

If some other references errors show up, try running scons again.

Don’t worry if lots of warnings appear ( they don’t stop the compiling process, and they will be fixed in near future ).

Don’t get scared if the .exe is a bit large ( it contains redundant symbols ). The exe will be optimised into smaller size ( I got 88 MB exe, and after optimization it should get below 8 MB )

Cross-compiling DC++ on Linux

August 12, 2007

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!”

TLS disabled, failed to generate certificate

August 6, 2007

“TLS disabled, failed to generate certificate:” followed by “Failed to load certificate file” is probably something you’ve seen. Most people, almost frantically, think that DC++ is somehow broken. Well, it’s not.

The short answer to all this is; Ignore the message. If you don’t know what it means, just ignore it.

The medium length answer to all this is; Ignore the message. The message concern TLS, which is encryption on DC. I’ve in the past written about it (though, I’m not sure how outdated that post is). The TLS will only work on ADC hubs, which there are few of. And you’re most likely not on one of them. (Unfortunately, I might add.) So, you aren’t likely to need this anyway. Just ignore it.

The long answer to all this is; Ignore the message, unless you know what you’re doing. The first message come when DC++ tries to see if you have any certificates file entered in the settings for DC++. If you don’t have entered anything in the “Security Certificates” window, in the box “Private key file” or the “Own certificate file” box. (Or if they aren’t in their default DC++ folder, which they’re likely not when you’ve just installed DC++.) The second message come when you haven’t entered anything in the “Own certificate box”, or when there occur an error when using what’s inputted. (There’s a couple of things that could go wrong – I’m not confident to talk about any of them.) (The different messages are there because they mean different things.)

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

Edit: I feel that I need to edit this post. The message have no effect on your ability to download or search. Consult the FAQ for such inqueries.

Continue on with your break

August 2, 2007

A really nifty feature in DC++ is the ability to change the priority of files in the download queue, with the keyboard. It’s quite simple, you just press ‘+’ or ‘-’ on the numeric keyboard. When you select multiple files, all of them change priority.

At one point, however, selecting multiple files and changing the priority on them, didn’t really change the priority for some files. This appeared (at first) to happen randomly, but after a couple of minutes, the reason became more clear.

When you selected several files, that had different priorities, and pressed ‘+’ or ‘-’ until one of the files reached “Highest” or “Paused”, the other files completely seized to update. You could try pressing 4, or 400, times more, but nothing would happen.

The buggy code was similar to what I’ve written below.
1. loop until the entire list of files have been looked at
2. if the selected file is in “highest” or “paused” mode, break to 4 and continue on
3. otherwise, change the priority and jump back to 1 and continue on
4. “do some other stuff that isn’t related to this…”

If you notice, the above “code” show exactly what the bug report said. The solution was quite simple, too; “change the 4 to a 1″.

Now you know what you’ve always (secretly) wanted to know about that priority bug.

(The reason “break” and “continue” is used here, is because the actual fix was to literally replace the code “break” with “continue”.)

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

UPnP file required for compiling

May 7, 2007

At one point in time, DC++ added support for UPnP, which enabled DC++ an automagic configuration for active mode.

For accomplish this, a specific file in the source code was required. This file is called ‘natupnp.h’. I’m sure people have noticed it; the compile information mention this file and if you’ve attempted to compile DC++ without the file, the compiler would complain.

(Visual Studio 2005 have this file built in, but if you used Visual Studio 2003, you need this file in your includes.)

The compile information note that you can get the file in three ways; (1) To download the .NET SDK, (2) get it through our Bugzilla install (which is down, yes) and (3) by contacting someone of us and then we’d give it to you.

Unfortunately, this presents us with a problem. We might actually be in a pickle if we provide it for you directly because we don’t have permission by Microsoft to distribute it.

So to save us all some time and trouble, download the SDK provided by Microsoft and you’re all set.

(I don’t know if this file, or another one, is required for UPnP compilation with other compilers, other than Microsoft’s.)

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

Interface change in upcoming versions

April 3, 2007

A very large change in upcoming versions of DC++ is that the interface will change. Hopefully, the interface change will be transparent for users, and only be noticeable for developers.

So, what is changing? Well, the intent is to remove all of the WTL code, the code that handles the interface, and translate it to Smartwin code. The code is similar, but not exactly the same. This translation process will take quite a while, so you need to have patience.

The fact that DC++ is going to use Smartwin, instead of WTL, will mean that we will get rid of the dependancy for Visual Studio. DC++ will still be able to be compiled with VS, but you aren’t required to have it to compile DC++. From now on, one can compile DC++ with mingw. All in all, DC++ will be able to be compiled with completely free (of charge) tools. (Read compile.txt for specific instructions.)

No, Smartwin does not mean that one can natively run DC++ on Linux or Macintosh. Luckily, there’s projects like LinuxDC++ and MultiDC++, for respectively system.

If you are interested in translating the code in DC++, everything in “#ifdef PORT_ME” (and the corresponding “#endif”) is the old code that need to be translated.

If you have no idea what I’m talking about, let me put it this way; Every window in DC++ need to be re-written “from scratch”. (No, this does not mean that entire DC++ need to be re-written.)

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

Detecting your hub software

March 25, 2007

There exist many hubs for NMDC, and for ADC. Although the amount of hubs supporting the former is greater, the latter is increasing.

As hubs get developed, they are intended for an audience, and the hub developer will try to market the software so more people will use the hub.

One of the market tricks hub developers use is that they will broadcast what the hub is called, when your client connect to the hub. You’ve seen it; “This hub is using DCH++” or some other type of message.

Though, the target audience is not just the normal users of the hub. It is also a hub list. The hub list can then, through either a website or the actual hub list file, broadcast what hub is being used. This is great advertisement, as the hub developer don’t need to do any active marketing.

However, the hub list isn’t composed of some guy in a basement manually typing the hub software used. Hub lists use programs to determine the hub software. This mean that the program need to look at a specific pattern to identify a hub.

When a client connects to a hub, the hub will broadcast the software. As we have two different protocols, we have two different methods of doing so. In NMDC, the hub list will check the $Lock the hub send. Respectively in ADC, the hub list will look at the VE parameter in the INF.

To do this effectively, Gadget (one of the people behind Hublist.org) published Visual Basic code to be able to parse the information in the lock, so it’s NMDC. But it shouldn’t be very difficult for you to replace the “$Lock” stuff with “VE” or some such. In the code, regular expressions are used, so you need to find the corresponding function in your language to do the same thing.

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