[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - tubes/inc tubes/qa tubes/source

2012-03-26 Thread Eike Rathke
 tubes/inc/tubes/manager.hxx |3 ---
 tubes/qa/test_manager.cxx   |8 
 tubes/source/approver.c |   28 ++--
 tubes/source/file-transfer-helper.c |8 
 tubes/source/manager.cxx|   12 
 5 files changed, 26 insertions(+), 33 deletions(-)

New commits:
commit 60fdff033ba2f38063c2a14f01a22c89e7d166b5
Author: Eike Rathke er...@redhat.com
Date:   Mon Mar 26 23:54:58 2012 +0200

cleanout flushLoop

relict from testing era, not needed anymore

diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index 8ba3a02..74d0424 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -192,9 +192,6 @@ public:
 /** Iterate our GMainLoop, blocking, until the callback is done. */
 voiditerateLoop( const TeleConference* pConference, 
ConferenceCallBackInvokedFunc pFunc );
 
-/** Iterate our GMainLoop, non-blocking, until nothing pending. */
-voidflushLoop() const;
-
 /// LibreOfficeWhatEver
 static rtl::OString getFullClientName();
 
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index ae9b713..dcfbb47 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -60,7 +60,6 @@ public:
 void testSendPacket();
 void testReceivePacket();
 void testSendFile();
-void testFlushLoops();
 void testDestroyManager1();
 void testDestroyManager2();
 void testDestroyAccepterContact();
@@ -88,7 +87,6 @@ public:
 CPPUNIT_TEST( testSendPacket );
 CPPUNIT_TEST( testReceivePacket );
 CPPUNIT_TEST( testSendFile );
-CPPUNIT_TEST( testFlushLoops );
 CPPUNIT_TEST( testDestroyManager1 );
 CPPUNIT_TEST( testDestroyManager2 );
 CPPUNIT_TEST( testDestroyAccepterContact );
@@ -346,12 +344,6 @@ void TestTeleTubes::testSendFile()
 maFileReceivedUri == file:///tmp/LibreOffice-collab-test-config.ini);
 }
 
