本文整理汇总了C++中IrcUser::network方法的典型用法代码示例。如果您正苦于以下问题:C++ IrcUser::network方法的具体用法?C++ IrcUser::network怎么用?C++ IrcUser::network使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IrcUser
的用法示例。
在下文中一共展示了IrcUser::network方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addIrcUserActions
void ContextMenuActionProvider::addIrcUserActions(QMenu *menu, const QModelIndex &index)
{
// this can be called: a) as a nicklist context menu (index has IrcUserItemType)
// b) as a query buffer context menu (index has BufferItemType and is a QueryBufferItem)
// c) right-click in a query chatview (same as b), index will be the corresponding QueryBufferItem)
// d) right-click on some nickname (_contextItem will be non-null, _filter -> chatview, index -> message buffer)
if (contextItem().isNull()) {
// cases a, b, c
bool haveQuery = indexList().count() == 1 && findQueryBuffer(index).isValid();
NetworkModel::ItemType itemType = static_cast<NetworkModel::ItemType>(index.data(NetworkModel::ItemTypeRole).toInt());
addAction(_nickModeMenuAction, menu, itemType == NetworkModel::IrcUserItemType);
addAction(_nickCtcpMenuAction, menu);
IrcUser *ircUser = qobject_cast<IrcUser *>(index.data(NetworkModel::IrcUserRole).value<QObject *>());
if (ircUser) {
Network *network = ircUser->network();
// only show entries for usermode +h if server supports it
if (network && network->prefixModes().contains('h')) {
action(NickHalfop)->setVisible(true);
action(NickDehalfop)->setVisible(true);
}
else {
action(NickHalfop)->setVisible(false);
action(NickDehalfop)->setVisible(false);
}
// ignoreliststuff
QString bufferName;
BufferInfo bufferInfo = index.data(NetworkModel::BufferInfoRole).value<BufferInfo>();
if (bufferInfo.type() == BufferInfo::ChannelBuffer)
bufferName = bufferInfo.bufferName();
QMap<QString, bool> ignoreMap = Client::ignoreListManager()->matchingRulesForHostmask(ircUser->hostmask(), ircUser->network()->networkName(), bufferName);
addIgnoreMenu(menu, ircUser->hostmask(), ignoreMap);
// end of ignoreliststuff
}
menu->addSeparator();
addAction(NickQuery, menu, itemType == NetworkModel::IrcUserItemType && !haveQuery && indexList().count() == 1);
addAction(NickSwitchTo, menu, itemType == NetworkModel::IrcUserItemType && haveQuery);
menu->addSeparator();
addAction(NickWhois, menu, true);
}
else if (!contextItem().isEmpty() && messageFilter()) {
// case d
// TODO
}
}