This is a followup request toin order to support integration with the OG module (via the og_flag module).
One of the barriers to fully implementing Organic Groups support is the need to apply group specific flag overrides early enough in the processing cycle so that the flag module itself and other contrib modules can react to the group specific overrides rather than the default system wide flag definition.
The attached patch adds a new hook to flag.module: hook_flag_get_flags().
This hook allows other modules to modify the list of available flags before they are filtered and returned to the calling functions. By making modifications to the flags at this point, I can avoid having to duplicate and potentially override other logic already existing in the flag module and other contrib modules. The OG Integration only allows group administrators to change existing settings such as the display text or permissions for a flag. It doesn't provide any new functionality.
The attached patch works on both the 2.x and 3.x branches of the flag module. Ideally this update would be incorporated into both branches.