本文整理汇总了C++中ExtensionItem::serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ ExtensionItem::serialize方法的具体用法?C++ ExtensionItem::serialize怎么用?C++ ExtensionItem::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtensionItem
的用法示例。
在下文中一共展示了ExtensionItem::serialize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendUsers
/** send all users and their oper state/modes */
void TreeSocket::SendUsers(BurstState& bs)
{
ProtocolInterface::Server& piserver = bs.server;
for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++)
{
User* user = u->second;
if (user->registered != REG_ALL)
continue;
this->WriteLine(CommandUID::Builder(user));
if (user->IsOper())
this->WriteLine(CommandOpertype::Builder(user));
if (user->IsAway())
this->WriteLine(CommandAway::Builder(user));
const Extensible::ExtensibleStore& exts = user->GetExtList();
for (Extensible::ExtensibleStore::const_iterator i = exts.begin(); i != exts.end(); ++i)
{
ExtensionItem* item = i->first;
std::string value = item->serialize(FORMAT_NETWORK, u->second, i->second);
if (!value.empty())
this->WriteLine(CommandMetadata::Builder(user, item->name, value));
}
FOREACH_MOD(OnSyncUser, (user, piserver));
}
}
示例2: DumpMeta
void DumpMeta(std::stringstream& data, Extensible* ext)
{
data << "<metadata>";
for(Extensible::ExtensibleStore::const_iterator i = ext->GetExtList().begin(); i != ext->GetExtList().end(); i++)
{
ExtensionItem* item = i->first;
std::string value = item->serialize(FORMAT_USER, ext, i->second);
if (!value.empty())
data << "<meta name=\"" << item->name << "\">" << Sanitize(value) << "</meta>";
else if (!item->name.empty())
data << "<meta name=\"" << item->name << "\"/>";
}
data << "</metadata>";
}
示例3: dumpExt
void dumpExt(User* user, const std::string& checkstr, Extensible* ext)
{
std::stringstream dumpkeys;
for(Extensible::ExtensibleStore::const_iterator i = ext->GetExtList().begin(); i != ext->GetExtList().end(); i++)
{
ExtensionItem* item = i->first;
std::string value = item->serialize(FORMAT_USER, ext, i->second);
if (!value.empty())
user->SendText(checkstr + " meta:" + item->name + " " + value);
else if (!item->name.empty())
dumpkeys << " " << item->name;
}
if (!dumpkeys.str().empty())
user->SendText(checkstr + " metadata", dumpkeys);
}
示例4: SendUsers
/** send all users and their oper state/modes */
void TreeSocket::SendUsers()
{
char data[MAXBUF];
std::string dataline;
for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++)
{
if (u->second->registered == REG_ALL)
{
TreeServer* theirserver = Utils->FindServer(u->second->server);
if (theirserver)
{
snprintf(data,MAXBUF,":%s UID %s %lu %s %s %s %s %s %lu +%s :%s",
theirserver->GetID().c_str(), /* Prefix: SID */
u->second->uuid.c_str(), /* 0: UUID */
(unsigned long)u->second->age, /* 1: TS */
u->second->nick.c_str(), /* 2: Nick */
u->second->host.c_str(), /* 3: Displayed Host */
u->second->dhost.c_str(), /* 4: Real host */
u->second->ident.c_str(), /* 5: Ident */
u->second->GetIPString().c_str(), /* 6: IP string */
(unsigned long)u->second->signon, /* 7: Signon time for WHOWAS */
u->second->FormatModes(true), /* 8...n: Modes and params */
u->second->fullname.c_str()); /* size-1: GECOS */
this->WriteLine(data);
if (u->second->IsOper())
{
snprintf(data,MAXBUF,":%s OPERTYPE %s", u->second->uuid.c_str(), u->second->oper->name.c_str());
this->WriteLine(data);
}
if (u->second->IsAway())
{
snprintf(data,MAXBUF,":%s AWAY %ld :%s", u->second->uuid.c_str(), (long)u->second->awaytime, u->second->awaymsg.c_str());
this->WriteLine(data);
}
}
for(Extensible::ExtensibleStore::const_iterator i = u->second->GetExtList().begin(); i != u->second->GetExtList().end(); i++)
{
ExtensionItem* item = i->first;
std::string value = item->serialize(FORMAT_NETWORK, u->second, i->second);
if (!value.empty())
Utils->Creator->ProtoSendMetaData(this, u->second, item->name, value);
}
FOREACH_MOD(I_OnSyncUser,OnSyncUser(u->second,Utils->Creator,this));
}
}
}
示例5: OnUserConnect
void ModuleSpanningTree::OnUserConnect(LocalUser* user)
{
if (user->quitting)
return;
CommandUID::Builder(user).Broadcast();
if (user->IsOper())
CommandOpertype::Builder(user).Broadcast();
for(Extensible::ExtensibleStore::const_iterator i = user->GetExtList().begin(); i != user->GetExtList().end(); i++)
{
ExtensionItem* item = i->first;
std::string value = item->serialize(FORMAT_NETWORK, user, i->second);
if (!value.empty())
ServerInstance->PI->SendMetaData(user, item->name, value);
}
Utils->TreeRoot->UserCount++;
}
示例6: SyncChannel
/** Send channel topic, modes and metadata */
void TreeSocket::SyncChannel(Channel* chan, BurstState& bs)
{
SendFJoins(chan);
// If the topic was ever set, send it, even if it's empty now
// because a new empty topic should override an old non-empty topic
if (chan->topicset != 0)
this->WriteLine(CommandFTopic::Builder(chan));
SendListModes(chan);
for (Extensible::ExtensibleStore::const_iterator i = chan->GetExtList().begin(); i != chan->GetExtList().end(); i++)
{
ExtensionItem* item = i->first;
std::string value = item->serialize(FORMAT_NETWORK, chan, i->second);
if (!value.empty())
this->WriteLine(CommandMetadata::Builder(chan, item->name, value));
}
FOREACH_MOD(OnSyncChannel, (chan, bs.server));
}
示例7: SyncChannel
/** Send channel topic, modes and metadata */
void TreeSocket::SyncChannel(Channel* chan)
{
char data[MAXBUF];
SendFJoins(chan);
// If the topic was ever set, send it, even if it's empty now
// because a new empty topic should override an old non-empty topic
if (chan->topicset != 0)
{
snprintf(data,MAXBUF,":%s FTOPIC %s %lu %lu %s :%s", ServerInstance->Config->GetSID().c_str(), chan->name.c_str(), (unsigned long) chan->age, (unsigned long)chan->topicset, chan->setby.c_str(), chan->topic.c_str());
this->WriteLine(data);
}
for (Extensible::ExtensibleStore::const_iterator i = chan->GetExtList().begin(); i != chan->GetExtList().end(); i++)
{
ExtensionItem* item = i->first;
std::string value = item->serialize(FORMAT_NETWORK, chan, i->second);
if (!value.empty())
Utils->Creator->ProtoSendMetaData(this, chan, item->name, value);
}
FOREACH_MOD(I_OnSyncChannel,OnSyncChannel(chan, Utils->Creator, this));
}