int CRoomBottomLeftDlg::GetGuestCount() { if (GetUserManager() != NULL) { return GetUserManager()->GetGuestCount(); } return 0; }
int CRoomBottomLeftDlg::GetMicListCount() { if (GetUserManager() != NULL) { return GetUserManager()->GetWaitingCount(); } return 0; }
IUserItem * CRoomBottomLeftDlg::GetSelfUserItem() { if (GetUserManager() != NULL) { return GetUserManager()->GetSelfUserItem(); } return NULL; }
void CRoomBottomLeftDlg::OnClickNameLink( CString& strName , uint32 unUUID ) { IUserItem * pUserItem = GetUserManager()->SearchUserByUIN(unUUID); if (pUserItem != NULL) { if (m_UserListCtrl.GetSafeHwnd() && m_UserListCtrl.IsWindowVisible()) { m_UserListCtrl.MoveToUserItem(pUserItem); return; } if (m_ManagerListCtrl.GetSafeHwnd() && m_ManagerListCtrl.IsWindowVisible()) { m_ManagerListCtrl.MoveToUserItem(pUserItem); return; } if (m_ManagerListCtrl.GetSafeHwnd() && m_MicListCtrl.IsWindowVisible()) { m_MicListCtrl.MoveToUserItem(pUserItem); return; } if (m_SearchListCtrl.GetSafeHwnd() && m_SearchListCtrl.IsWindowVisible()) { m_SearchListCtrl.MoveToUserItem(pUserItem); return; } } }
void CRoomBottomLeftDlg::SearchUserList( std::wstring strKey, ENM_UserListType enmListType ) { m_SearchListCtrl.ShowWindow(SW_SHOW); std::vector<IUserItem*> vecUserItem; if (GetSelfUserItem() != NULL) { GetUserManager()->SmartSearch(enmListType, strKey, vecUserItem); } if (vecUserItem.size() != 0) { m_SearchListCtrl.InsertUserItem(vecUserItem); } else { m_SearchListCtrl.DeleteAllItems(); } }
void AD::AddUsers(LDAPMessage *search) { DWORD i; DWORD j; LDAPMessage *entry = NULL; PWCHAR attribute; PWCHAR *values; BerElement *berElement; for(i = 0; i < ldap_count_entries(ldap, search); i++) { User *u = new User(); if(!i) { entry = ldap_first_entry(ldap, search); } else { entry = ldap_next_entry(ldap, entry); } attribute = ldap_first_attribute(ldap, entry, &berElement); while(attribute != NULL) { //wprintf(L"%s: ", attribute); values = ldap_get_values(ldap, entry, attribute); u->sidString = L"N/A"; u->lastLogin = 0; u->lastLogout = 0; if(lstrcmpi(attribute, L"samaccountname") == 0) { u->accountName.append(values[0]); } if(lstrcmpi(attribute, L"cn") == 0) { u->fullName.append(values[0]); } if(lstrcmpi(attribute, L"homedirectory") == 0) { u->homePath.append(values[0]); } if(lstrcmpi(attribute, L"memberof") == 0) { for(j = 0; j < ldap_count_values(values); j++) { std::wstring groupString = values[j]; // The 3 offset from left makes sense (to cull out the CN=) // but I'm not quite sure whey I need to find()-3. Here's // hoping that doesn't break when tested out in the world. std::wstring subString = groupString.substr(3, groupString.find(L",")-3); std::wstring *testString = new std::wstring(subString); if(subString.length() > 0) { u->groups.push_back(new std::wstring(subString)); } } } ldap_value_free(values); ldap_memfree(attribute); attribute = ldap_next_attribute(ldap, entry, berElement); } ber_free(berElement, 0); // Moment of truth; we only want accounts with account names. if(u->accountName.length() > 0) { GetUserManager()->users.push_back(u); u->PrettyPrint(); } else { delete(u); } } }