本文整理汇总了C++中ChannelInfo类的典型用法代码示例。如果您正苦于以下问题:C++ ChannelInfo类的具体用法?C++ ChannelInfo怎么用?C++ ChannelInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChannelInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aprovider
Serializable* ChanAccess::Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string provider, chan;
data["provider"] >> provider;
data["ci"] >> chan;
ServiceReference<AccessProvider> aprovider("AccessProvider", provider);
ChannelInfo *ci = ChannelInfo::Find(chan);
if (!aprovider || !ci)
return NULL;
ChanAccess *access;
if (obj)
access = anope_dynamic_static_cast<ChanAccess *>(obj);
else
access = aprovider->Create();
access->ci = ci;
Anope::string m;
data["mask"] >> m;
access->SetMask(m, ci);
data["creator"] >> access->creator;
data["last_seen"] >> access->last_seen;
data["created"] >> access->created;
Anope::string adata;
data["data"] >> adata;
access->AccessUnserialize(adata);
if (!obj)
ci->AddAccess(access);
return access;
}
示例2: Tick
void Tick(time_t)
{
if (!Config->CSExpire || noexpire || readonly)
return;
for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; )
{
ChannelInfo *ci = it->second;
++it;
bool expire = false;
if (!ci->c && Config->CSExpire && Anope::CurTime - ci->last_used >= Config->CSExpire)
expire = true;
if (ci->HasFlag(CI_NO_EXPIRE))
expire = false;
FOREACH_MOD(I_OnPreChanExpire, OnPreChanExpire(ci, expire));
if (expire)
{
Anope::string extra;
if (ci->HasFlag(CI_SUSPENDED))
extra = "suspended ";
Log(LOG_NORMAL, "chanserv/expire") << "Expiring " << extra << "channel " << ci->name << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << ")";
FOREACH_MOD(I_OnChanExpire, OnChanExpire(ci));
delete ci;
}
}
}
示例3: if
void ChanAccess::SetMask(const Anope::string &m, ChannelInfo *c)
{
if (*nc != NULL)
nc->RemoveChannelReference(this->ci);
else if (!this->mask.empty())
{
ChannelInfo *targc = ChannelInfo::Find(this->mask);
if (targc)
targc->RemoveChannelReference(this->ci->name);
}
ci = c;
mask.clear();
nc = NULL;
const NickAlias *na = NickAlias::Find(m);
if (na != NULL)
{
nc = na->nc;
nc->AddChannelReference(ci);
}
else
{
mask = m;
ChannelInfo *targci = ChannelInfo::Find(mask);
if (targci != NULL)
targci->AddChannelReference(ci->name);
}
}
示例4: SetTextFromMap
void ChannelRecPriority::updateInfo(MythUIButtonListItem *item)
{
if (!item)
return;
ChannelInfo *channelItem = item->GetData().value<ChannelInfo *>();
if (!m_channelData.isEmpty() && channelItem)
{
QString rectype;
if (m_iconImage)
{
QString iconUrl = gCoreContext->GetMasterHostPrefix("ChannelIcons", channelItem->icon);
m_iconImage->SetFilename(iconUrl);
m_iconImage->Load();
}
InfoMap chanmap;
channelItem->ToMap(chanmap);
SetTextFromMap(chanmap);
if (m_chanstringText)
m_chanstringText->SetText(channelItem->GetFormatted(ChannelInfo::kChannelLong));
}
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_channelData.isEmpty());
}
示例5: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms)
{
const Anope::string &chan = params[0];
User *u = source.u;
Channel *c = findchan(chan);
if (!c)
{
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
return;
}
ChannelInfo *ci = c->ci;
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
return;
}
if (!ci->AccessFor(u).HasPriv("INVITE") && !u->HasCommand("chanserv/invite"))
{
source.Reply(ACCESS_DENIED);
return;
}
User *u2;
if (params.size() == 1)
u2 = u;
else
{
if (!(u2 = finduser(params[1])))
{
source.Reply(NICK_X_NOT_IN_USE, params[1].c_str());
return;
}
}
if (c->FindUser(u2))
{
if (u2 == u)
source.Reply(_("You are already in \002%s\002!"), c->name.c_str());
else
source.Reply(_("\002%s\002 is already in \002%s\002!"), u2->nick.c_str(), c->name.c_str());
}
else
{
bool override = !ci->AccessFor(u).HasPriv("INVITE");
ircdproto->SendInvite(ci->WhoSends(), chan, u2->nick);
if (u2 != u)
{
source.Reply(_("\002%s\002 has been invited to \002%s\002."), u2->nick.c_str(), c->name.c_str());
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << u2->nick;
}
else
{
示例6: result
void ChannelRecPriority::FillList(void)
{
QMap<int, QString> srcMap;
m_channelData.clear();
m_sortedChannel.clear();
MSqlQuery result(MSqlQuery::InitCon());
result.prepare("SELECT sourceid, name FROM videosource;");
if (result.exec())
{
while (result.next())
{
srcMap[result.value(0).toInt()] = result.value(1).toString();
}
}
result.prepare("SELECT chanid, channum, sourceid, callsign, "
"icon, recpriority, name FROM channel WHERE visible=1;");
if (result.exec())
{
int cnt = 999;
while (result.next())
{
ChannelInfo *chaninfo = new ChannelInfo;
chaninfo->chanid = result.value(0).toInt();
chaninfo->channum = result.value(1).toString();
chaninfo->sourceid = result.value(2).toInt();
chaninfo->callsign = result.value(3).toString();
QString iconurl = result.value(4).toString();
if (!iconurl.isEmpty())
iconurl = gCoreContext->GetMasterHostPrefix( "ChannelIcons", iconurl);
chaninfo->icon = iconurl;
chaninfo->recpriority = result.value(5).toInt();
chaninfo->name = result.value(6).toString();
chaninfo->SetSourceName(srcMap[chaninfo->sourceid]);
m_channelData[QString::number(cnt)] = *chaninfo;
// save recording priority value in map so we don't have to save
// all channel's recording priority values when we exit
m_origRecPriorityData[QString::number(chaninfo->chanid)] =
chaninfo->recpriority;
cnt--;
}
}
else if (!result.isActive())
MythDB::DBError("Get channel recording priorities query", result);
SortList();
}
示例7: FillChannelInfo
bool FillChannelInfo( DTC::ChannelInfo *pChannel,
uint nChanID,
bool bDetails /* = true */ )
{
ChannelInfo channel;
if (channel.Load(nChanID))
{
return FillChannelInfo(pChannel, channel, bDetails);
}
return false;
}
示例8: cs_findchan
void EntryMsg::unserialize(serialized_data &data)
{
ChannelInfo *ci = cs_findchan(data["ci"].astr());
if (!ci)
return;
EntryMessageList *messages = ci->GetExt<EntryMessageList *>("cs_entrymsg");
if (messages == NULL)
{
messages = new EntryMessageList();
ci->Extend("cs_entrymsg", messages);
}
messages->push_back(EntryMsg(ci, data["creator"].astr(), data["message"].astr()));
}
示例9: updateList
void ChannelRecPriority::updateList()
{
m_channelList->Reset();
QMap<QString, ChannelInfo*>::Iterator it;
MythUIButtonListItem *item;
for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it)
{
ChannelInfo *chanInfo = *it;
item = new MythUIButtonListItem(m_channelList, "",
qVariantFromValue(chanInfo));
QString fontState = "default";
if (!m_visMap[chanInfo->chanid])
fontState = "disabled";
QString stringFormat = item->GetText();
if (stringFormat.isEmpty())
stringFormat = "<num> <sign> \"<name>\"";
item->SetText(chanInfo->GetFormatted(stringFormat), fontState);
item->SetText(chanInfo->chanstr, "channum", fontState);
item->SetText(chanInfo->callsign, "callsign", fontState);
item->SetText(chanInfo->channame, "name", fontState);
item->SetText(QString().setNum(chanInfo->sourceid), "sourceid",
fontState);
item->SetText(chanInfo->sourcename, "sourcename", fontState);
if (m_visMap[chanInfo->chanid])
item->DisplayState("normal", "status");
else
item->DisplayState("disabled", "status");
item->SetImage(chanInfo->iconpath, "icon");
item->SetImage(chanInfo->iconpath);
item->SetText(chanInfo->recpriority, "priority", fontState);
if (m_currentItem == chanInfo)
m_channelList->SetItemCurrent(item);
}
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_channelData.isEmpty());
}
示例10: MythUIButtonListItem
void ChannelRecPriority::updateList()
{
m_channelList->Reset();
QMap<QString, ChannelInfo*>::Iterator it;
for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it)
{
ChannelInfo *chanInfo = *it;
MythUIButtonListItem *item =
new MythUIButtonListItem(m_channelList, "",
qVariantFromValue(chanInfo));
QString fontState = "default";
item->SetText(chanInfo->GetFormatted(ChannelInfo::kChannelLong),
fontState);
InfoMap infomap;
chanInfo->ToMap(infomap);
item->SetTextFromMap(infomap, fontState);
item->DisplayState("normal", "status");
if (!chanInfo->icon.isEmpty())
{
QString iconUrl = gCoreContext->GetMasterHostPrefix("ChannelIcons",
chanInfo->icon);
item->SetImage(iconUrl, "icon");
item->SetImage(iconUrl);
}
item->SetText(QString::number(chanInfo->recpriority), "priority", fontState);
if (m_currentItem == chanInfo)
m_channelList->SetItemCurrent(item);
}
// this textarea name is depreciated use 'nochannels_warning' instead
MythUIText *noChannelsText = dynamic_cast<MythUIText*>(GetChild("norecordings_info"));
if (!noChannelsText)
noChannelsText = dynamic_cast<MythUIText*>(GetChild("nochannels_warning"));
if (noChannelsText)
noChannelsText->SetVisible(m_channelData.isEmpty());
}
示例11: BuildChanList
void BuildChanList(NickAlias *na, TemplateFileServer::Replacements &replacements)
{
std::deque<ChannelInfo *> queue;
na->nc->GetChannelReferences(queue);
std::sort(queue.begin(), queue.end(), ChannelSort);
for (unsigned i = 0; i < queue.size(); ++i)
{
ChannelInfo *ci = queue[i];
if (na->nc != ci->GetFounder() && ci->AccessFor(na->nc).empty())
continue;
replacements["CHANNEL_NAMES"] = ci->name;
replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name);
}
}
示例12:
ChanAccess::~ChanAccess()
{
if (this->ci)
{
std::vector<ChanAccess *>::iterator it = std::find(this->ci->access->begin(), this->ci->access->end(), this);
if (it != this->ci->access->end())
this->ci->access->erase(it);
if (*nc != NULL)
nc->RemoveChannelReference(this->ci);
else
{
ChannelInfo *c = ChannelInfo::Find(this->mask);
if (c)
c->RemoveChannelReference(this->ci->name);
}
}
}
示例13: MythUIButtonListItem
void ChannelRecPriority::updateList()
{
m_channelList->Reset();
QMap<QString, ChannelInfo*>::Iterator it;
MythUIButtonListItem *item;
for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it)
{
ChannelInfo *chanInfo = *it;
item = new MythUIButtonListItem(m_channelList, "",
qVariantFromValue(chanInfo));
QString fontState = "default";
if (!m_visMap[chanInfo->chanid])
fontState = "disabled";
item->SetText(chanInfo->GetFormatted(ChannelInfo::kChannelLong),
fontState);
InfoMap infomap;
chanInfo->ToMap(infomap);
item->SetTextFromMap(infomap, fontState);
if (m_visMap[chanInfo->chanid])
item->DisplayState("normal", "status");
else
item->DisplayState("disabled", "status");
item->SetImage(chanInfo->iconpath, "icon");
item->SetImage(chanInfo->iconpath);
item->SetText(chanInfo->recpriority, "priority", fontState);
if (m_currentItem == chanInfo)
m_channelList->SetItemCurrent(item);
}
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_channelData.isEmpty());
}
示例14: channel
void PrivateTab::channel(const ChannelInfo &info)
{
if (info.id() != id())
return;
if (m_joined)
return;
m_chatView->add(ServiceMessage::joined(id()));
m_joined = true;
}
示例15: page
bool WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
std::deque<ChannelInfo *> queue;
na->nc->GetChannelReferences(queue);
std::sort(queue.begin(), queue.end(), ChannelSort);
int chan_count = 0;
for (unsigned q = 0; q < queue.size(); ++q)
{
ChannelInfo *ci = queue[q];
if (ci->GetFounder() == na->nc)
{
++chan_count;
replacements["NUMBERS"] = stringify(chan_count);
replacements["CHANNELS"] = (ci->HasExt("CS_NO_EXPIRE") ? "!" : "") + ci->name;
replacements["ACCESSES"] = "Founder";
continue;
}
AccessGroup access = ci->AccessFor(na->nc);
if (access.empty())
continue;
++chan_count;
replacements["NUMBERS"] = stringify(chan_count);
replacements["CHANNELS"] = (ci->HasExt("CS_NO_EXPIRE") ? "!" : "") + ci->name;
Anope::string access_str;
for (unsigned i = 0; i < access.size(); ++i)
access_str += ", " + access[i]->AccessSerialize();
replacements["ACCESSES"] = access_str.substr(2);
}
TemplateFileServer page("nickserv/alist.html");
page.Serve(server, page_name, client, message, reply, replacements);
return true;
}