BMessage msg(SH_COMMAND_REMOVECOMPONENTS);
msg.AddString(SH_NAME_TO, "/Joe");
msg.AddString(SH_NAME_CHILDREN, "X*");
root->PostMessage(&msg);
Note: Another way to do this is to send an SH_COMMAND_QUIT BMessage to the child nodes themselves:
BMessage msg(SH_COMMAND_REMOVECOMPONENTS);
msg.AddString(SH_NAME_TO, "/Joe");
msg.AddString(SH_NAME_SYMLINKS, "*");
root->PostMessage(&msg);
Note: The SH_NAME_SYMLINKS field will cause only children that are symlinks to be removed. It will never affect "real" children. However, the SH_NAME_CHILDREN field will cause symlinks to be removed, if the symlinks' names match the specified regular expression string(s).
BMessage msg(SH_COMMAND_REMOVECOMPONENTS);
msg.AddString(SH_NAME_TO, "/Joe");
SHNodeSpec filesToDelete;
filesToDelete.AddFlavor(SHFlavor("file1", 0,
0, 0, false)); // specify all args manually so that AddFlavor() will
filesToDelete.AddFlavor(SHFlavor("file2", 0,
0, 0, false)); // succeed even if the files don't exist on the sending
node.
msg.AddFlat(SH_NAME_FILES, &multiFiles);
root->PostMessage(&msg);
BMessage msg(SH_COMMAND_REMOVECOMPONENTS);
msg.AddString(SH_NAME_TO, "/Joe");
msg.AddString(SH_NAME_WORKERS, "RemoveMe*");
msg.AddString(SH_NAME_SORTERS, "DeadFred");
root->PostMessage(&msg);
Fancy Examples of SH_COMMAND_REMOVECOMPONENTS
BMessage msg(SH_COMMAND_REMOVECOMPONENTS);
msg.AddString(SH_NAME_TO, "/Joe");
msg.AddString(SH_NAME_WORKERS, "*"); //
Removes all SHWorkers
msg.AddString(SH_NAME_SORTERS, "*"); //
Removes all SHSorters (except the default SHWi1dPathSorter)
msg.AddString(SH_NAME_CHILDREN, "*"); // This
will remove all symlinks also!
root->PostMessage(&msg);
(Actually, this won't remove the SHWi1dPathSorter that the node was
given on startup--that sorter is protected from removal, because the SockHop
server uses it for internal operations)