summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-27 20:49:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-28 08:52:46 +0200
commit97c28ad74f09da7337119f3acf2e6b911b48523f (patch)
tree960a78ae3b9545e801fe796e22d1685acb18b238
parentMissing dependency (--enable-telepathy) (diff)
downloadcore-97c28ad74f09da7337119f3acf2e6b911b48523f.tar.gz
core-97c28ad74f09da7337119f3acf2e6b911b48523f.zip
Various loplugin warnings in --enable-telepathy
Change-Id: I4c437491466c3029f2a9c93fb630c7b5a8d2ff21
-rw-r--r--compilerplugins/clang/reservedid.cxx2
-rw-r--r--include/sal/log-areas.dox3
-rw-r--r--include/tubes/collaboration.hxx9
-rw-r--r--include/tubes/conference.hxx2
-rw-r--r--include/tubes/file-transfer-helper.h2
-rw-r--r--include/tubes/manager.hxx3
-rw-r--r--sc/source/ui/collab/sendfunc.cxx30
-rw-r--r--sc/source/ui/collab/sendfunc.hxx20
-rw-r--r--sc/source/ui/inc/sccollaboration.hxx10
-rw-r--r--tubes/qa/test_manager.cxx38
-rw-r--r--tubes/source/collaboration.cxx14
-rw-r--r--tubes/source/conference.cxx83
-rw-r--r--tubes/source/contacts.cxx276
-rw-r--r--tubes/source/contacts.hxx64
-rw-r--r--tubes/source/file-transfer-helper.c9
-rw-r--r--tubes/source/manager.cxx117
16 files changed, 373 insertions, 309 deletions
diff --git a/compilerplugins/clang/reservedid.cxx b/compilerplugins/clang/reservedid.cxx
index c6757199cbf9..bfb33171e437 100644
--- a/compilerplugins/clang/reservedid.cxx
+++ b/compilerplugins/clang/reservedid.cxx
@@ -151,6 +151,8 @@ bool ReservedId::VisitNamedDecl(NamedDecl const * decl) {
// vcl/unx/gtk/xid_fullscreen_on_all_monitors.c
&& s != "_GstVideoOverlay"
// avmedia/source/gstreamer/gstplayer.hxx
+ && s != "_TpAccount" && s != "_TpContact"
+ // include/tubes/manager.hxx
&& s != "_XRegion" // vcl/unx/generic/gdi/x11cairotextrender.cxx
&& s != "_XTrap") // vcl/unx/generic/gdi/xrender_peer.hxx
{
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index ef325861c25d..c69bebabbfc5 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -133,6 +133,7 @@ certain functionality.
@li @c sc.orcus.style
@li @c sc.orcus.table
@li @c sc.qa
+@li @c sc.tubes
@li @c sc.ui - Calc UI
@li @c sc.uitest - Calc UI Test part
@li @c sc.viewdata
@@ -566,6 +567,8 @@ certain functionality.
@li @c store
@li @c svg
@li @c test
+@li @c tubes
+@li @c tubes.method
@li @c ucbhelper
@li @c unodevtools
@li @c unoidl
diff --git a/include/tubes/collaboration.hxx b/include/tubes/collaboration.hxx
index 3f32d4188dbe..4f6866618af0 100644
--- a/include/tubes/collaboration.hxx
+++ b/include/tubes/collaboration.hxx
@@ -14,15 +14,20 @@
#include <rtl/ustring.hxx>
#include <tubes/tubesdllapi.h>
+#include <vcl/vclptr.hxx>
class TeleConference;
+namespace tubes { class TubeContacts; }
typedef struct _TpContact TpContact;
class TUBES_DLLPUBLIC Collaboration
{
TeleConference* mpConference;
- // This is in fact of type TubeContacts* from anonymous namespace
- void* mpContacts;
+ VclPtr<tubes::TubeContacts> mpContacts;
+
+ Collaboration(Collaboration &) = delete;
+ void operator =(Collaboration &) = delete;
+
public:
Collaboration();
virtual ~Collaboration();
diff --git a/include/tubes/conference.hxx b/include/tubes/conference.hxx
index 7dfd744d959a..3b80eb13eb33 100644
--- a/include/tubes/conference.hxx
+++ b/include/tubes/conference.hxx
@@ -27,7 +27,7 @@ public:
TeleConference( TpAccount* pAccount,
TpDBusTubeChannel* pChannel,
- const OString sUuid = OString(),
+ const OString & sUuid = OString(),
bool bMaster = false );
~TeleConference();
diff --git a/include/tubes/file-transfer-helper.h b/include/tubes/file-transfer-helper.h
index 25a4ce9faa7c..ffcbc4b19837 100644
--- a/include/tubes/file-transfer-helper.h
+++ b/include/tubes/file-transfer-helper.h
@@ -41,7 +41,7 @@ G_BEGIN_DECLS
#define EMPATHY_IS_FT_HANDLER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_FT_HANDLER))
-typedef struct _EmpathyFTHandlerPriv EmpathyFTHandlerPriv;
+typedef struct EmpathyFTHandlerPriv_ EmpathyFTHandlerPriv;
typedef struct {
GObject parent;
diff --git a/include/tubes/manager.hxx b/include/tubes/manager.hxx
index dcf24dc0477b..2ea14fce3888 100644
--- a/include/tubes/manager.hxx
+++ b/include/tubes/manager.hxx
@@ -150,6 +150,9 @@ private:
static ::osl::Mutex& GetMutex();
};
+// FIXME: should be static and not used in conference.cxx
+void TeleManager_fileReceived( const OUString& rStr, const OString& rUuid );
+
#endif // INCLUDED_TUBES_MANAGER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 6831cb8919de..8b28962ccee8 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -35,14 +35,14 @@ EditTextObject stringToEdit( const OUString& /* rStr */ )
{
// FIXME: implement me.
// The code here only serves to make this file compilable.
- EditEngine aEditEngine(0);
+ EditEngine aEditEngine(nullptr);
return *aEditEngine.CreateTextObject();
}
ScFormulaCell* stringToFormulaCell( const OUString &rString )
{
(void)rString; // FIXME: implement me
- return NULL;
+ return nullptr;
}
struct ProtocolError {
@@ -77,7 +77,7 @@ public:
eState = FIND_LAST_QUOTE;
break;
}
- // else drop through
+ SAL_FALLTHROUGH;
case IN_TEXT:
if (rString[n] == ';')
{
@@ -206,7 +206,7 @@ public:
appendSeparator();
}
- void appendBool( sal_Bool b )
+ void appendBool( bool b )
{
aMessage.appendAscii( b ? "true" : "false" );
appendSeparator();
@@ -320,7 +320,7 @@ void ScDocFuncSend::EndListAction()
SendMessage( aOp );
}
-sal_Bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const OUString& rText, sal_Bool bApi )
+bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const OUString& rText, bool bApi )
{
ScChangeOpWriter aOp( "setNormalString" );
aOp.appendAddress( rPos );
@@ -331,7 +331,7 @@ sal_Bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& r
o_rbNumFmtSet = false;
if ( OUString( rText ) == "saveme" )
- mpCollaboration->SaveAndSendFile( NULL );
+ mpCollaboration->SaveAndSendFile( nullptr );
if ( OUString( rText ) == "contacts" )
mpCollaboration->DisplayContacts();
@@ -410,7 +410,7 @@ bool ScDocFuncSend::ShowNote( const ScAddress& rPos, bool bShow )
return true; // needs some code auditing action
}
-bool ScDocFuncSend::SetNoteText( const ScAddress& rPos, const OUString& rNoteText, sal_Bool bApi )
+bool ScDocFuncSend::SetNoteText( const ScAddress& rPos, const OUString& rNoteText, bool bApi )
{
ScChangeOpWriter aOp( "setNoteText" );
aOp.appendAddress( rPos );
@@ -420,8 +420,8 @@ bool ScDocFuncSend::SetNoteText( const ScAddress& rPos, const OUString& rNoteTex
return true; // needs some code auditing action
}
-sal_Bool ScDocFuncSend::RenameTable( SCTAB nTab, const OUString& rName,
- sal_Bool bRecord, sal_Bool bApi )
+bool ScDocFuncSend::RenameTable( SCTAB nTab, const OUString& rName,
+ bool bRecord, bool bApi )
{
ScChangeOpWriter aOp( "renameTable" );
aOp.appendInt( nTab );
@@ -432,22 +432,22 @@ sal_Bool ScDocFuncSend::RenameTable( SCTAB nTab, const OUString& rName,
return true; // needs some code auditing action
}
-sal_Bool ScDocFuncSend::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
- sal_Bool bApi )
+bool ScDocFuncSend::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
+ bool bApi )
{
SAL_INFO( "sc.tubes", "ApplyAttributes not implemented!" );
return ScDocFunc::ApplyAttributes( rMark, rPattern, bApi );
}
-sal_Bool ScDocFuncSend::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
- sal_Bool bApi )
+bool ScDocFuncSend::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
+ bool bApi )
{
SAL_INFO( "sc.tubes", "ApplyStyle not implemented!" );
return ScDocFunc::ApplyStyle( rMark, rStyleName, bApi );
}
-sal_Bool ScDocFuncSend::MergeCells( const ScCellMergeOption& rOption, sal_Bool bContents,
- sal_Bool bRecord, sal_Bool bApi )
+bool ScDocFuncSend::MergeCells( const ScCellMergeOption& rOption, bool bContents,
+ bool bRecord, bool bApi )
{
SAL_INFO( "sc.tubes", "MergeCells not implemented!" );
return ScDocFunc::MergeCells( rOption, bContents, bRecord, bApi );
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index 1baacd58818a..b0bfc80d2bf3 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -28,12 +28,12 @@ public:
// FIXME: really ScDocFunc should be an abstract base, so
// we don't need the rDocSh hack/pointer
ScDocFuncSend( ScDocShell& rDocSh, ScDocFuncDirect* pDirect, ScCollaboration* pCollaboration );
- virtual ~ScDocFuncSend();
+ virtual ~ScDocFuncSend() override;
virtual void EnterListAction( sal_uInt16 nNameResId );
virtual void EndListAction();
- virtual sal_Bool SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const OUString& rText, sal_Bool bApi );
+ virtual bool SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const OUString& rText, bool bApi );
virtual bool SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction );
virtual bool SetValueCells( const ScAddress& rPos, const std::vector<double>& aVals, bool bInteraction );
virtual bool SetStringCell( const ScAddress& rPos, const OUString& rStr, bool bInteraction );
@@ -44,14 +44,14 @@ public:
const ScAddress& rPos, const OUString& rText, bool bInterpret, bool bEnglish,
bool bApi, const formula::FormulaGrammar::Grammar eGrammar );
virtual bool ShowNote( const ScAddress& rPos, bool bShow = true );
- virtual bool SetNoteText( const ScAddress& rPos, const OUString& rNoteText, sal_Bool bApi );
- virtual sal_Bool RenameTable( SCTAB nTab, const OUString& rName, sal_Bool bRecord, sal_Bool bApi );
- virtual sal_Bool ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
- sal_Bool bApi );
- virtual sal_Bool ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
- sal_Bool bApi );
- virtual sal_Bool MergeCells( const ScCellMergeOption& rOption, sal_Bool bContents,
- sal_Bool bRecord, sal_Bool bApi );
+ virtual bool SetNoteText( const ScAddress& rPos, const OUString& rNoteText, bool bApi );
+ virtual bool RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bool bApi );
+ virtual bool ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
+ bool bApi );
+ virtual bool ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
+ bool bApi );
+ virtual bool MergeCells( const ScCellMergeOption& rOption, bool bContents,
+ bool bRecord, bool bApi );
};
#endif
diff --git a/sc/source/ui/inc/sccollaboration.hxx b/sc/source/ui/inc/sccollaboration.hxx
index f0801e44b5d2..b3639233eab0 100644
--- a/sc/source/ui/inc/sccollaboration.hxx
+++ b/sc/source/ui/inc/sccollaboration.hxx
@@ -21,12 +21,12 @@ class ScCollaboration : public Collaboration
ScDocShell* mpScDocShell;
public:
ScCollaboration( ScDocShell* pScDocShell );
- virtual ~ScCollaboration();
+ virtual ~ScCollaboration() override;
- virtual void EndCollaboration() const;
- virtual void PacketReceived( const OString& rPacket ) const;
- virtual void SaveAndSendFile( TpContact* pContact ) const;
- virtual void StartCollaboration( TeleConference* pConference );
+ virtual void EndCollaboration() const override;
+ virtual void PacketReceived( const OString& rPacket ) const override;
+ virtual void SaveAndSendFile( TpContact* pContact ) const override;
+ virtual void StartCollaboration( TeleConference* pConference ) override;
private:
friend class ScDocShell;
ScDocFuncSend* GetScDocFuncSend() const;
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index a5c1397fe321..11b653eb0ce1 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -30,8 +30,8 @@ class TestTeleTubes: public CppUnit::TestFixture
{
public:
- virtual void setUp();
- virtual void tearDown();
+ virtual void setUp() override;
+ virtual void tearDown() override;
void testSession();
@@ -44,8 +44,8 @@ public:
class TestCollaboration;
// static, not members, so they actually survive cppunit test iteration
-static TestCollaboration* mpCollaboration1 = NULL;
-static TestCollaboration* mpCollaboration2 = NULL;
+static TestCollaboration* mpCollaboration1 = nullptr;
+static TestCollaboration* mpCollaboration2 = nullptr;
//static bool mbFileSentSuccess = false;
static bool mbPacketReceived = false;
static OUString maTestConfigIniURL;
@@ -54,14 +54,14 @@ static OString maAccepterIdentifier;
class TestCollaboration : public Collaboration
{
- virtual void EndCollaboration() const {}
- virtual void PacketReceived( const OString& rPacket ) const
+ virtual void EndCollaboration() const override {}
+ virtual void PacketReceived( const OString& rPacket ) const override
{
CPPUNIT_ASSERT( rPacket == "from 1 to 2");
mbPacketReceived = true;
}
- virtual void SaveAndSendFile( TpContact* ) const {}
- virtual void StartCollaboration( TeleConference* ) {}
+ virtual void SaveAndSendFile( TpContact* ) const override {}
+ virtual void StartCollaboration( TeleConference* ) override {}
};
gboolean timed_out( void * )
@@ -73,7 +73,7 @@ gboolean timed_out( void * )
void TestTeleTubes::setUp()
{
- g_timeout_add_seconds (10, timed_out, NULL);
+ g_timeout_add_seconds (10, timed_out, nullptr);
maTestConfigIniURL = "file://" +
OUString::createFromAscii( getenv("SRCDIR") ) + "/tubes/qa/test-config.ini";
rtl::Bootstrap aTestConfig( maTestConfigIniURL );
@@ -115,10 +115,10 @@ void TestTeleTubes::testSession()
"and are on each other's contact lists",
pairs.size() > 0 );
- TpAccount* mpOffererAccount = NULL;
- TpContact* mpAccepterContact = NULL;
+ TpAccount* mpOffererAccount = nullptr;
+ TpContact* mpAccepterContact = nullptr;
- for (guint i = 0; i < pairs.size(); i++)
+ for (AccountContactPairV::size_type i = 0; i < pairs.size(); i++)
{
AccountContactPair pair = pairs[i];
@@ -146,32 +146,32 @@ void TestTeleTubes::testSession()
mpAccepterContact);
// Now we can start session
- TeleConference* pConference = NULL;
+ TeleConference* pConference = nullptr;
pConference = TeleManager::startBuddySession( mpOffererAccount, mpAccepterContact);
- CPPUNIT_ASSERT( pConference != NULL);
+ CPPUNIT_ASSERT( pConference != nullptr);
mpCollaboration1->SetConference( pConference );
mpCollaboration1->SendFile( mpAccepterContact, maTestConfigIniURL );
g_object_unref(mpOffererAccount);
- mpOffererAccount = NULL;
+ mpOffererAccount = nullptr;
g_object_unref(mpAccepterContact);
- mpAccepterContact = NULL;
+ mpAccepterContact = nullptr;
//while (!mbFileSentSuccess)
// g_main_context_iteration( NULL, TRUE);
// This checks that the file was received and msCurrentUUID set (see manager.cxx)
while (!TeleManager::hasWaitingConference())
- g_main_context_iteration( NULL, TRUE);
+ g_main_context_iteration( nullptr, TRUE);
pConference = TeleManager::getConference();
- CPPUNIT_ASSERT( pConference != NULL);
+ CPPUNIT_ASSERT( pConference != nullptr);
mpCollaboration2->SetConference( pConference );
mpCollaboration1->SendPacket( "from 1 to 2");
while (!mbPacketReceived)
- g_main_context_iteration( NULL, TRUE);
+ g_main_context_iteration( nullptr, TRUE);
}
void TestTeleTubes::tearDown()
diff --git a/tubes/source/collaboration.cxx b/tubes/source/collaboration.cxx
index a6e5ec09b760..ce097b2c38b6 100644
--- a/tubes/source/collaboration.cxx
+++ b/tubes/source/collaboration.cxx
@@ -12,9 +12,10 @@
#include <tubes/conference.hxx>
#include <tubes/manager.hxx>
+#include <contacts.hxx>
+
Collaboration::Collaboration() :
- mpConference( NULL ),
- mpContacts( NULL )
+ mpConference( nullptr )
{
TeleManager::registerCollaboration( this );
}
@@ -40,10 +41,17 @@ void Collaboration::Invite( TpContact* pContact ) const
}
}
+void Collaboration::DisplayContacts()
+{
+ if (!mpContacts)
+ mpContacts = VclPtr<tubes::TubeContacts>::Create( this );
+ mpContacts->Populate();
+}
+
void Collaboration::SendFile( TpContact* pContact, const OUString& rURL ) const
{
if (mpConference)
- mpConference->sendFile( pContact, rURL, NULL, NULL );
+ mpConference->sendFile( pContact, rURL, nullptr, nullptr );
}
void Collaboration::SendPacket( const OString& rPacket ) const
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index df4a63f644bf..57d0e9d01cc1 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -37,7 +37,7 @@ struct InfoLogger
}
};
}
-#define INFO_LOGGER_F(s) InfoLogger aLogger(0,(s))
+#define INFO_LOGGER_F(s) InfoLogger aLogger(nullptr,(s))
#define INFO_LOGGER(s) InfoLogger aLogger(this,(s))
#else
#define INFO_LOGGER_F(s)
@@ -52,7 +52,7 @@ public:
bool mbTubeOfferedHandlerInvoked : 1;
TeleConferenceImpl() :
- mpTube( NULL ),
+ mpTube( nullptr ),
mbTubeOfferedHandlerInvoked( false )
{}
@@ -71,7 +71,7 @@ static void TeleConference_MethodCallHandler(
{
INFO_LOGGER_F( "TeleConference_MethodCallHandler");
- TeleConference* pConference = reinterpret_cast<TeleConference*>(pUserData);
+ TeleConference* pConference = static_cast<TeleConference*>(pUserData);
SAL_WARN_IF( !pConference, "tubes", "TeleConference_MethodCallHandler: no conference");
if (!pConference)
return;
@@ -97,7 +97,7 @@ static void TeleConference_MethodCallHandler(
GVariant *ay;
g_variant_get( pParameters, "(@ay)", &ay);
- const char* pPacketData = reinterpret_cast<const char*>( g_variant_get_data( ay));
+ const char* pPacketData = static_cast<const char*>( g_variant_get_data( ay));
gsize nPacketSize = g_variant_get_size( ay);
SAL_WARN_IF( !pPacketData, "tubes", "TeleConference_MethodCallHandler: couldn't get packet data");
@@ -114,7 +114,7 @@ static void TeleConference_MethodCallHandler(
if (pConference->isMaster())
pConference->sendPacket( aPacket );
- g_dbus_method_invocation_return_value( pInvocation, 0 );
+ g_dbus_method_invocation_return_value( pInvocation, nullptr );
g_variant_unref( ay);
}
@@ -129,7 +129,7 @@ static void TeleConference_ChannelCloseHandler(
{
INFO_LOGGER_F( "TeleConference_ChannelCloseHandler");
- TeleConference* pConference = reinterpret_cast<TeleConference*>(pUserData);
+ TeleConference* pConference = static_cast<TeleConference*>(pUserData);
SAL_WARN_IF( !pConference, "tubes", "TeleConference_ChannelCloseHandler: no conference");
if (!pConference)
return;
@@ -152,7 +152,7 @@ static void TeleConference_TubeOfferedHandler(
{
INFO_LOGGER_F( "TeleConference_TubeOfferedHandler");
- TeleConference* pConference = reinterpret_cast<TeleConference*>(pUserData);
+ TeleConference* pConference = static_cast<TeleConference*>(pUserData);
SAL_WARN_IF( !pConference, "tubes", "TeleConference_TubeOfferedHandler: no conference");
if (!pConference)
return;
@@ -160,7 +160,7 @@ static void TeleConference_TubeOfferedHandler(
pConference->setTubeOfferedHandlerInvoked( true);
TpDBusTubeChannel* pChannel = TP_DBUS_TUBE_CHANNEL( pSource);
- GError* pError = NULL;
+ GError* pError = nullptr;
GDBusConnection* pTube = tp_dbus_tube_channel_offer_finish(
pChannel, pResult, &pError);
@@ -183,7 +183,7 @@ static void TeleConference_TubeAcceptedHandler(
{
INFO_LOGGER_F( "TeleConference_TubeAcceptedHandler");
- TeleConference* pConference = reinterpret_cast<TeleConference*>(pUserData);
+ TeleConference* pConference = static_cast<TeleConference*>(pUserData);
SAL_WARN_IF( !pConference, "tubes", "TeleConference_TubeAcceptedHandler: no conference");
if (!pConference)
return;
@@ -191,7 +191,7 @@ static void TeleConference_TubeAcceptedHandler(
pConference->setTubeOfferedHandlerInvoked( true);
TpDBusTubeChannel* pChannel = TP_DBUS_TUBE_CHANNEL( pSource);
- GError* pError = NULL;
+ GError* pError = nullptr;
GDBusConnection* pTube = tp_dbus_tube_channel_accept_finish(
pChannel, pResult, &pError);
@@ -209,11 +209,11 @@ static void TeleConference_TubeAcceptedHandler(
TeleConference::TeleConference( TpAccount* pAccount,
- TpDBusTubeChannel* pChannel, const OString sUuid, bool bMaster )
+ TpDBusTubeChannel* pChannel, const OString & sUuid, bool bMaster )
:
- mpCollaboration( NULL ),
- mpAccount( NULL ),
- mpChannel( NULL ),
+ mpCollaboration( nullptr ),
+ mpAccount( nullptr ),
+ mpChannel( nullptr ),
msUuid( sUuid ),
mbMaster( bMaster ),
pImpl( new TeleConferenceImpl() )
@@ -230,10 +230,10 @@ TeleConference::~TeleConference()
static void channel_closed_cb( TpChannel *channel, gpointer user_data, GObject * /* weak_object */ )
{
- Collaboration* pCollaboration = reinterpret_cast<Collaboration*> (user_data);
+ Collaboration* pCollaboration = static_cast<Collaboration*> (user_data);
if (TeleManager::existsCollaboration( pCollaboration ))
{
- GtkWidget *dialog = gtk_message_dialog_new( NULL, static_cast<GtkDialogFlags> (0),
+ GtkWidget *dialog = gtk_message_dialog_new( nullptr, static_cast<GtkDialogFlags> (0),
GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
"Contact %s lost, you'll now be working locally.",
tp_contact_get_alias (tp_channel_get_target_contact (channel)) );
@@ -268,10 +268,10 @@ bool TeleConference::spinUntilTubeEstablished()
{
while (!isTubeOfferedHandlerInvoked())
{
- g_main_context_iteration( NULL, TRUE );
+ g_main_context_iteration( nullptr, TRUE );
}
- bool bOpen = pImpl->mpTube != NULL;
+ bool bOpen = pImpl->mpTube != nullptr;
SAL_INFO( "tubes", "TeleConference::spinUntilTubeEstablished: tube open: " << bOpen);
return bOpen;
}
@@ -303,7 +303,7 @@ bool TeleConference::offerTube()
GHashTable* pParameters = tp_asv_new (
LIBO_TUBES_UUID, G_TYPE_STRING, msUuid.getStr(),
- NULL);
+ nullptr);
tp_dbus_tube_channel_offer_async(
mpChannel,
@@ -327,9 +327,9 @@ bool TeleConference::setTube( GDBusConnection* pTube)
static const GDBusInterfaceVTable interface_vtable =
{
TeleConference_MethodCallHandler,
- NULL,
- NULL,
- { NULL },
+ nullptr,
+ nullptr,
+ { nullptr },
};
static const gchar introspection_xml[] =
"<node>"
@@ -340,12 +340,12 @@ bool TeleConference::setTube( GDBusConnection* pTube)
" </interface>"
"</node>";
- introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
- g_assert (introspection_data != NULL);
+ introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, nullptr);
+ g_assert (introspection_data != nullptr);
pImpl->maObjectRegistrationId = g_dbus_connection_register_object( pImpl->mpTube,
LIBO_TUBES_DBUS_PATH, introspection_data->interfaces[0],
- &interface_vtable, this, NULL, NULL);
+ &interface_vtable, this, nullptr, nullptr);
g_assert (pImpl->maObjectRegistrationId > 0);
g_dbus_node_info_unref (introspection_data);
@@ -373,7 +373,7 @@ void TeleConference::close()
INFO_LOGGER( "TeleConference::close");
if (mpChannel)
- tp_cli_channel_call_close( TP_CHANNEL( mpChannel), 5000, TeleConference_ChannelCloseHandler, this, NULL, NULL);
+ tp_cli_channel_call_close( TP_CHANNEL( mpChannel), 5000, TeleConference_ChannelCloseHandler, this, nullptr, nullptr);
else
finalize();
}
@@ -388,21 +388,21 @@ void TeleConference::finalize()
if (mpChannel)
{
g_object_unref( mpChannel);
- mpChannel = NULL;
+ mpChannel = nullptr;
}
if (mpAccount)
{
g_object_unref( mpAccount);
- mpAccount = NULL;
+ mpAccount = nullptr;
}
if (pImpl->mpTube)
{
g_dbus_connection_unregister_object( pImpl->mpTube, pImpl->maObjectRegistrationId);
- g_dbus_connection_close_sync( pImpl->mpTube, NULL, NULL );
+ g_dbus_connection_close_sync( pImpl->mpTube, nullptr, nullptr );
g_object_unref( pImpl->mpTube );
- pImpl->mpTube = NULL;
+ pImpl->mpTube = nullptr;
}
//! *this gets destructed here!
@@ -433,14 +433,14 @@ bool TeleConference::sendPacket( const OString& rPacket )
g_free, pData);
g_dbus_connection_call( pImpl->mpTube,
- NULL, /* bus name; in multi-user case we'd address this to the master. */
+ nullptr, /* bus name; in multi-user case we'd address this to the master. */
LIBO_TUBES_DBUS_PATH,
LIBO_TUBES_DBUS_INTERFACE,
LIBO_TUBES_DBUS_MSG_METHOD,
pParameters, /* consumes the floating reference */
- NULL,
+ nullptr,
G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, NULL, NULL);
+ -1, nullptr, nullptr, nullptr);
// If we started the session, we can execute commands immediately.
if (mbMaster && mpCollaboration)
@@ -464,9 +464,9 @@ void TeleConference::setCollaboration( Collaboration* pCollaboration )
mpCollaboration = pCollaboration;
if (mpChannel)
{
- GError *error = NULL;
+ GError *error = nullptr;
if (!tp_cli_channel_connect_to_closed( TP_CHANNEL (mpChannel),
- channel_closed_cb, mpCollaboration, NULL, NULL, &error ))
+ channel_closed_cb, mpCollaboration, nullptr, nullptr, &error ))
{
SAL_WARN( "tubes", "Error when connecting to signal closed: " << error->message );
g_error_free (error);
@@ -480,7 +480,7 @@ void TeleConference::invite( TpContact *pContact )
TpHandle aHandle = tp_contact_get_handle( pContact );
GArray handles = { reinterpret_cast<gchar *> (&aHandle), 1 };
tp_cli_channel_interface_group_call_add_members( TP_CHANNEL( mpChannel ),
- -1, &handles, NULL, NULL, NULL, NULL, NULL );
+ -1, &handles, nullptr, nullptr, nullptr, nullptr, nullptr );
}
namespace {
@@ -500,7 +500,7 @@ public:
static void TeleConference_TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel *, gpointer user_data)
{
- SendFileRequest *request = reinterpret_cast<SendFileRequest *>(user_data);
+ SendFileRequest *request = static_cast<SendFileRequest *>(user_data);
if (request->mpCallback)
request->mpCallback(true, request->mpUserData);
@@ -510,7 +510,7 @@ static void TeleConference_TransferDone( EmpathyFTHandler *handler, TpFileTransf
static void TeleConference_TransferError( EmpathyFTHandler *handler, const GError *error, gpointer user_data)
{
- SendFileRequest *request = reinterpret_cast<SendFileRequest *>(user_data);
+ SendFileRequest *request = static_cast<SendFileRequest *>(user_data);
SAL_INFO( "tubes", "TeleConference_TransferError: " << error->message);
@@ -522,12 +522,12 @@ static void TeleConference_TransferError( EmpathyFTHandler *handler, const GErro
static void TeleConference_FTReady( EmpathyFTHandler *handler, GError *error, gpointer user_data)
{
- SendFileRequest *request = reinterpret_cast<SendFileRequest *>(user_data);
+ SendFileRequest *request = static_cast<SendFileRequest *>(user_data);
- if ( error != 0 )
+ if ( error != nullptr )
{
if (request->mpCallback)
- request->mpCallback(error == 0, request->mpUserData);
+ request->mpCallback(error == nullptr, request->mpUserData);
delete request;
g_object_unref (handler);
}
@@ -544,7 +544,6 @@ static void TeleConference_FTReady( EmpathyFTHandler *handler, GError *error, gp
}
// TODO: move sending file to TeleManager
-extern void TeleManager_fileReceived( const OUString&, const OString& );
void TeleConference::sendFile( TpContact* pContact, const OUString& localUri, FileSentCallback pCallback, void* pUserData)
{
INFO_LOGGER( "TeleConference::sendFile");
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index b86bf9f18287..fd7855407146 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -12,212 +12,180 @@
#include <vcl/graphicfilter.hxx>
#include <tubes/conference.hxx>
#include <tubes/collaboration.hxx>
-#include <tubes/manager.hxx>
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/lstbox.hxx>
#include <telepathy-glib/telepathy-glib.h>
-namespace {
+#include <contacts.hxx>
-class TubeContacts : public ModelessDialog
+void tubes::TubeContacts::Invite()
{
- VclPtr<PushButton> mpBtnDemo;
- VclPtr<PushButton> mpBtnBuddy;
- VclPtr<PushButton> mpBtnGroup;
- VclPtr<PushButton> mpBtnInvite;
- VclPtr<PushButton> mpBtnListen;
- VclPtr<ListBox> mpList;
- Collaboration* mpCollaboration;
-
- DECL_LINK( BtnDemoHdl, Button*, void );
- DECL_LINK( BtnConnectHdl, Button*, void );
- DECL_LINK( BtnGroupHdl, Button*, void );
- DECL_LINK( BtnInviteHdl, Button*, void );
- DECL_LINK( BtnListenHdl, Button*, void );
-
- AccountContactPairV maACs;
-
- void Invite()
+ if (mpList->GetSelectEntryCount())
{
- if (mpList->GetSelectEntryCount())
- {
- sal_uInt16 i = mpList->GetSelectEntryPos();
- TpContact* pContact = maACs[i].second;
- mpCollaboration->Invite( pContact );
- }
+ sal_uInt16 i = mpList->GetSelectEntryPos();
+ TpContact* pContact = maACs[i].second;
+ mpCollaboration->Invite( pContact );
}
+}
- void Listen()
+void tubes::TubeContacts::StartDemoSession()
+{
+ TeleConference* pConference = TeleManager::startDemoSession();
+ if (!pConference)
+ SAL_WARN( "tubes", "Could not start demo session!" );
+ else
{
- if (!TeleManager::registerClients())
- SAL_INFO( "tubes", "Could not register client handlers." );
+ mpCollaboration->StartCollaboration( pConference );
+ mpCollaboration->SaveAndSendFile( nullptr );
}
+}
- void StartDemoSession()
+void tubes::TubeContacts::StartBuddySession()
+{
+ if (mpList->GetSelectEntryCount())
{
- TeleConference* pConference = TeleManager::startDemoSession();
+ sal_uInt16 i = mpList->GetSelectEntryPos();
+ TpAccount* pAccount = maACs[i].first;
+ TpContact* pContact = maACs[i].second;
+ SAL_INFO( "tubes", "picked " << tp_contact_get_identifier( pContact ) );
+ TeleConference* pConference = TeleManager::startBuddySession( pAccount, pContact );
if (!pConference)
- SAL_WARN( "tubes", "Could not start demo session!" );
+ SAL_WARN( "tubes", "Could not start session with " <<
+ tp_contact_get_identifier( pContact ) );
else
{
mpCollaboration->StartCollaboration( pConference );
- mpCollaboration->SaveAndSendFile( NULL );
+ mpCollaboration->SaveAndSendFile( pContact );
}
}
+}
- void StartBuddySession()
+void tubes::TubeContacts::StartGroupSession()
+{
+ if (mpList->GetSelectEntryCount())
{
- if (mpList->GetSelectEntryCount())
+ sal_uInt16 i = mpList->GetSelectEntryPos();
+ TpAccount* pAccount = maACs[i].first;
+ SAL_INFO( "tubes", "picked " << tp_account_get_display_name( pAccount ) );
+ TeleConference* pConference = TeleManager::startGroupSession( pAccount,
+ "liboroom", "conference.jabber.org" );
+ if (!pConference)
+ SAL_WARN( "tubes", "Could not start group session." );
+ else
{
- sal_uInt16 i = mpList->GetSelectEntryPos();
- TpAccount* pAccount = maACs[i].first;
- TpContact* pContact = maACs[i].second;
- SAL_INFO( "tubes", "picked " << tp_contact_get_identifier( pContact ) );
- TeleConference* pConference = TeleManager::startBuddySession( pAccount, pContact );
- if (!pConference)
- SAL_WARN( "tubes", "Could not start session with " <<
- tp_contact_get_identifier( pContact ) );
- else
- {
- mpCollaboration->StartCollaboration( pConference );
- mpCollaboration->SaveAndSendFile( pContact );
- }
+ mpCollaboration->StartCollaboration( pConference );
}
}
+}
- void StartGroupSession()
- {
- if (mpList->GetSelectEntryCount())
- {
- sal_uInt16 i = mpList->GetSelectEntryPos();
- TpAccount* pAccount = maACs[i].first;
- SAL_INFO( "tubes", "picked " << tp_account_get_display_name( pAccount ) );
- TeleConference* pConference = TeleManager::startGroupSession( pAccount,
- OUString("liboroom"), OUString("conference.jabber.org") );
- if (!pConference)
- SAL_WARN( "tubes", "Could not start group session." );
- else
- {
- mpCollaboration->StartCollaboration( pConference );
- }
- }
- }
+tubes::TubeContacts::TubeContacts( Collaboration* pCollaboration ) :
+ ModelessDialog( nullptr, "ContactsDialog", "tubes/ui/contacts.ui" ),
+ mpCollaboration( pCollaboration )
+{
+ get( mpBtnListen, "listen");
+ get( mpBtnInvite, "invite");
+ get( mpBtnDemo, "demo");
+ get( mpBtnBuddy, "buddy");
+ get( mpBtnGroup, "group");
+ get( mpList, "contacts");
+ mpBtnListen->SetClickHdl( LINK( this, TubeContacts, BtnListenHdl ) );
+ mpBtnInvite->SetClickHdl( LINK( this, TubeContacts, BtnInviteHdl ) );
+ mpBtnDemo->SetClickHdl( LINK( this, TubeContacts, BtnDemoHdl ) );
+ mpBtnBuddy->SetClickHdl( LINK( this, TubeContacts, BtnConnectHdl ) );
+ mpBtnGroup->SetClickHdl( LINK( this, TubeContacts, BtnGroupHdl ) );
+}
-public:
- explicit TubeContacts( Collaboration* pCollaboration ) :
- ModelessDialog( NULL, "ContactsDialog", "tubes/ui/contacts.ui" ),
- mpCollaboration( pCollaboration )
- {
- get( mpBtnListen, "listen");
- get( mpBtnInvite, "invite");
- get( mpBtnDemo, "demo");
- get( mpBtnBuddy, "buddy");
- get( mpBtnGroup, "group");
- get( mpList, "contacts");
- mpBtnListen->SetClickHdl( LINK( this, TubeContacts, BtnListenHdl ) );
- mpBtnInvite->SetClickHdl( LINK( this, TubeContacts, BtnInviteHdl ) );
- mpBtnDemo->SetClickHdl( LINK( this, TubeContacts, BtnDemoHdl ) );
- mpBtnBuddy->SetClickHdl( LINK( this, TubeContacts, BtnConnectHdl ) );
- mpBtnGroup->SetClickHdl( LINK( this, TubeContacts, BtnGroupHdl ) );
- }
- virtual ~TubeContacts()
- {
- dispose();
- }
+tubes::TubeContacts::~TubeContacts()
+{
+ disposeOnce();
+}
- virtual void dispose() override
- {
- mpBtnListen.clear();
- mpBtnGroup.clear();
- mpBtnDemo.clear();
- mpBtnBuddy.clear();
- mpBtnGroup.clear();
- mpList.clear();
- }
+void tubes::TubeContacts::dispose()
+{
+ mpBtnListen.disposeAndClear();
+ mpBtnInvite.disposeAndClear();
+ mpBtnDemo.disposeAndClear();
+ mpBtnBuddy.disposeAndClear();
+ mpBtnGroup.disposeAndClear();
+ mpList.disposeAndClear();
+ ModelessDialog::dispose();
+}
- static OUString fromUTF8( const char *pStr )
- {
- return OStringToOUString( OString( pStr, strlen( pStr ) ),
- RTL_TEXTENCODING_UTF8 );
- }
+namespace {
- void Populate()
+OUString fromUTF8( const char *pStr )
+{
+ return OStringToOUString( OString( pStr, strlen( pStr ) ),
+ RTL_TEXTENCODING_UTF8 );
+}
+
+}
+
+void tubes::TubeContacts::Populate()
+{
+ SAL_INFO( "tubes", "Populating contact list dialog" );
+ mpList->Clear();
+ maACs.clear();
+
+ AccountContactPairV aPairs = TeleManager::getContacts();
+ AccountContactPairV::iterator it;
+ // make sure we have enough memory to not need re-allocation
+ // which would invalidate pointers stored in mpList entries
+ maACs.reserve( aPairs.size() );
+ for( it = aPairs.begin(); it != aPairs.end(); ++it )
{
- SAL_INFO( "tubes", "Populating contact list dialog" );
- mpList->Clear();
- maACs.clear();
-
- AccountContactPairV aPairs = TeleManager::getContacts();
- AccountContactPairV::iterator it;
- // make sure we have enough memory to not need re-allocation
- // which would invalidate pointers stored in mpList entries
- maACs.reserve( aPairs.size() );
- for( it = aPairs.begin(); it != aPairs.end(); ++it )
+ Image aImage;
+ GFile *pAvatarFile = tp_contact_get_avatar_file( it->second );
+ if( pAvatarFile )
{
- Image aImage;
- GFile *pAvatarFile = tp_contact_get_avatar_file( it->second );
- if( pAvatarFile )
+ const OUString sAvatarFileUrl = fromUTF8( g_file_get_path ( pAvatarFile ) );
+ Graphic aGraphic;
+ if( GRFILTER_OK == GraphicFilter::LoadGraphic( sAvatarFileUrl, "", aGraphic ) )
{
- const OUString sAvatarFileUrl = fromUTF8( g_file_get_path ( pAvatarFile ) );
- Graphic aGraphic;
- if( GRFILTER_OK == GraphicFilter::LoadGraphic( sAvatarFileUrl, OUString(""), aGraphic ) )
- {
- BitmapEx aBitmap = aGraphic.GetBitmapEx();
- double fScale = 30.0 / aBitmap.GetSizePixel().Height();
- aBitmap.Scale( fScale, fScale );
- aImage = Image( aBitmap );
- }
+ BitmapEx aBitmap = aGraphic.GetBitmapEx();
+ double fScale = 30.0 / aBitmap.GetSizePixel().Height();
+ aBitmap.Scale( fScale, fScale );
+ aImage = Image( aBitmap );
}
- OUStringBuffer aEntry( 128 );
- aEntry.append( " " );
- aEntry.append( fromUTF8 ( tp_contact_get_alias( it->second ) ) );
- aEntry.append( " - " );
- aEntry.append( fromUTF8 ( tp_contact_get_identifier( it->second ) ) );
- mpList->InsertEntry( aEntry.makeStringAndClear(), aImage);
- // FIXME: ref the TpAccount, TpContact ...
- maACs.push_back( AccountContactPair( it->first, it->second ) );
-
- g_object_unref (it->first);
- g_object_unref (it->second);
}
- Show();
+ OUStringBuffer aEntry( 128 );
+ aEntry.append( " " );
+ aEntry.append( fromUTF8 ( tp_contact_get_alias( it->second ) ) );
+ aEntry.append( " - " );
+ aEntry.append( fromUTF8 ( tp_contact_get_identifier( it->second ) ) );
+ mpList->InsertEntry( aEntry.makeStringAndClear(), aImage);
+ // FIXME: ref the TpAccount, TpContact ...
+ maACs.push_back( AccountContactPair( it->first, it->second ) );
+
+ g_object_unref (it->first);
+ g_object_unref (it->second);
}
-};
+ Show();
+}
-IMPL_LINK_NOARG( TubeContacts, BtnDemoHdl, Button*, void )
+IMPL_LINK_NOARG( tubes::TubeContacts, BtnDemoHdl, Button*, void )
{
StartDemoSession();
}
-IMPL_LINK_NOARG( TubeContacts, BtnConnectHdl, Button*, void )
+IMPL_LINK_NOARG( tubes::TubeContacts, BtnConnectHdl, Button*, void )
{
StartBuddySession();
}
-IMPL_LINK_NOARG( TubeContacts, BtnGroupHdl, Button*, void )
+IMPL_LINK_NOARG( tubes::TubeContacts, BtnGroupHdl, Button*, void )
{
StartGroupSession();
}
-IMPL_LINK_NOARG( TubeContacts, BtnInviteHdl, Button*, void )
+IMPL_LINK_NOARG( tubes::TubeContacts, BtnInviteHdl, Button*, void )
{
Invite();
}
-IMPL_LINK_NOARG( TubeContacts, BtnListenHdl, Button*, void )
-{
- Listen();
-}
-
-} // anonymous namespace
-
-void Collaboration::DisplayContacts()
+IMPL_STATIC_LINK_NOARG( tubes::TubeContacts, BtnListenHdl, Button*, void )
{
- if (!mpContacts)
- mpContacts = new TubeContacts( this );
- reinterpret_cast<TubeContacts*> (mpContacts)->Populate();
+ if (!TeleManager::registerClients())
+ SAL_INFO( "tubes", "Could not register client handlers." );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/source/contacts.hxx b/tubes/source/contacts.hxx
new file mode 100644
index 000000000000..7684db962d22
--- /dev/null
+++ b/tubes/source/contacts.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TUBES_SOURCE_CONTACTS_HXX
+#define INCLUDED_TUBES_SOURCE_CONTACTS_HXX
+
+#include <sal/config.h>
+
+#include <tubes/manager.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/lstbox.hxx>
+
+class Collaboration;
+
+namespace tubes {
+
+class TubeContacts : public ModelessDialog
+{
+ VclPtr<PushButton> mpBtnDemo;
+ VclPtr<PushButton> mpBtnBuddy;
+ VclPtr<PushButton> mpBtnGroup;
+ VclPtr<PushButton> mpBtnInvite;
+ VclPtr<PushButton> mpBtnListen;
+ VclPtr<ListBox> mpList;
+ Collaboration* mpCollaboration;
+
+ DECL_LINK( BtnDemoHdl, Button*, void );
+ DECL_LINK( BtnConnectHdl, Button*, void );
+ DECL_LINK( BtnGroupHdl, Button*, void );
+ DECL_LINK( BtnInviteHdl, Button*, void );
+ DECL_STATIC_LINK( TubeContacts, BtnListenHdl, Button*, void );
+
+ AccountContactPairV maACs;
+
+ void Invite();
+
+ void StartDemoSession();
+
+ void StartBuddySession();
+
+ void StartGroupSession();
+
+public:
+ explicit TubeContacts( Collaboration* pCollaboration );
+
+ virtual ~TubeContacts() override;
+
+ virtual void dispose() override;
+
+ void Populate();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/tubes/source/file-transfer-helper.c b/tubes/source/file-transfer-helper.c
index 725ebad6c35b..d2dc4fd3d505 100644
--- a/tubes/source/file-transfer-helper.c
+++ b/tubes/source/file-transfer-helper.c
@@ -66,7 +66,14 @@
* to use in an UI.
*/
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
G_DEFINE_TYPE (EmpathyFTHandler, empathy_ft_handler, G_TYPE_OBJECT)
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
#define BUFFER_SIZE 4096
@@ -112,7 +119,7 @@ typedef struct {
} CallbacksData;
/* private data */
-struct _EmpathyFTHandlerPriv {
+struct EmpathyFTHandlerPriv_ {
gboolean dispose_run;
GFile *gfile;
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index e4b0f42ddea0..909904e2f7b6 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -50,7 +50,7 @@ struct InfoLogger
}
};
}
-#define INFO_LOGGER_F(s) InfoLogger aLogger(0,(s))
+#define INFO_LOGGER_F(s) InfoLogger aLogger(nullptr,(s))
#else
#define INFO_LOGGER_F(s)
#endif // SAL_LOG_INFO
@@ -131,9 +131,12 @@ static void TeleManager_DBusChannelHandler(
tp_handle_channels_context_accept( pContext);
else
{
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ // 'tp_errors_quark' [expanded from macro 'TP_ERRORS'] is deprecated
GError *pError = g_error_new_literal( TP_ERRORS, TP_ERROR_CONFUSED,
"None of these channels were LibreOffice D-Bus tubes; "
"why did the Channel Dispatcher give them to us?");
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
tp_handle_channels_context_fail( pContext, pError);
g_clear_error (&pError);
}
@@ -155,7 +158,7 @@ TeleConference* TeleManager::getConference()
TeleManagerImpl::MapStringConference::const_iterator it =
pImpl->maAcceptedConferences.find( pImpl->msCurrentUUID );
- TeleConference* pConference = NULL;
+ TeleConference* pConference = nullptr;
if (it != pImpl->maAcceptedConferences.end())
pConference = it->second;
SAL_WARN_IF( !pConference, "tubes", "TeleManager::getConference: "
@@ -233,7 +236,6 @@ void TeleManager::setCurrentUuid( const OString& rUuid )
pImpl->msCurrentUUID = rUuid;
}
-// FIXME: should be static and not used in conference.cxx
void TeleManager_fileReceived( const OUString& rStr, const OString& rUuid )
{
SAL_INFO( "tubes", "TeleManager_fileReceived: incoming file: " << rStr );
@@ -242,7 +244,7 @@ void TeleManager_fileReceived( const OUString& rStr, const OString& rUuid )
if (sUuid == "demo")
{
sUuid = TeleManager::createUuid();
- TeleConference* pConference = new TeleConference( NULL, NULL, sUuid );
+ TeleConference* pConference = new TeleConference( nullptr, nullptr, sUuid );
TeleManager::addConference( pConference );
TeleManager::registerDemoConference( pConference );
}
@@ -307,8 +309,8 @@ static void lcl_IncomingHandlerReady (
empathy_ft_handler_incoming_set_destination( pHandler, pDestination);
g_object_unref( pDestination);
- g_signal_connect( pHandler, "transfer-done", G_CALLBACK (TeleManager_TransferDone), NULL);
- g_signal_connect( pHandler, "transfer-error", G_CALLBACK (TeleManager_TransferError), NULL);
+ g_signal_connect( pHandler, "transfer-done", G_CALLBACK (TeleManager_TransferDone), nullptr);
+ g_signal_connect( pHandler, "transfer-error", G_CALLBACK (TeleManager_TransferError), nullptr);
SAL_INFO ("tubes", "lcl_IncomingHandlerReady: starting file transfer..");
empathy_ft_handler_start_transfer( pHandler);
}
@@ -337,7 +339,7 @@ static void TeleManager_FileTransferHandler(
{
SAL_INFO( "tubes", "accepting file transfer");
empathy_ft_handler_new_incoming( TP_FILE_TRANSFER_CHANNEL( pChannel),
- lcl_IncomingHandlerReady, NULL);
+ lcl_IncomingHandlerReady, nullptr);
aAccepted = true;
}
else
@@ -350,9 +352,12 @@ static void TeleManager_FileTransferHandler(
tp_handle_channels_context_accept( pContext);
else
{
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ // 'tp_errors_quark' [expanded from macro 'TP_ERRORS'] is deprecated
GError *pError = g_error_new_literal( TP_ERRORS, TP_ERROR_CONFUSED,
"None of these channels were file transfers; "
"why did the Channel Dispatcher give them to us?");
+ SAL_WNODEPRECATED_DECLARATIONS_POP
tp_handle_channels_context_fail( pContext, pError);
g_clear_error (&pError);
}
@@ -367,7 +372,7 @@ void TeleManagerImpl::ChannelReadyHandler(
{
INFO_LOGGER_F( "TeleManagerImpl::ChannelReadyHandler");
- TeleConference* pConference = reinterpret_cast<TeleConference*>(pUserData);
+ TeleConference* pConference = static_cast<TeleConference*>(pUserData);
SAL_WARN_IF( !pConference, "tubes", "TeleManagerImpl::ChannelReadyHandler: no conference");
if (!pConference)
return;
@@ -375,9 +380,9 @@ void TeleManagerImpl::ChannelReadyHandler(
mbChannelReadyHandlerInvoked = true;
TpAccountChannelRequest* pChannelRequest = TP_ACCOUNT_CHANNEL_REQUEST( pSourceObject);
- GError* pError = NULL;
+ GError* pError = nullptr;
TpChannel * pChannel = tp_account_channel_request_create_and_handle_channel_finish(
- pChannelRequest, pResult, NULL, &pError);
+ pChannelRequest, pResult, nullptr, &pError);
if (!pChannel)
{
// "account isn't Enabled" means just that..
@@ -399,7 +404,7 @@ void TeleManagerImpl::AccountManagerReadyHandler(
{
INFO_LOGGER_F( "TeleManagerImpl::AccountManagerReadyHandler");
- GError* pError = NULL;
+ GError* pError = nullptr;
gboolean bPrepared = tp_proxy_prepare_finish( pSourceObject, pResult, &pError);
SAL_WARN_IF( !bPrepared, "tubes", "TeleManagerImpl::AccountManagerReadyHandler: not prepared");
if (!bPrepared || pError)
@@ -443,7 +448,7 @@ bool TeleManager::createAccountManager()
if (pImpl->mpAccountManager)
return true;
- GError* pError = NULL;
+ GError* pError = nullptr;
TpDBusDaemon *pDBus = tp_dbus_daemon_dup( &pError);
SAL_WARN_IF( !pDBus, "tubes", "TeleManager::createAccountManager: no dbus daemon");
if (!pDBus || pError)
@@ -484,12 +489,12 @@ bool TeleManager::createAccountManager()
pImpl->mpAccountManager = tp_account_manager_new_with_factory (pImpl->mpFactory);
tp_account_manager_set_default (pImpl->mpAccountManager);
- pImpl->mbAccountManagerReadyHandlerInvoked = false;
- tp_proxy_prepare_async( pImpl->mpAccountManager, NULL, TeleManagerImpl::AccountManagerReadyHandler, NULL);
- while (!pImpl->mbAccountManagerReadyHandlerInvoked)
- g_main_context_iteration( NULL, TRUE);
+ TeleManagerImpl::mbAccountManagerReadyHandlerInvoked = false;
+ tp_proxy_prepare_async( pImpl->mpAccountManager, nullptr, TeleManagerImpl::AccountManagerReadyHandler, nullptr);
+ while (!TeleManagerImpl::mbAccountManagerReadyHandlerInvoked)
+ g_main_context_iteration( nullptr, TRUE);
- return pImpl->mbAccountManagerReady;
+ return TeleManagerImpl::mbAccountManagerReady;
}
bool TeleManager::registerClients()
@@ -510,8 +515,8 @@ bool TeleManager::registerClients()
getFullClientName().getStr(), // name
FALSE, // uniquify
TeleManager_DBusChannelHandler, // callback
- NULL, // user_data
- NULL // destroy
+ nullptr, // user_data
+ nullptr // destroy
);
SAL_WARN_IF( !pImpl->mpClient, "tubes", "TeleManager::registerClients: no client");
if (!pImpl->mpClient)
@@ -523,7 +528,7 @@ bool TeleManager::registerClients()
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, G_TYPE_STRING, getFullServiceName().getStr(),
- NULL));
+ nullptr));
/* TODO: setup filters for LibreOfficeCalc, LibreOfficeWriter, ... */
@@ -533,9 +538,9 @@ bool TeleManager::registerClients()
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_ROOM,
TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, G_TYPE_STRING, getFullServiceName().getStr(),
- NULL));
+ nullptr));
- GError* pError = NULL;
+ GError* pError = nullptr;
if (!tp_base_client_register( pImpl->mpClient, &pError))
{
SAL_WARN( "tubes", "TeleManager::registerClients: error registering client handler: " << pError->message);
@@ -558,15 +563,15 @@ bool TeleManager::registerClients()
getFullClientName().getStr(), // name
TRUE, // uniquify to get a different bus name to the main client, above
TeleManager_FileTransferHandler, // callback
- NULL, // user_data
- NULL // destroy
+ nullptr, // user_data
+ nullptr // destroy
);
tp_base_client_take_handler_filter( pImpl->mpFileTransferClient,
tp_asv_new(
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME, G_TYPE_STRING, getFullServiceName().getStr(),
- NULL));
+ nullptr));
if (!tp_base_client_register( pImpl->mpFileTransferClient, &pError))
{
@@ -583,7 +588,7 @@ TeleConference* TeleManager::startDemoSession()
{
INFO_LOGGER_F( "TeleManager::startDemoSession");
- TeleConference* pConference = new TeleConference( NULL, NULL, "demo" );
+ TeleConference* pConference = new TeleConference( nullptr, nullptr, "demo" );
registerDemoConference( pConference );
return pConference;
@@ -623,7 +628,7 @@ TeleConference* TeleManager::startGroupSession( TpAccount *pAccount,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, TP_TYPE_HANDLE, TP_HANDLE_TYPE_ROOM,
TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, aTarget.getStr(),
TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, G_TYPE_STRING, getFullServiceName().getStr(),
- NULL);
+ nullptr);
TpAccountChannelRequest * pChannelRequest = tp_account_channel_request_new(
pAccount, pRequest, TP_USER_ACTION_TIME_NOT_USER_ACTION);
@@ -631,24 +636,24 @@ TeleConference* TeleManager::startGroupSession( TpAccount *pAccount,
if (!pChannelRequest)
{
g_hash_table_unref( pRequest);
- return NULL;
+ return nullptr;
}
- pImpl->mbChannelReadyHandlerInvoked = false;
+ TeleManagerImpl::mbChannelReadyHandlerInvoked = false;
- TeleConference* pConference = new TeleConference( NULL, NULL, aSessionId );
+ TeleConference* pConference = new TeleConference( nullptr, nullptr, aSessionId );
tp_account_channel_request_create_and_handle_channel_async(
- pChannelRequest, NULL, TeleManagerImpl::ChannelReadyHandler, pConference);
+ pChannelRequest, nullptr, TeleManagerImpl::ChannelReadyHandler, pConference);
- while (!pImpl->mbChannelReadyHandlerInvoked)
- g_main_context_iteration( NULL, TRUE );
+ while (!TeleManagerImpl::mbChannelReadyHandlerInvoked)
+ g_main_context_iteration( nullptr, TRUE );
g_object_unref( pChannelRequest);
g_hash_table_unref( pRequest);
if (!pConference->isReady())
- return NULL;
+ return nullptr;
return pConference;
}
@@ -671,11 +676,11 @@ static void lcl_ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy )
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TUBES,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, TP_TYPE_HANDLE, TP_HANDLE_TYPE_CONTACT,
TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, tp_contact_get_identifier (pBuddy),
- NULL);
+ nullptr);
TpAccountChannelRequest* pChannelRequest = tp_account_channel_request_new(
pAccount, pRequest, TP_USER_ACTION_TIME_NOT_USER_ACTION);
- tp_account_channel_request_ensure_channel_async( pChannelRequest, NULL,
- NULL, NULL, NULL );
+ tp_account_channel_request_ensure_channel_async( pChannelRequest, nullptr,
+ nullptr, nullptr, nullptr );
g_object_unref( pChannelRequest );
g_hash_table_unref( pRequest );
}
@@ -697,7 +702,7 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, TP_TYPE_HANDLE, TP_HANDLE_TYPE_CONTACT,
TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, pIdentifier,
TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, G_TYPE_STRING, getFullServiceName().getStr(),
- NULL);
+ nullptr);
TpAccountChannelRequest * pChannelRequest = tp_account_channel_request_new(
pAccount, pRequest, TP_USER_ACTION_TIME_NOT_USER_ACTION);
@@ -705,24 +710,24 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *
if (!pChannelRequest)
{
g_hash_table_unref( pRequest);
- return NULL;
+ return nullptr;
}
- pImpl->mbChannelReadyHandlerInvoked = false;
+ TeleManagerImpl::mbChannelReadyHandlerInvoked = false;
- TeleConference* pConference = new TeleConference( NULL, NULL, createUuid(), true );
+ TeleConference* pConference = new TeleConference( nullptr, nullptr, createUuid(), true );
tp_account_channel_request_create_and_handle_channel_async(
- pChannelRequest, NULL, TeleManagerImpl::ChannelReadyHandler, pConference );
+ pChannelRequest, nullptr, TeleManagerImpl::ChannelReadyHandler, pConference );
- while (!pImpl->mbChannelReadyHandlerInvoked)
- g_main_context_iteration( NULL, TRUE );
+ while (!TeleManagerImpl::mbChannelReadyHandlerInvoked)
+ g_main_context_iteration( nullptr, TRUE );
g_object_unref( pChannelRequest);
g_hash_table_unref( pRequest);
if (!pConference->isReady())
- return NULL;
+ return nullptr;
return pConference;
}
@@ -767,15 +772,15 @@ AccountContactPairV TeleManager::getContacts()
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
for (GList *accounts = tp_account_manager_get_valid_accounts (pImpl->mpAccountManager);
- accounts != NULL; accounts = g_list_delete_link (accounts, accounts))
+ accounts != nullptr; accounts = g_list_delete_link (accounts, accounts))
{
- TpAccount *account = reinterpret_cast<TpAccount *>(accounts->data);
+ TpAccount *account = static_cast<TpAccount *>(accounts->data);
TpConnection *connection = tp_account_get_connection (account);
/* Verify account is online and received its contact list. If state is not
* SUCCESS this means we didn't received the roster from server yet and
* we would have to wait for the "notify:contact-list-state" signal. */
- if (connection == NULL || tp_connection_get_contact_list_state (connection) !=
+ if (connection == nullptr || tp_connection_get_contact_list_state (connection) !=
TP_CONTACT_LIST_STATE_SUCCESS)
continue;
@@ -783,12 +788,12 @@ AccountContactPairV TeleManager::getContacts()
GPtrArray *contacts = tp_connection_dup_contact_list (connection);
for (guint i = 0; i < contacts->len; i++)
{
- TpContact *contact = reinterpret_cast<TpContact *>(g_ptr_array_index (contacts, i));
+ TpContact *contact = static_cast<TpContact *>(g_ptr_array_index (contacts, i));
if (pImpl->maRegisteredContacts.find (contact) == pImpl->maRegisteredContacts.end())
{
pImpl->maRegisteredContacts.insert (contact);
g_signal_connect (contact, "presence-changed",
- G_CALLBACK (presence_changed_cb), NULL );
+ G_CALLBACK (presence_changed_cb), nullptr );
}
if (contact != self && tb_contact_is_online (contact))
{
@@ -830,7 +835,7 @@ OString TeleManager::getFullObjectPath()
OString TeleManager::createUuid()
{
sal_uInt8 nId[16];
- rtl_createUuid( nId, 0, sal_True);
+ rtl_createUuid( nId, nullptr, true);
char aBuf[33];
for (size_t i=0; i<16; ++i)
{
@@ -842,7 +847,7 @@ OString TeleManager::createUuid()
Mutex& TeleManager::GetMutex()
{
- static Mutex* pMutex = NULL;
+ static Mutex* pMutex = nullptr;
if (!pMutex)
{
MutexGuard aGuard( Mutex::getGlobalMutex());
@@ -860,10 +865,10 @@ void TeleManager::addSuffixToNames( const char* pName )
TeleManagerImpl::TeleManagerImpl()
:
- mpFactory( NULL),
- mpClient( NULL),
- mpFileTransferClient( NULL),
- mpAccountManager( NULL)
+ mpFactory( nullptr),
+ mpClient( nullptr),
+ mpFileTransferClient( nullptr),
+ mpAccountManager( nullptr)
{
#if !GLIB_CHECK_VERSION(2,36,0)
g_type_init();