My initial port of this wasn't great, this is much better.
Testing Done:
sent messages between pidgin2 with gkdr/carbons, conversations on my phone, and pidgin3. I sent messages from all clients and received them on all three clients.
Reviewed at https://reviews.imfreedom.org/r/462/
/*
silcpurple_ft.c
Author: Pekka Riikonen <priikone@silcnet.org>
Copyright (C) 2004 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include"internal.h"
PURPLE_BEGIN_IGNORE_CAST_ALIGN
#include"silc.h"
PURPLE_END_IGNORE_CAST_ALIGN
#include"silcclient.h"
#include"silcpurple.h"
/****************************** File Transfer ********************************/
/* This implements the secure file transfer protocol (SFTP) using the SILC
SFTP library implementation. The API we use from the SILC Toolkit is the
SILC Client file transfer API, as it provides a simple file transfer we
need in this case. We could use the SILC SFTP API directly, but it would
be an overkill since we'd effectively re-implement the file transfer what
the SILC Client's file transfer API already provides.
From Purple we do NOT use the FT API to do the transfer as it is very limiting.
In fact it does not suite to file transfers like SFTP at all. For example,
it assumes that read operations are synchronous what they are not in SFTP.
It also assumes that the file transfer socket is to be handled by the Purple
eventloop, and this naturally is something we don't want to do in case of
SILC Toolkit. The FT API suites well to purely stream based file transfers
like HTTP GET and similar.
For this reason, we directly access the Purple GKT FT API and hack the FT
API to merely provide the user interface experience and all the magic
is done in the SILC Toolkit. Ie. we update the statistics information in
the FT API for user interface, and that's it. A bit dirty but until the
FT API gets better this is the way to go. Good thing that FT API allowed