-void TestTeleTubes::testFlushLoops()
-{
-mpManager1-flushLoop();
-mpManager2-flushLoop();
-}
-
 void TestTeleTubes::testDestroyManager1()
 {
 delete mpManager1;
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 73895f9..b9ecfd0 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -931,18 +931,6 @@ void TeleManager::iterateLoop( const TeleConference* 
pConference, ConferenceCall
 }
 
 
-void TeleManager::flushLoop() const
-{
-if (pImpl-mpLoop)
-{
-GMainContext* pContext = g_main_loop_get_context( pImpl-mpLoop);
-while (g_main_context_iteration( pContext, FALSE))
-{
-}
-}
-}
-
-
 GMainLoop* TeleManager::getMainLoop() const
 {
 return pImpl-mpLoop;
commit d824a60f80c5d4055d5ce69a2dfcd40f8d5a00e6
Author: Eike Rathke er...@redhat.com
Date:   Mon Mar 26 23:31:58 2012 +0200

silence WaE incompatible pointer type and unused parameters

* passing argument 1 of ‘gtk_message_dialog_format_secondary_markup’ 
from
  incompatible pointer type
  * dialog was in fact constructed as GtkMessageDialog using
gtk_message_dialog_new_with_markup(), so use it as such
* passing argument 1 of ‘gtk_widget_destroy’ from incompatible pointer 
type
  * use GTK_WIDGET() on dialog GtkMessageDialog*
* passing argument 1 of ‘g_object_get_data’ from incompatible pointer 
type
  * use G_OBJECT on dialog GtkWidget*
* passing argument 1 of ‘gtk_dialog_set_response_sensitive’ from 
incompatible
  pointer type
  * use GTK_DIALOG on dialog GtkWidget*
* passing argument 1 of ‘gtk_message_dialog_set_image’ from 
incompatible
  pointer type and passing argument 1 of ‘gtk_dialog_add_buttons’ from
  incompatible pointer type
  * use GTK_MESSAGE_DIALOG() on dialog GtkWidget*
* passing argument 1 of ‘g_object_set_data_full’ from incompatible 
pointer
  type
  * use G_OBJECT() on dialog GtkWidget*:x
* passing argument 3 of ‘g_signal_connect_data’ from incompatible 
pointer
  type
  * use G_CALLBACK() on dialog_response_cb
* passing argument 1 of ‘gtk_window_set_skip_taskbar_hint’ from 
incompatible
  pointer type
  * use GTK_WINDOW() on dialog GtkWidget*

How awful C is :-/  GtkMessageDialog is a GtkDialog is a GtkWindow is
a GtkWidget is a GObject, but still ...

diff --git a/tubes/source/approver.c b/tubes/source/approver.c
index 5f4bbde..f5e5812 100644
--- a/tubes/source/approver.c
+++ b/tubes/source/approver.c
@@ -45,7 +45,7 @@ handle_with_cb (GObject *source,
 gpointer user_data)
 {
   TpChannelDispatchOperation *cdo = TP_CHANNEL_DISPATCH_OPERATION (source);
-  GtkDialog *dialog = GTK_DIALOG (user_data);
+  GtkMessageDialog *dialog = GTK_MESSAGE_DIALOG (user_data);
   GError *error = NULL;
 
   if (!tp_channel_dispatch_operation_handle_with_finish (cdo, result, error))
@@ -59,7 +59,7 @@ handle_with_cb (GObject *source,
 }
 
   

[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - tubes/inc tubes/qa tubes/source

2012-03-23 Thread Will Thompson
 tubes/inc/tubes/conference.hxx |2 
 tubes/inc/tubes/file-transfer-helper.h |3 
 tubes/inc/tubes/manager.hxx|9 ++
 tubes/qa/test_manager.cxx  |   30 ++
 tubes/source/conference.cxx|5 -
 tubes/source/file-transfer-helper.c|   29 +-
 tubes/source/manager.cxx   |  148 +++--
 7 files changed, 212 insertions(+), 14 deletions(-)

New commits:
commit 7b662a91f6452f22265fb99ff782539f43dd2095
Author: Will Thompson will.thomp...@collabora.co.uk
Date:   Fri Mar 23 08:57:52 2012 +

tubes: remove account without account?? warning

It's completely kosher for Telepathy accounts not to have a parameter
called 'account' (which really means 'username'): Salut (link-local
XMPP) accounts do not, for example, because you don't need to specify a
username.

tp_account_get_normalized_name() gets your contact ID for an account,
which is really what we're looking for here.

diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index b479d5d..cb9e5d7 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -668,9 +668,7 @@ TpAccount* TeleManager::getAccount( const rtl::OString 
rAccountID )
 for (GList* pA = pAccounts; pA; pA = pA-next)
 {
 TpAccount* pAcc = TP_ACCOUNT( pA-data);
-const GHashTable* pPar = tp_account_get_parameters( pAcc);
-const gchar* pID = tp_asv_get_string( pPar, account);
-SAL_WARN_IF( !pID, tubes, TeleManager::getMyAccount: account 
without account??);
+const gchar* pID = tp_account_get_normalized_name( pAcc);
 if (pID  rAccountID == pID)
 {
 pAccount = pAcc;
commit 25c39927fd338283d2441694eb00b7e595b68f4c
Author: Will Thompson will.thomp...@collabora.co.uk
Date:   Fri Mar 23 08:53:21 2012 +

tubes: implement receiving files.

diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index 7428bcb..7c5fd30 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -94,6 +94,8 @@ public:
 { return 
mbTubeChannelStateChangedHandlerInvoked; }
 voidsetTubeChannelState( TpTubeChannelState eState ) { 
meTubeChannelState = eState; }
 
+static void FTReady( EmpathyFTHandler *handler, GError *error, 
gpointer user_data);
+
 private:
 
 rtl::OStringmaSessionId;
diff --git a/tubes/inc/tubes/file-transfer-helper.h 
b/tubes/inc/tubes/file-transfer-helper.h
index fe0678f..8960d14 100644
--- a/tubes/inc/tubes/file-transfer-helper.h
+++ b/tubes/inc/tubes/file-transfer-helper.h
@@ -90,6 +90,9 @@ void empathy_ft_handler_new_outgoing (
 gint64 action_time,
 EmpathyFTHandlerReadyCallback callback,
 gpointer user_data);
+void empathy_ft_handler_set_service_name (
+EmpathyFTHandler *self,
+const gchar *service_name);
 
 void empathy_ft_handler_new_incoming (TpFileTransferChannel *channel,
 EmpathyFTHandlerReadyCallback callback,
diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index 97f5de8..0d2ef3e 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -140,6 +140,9 @@ public:
 
 voidsendFile( rtl::OUString localUri, 
TeleConference::FileSentCallback pCallback, void* pUserData);
 
+typedef void  (*FileReceivedCallback)( rtl::OUString localUri, 
void* pUserData );
+voidsetFileReceivedCallback( FileReceivedCallback 
callback, void* pUserData );
+
 /// Only for use with MainLoopFlusher
 GMainLoop*  getMainLoop() const;
 
@@ -197,6 +200,9 @@ public:
 
 TpAccount*  getAccount( const rtl::OString rAccountID );
 
+/* Callbacks; not for use outside this class. */
+static void TransferDone( EmpathyFTHandler *handler, 
TpFileTransferChannel *, gpointer user_data);
+
 private:
 
 TeleConferenceVectormaConferences;
@@ -207,6 +213,9 @@ private:
 static sal_uInt32   nRefCount;
 static rtl::OString aNameSuffix;
 
+FileReceivedCallbackmpFileReceivedCallback;
+void   *mpFileReceivedCallbackData;
+
 friend class TeleManagerImpl;   // access to mutex
 
 TUBES_DLLPRIVATE static ::osl::Mutex   GetMutex();
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index d08190d..540728a 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -70,6 +70,7 @@ public:
 void spinMainLoop();
 
 static void FileSent( bool success, void *user_data);
+static void FileReceived( rtl::OUString aUri, void *user_data);
 
 // Order is significant.
 CPPUNIT_TEST_SUITE( TestTeleTubes );
@@ -102,6 +103,7 @@ private:
 rtl::OString  maAccepterIdentifier;
 
 bool  maFileSentSuccess;
+rtl::OUString maFileReceivedUri;
 };
 
 // static, not members, so 

[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - tubes/inc tubes/qa tubes/source

2012-03-22 Thread Will Thompson
 tubes/inc/tubes/conference.hxx |3 -
 tubes/inc/tubes/manager.hxx|   10 ++
 tubes/qa/test_manager.cxx  |   63 +
 tubes/source/conference.cxx|6 ---
 tubes/source/manager.cxx   |   12 +++
 5 files changed, 60 insertions(+), 34 deletions(-)

New commits:
commit b881624cc1225c2c851bfc391ac4647aa2539b8d
Author: Will Thompson will.thomp...@collabora.co.uk
Date:   Thu Mar 22 12:59:15 2012 +

tubes: make startBuddySession take a TpContact *.

I removed Conference::setTarget() because it's redundant: you can get
the target from the channel. And maTarget was unused anyway.

diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index 8f68333..b9fd366 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -71,8 +71,6 @@ public:
 // --- following only to be called only by manager's callbacks ---
 // TODO: make friends instead
 
-/// bu...@jabber.example.org or r...@conference.example.org or UUID
-voidsetTarget( const rtl::OString rTarget );
 voidsetChannel( TpChannel* pChannel );
 TpChannel*  getChannel() const  { return mpChannel; }
 boolofferTube();
@@ -92,7 +90,6 @@ public:
 
 private:
 
-rtl::OStringmaTarget;
 rtl::OStringmaSessionId;
 TeleManager*mpManager;
 TpChannel*  mpChannel;
diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index c704780..10f20ef 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -105,15 +105,13 @@ public:
 
 /** Start a session with a buddy.
 
-@param rAccount
-The account (JID) to use. This must be a valid JID that has been
-setup with Empathy or another Telepathy client providing
-Jabber/XMPP.
+@param pAccount
+The account to use. This must be a valid Jabber account.
 
-@param rBuddy
+@param pBuddy
 The buddy to be connected. Must be a contact of rAccount.
  */
-boolstartBuddySession( TpAccount *pAccount, const 
rtl::OString rBuddy );
+boolstartBuddySession( TpAccount *pAccount, TpContact 
*pBuddy);
 
 voidunregisterConference( TeleConferencePtr 
pConference );
 
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index debfef5..b053652 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -224,8 +224,10 @@ void TestTeleTubes::testPrepareAccountManager2()
 void TestTeleTubes::testStartBuddySession1()
 {
 TpAccount *pAcc1 = mpManager1-getAccount(maOffererIdentifier);
-CPPUNIT_ASSERT ( pAcc1 != 0);
-bool bStarted = mpManager1-startBuddySession( pAcc1, 
maAccepterIdentifier);
+CPPUNIT_ASSERT( pAcc1 != 0);
+/* This has to run after testContactList has run successfully. */
+CPPUNIT_ASSERT( mpAccepterContact != 0);
+bool bStarted = mpManager1-startBuddySession( pAcc1, mpAccepterContact);
 CPPUNIT_ASSERT( bStarted == true);
 }
 
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index f5875e0..830db5f 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -231,12 +231,6 @@ TeleConference::~TeleConference()
 }
 
 
-void TeleConference::setTarget( const rtl::OString rTarget )
-{
-maTarget = rTarget;
-}
-
-
 void TeleConference::setChannel( TpChannel* pChannel )
 {
 OSL_ENSURE( !mpChannel, TeleConference::setChannel: already have 
channel);
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 96c4b3e..5497435 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -392,7 +392,7 @@ bool TeleManager::startGroupSession( const rtl::OUString 
rUConferenceRoom, cons
 
 
 /* TODO: factor out common code with startGroupSession() */
-bool TeleManager::startBuddySession( TpAccount *pAccount, const rtl::OString 
rBuddy )
+bool TeleManager::startBuddySession( TpAccount *pAccount, TpContact *pBuddy )
 {
 INFO_LOGGER( TeleManager::startBuddySession);
 
@@ -404,16 +404,15 @@ bool TeleManager::startBuddySession( TpAccount *pAccount, 
const rtl::OString rB
 maConferences.push_back( pConference);
 
 /* TODO: associate the document with this session and conference */
-
-pConference-setTarget( rBuddy);
-
+const char *pIdentifier = tp_contact_get_identifier( pBuddy);
 SAL_INFO( tubes, TeleManager::startBuddySession: creating channel 
request from 
- tp_account_get_path_suffix( pAccount)   to   
rBuddy.getStr());
+ tp_account_get_path_suffix( pAccount)
+  to   pIdentifier);
 
 GHashTable* pRequest = tp_asv_new(
 TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, 
TP_IFACE_CHANNEL_TYPE_DBUS_TUBE,
 TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, TP_TYPE_HANDLE, 
TP_HANDLE_TYPE_CONTACT,