What are functions for..

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

Moderator: Moderators

Locked
Duran
Posts: 1
Joined: 2003-07-14 10:52

What are functions for..

Post by Duran » 2003-07-14 11:04

... force attempt and usernick. I tried to read source. I'm not 100% sure is cgi->getUser() function to get username of client which you try to connect (line 197-> ConnectionManager.cpp on oDC. Lines 197-199:

Code: Select all

                while(i != pendingDown.end()) {
                        ConnectionQueueItem* cqi = i->first;
                        dcassert(cqi->getUser());
). I'm trying to make oDC try again on smaller time than it normaly does (60s). I have found line where it checks time. Current problem is that I need to use 'Force attempt' pretty many times (it just says "Connecting...". When I press 'Force attempt', it starts downloading or gives normal error message ('no slots available' etc.). I want to use 'force attempt' feature for some users on every 10th time it tries to connect).

Thank you.

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Post by sarf » 2003-07-14 18:36

The cqi->getUser() actually returns a pointer to a User object. The User object contains lots of things, among them, the Client (which is a reference to the hub that the user is connected to).

Umm... did this answer your question?

This is how DC++ does a force attempt :

Code: Select all

LRESULT MainFrame::onForce(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
	int i = -1;
	while( (i = ctrlTransfers.GetNextItem(i, LVNI_SELECTED)) != -1) {
		ctrlTransfers.SetItemText(i, COLUMN_STATUS, CSTRING(CONNECTING_FORCED));
		((ItemInfo*)ctrlTransfers.GetItemData(i))->user->connect();
	}
	return 0;
}
... so the only thing you should need to do is to do a user->connect() whenever you want to "force attempt" someone.

Ehm... hope this helps.

Sarf
---
Win a live rat for your mother-in-law!

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

Re: What are functions for..

Post by GargoyleMT » 2003-07-19 16:41

Duran wrote:I have found line where it checks time. Current problem is that I need to use 'Force attempt' pretty many times (it just says "Connecting...". When I press 'Force attempt', it starts downloading or gives normal error message ('no slots available' etc.). I want to use 'force attempt' feature for some users on every 10th time it tries to connect).
If they also have files they want to download from you, this would explain the lack of a GUI update. This is a problem that Sedulus experiences frequently... I tried to make a patch, very early in my DC++ experiments. Bug 687087 is the tracker number for it. Take a look, this is probably what you're seeing.

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Post by Sedulus » 2003-07-19 18:28

http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

Locked