Пример #1
0
BOOL Cmeetphonemeet::ReloadMemberList()
{
	if(!m_sConfUID.IsEmpty())
	{
		LinphoneCore *lc = theApp.GetCore();
		CString restMethod;
		restMethod.Format(_T("/mcuWeb/controller/getConferenceMember?confid=%s"), m_sConfUID);
		Json::Value response;
		if(http_get_request(restMethod, response)) 
		{
			m_hListMember.DeleteAllItems();
			int real_index = 0;
			for ( unsigned int index = 0; index < response.size(); ++index ) 
			{
				
				const char* strName = response[index]["name"].asCString();
				const char *ip = response[index]["ip"].asCString();
				const char *state = response[index]["state"].asCString();
				int memberId = response[index]["id"].asInt();
				bool muted = response[index]["ismute"].asBool();
				if(state != NULL && strcasecmp("CONNECTED", state) == 0) {
					state = _(state);
				} else {
					continue;
				}
				CString cStrName;
				convert_utf8_to_unicode(strName, cStrName);
				m_hListMember.InsertItem(index, _T(""));
				m_hListMember.SetItemText(real_index, 1, cStrName);
				m_hListMember.SetItemText(real_index, 2, CString(ip));
				m_hListMember.SetItem(real_index, 3, LVIF_IMAGE, NULL, 0,LVIS_SELECTED, LVIS_SELECTED, NULL );
				if(lc->is_admin)
				{
					int image_pos = muted ? 3 : 1;
					m_hListMember.SetItem(real_index, 4, LVIF_IMAGE, NULL, image_pos,LVIS_SELECTED, LVIS_SELECTED, NULL );
					m_hListMember.SetItem(real_index, 5, LVIF_IMAGE, NULL, 2,LVIS_SELECTED, LVIS_SELECTED, NULL );
				}
				MemberData *memberData = new MemberData;
				memberData->memberId = memberId;
				memberData->muted = muted;
				m_hListMember.SetItemData(real_index, (DWORD_PTR)memberData);
				real_index++;
			}
		}
	}
	return TRUE;
}
Пример #2
0
//--------------------------------------------------------------------------------
//
//  Unicode file io API
//
//--------------------------------------------------------------------------------
int EmacsFile::fio_get( EmacsChar_t *buf, int len )
{
    if( m_convert_size < CONVERT_BUFFER_SIZE )
    {
        int size = fio_get( m_convert_buffer + m_convert_size, CONVERT_BUFFER_SIZE - m_convert_size );
        if( size <= 0 )
            return size;

        m_convert_size += size;
    }

    if( m_encoding_attr == FIO_Encoding_UTF_8 )
    {
        int utf8_usable_len = 0;
        int unicode_len = length_utf8_to_unicode(
                m_convert_size, m_convert_buffer,   // convert these bytes
                len,                                // upto this number of unicode chars
                utf8_usable_len );                  // and return the number of bytes required

        // convert
        convert_utf8_to_unicode( m_convert_buffer, unicode_len, buf );

        // remove converted chars from the buffer
        m_convert_size -= utf8_usable_len;
        memmove( m_convert_buffer, m_convert_buffer+utf8_usable_len, m_convert_size );

        return unicode_len;
    }
    else
    {
        int utf16_usable_len = 0;
        int unicode_len = length_utf16_to_unicode(
                m_convert_size, m_convert_buffer,   // convert these bytes
                len,                                // upto this number of unicode chars
                utf16_usable_len );                 // and return the number of bytes required

        // convert
        convert_utf16_to_unicode( m_convert_buffer, unicode_len, buf );

        // remove converted chars from the buffer
        m_convert_size -= utf16_usable_len;
        memmove( m_convert_buffer, m_convert_buffer+utf16_usable_len, m_convert_size );

        return unicode_len;
    }
}