Using drupal_set_message should be reserved to UI related code, like forms.
If an API function that can/would be called programmatically, it should not contain drupal_set_message because their is no guarantee that it is being called from the UI. So instead of putting the drupal_set_message call in the API function put it in the form function that is guaranteed to be called by the UI.
Examples can be found in the format plugins.
Comments
Comment #1
tom friedhof commentedWorking on this refs #25833 in OA
Comment #2
tom friedhof commentedThis is done.
Comment #3
dragonwize commentedComment #4
tom friedhof commented