Obviously there are some holes to be filled in, but the comments should lead you in the right direction.

This is not, by the way, a very efficient way to handle it, as switch_to_blog() is a bit of a resource hog. It’d be better to keep those activity items from being written in the first place. Look in bp-blogs.php to see how the bp_blogs_record_post() function works. I suggest that you hook to save_post (like bp_blogs_record_post() is) witha lower priority, do your category check, and then unhook bp_blogs_record_post from save_post if the post is in the returned category.