DC++K Help

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
[PT]Devilishly
Posts: 96
Joined: 2003-04-18 05:57
Location: Oporto, Portugal
Contact:

DC++K Help

Post by [PT]Devilishly » 2003-12-23 07:43

Hi,

I'm trying to adapt my DC++K to a Hub-link Network, so that it would check only users from the same hub as this client(this can be done by the connection, if it’s different from the usual connection types).
To do this, and since I don’t know nothing about C++, I’ve made this simple modifications:

Code: Select all

(StringDefs.cpp)

"Do not check zero byte sharers and users from other hubs(Hub-link Hub only)", //"Do not check zero byte sharers",

Code: Select all

(HubFrame.cpp)

if((((user->getBytesShared() == 0) || 
						!(user->getConnection().c_str()=="Cable"
						|| user->getConnection().c_str()=="28.8Kbps"
						|| user->getConnection().c_str()=="33.6Kbps"
						|| user->getConnection().c_str()=="56Kbps"
						|| user->getConnection().c_str()=="ISDN"
						|| user->getConnection().c_str()=="Satellite"
						|| user->getConnection().c_str()=="DSL"
						|| user->getConnection().c_str()=="LAN(T1)"
						|| user->getConnection().c_str()=="LAN(T3)"))
					&& (BOOLSETTING(DO_NOT_CHECK_ZERO_BYTE_SHARERS))))
					{
						shouldAdd = false;
					}

Code: Select all

(HubFrame.cpp)

bool shouldSkipCauseOfZeroBytesShared = (((user->getBytesShared() == 0) || 
					!(user->getConnection().c_str()=="Cable"
					|| user->getConnection().c_str()=="28.8Kbps"
					|| user->getConnection().c_str()=="33.6Kbps"
					|| user->getConnection().c_str()=="56Kbps"
					|| user->getConnection().c_str()=="ISDN"
					|| user->getConnection().c_str()=="Satellite"
					|| user->getConnection().c_str()=="DSL"
					|| user->getConnection().c_str()=="LAN(T1)"
					|| user->getConnection().c_str()=="LAN(T3)"))
					&& (BOOLSETTING(DO_NOT_CHECK_ZERO_BYTE_SHARERS)));
Ok, but this doesn’t solve my problem...
Does anyone can help me?

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-12-23 08:26

So the userlist shows users from a bunch of hubs, and you need dc++k to check only "local" users?

How do you indicate what hub a given user is on?

[PT]Devilishly
Posts: 96
Joined: 2003-04-18 05:57
Location: Oporto, Portugal
Contact:

Post by [PT]Devilishly » 2003-12-23 08:48

That is done in the connection type...
If the user is in hub "Hub_1" and I'm in "Hub_2", and his connection is cable; The connection type will apear "Hub_1Cable" (to me). If the user is in the same hub as me, it will apear only "cable".
So I don't need to know where the user is beacause I only want to check users ta are in the same hub as me("regular" connection type)...

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-12-23 08:56

Ok, that makes sense. Is HubFrame.cpp really where Sarf initiated the check for bad users? It seems like it should be as simple as using your code (though the .c_str() seems wasteful, the == should be overloaded for string and char[]) as a precondition to the check.

Oh, and check out modifying StringDefs.h and using MakeDefs to generate StringDefs.cpp and Example.xml. It should be as simple as passing relative paths to all three after compiling MakeDefs.exe ;)

[PT]Devilishly
Posts: 96
Joined: 2003-04-18 05:57
Location: Oporto, Portugal
Contact:

Post by [PT]Devilishly » 2003-12-23 10:58

Thanks GargoyleMT!! :o

Well that solved my problem"(though the .c_str() seems wasteful, the == should be overloaded for string and char[]) " :)

Best regards,
[PT]Devilishly

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-12-23 12:02

[PT]Devilishly wrote:Well that solved my problem"(though the .c_str() seems wasteful, the == should be overloaded for string and char[]) " :)
Hahaha, I guess I should've picked that up as the main problem instead of an aside. The cases should be consistent on connection types, but if they aren't, it could produce some unpredictable results - you can think about/look at Util::stricmp.

Or you could do a case-compare with the substring - to make sure the connection type beginning does not match "Hub_" - but you should probably aso check against whatever value Bots get assigned as well, just so there are no gotchas.

I hope this helps too. ;)

[PT]Devilishly
Posts: 96
Joined: 2003-04-18 05:57
Location: Oporto, Portugal
Contact:

Post by [PT]Devilishly » 2003-12-25 06:48

Thanks again GargoyleMT!
Yes, I‘ll try to improve the code, but by now I was very intrigued why doesn’t this work!! :? I think I had already tried to use it without the “.c_str()“ but I had many many errors(maybe they didn’t came from that ;))
Anyway Thanks a lot for the quick and effective help :)

Best regards,
[PT]Devilishly

ivulfusbar
Posts: 506
Joined: 2003-01-03 07:33

Post by ivulfusbar » 2003-12-25 07:34

Another way is ofcourse to change things on the hubserver side, Do the hub support $UserIP, and if so, does it send you $UserIP. Then you could trigger on this in your checks for example.
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

Locked