summaryrefslogtreecommitdiff
path: root/tubes
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-07-21 18:50:35 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-07-21 22:09:12 +0200
commit4d8e800d05683434637ffc9610905a1b89427f1d (patch)
treef669a9e206eef8f391fc659d28286aec709a2e94 /tubes
parent20b8d8957fad3b909151bb9c2aa8fb4b3adcc705 (diff)
tubes: remove TelePacket, it's just simple string
Change-Id: Iabfb50454c573ac9c01aba1b309822c4ef6fcc73
Diffstat (limited to 'tubes')
-rw-r--r--tubes/Library_tubes.mk1
-rw-r--r--tubes/Package_inc.mk1
-rw-r--r--tubes/inc/tubes/conference.hxx19
-rw-r--r--tubes/inc/tubes/manager.hxx1
-rw-r--r--tubes/inc/tubes/packet.hxx83
-rw-r--r--tubes/source/conference.cxx16
-rw-r--r--tubes/source/packet.cxx33
7 files changed, 15 insertions, 139 deletions
diff --git a/tubes/Library_tubes.mk b/tubes/Library_tubes.mk
index a08760c83841..e101a71620c8 100644
--- a/tubes/Library_tubes.mk
+++ b/tubes/Library_tubes.mk
@@ -53,7 +53,6 @@ $(eval $(call gb_Library_use_externals,tubes,\
$(eval $(call gb_Library_add_exception_objects,tubes,\
tubes/source/conference \
tubes/source/manager \
- tubes/source/packet \
tubes/source/contact-list \
))
diff --git a/tubes/Package_inc.mk b/tubes/Package_inc.mk
index 2573c05a7eec..a59ab3a0b085 100644
--- a/tubes/Package_inc.mk
+++ b/tubes/Package_inc.mk
@@ -31,7 +31,6 @@ $(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/constants.h,tubes/constant
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/contact-list.hxx,tubes/contact-list.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/file-transfer-helper.h,tubes/file-transfer-helper.h))
$(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/packet.hxx,tubes/packet.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))
diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index 29d4cefa2b04..54638f2bc4e8 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -31,15 +31,12 @@
#include <sal/config.h>
#include "tubes/tubesdllapi.h"
-#include "tubes/packet.hxx"
#include "tubes/file-transfer-helper.h"
#include <rtl/ustring.hxx>
#include <telepathy-glib/telepathy-glib.h>
#include <queue>
#include <tubes/warnings_guard_boost_signals2.hpp>
-typedef ::std::queue<TelePacket> TelePacketQueue;
-
class TeleManager;
/** Conference setup by TeleManager */
@@ -58,22 +55,19 @@ public:
TeleManager* getManager() const { return mpManager; }
- /** @param rPacket
- non-const on purpose, see TelePacket::getData()
- */
- TUBES_DLLPUBLIC bool sendPacket( TelePacket& rPacket );
+ TUBES_DLLPUBLIC bool sendPacket( const OString& rPacket );
/** Pop a received packet. */
- bool popPacket( TelePacket& rPacket );
+ bool popPacket( OString& rPacket );
- /** Queue incoming data as TelePacket */
- void queue( const char* pDBusSender, const char* pPacket, int nSize );
- void queue( TelePacket &rPacket );
+ /** Queue incoming data as OString */
+ void queue( const char* pPacket, int nSize );
+ void queue( const OString& rPacket );
TUBES_DLLPUBLIC void invite( TpContact *pContact );
/** Emitted when a packet is received. */
- boost::signals2::signal<void (TelePacket&)> sigPacketReceived;
+ boost::signals2::signal<void (const OString&)> sigPacketReceived;
typedef void (*FileSentCallback)( bool aSuccess, void* pUserData);
TUBES_DLLPUBLIC void sendFile( rtl::OUString &localUri, FileSentCallback pCallback, void* pUserData);
@@ -107,6 +101,7 @@ public:
void* pUserData);
private:
+ typedef ::std::queue<OString> TelePacketQueue;
bool spinUntilTubeEstablished();
bool setTube( GDBusConnection* pTube);
diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index f495c247ada3..d51154e54991 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -32,7 +32,6 @@
#include <sal/config.h>
#include "tubes/tubesdllapi.h"
#include "tubes/conference.hxx"
-#include "tubes/packet.hxx"
#include "tubes/contact-list.hxx"
#include <rtl/ustring.hxx>
#include <salhelper/thread.hxx>
diff --git a/tubes/inc/tubes/packet.hxx b/tubes/inc/tubes/packet.hxx
deleted file mode 100644
index 21136fba33da..000000000000
--- a/tubes/inc/tubes/packet.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- * Copyright (C) 2012 Red Hat, Inc., Eike Rathke <erack@redhat.com>
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#ifndef INCLUDED_TUBES_PACKET_HXX
-#define INCLUDED_TUBES_PACKET_HXX
-
-#include <sal/config.h>
-#include <rtl/string.hxx>
-#include <rtl/byteseq.hxx>
-
-
-class TelePacket
-{
-public:
-
- TelePacket( const char* pSender, const char* pData, int nSize )
- :
- maSender( pSender),
- maData( reinterpret_cast<const sal_Int8*>(pData), static_cast<sal_Int32>(nSize) )
- {
- }
-
- explicit TelePacket( const TelePacket& r )
- :
- maSender( r.maSender),
- maData( r.maData)
- {
- }
-
- TelePacket() {}
-
- /** Underlying getArray() ensures reference count is exactly one, hence
- this method is non-const! */
- const char* getData() { return reinterpret_cast<const char*>( maData.getArray()); }
- sal_Int32 getSize() const { return maData.getLength(); }
-
- bool operator==( const TelePacket& r ) const
- { return maSender == r.maSender && maData == r.maData; }
-
- TelePacket& operator=( const TelePacket& r )
- {
- if (this == &r)
- return *this;
- maSender = r.maSender;
- maData = r.maData;
- return *this;
- }
-
-private:
-
- rtl::OString maSender;
- rtl::ByteSequence maData;
-
-};
-
-#endif // INCLUDED_TUBES_PACKET_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index da182098385b..fde936892df7 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -110,7 +110,7 @@ void TeleConference::methodCallHandler(
SAL_INFO( "tubes", "TeleConference::methodCallHandler: received packet from sender "
<< (pSender ? pSender : "(null)") << " with size " << nPacketSize);
- pConference->queue( pSender, pPacketData, nPacketSize);
+ pConference->queue( pPacketData, nPacketSize );
g_dbus_method_invocation_return_value( pInvocation, 0 );
g_variant_unref( ay);
@@ -376,7 +376,7 @@ void TeleConference::finalize()
}
-bool TeleConference::sendPacket( TelePacket& rPacket )
+bool TeleConference::sendPacket( const OString& rPacket )
{
INFO_LOGGER( "TeleConference::sendPacket");
@@ -388,9 +388,9 @@ bool TeleConference::sendPacket( TelePacket& rPacket )
/* FIXME: in GLib 2.32 we can use g_variant_new_fixed_array(). It does
* essentially this.
*/
- void* pData = g_memdup( rPacket.getData(), rPacket.getSize() );
+ void* pData = g_memdup( rPacket.getStr(), rPacket.getLength() );
GVariant *pParameters = g_variant_new_from_data( G_VARIANT_TYPE("(ay)"),
- pData, rPacket.getSize(),
+ pData, rPacket.getLength(),
FALSE,
g_free, pData);
@@ -411,7 +411,7 @@ bool TeleConference::sendPacket( TelePacket& rPacket )
}
-void TeleConference::queue( TelePacket &rPacket )
+void TeleConference::queue( const OString &rPacket )
{
INFO_LOGGER( "TeleConference::queue");
@@ -421,9 +421,9 @@ void TeleConference::queue( TelePacket &rPacket )
}
-void TeleConference::queue( const char* pDBusSender, const char* pPacketData, int nPacketSize )
+void TeleConference::queue( const char* pPacketData, int nPacketSize )
{
- TelePacket aPacket( pDBusSender, pPacketData, nPacketSize );
+ OString aPacket( pPacketData, nPacketSize );
queue( aPacket );
}
@@ -514,7 +514,7 @@ void TeleConference::sendFile( rtl::OUString &localUri, FileSentCallback pCallba
}
-bool TeleConference::popPacket( TelePacket& rPacket )
+bool TeleConference::popPacket( OString& rPacket )
{
INFO_LOGGER( "TeleConference::popPacket");
diff --git a/tubes/source/packet.cxx b/tubes/source/packet.cxx
deleted file mode 100644
index 279398603270..000000000000
--- a/tubes/source/packet.cxx
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- * Copyright (C) 2012 Red Hat, Inc., Eike Rathke <erack@redhat.com>
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#include <tubes/packet.hxx>
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */