本文整理汇总了C++中UserInfo类的典型用法代码示例。如果您正苦于以下问题:C++ UserInfo类的具体用法?C++ UserInfo怎么用?C++ UserInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// !SMT!-S
LRESULT UsersFrame::onIgnorePrivate(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
int i = -1;
while ((i = ctrlUsers.GetNextItem(i, LVNI_SELECTED)) != -1)
{
UserInfo *ui = ctrlUsers.getItemData(i);
FavoriteManager::getInstance()->setNormalPM(ui->getUser());
ui->columns[COLUMN_IGNORE].clear();
switch (wID)
{
case IDC_PM_IGNORED:
ui->columns[COLUMN_IGNORE] = TSTRING(IGNORE_S);
FavoriteManager::getInstance()->setIgnorePM(ui->getUser(), true);
break;
case IDC_PM_FREE:
ui->columns[COLUMN_IGNORE] = TSTRING(FREE_PM_ACCESS);
FavoriteManager::getInstance()->setFreePM(ui->getUser(), true);
break;
};
updateUser(ui->getUser());
ctrlUsers.updateItem(i);
}
return 0;
}
示例2: throw
//----------------------------------------------------------------------
//
// GMServerInfoHander::execute()
//
// 게임 서버가 로그인 서버로부터 GMServerInfo 패킷을 받게 되면,
// ReconnectLoginInfo를 새로 추가하게 된다.
//
//----------------------------------------------------------------------
void GMServerInfoHandler::execute (GMServerInfo * pPacket )
throw(ProtocolException , Error )
{
__BEGIN_TRY __BEGIN_DEBUG_EX
__BEGIN_DEBUG
#ifdef __LOGIN_SERVER__
ZONEUSERDATA rData;
WorldID_t WorldID = pPacket->getWorldID();
ServerGroupID_t ServerGroupID = pPacket->getServerID();
BYTE MaxCount = pPacket->getZoneUserCount();
UserInfo * pUserInfo = g_pUserInfoManager->getUserInfo(ServerGroupID, WorldID);
pUserInfo->setUserNum(0);
Assert(pUserInfo != NULL);
for(int count = 0; count < MaxCount; count++ ) {
pPacket->popZoneUserData(rData);
pUserInfo->setUserNum(pUserInfo->getUserNum() + rData.UserNum);
}
#endif
__END_DEBUG
__END_DEBUG_EX __END_CATCH
}
示例3: while
//! \brief
void IncomingUdp::onExecute()
{
char buffer[ max_packet_size ]; // TODO: Member variable? Allow max_packet_size to be defined by configuration
// Memory allocation comes from round-robin memory buffer(s) to remove
// the necessity for new/delete blocks
while ( isActive() )
{
const int dataLength = m_socket.recv( buffer, max_packet_size );
if ( dataLength < 0 )
{
if ( isActive() )
{
processSocketError( dataLength );
}
}
else if ( dataLength > 0 ) // TODO: Simpler if the message queue handles this?
{
m_queue->push( buffer, dataLength );
// TODO: Should validate packet then pass it into message queue, we shouldn't know about UserInfo at this level.
// TODO: Decrypt packet content
UserInfo *user = findUser( packetInfo.publicKey );
if ( user && user->ipAddress == packetInfo.ipAddress )
{
user->queueMessage( buffer, dataLength );
}
else
{
m_log->Error( kModuleName, "Received unexpected UDP packet.\n" );
}
}
}
}
示例4: main
int main ()
{
try {
Connection connection("hostname", 22, true);
// connection.setCredentials("", "");
// connection.setKeyPath("");
UserInfo ui = connection.getUserInfo();
cout << "User infos:\n"
<< " login: " << ui.getUserName() << endl
<< " home: " << ui.getHomeDir() << endl
<< " shell: " << ui.getUserShell() << endl;
connection.mkConnection();
if (connection.isSessionValid())
cout << "Connection OK" << endl;
connection >> "whoami"
>> "id"
>> "echo 'test' > msg"
>> "cat msg";
string received_out = connection.getLastOutput();
cout << "Received output: " << endl << received_out << endl;
} catch (Exception & e) {
cout << "Exception caught: " << e.what() << endl;
}
return 0;
}
示例5: throw
void NsAdapterCatalog::updateUser(const UserInfo& user) throw (DmException)
{
// uid may not be initialized
UserInfo u = this->getUser(user.name);
wrapCall(dpns_modifyusrmap(u.getUnsigned("uid"),
(char*)user.name.c_str(),
user.getLong("banned")));
}
示例6: throw
//----------------------------------------------------------------------
// load data from database
//----------------------------------------------------------------------
void UserInfoManager::load ()
throw(Error )
{
__BEGIN_TRY
Statement * pStmt;
BEGIN_DB
{
pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
Result* pResult = pStmt->executeQuery(
"SELECT MAX(WorldID) FROM GameServerGroupInfo"
);
if (pResult->getRowCount() == 0)
{
throw Error("GameServerGroupInfo TABLE does not exist!");
}
pResult->next();
m_MaxWorldID = pResult->getInt(1) + 2;
SAFE_DELETE(pStmt);
}
END_DB(pStmt)
m_UserInfos= new HashMapUserInfo[m_MaxWorldID];
try {
pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
Result * pResult = pStmt->executeQuery(
"SELECT WorldID, GroupID FROM GameServerGroupInfo"
);
while (pResult->next() ) {
UserInfo * pUserInfo = new UserInfo();
WorldID_t WorldID = pResult->getInt(1);
pUserInfo->setWorldID(WorldID);
pUserInfo->setServerGroupID(pResult->getInt(2));
pUserInfo->setUserNum(0);
addUserInfo(pUserInfo);
}
} catch (SQLQueryException & sqe ) {
// 필살 삭제!
delete pStmt;
throw Error(sqe.toString());
}
// 필살 삭제!
delete pStmt;
__END_CATCH
}
示例7: u
void TestUserInfo::isTalkingTo()
{
UserInfo u(m_ipbxid, "1234");
u.setPhoneIdList(QStringList() << "asterisk/p1");
UserInfo *other = new UserInfo("asterisk", "u2");
other->setPhoneIdList(QStringList() << "asterisk/p2");
QCOMPARE(u.isTalkingTo("asterisk/u2"), false);
b_engine->setUser("asterisk/u2", other);
QCOMPARE(u.isTalkingTo("asterisk/u2"), true);
}
示例8: qDebug
/*! \brief display the context Menu
*/
void ExtendedTableWidget::contextMenuEvent(QContextMenuEvent * event)
{
qDebug() << Q_FUNC_INFO << event;
qDebug() << " " << event->pos();
QTableWidgetItem *item = itemAt(event->pos());
QAction *action;
if (item) {
event->accept();
QMenu contextMenu( this );
if (m_editable) {
action = contextMenu.addAction(tr("&Remove"), this, SLOT(remove()));
action->setProperty("row", row(item));
}
if (m_re_number.exactMatch(item->text())) {
action = contextMenu.addAction(tr("&Dial"), this, SLOT(dialNumber()));
action->setProperty("number", item->text());
QMenu *transferMenu = new QMenu(tr("Direct &Transfer"), &contextMenu);
QMenu *indirectTransferMenu = new QMenu(tr("&Indirect Transfer"), &contextMenu);
UserInfo *ui = b_engine->getXivoClientUser();
if (ui) {
foreach (const QString phone, ui->phonelist()) {
const PhoneInfo * pi = ui->getPhoneInfo( phone );
if (pi) {
QMapIterator<QString, QVariant> it( pi->comms() );
while(it.hasNext()) {
it.next();
QMap<QString, QVariant> call = it.value().toMap();
// Add the transfer entry with the callerid name and num
QString text;
if (call.contains("calleridname")) {
text.append( call["calleridname"].toString() );
text.append(" : ");
}
text.append(call["calleridnum"].toString() );
action = transferMenu->addAction(text, this, SLOT(dtransfer()));
action->setProperty("chan", call["peerchannel"]);
action->setProperty("number", item->text());
action = indirectTransferMenu->addAction(text, this, SLOT(itransfer()));
action->setProperty("chan", call["thischannel"]);
action->setProperty("number", item->text());
}
}
}
}
if (!transferMenu->isEmpty()) {
contextMenu.addMenu(transferMenu);
}
if (!indirectTransferMenu->isEmpty()) {
contextMenu.addMenu(indirectTransferMenu);
}
} else if(item->text().contains("@")) { // this is an email address
示例9: handleDescription
void UsersFrame::handleDescription() {
if(users->countSelected() == 1) {
int i = users->getSelected();
UserInfo* ui = users->getData(i);
ParamDlg dlg(this, ui->columns[COLUMN_NICK], T_("Description"), ui->columns[COLUMN_DESCRIPTION]);
if(dlg.run() == IDOK) {
FavoriteManager::getInstance()->setUserDescription(ui->getUser(), Text::fromT(dlg.getValue()));
ui->columns[COLUMN_DESCRIPTION] = dlg.getValue();
}
}
}
示例10: port
ContainerStatus ContainerManagement::getContainerStatus(Container &container,
Token &nmToken) {
//1. setup Connection to NodeManager
string host = container.getNodeId().getHost();
ostringstream oss;
oss << container.getNodeId().getPort();
string port(oss.str());
LOG(INFO,
"ContainerManagement, is going to connect to NM [%s:%s] to getContainerStatus container",
host.c_str(), port.c_str());
UserInfo user = UserInfo::LocalUser();
Yarn::Token anotherToken;
anotherToken.setIdentifier(nmToken.getIdentifier());
anotherToken.setKind(nmToken.getKind());
anotherToken.setPassword(nmToken.getPassword());
anotherToken.setService(nmToken.getService());
user.addToken(anotherToken);
RpcAuth rpcAuth(user, AuthMethod::TOKEN);
Yarn::Config config;
SessionConfig sessionConfig(config);
#ifdef MOCKTEST
ContainerManagementProtocol *nmClient = stub->getContainerManagementProtocol();
#else
ContainerManagementProtocol *nmClient = new ContainerManagementProtocol(
host, port, anotherToken.getService(), sessionConfig, rpcAuth);
#endif
ContainerId cid = container.getId();
list<ContainerId> cids;
cids.push_back(cid);
GetContainerStatusesRequest request;
request.setContainerIds(cids);
GetContainerStatusesResponse response = nmClient->getContainerStatuses(request);
//3. free
delete nmClient;
list<ContainerStatus> statusList = response.getContainerStatuses();
if (statusList.size() > 0){
list<ContainerStatus>::iterator statusHead = statusList.begin();
return (*statusHead);
}else{
ContainerStatus status;
return status;
}
}
示例11: writeMutex
int UserInfoMng::removeIdleUsers(void)
{
WriteMutex<PasMutex> writeMutex(lockUserInfo);
map<intMDN_t, UserInfo*>::const_iterator mdnpos = MDNs.begin();
vector<intMDN_t> idleMdnList;
vector<intIP_t> idleIpList;
time_t now = time(NULL);
for( ; mdnpos != MDNs.end(); mdnpos++)
{
// 상용에서는 20분
UserInfo *userInfo = mdnpos->second;
if (userInfo && userInfo->isIdle(now, maxIdleSec))
{
idleMdnList.push_back(mdnpos->first);
idleIpList.push_back(mdnpos->second->getIntIpAddr());
}
}
if (idleMdnList.size()==0)
return 0;
//PAS_INFO1("UserInfoMng:: found %d IDLE users", idleMdnList.size() );
int delCount = 0;
for (unsigned int i=0; i<idleMdnList.size(); i++)
{
char stripaddr[32];
Util::int2ipaddr(idleIpList[i], stripaddr, sizeof(stripaddr)-1);
PAS_TRACE2("UserInfoMng:: Idle user{MDN[0%d] IP[%s]}", idleMdnList[i], stripaddr);
map<intMDN_t, UserInfo*>::const_iterator mdnfound = MDNs.find(idleMdnList[i]);
if(mdnfound != MDNs.end())
{
delete mdnfound->second;
MDNs.erase(idleMdnList[i]);
IPs.erase(idleIpList[i]);
delCount++;
}
}
PAS_INFO3("UserInfoMng:: %d idle, %d deleted, %d left",
idleMdnList.size(), delCount, MDNs.size());
userCount = MDNs.size();
return delCount;
}
示例12: iniHelper
UserInfo* UserInfo::getUserMap(QString iniFile, QStringList keys, QString passphrase)
{
FUNC_DEBUG;
INIHelper iniHelper(iniFile);
UserInfo* info = new UserInfo();
for (int i = 0; i < keys.size(); i++) {
iniHelper.readValue("User",keys.at(i));
info->addUser(keys.at(i)
,iniHelper.readValue("User",keys.at(i))
,Crypt::decrypt(passphrase,iniHelper.readValue("Password",keys.at(i))));
}
return info;
}
示例13: throw
void ClientManager::userUpdated(sid_type sid, UserInfo const& ui) throw()
{
LocalUsers::iterator i = localUsers.find(sid);
if(i == localUsers.end())
assert(0); // maybe use this for remote later, but now...
const string& oldNick = i->second->getUserInfo()->getNick();
const string& newNick = ui.getNick();
if(ui.has("NI")) {
nicks.erase(oldNick);
nicks.insert(newNick);
}
// CID can't change, nothing else to do
}
示例14: addContact
void Home::setSurname(void *cmdptr, void *idptr)
{
std::vector<const char *> *value = (std::vector<const char *> *)cmdptr;
std::vector<int> *id = (std::vector<int> *)idptr;
std::map<int, UserInfo *>::iterator it;
static int tmp = 0;
if ((it = _musers.find(id[0][0])) == _musers.end()) {
UserInfo *info = new UserInfo;
if (tmp == 0)
_myid = id[0][0];
tmp++;
info->set_id(id[0][0]);
std::cout << info->get_id() << std::endl;
info->set_surname((*value)[0]);
_musers[id[0][0]] = info;
addContact(_musers[id[0][0]]);
}
else {
UserInfo *tmp = _musers[id[0][0]];
std::string stmp;
tmp->set_surname((*value)[0]);
stmp = tmp->get_name() + " " + tmp->get_surname();
std::map<int, t_contact *>::iterator it;
if ((it = _bcontact.find(id[0][0])) == _bcontact.end())
return;
_bcontact[id[0][0]]->item->setText(stmp.c_str());
}
}
示例15: throw
std::vector<UserInfo> BuiltInAuthn::getUsers(void) throw (DmException)
{
std::vector<UserInfo> users;
UserInfo user;
struct passwd* ent;
while ((ent = getpwent()) != NULL) {
user.clear();
user.name = ent->pw_name;
user["uid"] = ent->pw_uid;
users.push_back(user);
}
return users;
}