Bug 139591

Summary: mode q assumed to represent channel owner privileges
Product: [Applications] konversation Reporter: Philippe Cloutier <chealer>
Component: generalAssignee: argonel <argonel>
Status: RESOLVED FIXED    
Severity: normal CC: hein
Priority: NOR    
Version: 1.0.1   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Philippe Cloutier 2007-01-04 12:57:09 UTC
Version:           1.0.1 (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages
OS:                Linux

When a user is moded +q, the event is described by "%1 gives channel owner privileges to %2." (in channel.cpp). This assumes that q represents channel owner privileges, while, at least on OFTC, it actually represents...a quietban.
Comment 1 Stuart Prescott 2008-03-30 19:53:53 UTC
I just observed this today on OFTC. A troll was set +q by FloodServ which on OFTC is a "quiet" ban preventing the person from talking.

Instead of telling me that the troll had been silenced, Konversation instead told me that he had been given ownership of the channel. That's not really a good thing.

From Konversation's log file (I will spare you the gory details of the troll's pasting before he was auto-kicked):

[Sun Mar 30 2008] [18:41:40] <arne> EVERYBODY IN THIS CHANNEL [..snip..]
[Sun Mar 30 2008] [18:41:40] <arne> EVERYBODY IN THIS CHANNEL [..snip..]
[Sun Mar 30 2008] [18:41:40] <arne> EVERYBODY IN THIS CHANNEL [..snip..]
[Sun Mar 30 2008] [18:41:40] <arne> EVERYBODY IN THIS CHANNEL [..snip..]
[Sun Mar 30 2008] [18:41:40] <arne> EVERYBODY IN THIS CHANNEL [..snip..]
[Sun Mar 30 2008] [18:41:40] Kick arne has been kicked from the channel by debhelper (use the paster bot or #flood).
[Sun Mar 30 2008] [18:41:40] Mode FloodServ gives channel owner privileges to *!*@213-67-202-123-no11.tbcn.telia.com.

The last line is obviously incorrect... the troll tried to rejoin but was unable to continue because, as stated, +q on oftc devoices the person.
Comment 2 Eike Hein 2008-03-31 16:05:46 UTC
On EuIRC & Co, +q is founder/owner status. Once again we get kicked in the groin for valiant attempts to make IRC localizable - with networks stepping on each other's toes left and right using the same numericals and mode chars, the only way we can keep nice, translatable messages is going to be to profile networks/servers and display different stuff depending on what one is connected to, which of course sucks.

The workaround for the released version is to enable raw mode display in Behavior -> Chat Window in the preferences dialog. That will disable human-readable mode change messages in favor of simple mode +/-<mode> lines.
Comment 3 Eike Hein 2009-05-13 01:04:29 UTC
Bug #148437 may be related.
Comment 4 Eike Hein 2009-05-13 01:21:22 UTC
Possibly also related to bug #153580.
Comment 5 argonel 2010-02-05 22:13:48 UTC
commit dede2dae6424482b1c499d17f68b65a4a02d316e
Author: eli mackenzie <argonel@gmail.com>
Date:   Fri Feb 5 15:30:45 2010 -0500

    Change display of +q (et al) modes when they're not prefix modes.
    
    Non-prefix modes that are advertized by the 005 numeric as having a list
    will be displayed like bans, except for e and I, as we're in string freeze for
    1.2.2. Servers that don't give a 005 will continue to have their messages
    displayed incorrectly. If you're aware of such a server, let us know.
    
    CCBUG:139591,224954

diff --git a/src/commit.h b/src/commit.h
index 8405969..19d0e77 100644
--- a/src/commit.h
+++ b/src/commit.h
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 4016
+#define COMMIT 4017
 #endif
diff --git a/src/irc/channel.cpp b/src/irc/channel.cpp
index 6855dbb..9809970 100644
--- a/src/irc/channel.cpp
+++ b/src/irc/channel.cpp
@@ -1692,6 +1692,15 @@ void Channel::updateMode(const QString& sourceNick, char mode, bool plus, const
 
     bool fromMe=false;
     bool toMe=false;
+    bool banTypeThang = m_server->banAddressListModes().contains(QChar(mode));
+
+    // HACK to avoid changing strings for 1.2.2, we pretend any TYPE A mode is a
+    // ban except for e and I, as we have support for those
+    if (banTypeThang)
+    {
+        if (mode != 'b' && mode != 'e' && mode != 'I')
+            mode = 'b';
+    }
 
     // remember if this nick had any type of op.
     bool wasAnyOp=false;
diff --git a/src/irc/inputfilter.cpp b/src/irc/inputfilter.cpp
index a5a9368..65d4b19 100644
--- a/src/irc/inputfilter.cpp
+++ b/src/irc/inputfilter.cpp
@@ -903,6 +903,7 @@ void InputFilter::parseServerCommand(const QString &prefix, const QString &comma
                         {
                             if(!value.isEmpty())
                             {
+                                server->setChanModes(value);
                                 QString allowed = server->allowedChannelModes();
                                 QString newModes = value.remove(',');
                                 if(!allowed.isEmpty()) //attempt to merge the two
diff --git a/src/irc/server.cpp b/src/irc/server.cpp
index 14758be..4ebc139 100644
--- a/src/irc/server.cpp
+++ b/src/irc/server.cpp
@@ -97,6 +97,7 @@ Server::Server(QObject* parent, ConnectionSettings& settings) : QObject(parent)
     // TODO fold these into a QMAP, and these need to be reset to RFC values if this server object is reused.
     m_serverNickPrefixModes = "ovh";
     m_serverNickPrefixes = "@+%";
+    m_banAddressListModes = "b"; // {RFC-1459, draft-brocklesby-irc-isupport} -> pick one
     m_channelPrefixes = "#&";
     m_modesCount = 3;
     m_showSSLConfirmation = true;
@@ -473,6 +474,12 @@ void Server::setPrefixes(const QString &modes, const QString& prefixes)
     m_serverNickPrefixes = prefixes;
 }
 
+void Server::setChanModes(QString modes)
+{
+    QStringList abcd = modes.split(",");
+    m_banAddressListModes = abcd.value(0);
+}
+
 // return a nickname without possible mode character at the beginning
 void Server::mangleNicknameWithModes(QString& nickname,bool& isAdmin,bool& isOwner,
 bool& isOp,bool& isHalfop,bool& hasVoice)
diff --git a/src/irc/server.h b/src/irc/server.h
index f3d73b1..2d1d542 100644
--- a/src/irc/server.h
+++ b/src/irc/server.h
@@ -131,6 +131,9 @@ void resetNickSelection();
         int getModesCount();
 
         // extended user modes support
+        void setChanModes(QString);                 //grab modes types from RPL_ISUPPORT CHANMODES
+        QString banAddressListModes() { return m_banAddressListModes; }     // aka "TYPE A" modes http://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#section-3.3
+
         void setPrefixes(const QString &modes, const QString& prefixes);
         void mangleNicknameWithModes(QString &nickname,bool& isAdmin,bool& isOwner,bool &isOp,
             bool& isHalfop,bool &hasVoice);
@@ -679,6 +682,9 @@ void resetNickSelection();
         // TODO roll these into a QMap.
         QString m_serverNickPrefixes;               // Prefixes used by the server to indicate a mode
         QString m_serverNickPrefixModes;            // if supplied: modes related to those prefixes
+
+        QString m_banAddressListModes;              // "TYPE A" modes from RPL_ISUPPORT CHANMODES=A,B,C,D
+
         QString m_channelPrefixes;                  // prefixes that indicate channel names. defaults to RFC1459 "#&"
         int m_modesCount;                           // Maximum number of channel modes with parameter allowed per MODE command.
Comment 6 argonel 2010-02-06 11:55:52 UTC
commit dede2dae6424482b1c499d17f68b65a4a02d316e
Author: eli mackenzie <argonel@gmail.com>
Date:   Fri Feb 5 15:30:45 2010 -0500

    Change display of +q (et al) modes when they're not prefix modes.
    
    Non-prefix modes that are advertized by the 005 numeric as having a list
    will be displayed like bans, except for e and I, as we're in string freeze for
    1.2.2. Servers that don't give a 005 will continue to have their messages
    displayed incorrectly. If you're aware of such a server, let us know.
    
    CCBUG:139591,224954

diff --git a/src/commit.h b/src/commit.h
index 8405969..19d0e77 100644
--- a/src/commit.h
+++ b/src/commit.h
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 4016
+#define COMMIT 4017
 #endif
diff --git a/src/irc/channel.cpp b/src/irc/channel.cpp
index 6855dbb..9809970 100644
--- a/src/irc/channel.cpp
+++ b/src/irc/channel.cpp
@@ -1692,6 +1692,15 @@ void Channel::updateMode(const QString& sourceNick, char mode, bool plus, const
 
     bool fromMe=false;
     bool toMe=false;
+    bool banTypeThang = m_server->banAddressListModes().contains(QChar(mode));
+
+    // HACK to avoid changing strings for 1.2.2, we pretend any TYPE A mode is a
+    // ban except for e and I, as we have support for those
+    if (banTypeThang)
+    {
+        if (mode != 'b' && mode != 'e' && mode != 'I')
+            mode = 'b';
+    }
 
     // remember if this nick had any type of op.
     bool wasAnyOp=false;
diff --git a/src/irc/inputfilter.cpp b/src/irc/inputfilter.cpp
index a5a9368..65d4b19 100644
--- a/src/irc/inputfilter.cpp
+++ b/src/irc/inputfilter.cpp
@@ -903,6 +903,7 @@ void InputFilter::parseServerCommand(const QString &prefix, const QString &comma
                         {
                             if(!value.isEmpty())
                             {
+                                server->setChanModes(value);
                                 QString allowed = server->allowedChannelModes();
                                 QString newModes = value.remove(',');
                                 if(!allowed.isEmpty()) //attempt to merge the two
diff --git a/src/irc/server.cpp b/src/irc/server.cpp
index 14758be..4ebc139 100644
--- a/src/irc/server.cpp
+++ b/src/irc/server.cpp
@@ -97,6 +97,7 @@ Server::Server(QObject* parent, ConnectionSettings& settings) : QObject(parent)
     // TODO fold these into a QMAP, and these need to be reset to RFC values if this server object is reused.
     m_serverNickPrefixModes = "ovh";
     m_serverNickPrefixes = "@+%";
+    m_banAddressListModes = "b"; // {RFC-1459, draft-brocklesby-irc-isupport} -> pick one
     m_channelPrefixes = "#&";
     m_modesCount = 3;
     m_showSSLConfirmation = true;
@@ -473,6 +474,12 @@ void Server::setPrefixes(const QString &modes, const QString& prefixes)
     m_serverNickPrefixes = prefixes;
 }
 
+void Server::setChanModes(QString modes)
+{
+    QStringList abcd = modes.split(",");
+    m_banAddressListModes = abcd.value(0);
+}
+
 // return a nickname without possible mode character at the beginning
 void Server::mangleNicknameWithModes(QString& nickname,bool& isAdmin,bool& isOwner,
 bool& isOp,bool& isHalfop,bool& hasVoice)
diff --git a/src/irc/server.h b/src/irc/server.h
index f3d73b1..2d1d542 100644
--- a/src/irc/server.h
+++ b/src/irc/server.h
@@ -131,6 +131,9 @@ void resetNickSelection();
         int getModesCount();
 
         // extended user modes support
+        void setChanModes(QString);                 //grab modes types from RPL_ISUPPORT CHANMODES
+        QString banAddressListModes() { return m_banAddressListModes; }     // aka "TYPE A" modes http://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#section-3.3
+
         void setPrefixes(const QString &modes, const QString& prefixes);
         void mangleNicknameWithModes(QString &nickname,bool& isAdmin,bool& isOwner,bool &isOp,
             bool& isHalfop,bool &hasVoice);
@@ -679,6 +682,9 @@ void resetNickSelection();
         // TODO roll these into a QMap.
         QString m_serverNickPrefixes;               // Prefixes used by the server to indicate a mode
         QString m_serverNickPrefixModes;            // if supplied: modes related to those prefixes
+
+        QString m_banAddressListModes;              // "TYPE A" modes from RPL_ISUPPORT CHANMODES=A,B,C,D
+
         QString m_channelPrefixes;                  // prefixes that indicate channel names. defaults to RFC1459 "#&"
         int m_modesCount;                           // Maximum number of channel modes with parameter allowed per MODE command.
Comment 7 argonel 2010-07-01 16:16:43 UTC
commit dede2dae6424482b1c499d17f68b65a4a02d316e
Author: eli mackenzie <argonel@gmail.com>
Date:   Fri Feb 5 15:30:45 2010 -0500

    Change display of +q (et al) modes when they're not prefix modes.
    
    Non-prefix modes that are advertized by the 005 numeric as having a list
    will be displayed like bans, except for e and I, as we're in string freeze for
    1.2.2. Servers that don't give a 005 will continue to have their messages
    displayed incorrectly. If you're aware of such a server, let us know.
    
    CCBUG:139591,224954

diff --git a/src/commit.h b/src/commit.h
index 8405969..19d0e77 100644
--- a/src/commit.h
+++ b/src/commit.h
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 4016
+#define COMMIT 4017
 #endif
diff --git a/src/irc/channel.cpp b/src/irc/channel.cpp
index 6855dbb..9809970 100644
--- a/src/irc/channel.cpp
+++ b/src/irc/channel.cpp
@@ -1692,6 +1692,15 @@ void Channel::updateMode(const QString& sourceNick, char mode, bool plus, const
 
     bool fromMe=false;
     bool toMe=false;
+    bool banTypeThang = m_server->banAddressListModes().contains(QChar(mode));
+
+    // HACK to avoid changing strings for 1.2.2, we pretend any TYPE A mode is a
+    // ban except for e and I, as we have support for those
+    if (banTypeThang)
+    {
+        if (mode != 'b' && mode != 'e' && mode != 'I')
+            mode = 'b';
+    }
 
     // remember if this nick had any type of op.
     bool wasAnyOp=false;
diff --git a/src/irc/inputfilter.cpp b/src/irc/inputfilter.cpp
index a5a9368..65d4b19 100644
--- a/src/irc/inputfilter.cpp
+++ b/src/irc/inputfilter.cpp
@@ -903,6 +903,7 @@ void InputFilter::parseServerCommand(const QString &prefix, const QString &comma
                         {
                             if(!value.isEmpty())
                             {
+                                server->setChanModes(value);
                                 QString allowed = server->allowedChannelModes();
                                 QString newModes = value.remove(',');
                                 if(!allowed.isEmpty()) //attempt to merge the two
diff --git a/src/irc/server.cpp b/src/irc/server.cpp
index 14758be..4ebc139 100644
--- a/src/irc/server.cpp
+++ b/src/irc/server.cpp
@@ -97,6 +97,7 @@ Server::Server(QObject* parent, ConnectionSettings& settings) : QObject(parent)
     // TODO fold these into a QMAP, and these need to be reset to RFC values if this server object is reused.
     m_serverNickPrefixModes = "ovh";
     m_serverNickPrefixes = "@+%";
+    m_banAddressListModes = "b"; // {RFC-1459, draft-brocklesby-irc-isupport} -> pick one
     m_channelPrefixes = "#&";
     m_modesCount = 3;
     m_showSSLConfirmation = true;
@@ -473,6 +474,12 @@ void Server::setPrefixes(const QString &modes, const QString& prefixes)
     m_serverNickPrefixes = prefixes;
 }
 
+void Server::setChanModes(QString modes)
+{
+    QStringList abcd = modes.split(",");
+    m_banAddressListModes = abcd.value(0);
+}
+
 // return a nickname without possible mode character at the beginning
 void Server::mangleNicknameWithModes(QString& nickname,bool& isAdmin,bool& isOwner,
 bool& isOp,bool& isHalfop,bool& hasVoice)
diff --git a/src/irc/server.h b/src/irc/server.h
index f3d73b1..2d1d542 100644
--- a/src/irc/server.h
+++ b/src/irc/server.h
@@ -131,6 +131,9 @@ void resetNickSelection();
         int getModesCount();
 
         // extended user modes support
+        void setChanModes(QString);                 //grab modes types from RPL_ISUPPORT CHANMODES
+        QString banAddressListModes() { return m_banAddressListModes; }     // aka "TYPE A" modes http://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#section-3.3
+
         void setPrefixes(const QString &modes, const QString& prefixes);
         void mangleNicknameWithModes(QString &nickname,bool& isAdmin,bool& isOwner,bool &isOp,
             bool& isHalfop,bool &hasVoice);
@@ -679,6 +682,9 @@ void resetNickSelection();
         // TODO roll these into a QMap.
         QString m_serverNickPrefixes;               // Prefixes used by the server to indicate a mode
         QString m_serverNickPrefixModes;            // if supplied: modes related to those prefixes
+
+        QString m_banAddressListModes;              // "TYPE A" modes from RPL_ISUPPORT CHANMODES=A,B,C,D
+
         QString m_channelPrefixes;                  // prefixes that indicate channel names. defaults to RFC1459 "#&"
         int m_modesCount;                           // Maximum number of channel modes with parameter allowed per MODE command.
Comment 8 Eike Hein 2013-04-15 02:59:07 UTC
This is apparently still open because of the unfixed strings; Eli is looking into it.
Comment 9 Philippe Cloutier 2014-03-06 22:29:47 UTC
I'm not sure what you mean Eike, but I noticed that this was fixed. From #debian:
[2014-03-06 16:58:33] --> Dinosaurio (~asdf@85.62-99-36.dynamic.clientes.euskaltel.es) a rejoint ce canal.
[2014-03-06 16:58:36] <Dinosaurio> hi
[2014-03-06 16:59:08] <-- hele_ (~hele@cs178075132196.pp.htv.fi) a quitté ce serveur (Quit: Konversation terminated!).
[2014-03-06 16:59:09] <Dinosaurio> I've been reading the documentation of Debian and still can't find the command so as to answer this question
[2014-03-06 16:59:12] --> hele_ (~hele@cs178075132196.pp.htv.fi) a rejoint ce canal.
[2014-03-06 16:59:18] <Dinosaurio> why are you so gays?
[2014-03-06 16:59:30] *** ChanServ donne les privilèges d'opérateur du canal à dondelelcaro.
[2014-03-06 16:59:31] *** dondelelcaro définit le silence pour *!*@85.62-99-36.dynamic.clientes.euskaltel.es.
[2014-03-06 16:59:31] *** dondelelcaro retire à dondelelcaro les privilèges d'opérateur du canal.