emit dataChanged();
}
+QString ChannelBufferItem::nickChannelModes(const QString &nick) const
+{
+ if (!_ircChannel) {
+ qDebug() << Q_FUNC_INFO << "IrcChannel not set, can't get user modes";
+ return QString();
+ }
+
+ return _ircChannel->userModes(nick);
+}
+
void ChannelBufferItem::ircChannelParted()
{
};
tooltip << "<table cellspacing='5' cellpadding='0'>";
+ addRow(tr("Modes"),
+ NetworkItem::escapeHTML(channelModes()),
+ !channelModes().isEmpty());
if (_ircUser->isAway()) {
QString awayMessage(tr("(unknown)"));
if(!_ircUser->awayMessage().isEmpty()) {
return strTooltip;
}
+QString IrcUserItem::channelModes() const
+{
+ // IrcUserItems are parented to UserCategoryItem, which are parented to ChannelBufferItem.
+ // We want the channel buffer item in order to get the channel-specific user modes.
+ UserCategoryItem *category = qobject_cast<UserCategoryItem *>(parent());
+ if (!category)
+ return QString();
+
+ ChannelBufferItem *channel = qobject_cast<ChannelBufferItem *>(category->parent());
+ if (!channel)
+ return QString();
+
+ return channel->nickChannelModes(nickName());
+}
+
/*****************************************
* NetworkModel
void attachIrcChannel(IrcChannel *ircChannel);
+ /**
+ * Gets the list of channel modes for a given nick.
+ *
+ * @param[in] nick IrcUser nickname to check
+ * @returns Channel modes as a string if any, otherwise empty string
+ */
+ QString nickChannelModes(const QString &nick) const;
+
public slots:
void join(const QList<IrcUser *> &ircUsers);
void part(IrcUser *ircUser);
virtual QVariant data(int column, int role) const;
virtual QString toolTip(int column) const;
+ /**
+ * Gets the list of channel modes for this nick if parented to channel.
+ *
+ * @returns Channel modes as a string if any, otherwise empty string
+ */
+ QString channelModes() const;
+
private slots:
inline void ircUserQuited() { parent()->removeChild(this); }