Hello community,
here is the log from the commit of package libqmatrixclient for
openSUSE:Factory checked in at 2019-01-15 09:17:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libqmatrixclient (Old)
and /work/SRC/openSUSE:Factory/.libqmatrixclient.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libqmatrixclient"
Tue Jan 15 09:17:26 2019 rev:3 rq:665301 version:0.4.2.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/libqmatrixclient/libqmatrixclient.changes
2018-12-18 14:59:54.394114358 +0100
+++
/work/SRC/openSUSE:Factory/.libqmatrixclient.new.28833/libqmatrixclient.changes
2019-01-15 09:17:46.374157400 +0100
@@ -1,0 +2,9 @@
+Sun Jan 13 12:42:05 UTC 2019 - Michael Vetter <[email protected]>
+
+
+- Update to 0.4.2.1:
+ * No more treat fake state events (that don't have
+ state_key, even if they have state-related type, e.g., m.room.topic)
+ as state events, turning them into unknown events instead.
+
+-------------------------------------------------------------------
Old:
----
v0.4.1.tar.gz
New:
----
v0.4.2.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libqmatrixclient.spec ++++++
--- /var/tmp/diff_new_pack.gZlN3N/_old 2019-01-15 09:17:46.818156986 +0100
+++ /var/tmp/diff_new_pack.gZlN3N/_new 2019-01-15 09:17:46.850156956 +0100
@@ -1,7 +1,7 @@
#
# spec file for package libqmatrixclient
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -21,7 +21,7 @@
%define soversion 0_4
Name: libqmatrixclient
-Version: 0.4.1
+Version: 0.4.2.1
Release: 0
Summary: Library for Qt Matrix Clients
License: LGPL-2.1-only
++++++ v0.4.1.tar.gz -> v0.4.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libqmatrixclient-0.4.1/CMakeLists.txt
new/libqmatrixclient-0.4.2.1/CMakeLists.txt
--- old/libqmatrixclient-0.4.1/CMakeLists.txt 2018-12-06 13:01:06.000000000
+0100
+++ new/libqmatrixclient-0.4.2.1/CMakeLists.txt 2019-01-13 10:54:44.000000000
+0100
@@ -140,7 +140,7 @@
${libqmatrixclient_cswellknown_SRCS}
${libqmatrixclient_asdef_SRCS} ${libqmatrixclient_isdef_SRCS})
set(API_VERSION "0.4")
-set_property(TARGET QMatrixClient PROPERTY VERSION "${API_VERSION}.0")
+set_property(TARGET QMatrixClient PROPERTY VERSION "${API_VERSION}.2.1")
set_property(TARGET QMatrixClient PROPERTY SOVERSION ${API_VERSION} )
set_property(TARGET QMatrixClient PROPERTY
INTERFACE_QMatrixClient_MAJOR_VERSION ${API_VERSION})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libqmatrixclient-0.4.1/examples/qmc-example.cpp
new/libqmatrixclient-0.4.2.1/examples/qmc-example.cpp
--- old/libqmatrixclient-0.4.1/examples/qmc-example.cpp 2018-12-06
13:01:06.000000000 +0100
+++ new/libqmatrixclient-0.4.2.1/examples/qmc-example.cpp 2019-01-13
10:54:44.000000000 +0100
@@ -5,6 +5,7 @@
#include "csapi/room_send.h"
#include "csapi/joining.h"
#include "csapi/leaving.h"
+#include "events/simplestateevents.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QStringBuilder>
@@ -27,6 +28,7 @@
void onNewRoom(Room* r);
void startTests();
void sendMessage();
+ void setTopic();
void addAndRemoveTag();
void sendAndRedact();
void checkRedactionOutcome(const QString& evtIdToRedact,
@@ -143,6 +145,7 @@
{
cout << "Starting tests" << endl;
sendMessage();
+ setTopic();
addAndRemoveTag();
sendAndRedact();
markDirectChat();
@@ -168,6 +171,49 @@
// Independently, check when it shows up in the timeline.
}
+void QMCTest::setTopic()
+{
+ running.push_back("State setting test");
+ running.push_back("Fake state event immunity test");
+ auto initialTopic = targetRoom->topic();
+
+ const auto newTopic = c->generateTxnId();
+ targetRoom->setTopic(newTopic); // Sets the state by proper means
+ const auto fakeTopic = c->generateTxnId();
+ targetRoom->postJson(RoomTopicEvent::matrixTypeId(), // Fake state event
+ RoomTopicEvent(fakeTopic).contentJson());
+
+ {
+ auto* context = new QObject;
+ connect(targetRoom, &Room::topicChanged, context,
+ [this,newTopic,fakeTopic,initialTopic,context] {
+ if (targetRoom->topic() == newTopic)
+ {
+ QMC_CHECK("State setting test", true);
+ // Don't reset the topic yet if the negative test still
runs
+ if (!running.contains("Fake state event immunity test"))
+ targetRoom->setTopic(initialTopic);
+
+ context->deleteLater();
+ }
+ });
+ }
+
+ {
+ auto* context = new QObject;
+ connect(targetRoom, &Room::pendingEventAboutToMerge, context,
+ [this,fakeTopic,initialTopic,context] (const RoomEvent* e, int) {
+ if (e->contentJson().value("topic").toString() != fakeTopic)
+ return; // Wait on for the right event
+
+ QMC_CHECK("Fake state event immunity test",
!e->isStateEvent());
+ if (!running.contains("State setting test"))
+ targetRoom->setTopic(initialTopic);
+ context->deleteLater();
+ });
+ }
+}
+
void QMCTest::addAndRemoveTag()
{
running.push_back("Tagging test");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libqmatrixclient-0.4.1/lib/events/stateevent.cpp
new/libqmatrixclient-0.4.2.1/lib/events/stateevent.cpp
--- old/libqmatrixclient-0.4.1/lib/events/stateevent.cpp 2018-12-06
13:01:06.000000000 +0100
+++ new/libqmatrixclient-0.4.2.1/lib/events/stateevent.cpp 2019-01-13
10:54:44.000000000 +0100
@@ -21,7 +21,17 @@
using namespace QMatrixClient;
[[gnu::unused]] static auto stateEventTypeInitialised =
- RoomEvent::factory_t::chainFactory<StateEventBase>();
+ RoomEvent::factory_t::addMethod(
+ [] (const QJsonObject& json, const QString& matrixType) ->
StateEventPtr
+ {
+ if (!json.contains("state_key"))
+ return nullptr;
+
+ if (auto e = StateEventBase::factory_t::make(json, matrixType))
+ return e;
+
+ return nullptr;
+ });
bool StateEventBase::repeatsState() const
{