Hello community,

here is the log from the commit of package konversation for openSUSE:Factory 
checked in at 2017-08-28 16:16:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/konversation (Old)
 and      /work/SRC/openSUSE:Factory/.konversation.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "konversation"

Mon Aug 28 16:16:30 2017 rev:51 rq:518651 version:1.7.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/konversation/konversation.changes        
2017-06-01 16:27:30.683311845 +0200
+++ /work/SRC/openSUSE:Factory/.konversation.new/konversation.changes   
2017-08-28 16:16:32.188110745 +0200
@@ -1,0 +2,6 @@
+Fri Aug 25 06:48:48 UTC 2017 - [email protected]
+
+- Add patch to fix prefix handling for channel types (kde#383801):
+  * fix-prefix-addressed-message-handling.patch
+
+-------------------------------------------------------------------

New:
----
  fix-prefix-addressed-message-handling.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ konversation.spec ++++++
--- /var/tmp/diff_new_pack.kb2heX/_old  2017-08-28 16:16:33.643906168 +0200
+++ /var/tmp/diff_new_pack.kb2heX/_new  2017-08-28 16:16:33.655904482 +0200
@@ -26,6 +26,8 @@
 Group:          Productivity/Networking/IRC
 Url:            http://konversation.kde.org/
 Source0:        
http://download.kde.org/stable/%{name}/%{version}/src/%{name}-%{version}.tar.xz
+# PATCH-FIX-UPSTREAM
+Patch1:         fix-prefix-addressed-message-handling.patch
 BuildRequires:  extra-cmake-modules
 BuildRequires:  karchive-devel >= %{kf5_version}
 BuildRequires:  kbookmarks-devel >= %{kf5_version}
@@ -80,6 +82,7 @@
 
 %prep
 %setup -q
+%patch1 -p1
 
 %build
 %cmake_kf5 -d build

++++++ fix-prefix-addressed-message-handling.patch ++++++
>From 72de2027f3d3e7a0c48aef6acd666e04fc0b19b1 Mon Sep 17 00:00:00 2001
From: Eli MacKenzie <[email protected]>
Date: Thu, 24 Aug 2017 17:11:17 -0400
Subject: Fix prefix-addressed message handling

Messages sent to all channel operators or other mode-prefixed classes of
channel members could use flags that conflict with channel prefix flags.
This tries harder to ensure that the actual channel prefix is found.

BUG:383801
---
 ChangeLog          |  1 +
 src/commit.h       |  2 +-
 src/irc/server.cpp | 34 +++++++++++++++++++---------------
 src/irc/server.h   |  7 +++++--
 4 files changed, 26 insertions(+), 18 deletions(-)

Index: konversation-1.7.2/src/commit.h
===================================================================
--- konversation-1.7.2.orig/src/commit.h
+++ konversation-1.7.2/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 5016
+#define COMMIT 5016+5020
 #endif
Index: konversation-1.7.2/src/irc/server.cpp
===================================================================
--- konversation-1.7.2.orig/src/irc/server.cpp
+++ konversation-1.7.2/src/irc/server.cpp
@@ -540,10 +540,16 @@ void Server::showSSLDialog()
         */
 }
 
+void Server::rebuildTargetPrefixMatcher()
+{
+    m_targetMatcher.setPattern(QLatin1String("^([") + getServerNickPrefixes() 
+ QLatin1String("]*)([") + getChannelTypes() + QLatin1String("])(.+)"));
+}
+
 // set available channel types according to 005 RPL_ISUPPORT
 void Server::setChannelTypes(const QString &pre)
 {
     m_channelPrefixes = pre;
+    rebuildTargetPrefixMatcher();
 
     if (getConnectionSettings().reconnectCount() == 0) {
         updateAutoJoin(m_connectionSettings.oneShotChannelList());
@@ -575,6 +581,7 @@ void Server::setPrefixes(const QString &
     // modes which relates to the network's nick-prefixes
     m_serverNickPrefixModes = modes;
     m_serverNickPrefixes = prefixes;
+    rebuildTargetPrefixMatcher();
 }
 
 QString Server::getServerNickPrefixes() const
@@ -2965,18 +2972,18 @@ Channel* Server::getChannelByName(const
     // Convert wanted channel name to lowercase
     QString wanted = name.toLower();
 
-    if (m_serverNickPrefixes.contains(wanted.at(0))) {
-        wanted.remove(0, 1);
-    }
+    QRegularExpressionMatch p = m_targetMatcher.match(wanted);
+    int index = p.capturedStart(2);
 
-    if (name.isEmpty()) {
-        return nullptr;
-    }
+    if (index >= 0)
+    {
+        wanted = wanted.mid(index);
 
-    if (m_loweredChannelNameHash.contains(wanted))
-        return m_loweredChannelNameHash.value(wanted);
+        if (m_loweredChannelNameHash.contains(wanted))
+            return m_loweredChannelNameHash.value(wanted);
+    }
 
-    return 0;
+    return nullptr;
 }
 
 Query* Server::getQueryByName(const QString& name)
@@ -3844,13 +3851,10 @@ bool Server::isAChannel(const QString &c
 {
     if (channel.isEmpty()) return false;
 
-    uint index = 0;
-
-    if (m_serverNickPrefixes.contains(channel.at(0)) && channel.length() >= 2) 
{
-        ++index;
-    }
+    QRegularExpressionMatch x = m_targetMatcher.match(channel);
+    int index = x.capturedStart(2);
 
-    return (getChannelTypes().contains(channel.at(index)) > 0);
+    return (index >= 0 && getChannelTypes().contains(channel.at(index)) > 0);
 }
 
 void Server::addRawLog(bool show)
Index: konversation-1.7.2/src/irc/server.h
===================================================================
--- konversation-1.7.2.orig/src/irc/server.h
+++ konversation-1.7.2/src/irc/server.h
@@ -713,8 +713,11 @@ class Server : public QObject
         QStringListModel* m_nickListModel;
 
         // 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_serverNickPrefixes;               ///< Nickname prefixes 
used by the server to indicate a mode
+        QString m_serverNickPrefixModes;            ///< if supplied: mode 
flags related to nickname prefixes
+
+        QRegularExpression m_targetMatcher;         ///< a character set 
composed of m_serverNickPrefixes and m_channelPrefixes
+        void rebuildTargetPrefixMatcher();          ///< updates the regexp 
when prefixes change
 
         QString m_banAddressListModes;              // "TYPE A" modes from 
RPL_ISUPPORT CHANMODES=A,B,C,D
 

Reply via email to