Force parsing of PREFIX in RPL_ISUPPORT. Fixes #936
authorHendrik Leppkes <h.leppkes@gmail.com>
Tue, 27 Jul 2010 13:50:33 +0000 (15:50 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 11 Aug 2010 14:30:42 +0000 (16:30 +0200)
In some cases the automatic parsing of PREFIX was actually
triggered before RPL_ISUPPORT was actually received. In this case
the internal prefix configuration would only contain the default
modes, and not the network specific modes, which would cause
custom modes to be ignored completly.

This patch forces the parsing of PREFIX directly after RPL_ISUPPORT
was received, and the data is available.

src/common/network.cpp
src/common/network.h
src/core/ircserverhandler.cpp

index 6eccc9b..ed8b35a 100644 (file)
@@ -748,6 +748,9 @@ void Network::determinePrefixes() {
       _prefixModes = defaultPrefixModes;
       return;
     }
       _prefixModes = defaultPrefixModes;
       return;
     }
+    // clear the existing modes, just in case we're run multiple times
+    _prefixes = QString();
+    _prefixModes = QString();
 
     // we just assume that in PREFIX are only prefix chars stored
     for(int i = 0; i < defaultPrefixes.size(); i++) {
 
     // we just assume that in PREFIX are only prefix chars stored
     for(int i = 0; i < defaultPrefixes.size(); i++) {
index 6bce3d9..236269a 100644 (file)
@@ -171,6 +171,7 @@ public:
 
   QString prefixes();
   QString prefixModes();
 
   QString prefixes();
   QString prefixModes();
+  void determinePrefixes();
 
   bool supports(const QString &param) const { return _supports.contains(param); }
   QString support(const QString &param) const;
 
   bool supports(const QString &param) const { return _supports.contains(param); }
   QString support(const QString &param) const;
@@ -360,8 +361,6 @@ private:
   bool _unlimitedReconnectRetries;
   bool _rejoinChannels;
 
   bool _unlimitedReconnectRetries;
   bool _rejoinChannels;
 
-  void determinePrefixes();
-
   QTextCodec *_codecForServer;
   QTextCodec *_codecForEncoding;
   QTextCodec *_codecForDecoding;
   QTextCodec *_codecForServer;
   QTextCodec *_codecForEncoding;
   QTextCodec *_codecForDecoding;
index ef42086..32a40f0 100644 (file)
@@ -650,6 +650,9 @@ void IrcServerHandler::handle005(const QString &prefix, const QList<QByteArray>
     QString value = rawSupport.section("=", 1);
     network()->addSupport(key, value);
   }
     QString value = rawSupport.section("=", 1);
     network()->addSupport(key, value);
   }
+
+  /* determine our prefixes here to get an accurate result */
+  network()->determinePrefixes();
 }
 
 /* RPL_UMODEIS - "<user_modes> [<user_mode_params>]" */
 }
 
 /* RPL_UMODEIS - "<user_modes> [<user_mode_params>]" */