Speaking about    worldly matters in the mosque
Question

How should one behave, specially in a masjid, when the Adhan is being called? Are we allowed to talk worldly affairs while it is being called? Are we allowed to excange "Salam" (greetings) while it is being called?
Praise be to Allah.Al-Haakim reported in al-Mustadrak (4/359) that Anas ibn Maalik (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings of Allah be upon him) said: There will come a time when people will sit in circles in the mosques and they will have no concern except this world. Allah has no need of them so do not sit with them. This is a saheeh hadeeth even though al-Bukhaari and Muslim did not narrate it. Al-Dhahabi said in al-Talkhees that it is saheeh.
This hadeeth states that this blameworthy deed is disliked, because the mosques are not built for such a purpose. Allah commanded that mosques should be built to remember Him and to conduct prayers and acts of worship and obedience to Him, such as Itikaaf (retreat, seclusion for devotion and worship), and different kinds of dhikr such as circles for reciting Quran and seeking knowledge.
On the other hand, there are ahaadeeth that command us to repeat the words of the adhan after the muezzin, as a mustahabb or encouraged deed, and to set an example of how one should behave when hearing the adhan. Some people neglect this, and do not realize how much reward they are missing out on and how much they are to blame for that. What sort of hearts must they have?! They hear the remembrance of Allah then they turn away from Him, and it has no effect on their hearts so that they may fear Him and feel compelled to listen.
One of these ahaadeeth is that narrated by Imaam Muslim in his Saheeh (no. 384) from Amr ibn al-Aas (may Allah be pleased with him), who said that he heard the Prophet (peace and blessings of Allah be upon him) say: When any one of you hears the muezzin, let him say something like he says, then send blessings on me, for whoever sends blessings on me, Allah will send blessings tenfold on him. Then ask Allah to grant me al-waseelah, for it is a status in Paradise that only one of Allahs slaves will attain, and I hope that I will be the one. Whoever asks for al-waseelah for me, will be granted my intercession for him.
As for giving the greeting of salam and shaking hands, there is nothing wrong with this, for these are acts of obedience to Allah. There is no conflict between doing these things and responding to the muezzin, because a person may do all of these things at once.
Muslims should beware of doing anything that may offend or disturb those who come to the mosque for worship. This includes disturbing those who are reading Quran, praying or remembering Allah in the mosque. It is an evil deed (sayiah) to disturb the people in the mosque by talking about worldly affairs, because this is offensive to them and distracts Muslims from doing acts of worship properly. Disturbing others is not allowed, even if it takes the form of reading Quran, so how about if it takes other forms? Ahmad ibn Shuayb al-Nisaa'i reported in al-Sunan al-Kubra (5/32) under the heading Dhikr Qawl al-Nabi (peace and blessings of Allah be upon him) Laa yajhar badukam ala badin fil-Quran (Mentioning the statement of the Prophet (peace and blessings of Allah be upon him), None of you should compete with one another in reciting Quran loudly), a report from Abu Haazim al-Timaar from al-Bayaadi, that the Prophet (peace and blessings of Allah be upon him) came out and found the people praying and reciting in loud voices. He said: The one who is praying is conversing with his Lord, so let him think about what he is saying to Him. Do not compete with one another in reciting Quran loudly. Ibn Muhayreez (may Allah have mercy on him) is reported to have said: Speaking in the mosque is idle talk, except for one who is praying, or remembering his Lord, or asking for help or giving help. (Musannaf Abd al-Razzaaq, part 8, Baab Kalaam Ikrimah). Ibn al-Haaj said, concerning the manners of the Muslim when he sets out for the mosque: He should intend to avoid idle talk in the mosque or talking about that which does not concern him, for there is a report that says that speaking in the mosque about anything but the deeds of the Hereafter is like fire in dry wood, it eats up hasanaat (good deeds). So he should take care to avoid that, lest he goes out to engage in trade and comes back having lost everything because of his idle talk. (al-Madkhal by Ibn al-Haaj, part 1, al-Sunnah fil-Mashiy ilal-Masjid).
And Allah knows best. May Allah bless our Prophet Muhammad. Praise be to Allah, Lord of the Worlds.