示例#1
0
BOOL EM_UserInfo::GetLocalHostIP(char *szBuf)
{
	ASSERT(NULL != szBuf);
	char buf[256]={NULL};
	GetLocalHostName(buf);

	char ip[128] = {NULL};
	hostent *host = gethostbyname(buf);

	if (host != NULL)
	{
		sockaddr_in sin;
		memcpy(& sin.sin_addr.s_addr, host->h_addr_list[0], host->h_length);
		strcpy(ip, inet_ntoa(sin.sin_addr));

		if (szBuf != NULL)
			strcpy(szBuf, ip);
		else
		{
			ErrorOccured();
			return FALSE;
		}
		strcpy(m_szIP, ip);
	}
	else
	{
		ErrorOccured();
		return FALSE;
	}
	return TRUE;
}
// -----------------------------------------------------------------------------
// CSIPClientDiscoveryReceiver::RunL
// -----------------------------------------------------------------------------
//
void CSIPClientDiscoveryReceiver::RunL()
    {
    TInt err = iStatus.Int();
    
    if (err == KErrServerTerminated)
        {
        // This will leave to RunError-function. See below.
    	User::Leave(err);
	    }
		
    if (err == KErrNone)
        {
        switch (iClientResolved())
            {
            case ESIPCRChannelComplete:
                HandleChannelResolvedL();
                break;
            
            case ESIPCRClientNotFound:
                HandleClientNotFoundL();
                break;
            
            default:
                break;
            }
        }
    else
        {
        ErrorOccured(err);
        }

	ReceiveNext ();
    }
示例#3
0
BOOL EM_UserInfo::GetGroupName(char *szGroupName)
{
	if ( szGroupName != NULL )
		strcpy(szGroupName, m_szGroupName);
	else
	{
		ErrorOccured();
		return FALSE;
	}

	return TRUE;
}
示例#4
0
BOOL EM_UserInfo::GetGender(char *szGender)
{
	if ( szGender != NULL )
		strcpy(szGender, m_szGender);
	else
	{
		ErrorOccured();
		return FALSE;
	}

	return TRUE;
}
示例#5
0
BOOL EM_UserInfo::GetDisplayName(char *szDisplayName)
{
	if ( szDisplayName != NULL )
	{
		ASSERT(NULL != m_szDisplayName);
		strcpy(szDisplayName, m_szDisplayName);
	}
	else
	{
		ErrorOccured();
		return FALSE;
	}

	return TRUE;
}
示例#6
0
BOOL EM_UserInfo::GetLocalHostName(char *szBuf/* = NULL*/)
{
	ASSERT(NULL != szBuf);

	char buf[512];
	gethostname(buf, 512);

	if (szBuf != NULL)
		strcpy(szBuf, buf);
	else
	{
		ErrorOccured();
		return FALSE;
	}

	return TRUE;
}