From e2034480561f1266bd0fa975ba74956b0301695f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= <slavek.banko@axis.cz>
Date: Wed, 23 Jun 2021 17:21:16 +0200
Subject: Separate OTRPlugin object code from the OTRPluginFactory definition.
 This resolves bug 1153.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix support for GCC hidden visibility.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 8403288e0159dbe377403e5f089072685a9d94f3)
---
 src/Makefile.am           |  8 +++++---
 src/otrlchatinterface.h   |  4 ++--
 src/otrlconfinterface.h   |  2 +-
 src/otrplugin-factory.cpp | 32 ++++++++++++++++++++++++++++++++
 src/otrplugin.cpp         |  3 ---
 src/otrplugin.h           |  2 +-
 6 files changed, 41 insertions(+), 10 deletions(-)
 create mode 100644 src/otrplugin-factory.cpp

diff --git a/src/Makefile.am b/src/Makefile.am
index 0486258..06300a5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,8 +8,8 @@ INCLUDES = $(all_includes) -I$(kde_includes)/kopete -I$(kde_includes)/tde/kopete
 
 kde_module_LTLIBRARIES = kcm_kopete_otr.la kopete_otr.la
 
-kopete_otr_la_SOURCES = kopete_otr.kcfgc otrguiclient.cpp otrplugin.cpp
-	
+kopete_otr_la_SOURCES = otrplugin-factory.cpp
+
 
 kopete_otr_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries) $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) \
 	-lkopete
@@ -39,7 +39,9 @@ rc_DATA = otrchatui.rc otrui.rc
 
 lib_LTLIBRARIES = libkotr.la
 libkotr_la_LDFLAGS = $(all_libraries) $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI)
-libkotr_la_SOURCES = otrlchatinterface.cpp otrlconfinterface.cpp \
+libkotr_la_SOURCES = \
+	kopete_otr.kcfgc otrguiclient.cpp otrplugin.cpp \
+	otrlchatinterface.cpp otrlconfinterface.cpp \
 	privkeypopup.cpp privkeypopupui.ui smppopup.cpp smppopupui.ui verifypopup.cpp \
 	verifypopupui.ui
 libkotr_la_LIBADD = -lotr
diff --git a/src/otrlchatinterface.h b/src/otrlchatinterface.h
index 1f2fd3e..c4a9428 100644
--- a/src/otrlchatinterface.h
+++ b/src/otrlchatinterface.h
@@ -41,7 +41,7 @@ extern "C" {
 #include <libotr/userstate.h>
 }
 
-class OtrlChatInterface: public TQObject
+class KDE_EXPORT OtrlChatInterface: public TQObject
 {
 	Q_OBJECT
 
@@ -82,7 +82,7 @@ private:
 	TQTimer m_forwardSecrecyTimer;
 };
 
- class KeyGenThread : public TQThread {
+class KeyGenThread : public TQThread {
 
 private:
 	TQString accountname;
diff --git a/src/otrlconfinterface.h b/src/otrlconfinterface.h
index 5cfe244..801889a 100644
--- a/src/otrlconfinterface.h
+++ b/src/otrlconfinterface.h
@@ -40,7 +40,7 @@ extern "C" {
 #include <libotr/context.h>
 }
 
-class OtrlConfInterface
+class KDE_EXPORT OtrlConfInterface
 {
 
 public:
diff --git a/src/otrplugin-factory.cpp b/src/otrplugin-factory.cpp
new file mode 100644
index 0000000..bf1df9f
--- /dev/null
+++ b/src/otrplugin-factory.cpp
@@ -0,0 +1,32 @@
+/***************************************************************************
+ *   Copyright (C) 2007 by Michael Zanetti                                 *
+ *                                                                         *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
+ ***************************************************************************/
+
+#include <kgenericfactory.h>
+#include <tdeaboutdata.h>
+
+#include "otrplugin.h"
+
+/**
+  * @author Michael Zanetti
+  */
+
+typedef KGenericFactory<OTRPlugin> OTRPluginFactory;
+static const TDEAboutData aboutdata("kopete_otr", I18N_NOOP("OTR") , "0.7" );
+K_EXPORT_COMPONENT_FACTORY( kopete_otr, OTRPluginFactory( &aboutdata )  )
diff --git a/src/otrplugin.cpp b/src/otrplugin.cpp
index a9b918b..0d9a5fe 100644
--- a/src/otrplugin.cpp
+++ b/src/otrplugin.cpp
@@ -31,7 +31,6 @@
 #include <tdeconfig.h>
 #include <kgenericfactory.h>
 #include <tdeversion.h>
-#include <tdeaboutdata.h>
 #include <kstandarddirs.h>
 #include <tdemessagebox.h>
 
@@ -59,8 +58,6 @@
 
 
 typedef KGenericFactory<OTRPlugin> OTRPluginFactory;
-static const TDEAboutData aboutdata("kopete_otr", I18N_NOOP("OTR") , "0.7" );
-K_EXPORT_COMPONENT_FACTORY( kopete_otr, OTRPluginFactory( &aboutdata )  )
 
 OTRPlugin::OTRPlugin( TQObject *parent, const char *name, const TQStringList & /* args */ )
 : Kopete::Plugin( OTRPluginFactory::instance(), parent, name )
diff --git a/src/otrplugin.h b/src/otrplugin.h
index da6b320..14d582b 100644
--- a/src/otrplugin.h
+++ b/src/otrplugin.h
@@ -65,7 +65,7 @@ public:
 	}
 };
 
-class OTRPlugin : public Kopete::Plugin
+class KDE_EXPORT OTRPlugin : public Kopete::Plugin
 {
 	Q_OBJECT
   
-- 
cgit v1.2.1