tubes: use file channel description for sending UUID

Change-Id: I44129798110491cd59e1eb39d2f4c2cf3eb3c81b
This commit is contained in:
Matúš Kukan 2012-08-07 23:11:50 +02:00
parent 35aa0360ed
commit 1fa1894ec4
3 changed files with 38 additions and 4 deletions

View file

@ -93,6 +93,10 @@ void empathy_ft_handler_new_outgoing (
void empathy_ft_handler_set_service_name (
EmpathyFTHandler *self,
const gchar *service_name);
void empathy_ft_handler_set_description (
EmpathyFTHandler *self,
const gchar *description);
void empathy_ft_handler_new_incoming (TpFileTransferChannel *channel,
EmpathyFTHandlerReadyCallback callback,
@ -108,6 +112,7 @@ const char * empathy_ft_handler_get_filename (EmpathyFTHandler *handler);
const char * empathy_ft_handler_get_content_type (EmpathyFTHandler *handler);
TpContact * empathy_ft_handler_get_contact (EmpathyFTHandler *handler);
GFile * empathy_ft_handler_get_gfile (EmpathyFTHandler *handler);
const char *empathy_ft_handler_get_description(EmpathyFTHandler*);
gboolean empathy_ft_handler_get_use_hash (EmpathyFTHandler *handler);
gboolean empathy_ft_handler_is_incoming (EmpathyFTHandler *handler);
guint64 empathy_ft_handler_get_transferred_bytes (EmpathyFTHandler *handler);

View file

@ -474,16 +474,20 @@ void TeleConference::invite( TpContact *pContact )
-1, &handles, NULL, NULL, NULL, NULL, NULL );
}
namespace {
class SendFileRequest {
public:
SendFileRequest( TeleConference::FileSentCallback pCallback, void* pUserData)
SendFileRequest( TeleConference::FileSentCallback pCallback, void* pUserData, const char* sUuid )
: mpCallback(pCallback)
, mpUserData(pUserData) {};
, mpUserData(pUserData)
, msUuid(sUuid)
{}
TeleConference::FileSentCallback mpCallback;
void* mpUserData;
const char* msUuid;
};
}
static void TeleConference_TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel *, gpointer user_data)
{
@ -525,6 +529,7 @@ static void TeleConference_FTReady( EmpathyFTHandler *handler, GError *error, gp
g_signal_connect(handler, "transfer-error",
G_CALLBACK (TeleConference_TransferError), request);
empathy_ft_handler_set_service_name(handler, TeleManager::getFullServiceName().getStr());
empathy_ft_handler_set_description(handler, request->msUuid);
empathy_ft_handler_start_transfer(handler);
}
}
@ -549,7 +554,7 @@ void TeleConference::sendFile( TpContact* pContact, const OUString& localUri, Fi
GFile *pSource = g_file_new_for_uri(
OUStringToOString( localUri, RTL_TEXTENCODING_UTF8).getStr() );
SendFileRequest *pReq = new SendFileRequest( pCallback, pUserData);
SendFileRequest *pReq = new SendFileRequest( pCallback, pUserData, msUuid.getStr() );
empathy_ft_handler_new_outgoing( mpAccount,
pContact,

View file

@ -923,6 +923,9 @@ ft_handler_populate_outgoing_request (EmpathyFTHandler *handler)
if (priv->service_name != NULL)
tp_asv_set_string (priv->request, TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME, priv->service_name);
if (priv->description != NULL)
tp_asv_set_string (priv->request, TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DESCRIPTION, priv->description);
g_free (uri);
}
@ -1455,6 +1458,15 @@ empathy_ft_handler_set_service_name (
self->priv->service_name = g_strdup (service_name);
}
void
empathy_ft_handler_set_description (
EmpathyFTHandler *self,
const gchar *description)
{
g_free (self->priv->description);
self->priv->description = g_strdup (description);
}
/**
* empathy_ft_handler_new_incoming:
* @channel: the #TpFileTransferChannel proxy to the incoming channel
@ -1616,6 +1628,18 @@ empathy_ft_handler_get_filename (EmpathyFTHandler *handler)
return priv->filename;
}
const char *
empathy_ft_handler_get_description (EmpathyFTHandler *handler)
{
EmpathyFTHandlerPriv *priv;
g_return_val_if_fail (EMPATHY_IS_FT_HANDLER (handler), NULL);
priv = handler->priv;
return priv->description;
}
/**
* empathy_ft_handler_get_content_type:
* @handler: an #EmpathyFTHandler