Ask opinion about situations in which researchers/non-researchers get involved in projects (externally) and the best way to avoid strange situations
Situation A is more or less common specially it comes to publications. 

Generally in such situation, 


Both the parties should have clear cut understanding of role of each other before starting working on the project. 
Ethically, that researcher SHOULD knowledge you for your contribution in the project if she/he want's to get it published or submit to any grant agency. 
If you have contributed sufficiently and you think you should be part of their publication, you can just express your opinion to professor and make it clear. 
Do not 'assume' that they have kicked you out. There might be changes in their project direction and they might need some other set of skills.
Inform regarding this to your adviser. It is important to keep him/her in loop.


However also remember, sometimes whatever you have decided may not work out because experiments/analysis might need to get more help or reduce existing resources etc. Best thing to do in this case is talk to professor and see what is your role in this project. To avoid further such situations, always be clear about your role in project. Sometimes your role might change depending on direction or project or results you got. You should be flexible enough to handle such cases. 

In the case of situation B, try to contact their organization/institute regarding this. See what is the purpose of that advertisement. As you had not provided them any details, they could have come up with similar thing by their own. See their website /publications if they had working on similar thing before. Be patient and contact them again regarding this.