X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=aea48bf860ced751ac31f9d8d50ef54d7c4019ee;hb=5b164bbc62960cea62a31287f679197b623ad7ac;hp=1edbb241705276df456e4d594bedd84a426084f2;hpb=b8e94e1fbe17e2c968339e78a58b7e95331bd4d5;p=quassel.git
diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp
index 1edbb241..aea48bf8 100644
--- a/src/client/networkmodel.cpp
+++ b/src/client/networkmodel.cpp
@@ -569,12 +569,33 @@ QString QueryBufferItem::toolTip(int column) const
NetworkItem::escapeHTML(_ircUser->suserHost()),
!_ircUser->suserHost().isEmpty());
}
+
+ // Keep track of whether or not the account information's been added. Don't show it twice.
+ bool accountAdded = false;
+ if(!_ircUser->account().isEmpty()) {
+ // IRCv3 account-notify is supported by the core and IRC server.
+ // Assume logged out (seems to be more common)
+ QString accountHTML = QString("
%1
").arg(tr("Not logged in"));
+
+ // If account is logged in, replace with the escaped account name.
+ if (_ircUser->account() != "*") {
+ accountHTML = NetworkItem::escapeHTML(_ircUser->account());
+ }
+ addRow(NetworkItem::escapeHTML(tr("Account"), true),
+ accountHTML,
+ true);
+ // Mark the row as added
+ accountAdded = true;
+ }
// whoisServiceReply may return " is identified for this nick", which should be translated.
// See https://www.alien.net.au/irc/irc2numerics.html
if(_ircUser->whoisServiceReply().endsWith("identified for this nick")) {
addRow(NetworkItem::escapeHTML(tr("Account"), true),
NetworkItem::escapeHTML(tr("Identified for this nick")),
- true);
+ !accountAdded);
+ // Don't add the account row again if information's already added via account-notify
+ // Mark the row as added
+ accountAdded = true;
} else {
addRow(NetworkItem::escapeHTML(tr("Service Reply"), true),
NetworkItem::escapeHTML(_ircUser->whoisServiceReply()),
@@ -744,6 +765,16 @@ void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel)
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()
{
@@ -1065,6 +1096,9 @@ QString IrcUserItem::toolTip(int column) const
};
tooltip << "";
+ addRow(tr("Modes"),
+ NetworkItem::escapeHTML(channelModes()),
+ !channelModes().isEmpty());
if (_ircUser->isAway()) {
QString awayMessage(tr("(unknown)"));
if(!_ircUser->awayMessage().isEmpty()) {
@@ -1087,12 +1121,33 @@ QString IrcUserItem::toolTip(int column) const
NetworkItem::escapeHTML(_ircUser->suserHost()),
!_ircUser->suserHost().isEmpty());
}
+
+ // Keep track of whether or not the account information's been added. Don't show it twice.
+ bool accountAdded = false;
+ if(!_ircUser->account().isEmpty()) {
+ // IRCv3 account-notify is supported by the core and IRC server.
+ // Assume logged out (seems to be more common)
+ QString accountHTML = QString("%1
").arg(tr("Not logged in"));
+
+ // If account is logged in, replace with the escaped account name.
+ if (_ircUser->account() != "*") {
+ accountHTML = NetworkItem::escapeHTML(_ircUser->account());
+ }
+ addRow(NetworkItem::escapeHTML(tr("Account"), true),
+ accountHTML,
+ true);
+ // Mark the row as added
+ accountAdded = true;
+ }
// whoisServiceReply may return " is identified for this nick", which should be translated.
// See https://www.alien.net.au/irc/irc2numerics.html
if(_ircUser->whoisServiceReply().endsWith("identified for this nick")) {
addRow(NetworkItem::escapeHTML(tr("Account"), true),
NetworkItem::escapeHTML(tr("Identified for this nick")),
- true);
+ !accountAdded);
+ // Don't add the account row again if information's already added via account-notify
+ // Mark the row as added
+ accountAdded = true;
} else {
addRow(NetworkItem::escapeHTML(tr("Service Reply"), true),
NetworkItem::escapeHTML(_ircUser->whoisServiceReply()),
@@ -1128,6 +1183,21 @@ QString IrcUserItem::toolTip(int column) const
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(parent());
+ if (!category)
+ return QString();
+
+ ChannelBufferItem *channel = qobject_cast(category->parent());
+ if (!channel)
+ return QString();
+
+ return channel->nickChannelModes(nickName());
+}
+
/*****************************************
* NetworkModel