Close unused hubs feature ?

Archived discussion about features (predating the use of Bugzilla as a bug and feature tracker)

Moderator: Moderators

Locked
zoin
Posts: 1
Joined: 2003-03-20 20:14

Close unused hubs feature ?

Post by zoin » 2004-03-09 17:10

I would like a menuitem like "Close unused hubs" that would close all "unused" hubs.

For example:
I'm online on 10 hubs. A, B, C, D...
Downloading from a user that is on hub A
Uploading to a user on hub B
When i use the "Close unused hubs" item, it disconnects from hub C, D... but stays connected on hub A, B.

Is it possible to add a thing like this ?

Qbert
Posts: 73
Joined: 2003-06-07 03:12

Post by Qbert » 2004-03-09 20:56

I used to commonly do this manually a while ago. "Close disconnected" just wasn't enough for me, because I had to handle so many search requests when in a large amount of connected hubs. Obviously you can't just close every hub and expect that every user will continue to upload files to you, and so getting rid of hubs you didn't make use of seems logical.
I could see how this can be useful.
My Visual Studio .NET 2003 is licensed under my name, and the same for my operating system... What about you?
I surf on an OC3 without limitations, two to be exact, and I'm not joking.

darwusch
Posts: 23
Joined: 2004-03-19 12:57

Post by darwusch » 2004-08-06 11:30

This is a great idea, I've been thinking about it myself.

Let's try to code it, shall we.

The idea is like this:
If a hub is named in the TranferViews Hub column, some connection (up- or download) is active.

It should be placed just like the "Close disconnected" feature, in the Window menu.

In the file Hubframe.cpp it should look like this:

Code: Select all


void HubFrame::closeAllUnusedHubs() { 
   for(FrameIter i=frames.begin(); i!= frames.end(); ++i) { 
      if(!(i->second->isActiveHub)) { 
                  i->second->PostMessage(WM_CLOSE); 
      } 
   } 
}; 
 
Here the isActiveHub is a bool which is true when the hub is in the TransferViews Hub column.

Now I'm a bit stuck where and how I should set this isActiveHub to true when a hub is used.

I guess it should be something like:

Code: Select all


if (Util::stricmp(TransferView::COLUMN_HUB, name_of_hub_window)==0) 
isActiveHub = true 
 
But in what way are the hub windows named, and where to do this ? In TransferView.h maybe ?

Any help would be appreciated !!

Thanks

PseudonympH
Forum Moderator
Posts: 366
Joined: 2004-03-06 02:46

Post by PseudonympH » 2004-08-06 21:01

I was planning on telling you all off for being in more hubs than you can handle manually, but since one of you went ahead and gave adding the feature a shot I'll refrain.

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

Post by GargoyleMT » 2004-08-07 08:51

darwusch wrote:But in what way are the hub windows named, and where to do this ? In TransferView.h maybe ?
You need to add a function that will let you set the value of isActive inside th class you put it in.

To go into DC++, the measure of activity needs to be set and measured in the client project, not using the windows\ (GUI) part of the project. Then the menu item would trigger a call in mainfrm, which would call some function in clientmanager, which would close the clients that weren't active, which would cause the windows to go away.

darwusch
Posts: 23
Joined: 2004-03-19 12:57

Post by darwusch » 2005-01-11 07:31

I have been busy with other things for a while...
Now I would like to finish this feature.

I still don't know exactly where in the clientmanager the isActive should be set however.
The most robust way would be if every hub gets an additional flag, an integer, with the value of how many connections are active on that hub.
Every time a down- or upload starts, the integer gets incremented, and every time a down- or upload finishes, the integer gets decremented.

When closeAllUnusedHubs() is called, all hubs with integer flag == 0, will close.

Can anybody help me with how to add this flag to the hubs, and how / where to add the setting of the integer flag?

I know many people think this feature is not needed or something but it can really be helpful if you're looking for a rare file. Then you connect and disconnect from many hubs, to search for it. But you don't want to disconnect the users that download from you, so you want to keep those active hubs. To do this fast, this feature could help a lot.

Thanks for helping

Locked