本文整理汇总了C++中user::Ptr::setEmail方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::setEmail方法的具体用法?C++ Ptr::setEmail怎么用?C++ Ptr::setEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user::Ptr
的用法示例。
在下文中一共展示了Ptr::setEmail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onLine
//.........这里部分代码省略.........
if(ni == users.end()) {
u = users[nick] = ClientManager::getInstance()->getUser(nick, this);
} else {
u = ni->second;
}
}
j = param.find('$', i);
if(j == string::npos)
return;
string tmpDesc = Util::validateMessage(fromNmdc(param.substr(i, j-i)), true);
// Look for a tag...
if(tmpDesc.size() > 0 && tmpDesc[tmpDesc.size()-1] == '>') {
x = tmpDesc.rfind('<');
if(x != string::npos) {
// Hm, we have something...
u->setTag(tmpDesc.substr(x));
tmpDesc.erase(x);
} else {
u->setTag(Util::emptyString);
}
} else {
u->setTag(Util::emptyString);
}
u->setDescription(tmpDesc);
i = j + 3;
j = param.find('$', i);
if(j == string::npos)
return;
u->setConnection(fromNmdc(param.substr(i, j-i-1)));
i = j + 1;
j = param.find('$', i);
if(j == string::npos)
return;
u->setEmail(Util::validateMessage(fromNmdc(param.substr(i, j-i)), true));
i = j + 1;
j = param.find('$', i);
if(j == string::npos)
return;
u->setBytesShared(param.substr(i, j-i));
Speaker<NmdcHubListener>::fire(NmdcHubListener::MyInfo(), this, u);
} else if(cmd == "$Quit") {
if(!param.empty()) {
User::Ptr u;
{
Lock l(cs);
User::NickIter i = users.find(fromNmdc(param));
if(i == users.end()) {
dcdebug("C::onLine Quitting user %s not found\n", param.c_str());
return;
}
u = i->second;
users.erase(i);
}
Speaker<NmdcHubListener>::fire(NmdcHubListener::Quit(), this, u);
ClientManager::getInstance()->putUserOffline(u, true);
}
} else if(cmd == "$ConnectToMe") {
if(state != STATE_CONNECTED) {
return;
}
string::size_type i = param.find(' ');
string::size_type j;
if( (i == string::npos) || ((i + 1) >= param.size()) ) {
示例2: handle
void AdcHub::handle(Command::INF, Command& c) throw() {
if(c.getFrom().isZero() || c.getParameters().empty())
return;
User::Ptr u = ClientManager::getInstance()->getUser(c.getFrom(), this, true);
int op = 0;
int reg = 0;
int norm = 0;
string ve;
int sl = 0;
for(StringIterC i = c.getParameters().begin(); i != c.getParameters().end(); ++i) {
if(i->length() < 2)
continue;
if(i->compare(0, 2, "NI") == 0) {
u->setNick(i->substr(2));
} else if(i->compare(0, 2, "HU") == 0) {
hub = u;
} else if(i->compare(0, 2, "DE") == 0) {
u->setDescription(i->substr(2));
} else if(i->compare(0, 2, "I4") == 0) {
u->setIp(i->substr(2));
} else if(i->compare(0, 2, "SS") == 0) {
u->setBytesShared(i->substr(2));
} else if(i->compare(0, 2, "VE") == 0) {
ve = i->substr(2);
} else if(i->compare(0, 2, "EM") == 0) {
u->setEmail(i->substr(2));
} else if(i->compare(0, 2, "OP") == 0) {
if(i->length() == 2) {
u->unsetFlag(User::OP);
} else {
u->setFlag(User::OP);
}
} else if(i->compare(0, 2, "HO") == 0) {
op = Util::toInt(i->substr(2));
} else if(i->compare(0, 2, "HR") == 0) {
reg = Util::toInt(i->substr(2));
} else if(i->compare(0, 2, "HN") == 0) {
norm = Util::toInt(i->substr(2));
} else if(i->compare(0, 2, "SL") == 0) {
sl = Util::toInt(i->substr(2));
} else if(i->compare(0, 2, "BO") == 0) {
if(i->length() == 2) {
u->unsetFlag(User::BOT);
} else {
u->setFlag(User::BOT);
}
} else if(i->compare(0, 2, "HI") == 0) {
if(i->length() == 2) {
u->unsetFlag(User::HIDDEN);
} else {
u->setFlag(User::HIDDEN);
}
} else if(i->compare(0, 2, "HU") == 0) {
if(i->length() == 2) {
u->unsetFlag(User::HUB);
} else {
u->setFlag(User::HUB);
}
}
}
if(!ve.empty()) {
if(ve.find(' ') != string::npos) {
ve.insert(ve.find(' ') + 1, "V:");
}
u->setTag("<" + ve + ",M:" + string(u->getIp().empty() ? "P" : "A") + ",H:" + Util::toString(norm) + "/" +
Util::toString(reg) + "/" + Util::toString(op) + ",S:" +
Util::toString(sl) + ">" );
}
if(u == getMe())
state = STATE_NORMAL;
fire(ClientListener::UserUpdated(), this, u);
}