summaryrefslogtreecommitdiff
path: root/tubes
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-08-04 22:14:08 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-08-04 22:51:36 +0200
commitb3da63d28fedeee9306fb2c44ffd85271408fa7d (patch)
tree3439a0bc9e8e253215c01f2e9840dba30e85d16e /tubes
parentee1b41dcc2fd00c9b45c7a7a7e2357c2c9c23ed5 (diff)
tubes: avoid boost::signaling received packets
Change-Id: I63e262aa05ec7c06c15eaf74201b6ac1966e2e56
Diffstat (limited to 'tubes')
-rw-r--r--tubes/Package_inc.mk1
-rw-r--r--tubes/inc/tubes/collaboration.hxx1
-rw-r--r--tubes/inc/tubes/conference.hxx4
-rw-r--r--tubes/inc/tubes/warnings_guard_boost_signals2.hpp44
-rw-r--r--tubes/qa/test_manager.cxx14
-rw-r--r--tubes/source/conference.cxx8
-rw-r--r--tubes/source/manager.cxx4
7 files changed, 9 insertions, 67 deletions
diff --git a/tubes/Package_inc.mk b/tubes/Package_inc.mk
index c6606fcade4e..1aff70bb00ec 100644
--- a/tubes/Package_inc.mk
+++ b/tubes/Package_inc.mk
@@ -31,6 +31,5 @@ $(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/conference.hxx,tubes/confe
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/contacts.hxx,tubes/contacts.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/manager.hxx,tubes/manager.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/tubesdllapi.h,tubes/tubesdllapi.h))
-$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/warnings_guard_boost_signals2.hpp,tubes/warnings_guard_boost_signals2.hpp))
# vim: set noet sw=4 ts=4:
diff --git a/tubes/inc/tubes/collaboration.hxx b/tubes/inc/tubes/collaboration.hxx
index 6249173fda7e..65595cde1143 100644
--- a/tubes/inc/tubes/collaboration.hxx
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -26,6 +26,7 @@ public:
virtual void ContactLeft() = 0;
virtual TeleConference* GetConference() = 0;
virtual sal_uInt64 GetId() = 0;
+ virtual void PacketReceived( const OString& rPacket ) = 0;
virtual void SetCollaboration( TeleConference* pConference ) = 0;
// TODO: I think this could be moved to TeleManager later.
virtual void SendFile( TpContact* pContact, const OUString& rURL ) = 0;
diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index 1a8627b48fb6..ad5ae1e15758 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -32,7 +32,6 @@
#include <sal/config.h>
#include "tubes/tubesdllapi.h"
#include <rtl/ustring.hxx>
-#include <tubes/warnings_guard_boost_signals2.hpp>
class Collaboration;
class TeleConferenceImpl;
@@ -65,9 +64,6 @@ public:
void invite( TpContact *pContact );
- /** Emitted when a packet is received. */
- boost::signals2::signal<void (const OString&)> sigPacketReceived;
-
typedef void (*FileSentCallback)( bool aSuccess, void* pUserData);
TUBES_DLLPUBLIC void sendFile( TpContact* pContact, rtl::OUString &localUri, FileSentCallback pCallback, void* pUserData);
const OString& getUuid() const { return msUuid; }
diff --git a/tubes/inc/tubes/warnings_guard_boost_signals2.hpp b/tubes/inc/tubes/warnings_guard_boost_signals2.hpp
deleted file mode 100644
index 90a4c08214a5..000000000000
--- a/tubes/inc/tubes/warnings_guard_boost_signals2.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_WARNINGS_GUARD_BOOST_SIGNALS2_HPP
-#define INCLUDED_WARNINGS_GUARD_BOOST_SIGNALS2_HPP
-
-// Because the GCC system_header mechanism doesn't work in .c/.cxx compilation
-// units and more important affects the rest of the current include file, the
-// warnings guard is separated into this header file on its own.
-
-// boost 1.44 boost/signals2.hpp with gcc 4.6.3 causes
-// solver/unxlngx6/inc/boost/signals2/detail/slot_template.hpp:122:7: error:
-// declaration of ‘slot’ shadows a member of 'this' [-Werror=shadow]
-// We want to minimize the patches to external headers, so the warnings are
-// disabled here instead of in the header file itself.
-#ifdef _MSC_VER
-#pragma warning(push, 1)
-#elif defined __GNUC__
-#pragma GCC system_header
-#endif
-#include <boost/signals2.hpp>
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif // INCLUDED_WARNINGS_GUARD_BOOST_SIGNALS2_HPP
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index ca03bae0ed08..89afd113614b 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -63,7 +63,6 @@ public:
void testDestroyTeleTubes();
void testFailAlways();
- void ReceiverCallback( const OString &rPacket );
static void FileSent( bool success, void *user_data);
// Order is significant.
@@ -91,7 +90,6 @@ static TpContact* mpAccepterContact = NULL;
static GMainLoop* mpMainLoop = NULL;
static bool maFileSentSuccess = false;
static sal_uInt32 mnSentPackets = 0;
-static sal_uInt32 mnPacketReceivedEmissions = 0;
static OUString maTestConfigIniURL;
static OString maOffererIdentifier;
static OString maAccepterIdentifier;
@@ -185,16 +183,6 @@ void TestTeleTubes::testPrepareAccountManager()
CPPUNIT_ASSERT( eStatus == TeleManager::AMS_PREPARED);
}
-void TestTeleTubes::ReceiverCallback( const OString & rPacket )
-{
- SAL_INFO( "tubes", "TestTeleTubes::ReceiverCallback: " << rPacket.getStr());
- if (!rPacket.isEmpty())
- {
- // we could pop a packet here
- mnPacketReceivedEmissions++;
- }
-}
-
void TestTeleTubes::testStartBuddySession()
{
TpAccount *pAcc1 = mpManager->getAccount(maOffererIdentifier);
@@ -221,11 +209,9 @@ void TestTeleTubes::testSendPacket()
{
OString aPacket( "from 1 to 2" );
- mpConference1->sigPacketReceived.connect( boost::bind( &TestTeleTubes::ReceiverCallback, this, _1 ) );
bool bSentPacket = mpConference1->sendPacket( aPacket );
CPPUNIT_ASSERT( bSentPacket );
mnSentPackets++;
- CPPUNIT_ASSERT( mnPacketReceivedEmissions == 1 );
}
void TestTeleTubes::testReceivePacket()
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index 6203685a5b1b..4eaaf8cd8d8e 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -27,9 +27,11 @@
*/
#include <tubes/conference.hxx>
-#include <tubes/manager.hxx>
+
+#include <tubes/collaboration.hxx>
#include <tubes/constants.h>
#include <tubes/file-transfer-helper.h>
+#include <tubes/manager.hxx>
#include <telepathy-glib/telepathy-glib.h>
#include <queue>
@@ -230,6 +232,7 @@ static void TeleConference_TubeAcceptedHandler(
TeleConference::TeleConference( TpAccount* pAccount,
TpDBusTubeChannel* pChannel, const OString sUuid, bool bMaster )
:
+ mpCollaboration( NULL ),
mpAccount( NULL ),
mpChannel( NULL ),
msUuid( sUuid ),
@@ -461,7 +464,8 @@ void TeleConference::queue( const OString &rPacket )
pImpl->maPacketQueue.push( rPacket);
- sigPacketReceived( rPacket );
+ if (mpCollaboration)
+ mpCollaboration->PacketReceived( rPacket );
}
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 6c9007ad72b9..fd00cd05191f 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -236,7 +236,7 @@ void TeleManager::broadcastPacket( const OString& rPacket )
INFO_LOGGER_F( "TeleManager::broadcastPacket" );
for (TeleManagerImpl::DemoConferences::iterator it = pImpl->maDemoConferences.begin();
it != pImpl->maDemoConferences.end(); ++it)
- (*it)->sigPacketReceived( rPacket );
+ (*it)->queue( rPacket );
}
bool TeleManager::hasWaitingConference()
@@ -296,7 +296,7 @@ static void TeleManager_TransferDone( EmpathyFTHandler *handler, TpFileTransferC
SAL_INFO( "tubes", "TeleManager_TransferDone: hooray!");
GFile *gfile = empathy_ft_handler_get_gfile( handler);
char *uri = g_file_get_uri( gfile);
- rtl::OUString aUri( uri, strlen( uri), RTL_TEXTENCODING_UTF8);
+ rtl::OUString aUri( OUString::createFromAscii( uri ) );
g_free( uri);
TeleManager_fileReceived( aUri );