HubManager::save()

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

Moderator: Moderators

Locked
psf8500
Posts: 23
Joined: 2003-03-04 18:51
Contact:

HubManager::save()

Post by psf8500 » 2004-02-20 17:13

I'm trying to add an extra page to settings on 0.306 similar to the user commands page.

I did the obvious and used the user commands page as a template and edited it to my needs. Theres just one thing I can't quite figure out. I see frequent calls to the HubManager::save() function eg.

Code: Select all

void updateUserCommand(const UserCommand& uc) {
		bool nosave = true;
		Lock l(cs);
		for(UserCommand::Iter i = userCommands.begin(); i != userCommands.end(); ++i) {
			if(i->getId() == uc.getId()) {
				*i = uc;
				nosave = uc.isSet(UserCommand::FLAG_NOSAVE);
				break;
			}
		}
		if(!nosave)
			save();
	}
From what i understand the save() function updates the .xml file and FLAG_NOSAVE lets you know if this is needed or not.

What i don't get is where is the flag set? I can see lots of places where the state of the flag is accessed, but not where it is actually changed.

I'm probably missing something really obvious here... But can anyone help?

Twink
Posts: 436
Joined: 2003-03-31 23:31
Location: New Zealand

Post by Twink » 2004-02-20 20:01

the hub can send you custom usercommands for that particular hub, which are not saved so most likely the nosave feature is for that.

psf8500
Posts: 23
Joined: 2003-03-04 18:51
Contact:

Post by psf8500 » 2004-02-21 05:59

Thanks Twink that helps. Looks like the state of the flag is never changed, its just initialised whenever HubManager::getInstance()->addUserCommand is called :)

Locked