VAIN TALK H 843 "If a person sits with others in which there is vain talk and before leaving supplicates: 'Exalted are You O Allah, and Yours is the praise: I bear witness that there is none worthy of worship except You; I ask Your forgiveness and turn to You.' He is forgiven for his participation in that gathering." R 843 Tirmidhi with a chain up to Abu Hurairah who related that the Holy Prophet, praise and peace be upon him, said this.
831- وعن أَبي هريرة رضي الله عنه ، قَالَ : قَالَ رسول الله صلى الله عليه وآله وسلم : "مَنْ جَلَسَ في مَجْلِسٍ ، فَكَثُرَ فِيهِ لَغَطُهُ فَقَالَ قَبْلَ أنْ يَقُومَ مِنْ مَجْلِسِهِ ذَلِكَ : سُبْحَانَكَ اللَّهُمَّ وَبِحَمْدِكَ ، أشْهَدُ أنْ لا إلهَ إِلاَّ أنْتَ ، أسْتَغْفِرُكَ وَأَتُوبُ إلَيْكَ ، إِلاَّ غُفِرَ لَهُ مَا كَانَ في مَجْلِسِهِ ذَلِكَ" رواه الترمذي ، وقال : "حديث حسن صحيح" .