void SimpleChatWidget::updateUsers() { if (userList_) { userList_->clear(); SimpleChatServer::UserSet users = server_.users(); UserMap oldUsers = users_; users_.clear(); for (SimpleChatServer::UserSet::iterator i = users.begin(); i != users.end(); ++i) { WCheckBox *w = new WCheckBox(escapeText(*i), userList_); w->setInline(false); UserMap::const_iterator j = oldUsers.find(*i); if (j != oldUsers.end()) w->setChecked(j->second); else w->setChecked(true); users_[*i] = w->isChecked(); w->changed().connect(this, &SimpleChatWidget::updateUser); if (*i == user_) w->setStyleClass("chat-self"); } } }
void MFModel::updateVectorsWithOneTime(UserMap um){ map<int, User*>::iterator umIter ; for(umIter = um.begin(); umIter != um.end(); umIter++){ int userID = umIter->first; User *user = umIter->second; updateVectorsWithOneUser(userID, user); } }
CHttpConn* GetHttpConnByUuid(uint32_t uuid) { CHttpConn* pConn = NULL; UserMap::iterator it = g_uuidConnMap.find(uuid); if (it != g_uuidConnMap.end()) { pConn = (CHttpConn *)it->second; } return pConn; }
User* getUserPtrbyId(int id,int allownewtype){ UserMap::iterator iter; iter =userlist.find(id); if(iter!=userlist.end()){ return iter->second; } if(allownewtype==NOALLOWNEW) return NULL; User *newuser=new User(id); userlist.insert(UserMap::value_type(id,newuser)); return newuser; }
void player_list(void) { UserMap users; ServerPrx server; server = meta->getServer(serverId, ctx); users = server->getUsers(ctx); cout << "SID Name Ping" << endl; for (UserMap::iterator ii=users.begin(); ii != users.end(); ii++) cout << setw(8) << right << (*ii).first << " " << (*ii).second.name << " " << (*ii).second.udpPing << endl; }
void CHttpConn::Close() { if (m_state != CONN_STATE_CLOSED) { m_state = CONN_STATE_CLOSED; g_httpConnMap.erase(m_sockHandle); g_uuidConnMap.erase(m_uuid); netlib_close(m_sockHandle); ReleaseRef(); } }
CHttpConn::CHttpConn() { m_busy = false; m_sockHandle = NETLIB_INVALID_HANDLE; m_state = CONN_STATE_IDLE; m_lastSendTick = m_lastRecvTick = get_tick_count(); m_uuid = ++g_uuidAlloctor; if (m_uuid == 0) { m_uuid = ++g_uuidAlloctor; } g_uuidConnMap.insert(make_pair(m_uuid, this)); m_HttpParser = new CHttpParserWrapper(); Logger.Log(INFO, "CHttpConn, handle=%u ", m_uuid); }