Re: multiple add friend requests - WeOnlyDo Discussion board

Re: multiple add friend requests (General questions)

by Sapna, Monday, June 15, 2009, 15:01 (5428 days ago) @ woddrazen

[code]void CViaClientDlg::XMPP_ContactAuthRequest(LPDISPATCH Contact, long* Action)
{
IXMPPContact cnt;

cnt.AttachDispatch(Contact);

CString jid = cnt.GetJid();

int i = jid.Find('/');

if (i > 1)
jid = jid.Left(i);

i = jid.Find(' ');

if (i > 1)
jid = jid.Left(i);
//linked list of buddies in a status sorted list
ClientObject *nav = SearchForClientInStatusSortedList(cnt) ;

if(nav == NULL)
{
CBuddyRequest m_pBuddyRequest ;
//to set the buddy name who wants to add you
m_pBuddyRequest.SetRequestBuddyName(jid) ;
int nRet = m_pBuddyRequest.DoModal() ;
if(nRet == IDOK)
{
//for getting the text of the button clicked whether accept, deny or //ignore
CString authorizationText = m_pBuddyRequest.GetAuthText() ;

if(authorizationText == Accept )
{
*Action = 1 ;
}
else if(authorizationText == Deny )
*Action = 0 ;
}
else
{
*Action = -1 ;
}
}
else
{
*Action = 3 ;
}
cnt.ReleaseDispatch() ;
}[/code]

this code when executed, crashes when the same buddy requests more than once.. is there a possible way out?


Complete thread: