diff --git a/Makefile.in b/Makefile.in
index b1f2242..8cda58b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -106,6 +106,8 @@ install: $(PRPL_LIBNAME) $(LOCALE_MOS)
install -m $(FILE_PERM) $(PRPL_LIBNAME) $(DESTDIR)$(PLUGIN_DIR_PURPLE)/$(PRPL_NAME)
mkdir -m $(DIR_PERM) -p $(DESTDIR)/etc/telegram-purple
install -m $(FILE_PERM) tg-server.tglpub $(DESTDIR)/etc/telegram-purple/server.tglpub
+ mkdir -m $(DIR_PERM) -p $(DESTDIR)$(datarootdir)/appdata
+ install -m $(FILE_PERM) telegram-purple.metainfo.xml $(DESTDIR)$(datarootdir)/appdata/telegram-purple.metainfo.xml
ifeq ($(COPY_ICONS),no)
@echo "Not copying icons due to configure-option --disable-icons."
@echo " If you're using Finch, Empathy, or Telepathy, then this is a good idea."
@@ -133,6 +135,7 @@ uninstall:
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16/telegram.png
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22/telegram.png
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
+ rm -f $(DESTDIR)$(datarootdir)/appdata/telegram-purple.metainfo.xml
# TODO: Delete all installed .mo's, no matter what LINGUAS says.
@for lang in $(LOCALES); do \
echo "removing $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo"; \
diff --git a/README.md b/README.md
index 541fb30..0e337f7 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ If your plattform is not supported or you want to contribute by testing or devel
#### OSX (Adium)
-1. Download and execute the [Telegram-Adium bundle] (https://github.com/majn/telegram-purple/releases/download/v1.2.3/telegram-adium-1.2.3.zip)
+1. Download and execute the [Telegram-Adium bundle] (https://github.com/majn/telegram-purple/releases/download/v1.2.4/telegram-adium-1.2.4.AdiumLibpurplePlugin.zip)
2. Restart Adium
#### Windows
@@ -35,15 +35,6 @@ The package is available in the Fedora 22 and 23 testing repositories:
dnf install purple-telegram
-#### Ubuntu/Mint PPA
-
-Webupd8 provides PPAs for installation, see the [article](http://www.webupd8.org/2014/11/add-telegram-support-to-pidgin-with.html) for additional instructions:
-
- sudo add-apt-repository ppa:nilarimogard/webupd8
- sudo apt-get update
- sudo apt-get install telegram-purple
-
-
#### Arch Linux (AUR)
https://aur.archlinux.org/packages/telegram-purple/
@@ -70,7 +61,7 @@ This repository has submodules, so you need to clone recursively.
sudo dnf install gcc gettext libgcrypt-devel libwebp-devel libpurple-devel zlib-devel
-###### Debian / Ubuntu
+##### Debian / Ubuntu
We are working on a Debian package! Please first check if it's already available to you: `sudo apt-get install telegram-purple`
@@ -80,7 +71,7 @@ If the above fails: Don't worry, just continue building it by yourself. Next you
sudo apt-get install libgcrypt20-dev libpurple-dev libwebp-dev
-###### OpenSUSE
+##### OpenSUSE
sudo zypper install gcc glib glib-devel libpurple libpurple-devel zlib-devel libwebp-devel
@@ -104,6 +95,7 @@ This repository contains submodules, and a simple pull just won't be enough to u
git pull
+ git submodule sync # just in case the configuration has changed
git submodule update --recursive
@@ -225,6 +217,11 @@ and `.dsc` files, do this:
Note that the parenthesis are important.
+1.2.4
+-----
+
+- Fix crash on unknown media type
+- Fix crash on logout after cancelling a file transfer
1.2.3
-----
diff --git a/configure b/configure
index 05aded4..6eb8fc5 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for telegram-purple 1.2.3.
+# Generated by GNU Autoconf 2.69 for telegram-purple 1.2.4.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='telegram-purple'
PACKAGE_TARNAME='telegram-purple'
-PACKAGE_VERSION='1.2.3'
-PACKAGE_STRING='telegram-purple 1.2.3'
+PACKAGE_VERSION='1.2.4'
+PACKAGE_STRING='telegram-purple 1.2.4'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1250,7 +1250,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures telegram-purple 1.2.3 to adapt to many kinds of systems.
+\`configure' configures telegram-purple 1.2.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1311,7 +1311,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of telegram-purple 1.2.3:";;
+ short | recursive ) echo "Configuration of telegram-purple 1.2.4:";;
esac
cat <<\_ACEOF
@@ -1421,7 +1421,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-telegram-purple configure 1.2.3
+telegram-purple configure 1.2.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1840,7 +1840,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by telegram-purple $as_me 1.2.3, which was
+It was created by telegram-purple $as_me 1.2.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -5106,7 +5106,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by telegram-purple $as_me 1.2.3, which was
+This file was extended by telegram-purple $as_me 1.2.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5168,7 +5168,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-telegram-purple config.status 1.2.3
+telegram-purple config.status 1.2.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 34c504b..abf90a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
-AC_INIT([telegram-purple], [1.2.3])
+AC_INIT([telegram-purple], [1.2.4])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
diff --git a/rpm/purple-telegram.spec b/rpm/purple-telegram.spec
index 86090c9..cb0232c 100644
--- a/rpm/purple-telegram.spec
+++ b/rpm/purple-telegram.spec
@@ -1,16 +1,17 @@
-Name: purple-telegram
-Version: 1.3.0
-Release: 1%{?dist}
-Summary: Adds support for Libpurple based messengers
-Group: Applications/Internet
-License: GPLv2+
-URL: https://github.com/majn/telegram-purple
-Source0: https://codeload.github.com/majn/telegram-purple/tar.gz/v%{version}.tar.gz
+Name: purple-telegram
+Version: 1.3.0
+Release: 1%{?dist}
+Summary: Adds support for Libpurple based messengers
+Group: Applications/Internet
+License: GPLv2+
+URL: https://github.com/majn/telegram-purple
+Source0: https://codeload.github.com/majn/telegram-purple/tar.gz/v%{version}.tar.gz
-BuildRequires: gettext, libgcrypt-devel >= 1.6, pkgconfig(zlib), pkgconfig(purple), pkgconfig(libwebp)
+BuildRequires: gettext, libgcrypt-devel >= 1.6, pkgconfig(zlib), pkgconfig(purple), pkgconfig(libwebp)
+BuildRequires: pkgconfig(appstream-glib)
%description
-Adds support for Telegram to Pidgin, Adium, Finch
+Adds support for Telegram to Pidgin, Adium, Finch
and other Libpurple based messengers.
%prep
@@ -25,10 +26,14 @@ make %{?_smp_mflags}
chmod 755 %{buildroot}/%{_libdir}/purple-2/telegram-purple.so
%find_lang telegram-purple
+%check
+appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/telegram-purple.metainfo.xml
+
%files -f telegram-purple.lang
-%doc README* CHANGELOG*
+%doc README* CHANGELOG*
%{_libdir}/purple-2/telegram-purple.so
%config %{_sysconfdir}/telegram-purple/*
+%{_datadir}/appdata/telegram-purple.metainfo.xml
%{_datadir}/pixmaps/pidgin/protocols/16/telegram.png
%{_datadir}/pixmaps/pidgin/protocols/22/telegram.png
%{_datadir}/pixmaps/pidgin/protocols/48/telegram.png
@@ -37,8 +42,11 @@ chmod 755 %{buildroot}/%{_libdir}/purple-2/telegram-purple.so
* Thu Dec 10 2015 tuxmaster 1.3.0
- Build for 1.3.0
+* Thu Dec 10 2015 tuxmaster 1.2.4-2
+- Fix build for appdata.
+
* Wed Nov 18 2015 tuxmaster 1.2.2-3
-- Add required version for libgcrypt.
+- Add required version for libgcrypt.
* Wed Oct 14 2015 tuxmaster 1.2.2-2
- Use the better pkconfig for build requires.
@@ -47,4 +55,3 @@ chmod 755 %{buildroot}/%{_libdir}/purple-2/telegram-purple.so
* Wed Oct 07 2015 mjentsch 1.2.2-1
- update version to 1.2.2
-
diff --git a/telegram-adium/telegram-adium/telegram-adium-Info.plist b/telegram-adium/telegram-adium/telegram-adium-Info.plist
index 9b827e1..f7f7cdc 100644
--- a/telegram-adium/telegram-adium/telegram-adium-Info.plist
+++ b/telegram-adium/telegram-adium/telegram-adium-Info.plist
@@ -19,7 +19,7 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 1.2.3
+ 1.2.4
CFBundleSignature
AdIM
CFBundleVersion
diff --git a/tgp-ft.c b/tgp-ft.c
index 08cbc36..ca72430 100644
--- a/tgp-ft.c
+++ b/tgp-ft.c
@@ -1,20 +1,20 @@
/*
This file is part of telegram-purple
-
+
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; either version 2 of the License, or
(at your option) any later version.
-
+
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.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
-
+
Copyright Matthias Jentsch 2014-2015
*/
@@ -25,7 +25,8 @@
static void tgprpl_xfer_free_data (struct tgp_xfer_send_data *data);
static char *tgp_strdup_determine_filename (const char *mime, const char *caption,
- int flags, long long hash) {
+ int flags, long long hash) {
+
if (caption) {
return g_strdup (caption);
}
@@ -61,21 +62,30 @@ static char *tgp_strdup_determine_filename (const char *mime, const char *captio
static void tgprpl_xfer_recv_on_finished (struct tgl_state *TLS, void *_data, int success, const char *filename) {
debug ("tgprpl_xfer_recv_on_finished()");
struct tgp_xfer_send_data *data = _data;
- char *selected = g_strdup(purple_xfer_get_local_filename (data->xfer));
+ char *selected = g_strdup (purple_xfer_get_local_filename (data->xfer));
if (success) {
- if (!data->done) {
- debug ("purple_xfer_set_completed");
- purple_xfer_set_bytes_sent (data->xfer, purple_xfer_get_size (data->xfer));
- purple_xfer_set_completed (data->xfer, TRUE);
+ debug ("purple_xfer_set_completed");
+
+ // always completed the file transfer to avoid a warning dialogue when closing (Adium)
+ purple_xfer_set_bytes_sent (data->xfer, purple_xfer_get_size (data->xfer));
+ purple_xfer_set_completed (data->xfer, TRUE);
+
+ if (! purple_xfer_is_canceled (data->xfer)) {
purple_xfer_end (data->xfer);
}
} else {
tgp_notify_on_error_gw (TLS, NULL, success);
- failure ("ERROR xfer failed");
+ if (! purple_xfer_is_canceled (data->xfer)) {
+ purple_xfer_cancel_remote (data->xfer);
+ }
+ failure ("recv xfer failed");
}
+ data->loading = FALSE;
+
data->xfer->data = NULL;
+ purple_xfer_unref (data->xfer);
tgprpl_xfer_free_data (data);
debug ("moving transferred file from tgl directory %s to selected target %s", selected, filename);
@@ -84,63 +94,77 @@ static void tgprpl_xfer_recv_on_finished (struct tgl_state *TLS, void *_data, in
g_free (selected);
}
-static void tgprpl_xfer_on_finished (struct tgl_state *TLS, void *_data, int success, struct tgl_message *M) {
+static void tgprpl_xfer_send_on_finished (struct tgl_state *TLS, void *_data, int success, struct tgl_message *M) {
debug ("tgprpl_xfer_on_finished()");
struct tgp_xfer_send_data *data = _data;
-
+
if (success) {
- if (!data->done) {
+ if (! purple_xfer_is_canceled (data->xfer)) {
debug ("purple_xfer_set_completed");
purple_xfer_set_bytes_sent (data->xfer, purple_xfer_get_size (data->xfer));
purple_xfer_set_completed (data->xfer, TRUE);
- purple_xfer_end(data->xfer);
+ purple_xfer_end (data->xfer);
}
write_secret_chat_file (TLS);
} else {
tgp_notify_on_error_gw (TLS, NULL, success);
- failure ("ERROR xfer failed");
+ if (! purple_xfer_is_canceled (data->xfer)) {
+ purple_xfer_cancel_remote (data->xfer);
+ }
+ failure ("send xfer failed");
}
-
+
+ data->loading = FALSE;
+
data->xfer->data = NULL;
+ purple_xfer_unref (data->xfer);
tgprpl_xfer_free_data (data);
}
static void tgprpl_xfer_canceled (PurpleXfer *X) {
+ debug ("tgprpl_xfer_canceled()");
struct tgp_xfer_send_data *data = X->data;
- tgprpl_xfer_free_data (data);
+
+ // the xfer data must not be freed when the transfer is still running, since there is no way to cancel
+ // the running transfer and the callback still needs the xfer data. In that case transfer data will
+ // be freed once the transfer finished or the account goes offline and all loading transfers are aborted.
+ if (! data->loading) {
+ data->xfer->data = NULL;
+ tgprpl_xfer_free_data (data);
+ }
}
static gboolean tgprpl_xfer_upload_progress (gpointer _data) {
PurpleXfer *X = _data;
struct tgp_xfer_send_data *data = X->data;
connection_data *conn = data->conn;
-
- PurpleXferType type = purple_xfer_get_type(X);
+
+ PurpleXferType type = purple_xfer_get_type (X);
switch (type) {
case PURPLE_XFER_SEND:
purple_xfer_set_size (X, conn->TLS->cur_uploading_bytes);
purple_xfer_set_bytes_sent (X, conn->TLS->cur_uploaded_bytes);
purple_xfer_update_progress (X);
-
+
debug ("PURPLE_XFER_SEND progress %d / %d", conn->TLS->cur_uploaded_bytes, conn->TLS->cur_uploading_bytes);
if (conn->TLS->cur_uploaded_bytes == conn->TLS->cur_uploading_bytes) {
data->timer = 0;
return FALSE;
}
break;
-
+
case PURPLE_XFER_RECEIVE:
purple_xfer_set_size (X, conn->TLS->cur_downloading_bytes);
purple_xfer_set_bytes_sent (X, conn->TLS->cur_downloaded_bytes);
purple_xfer_update_progress (X);
-
+
debug ("PURPLE_XFER_RECEIVE progress %d / %d", conn->TLS->cur_downloaded_bytes, conn->TLS->cur_downloading_bytes);
if (conn->TLS->cur_downloading_bytes == conn->TLS->cur_downloaded_bytes) {
data->timer = 0;
return FALSE;
}
break;
-
+
default:
case PURPLE_XFER_UNKNOWN:
failure ("ERROR: tgprpl_xfer_upload_progress xfer type PURPLE_XFER_UNKNOWN.");
@@ -151,52 +175,59 @@ static gboolean tgprpl_xfer_upload_progress (gpointer _data) {
}
static void tgprpl_xfer_recv_init (PurpleXfer *X) {
- debug ("tgprpl_xfer_recv_init");
+ debug ("tgprpl_xfer_recv_init(): receiving xfer accepted.");
+
struct tgp_xfer_send_data *data = X->data;
struct tgl_state *TLS = data->conn->TLS;
struct tgl_message *M = data->msg;
struct tgl_document *D = M->media.document;
tgl_peer_t *P = NULL;
-
+
purple_xfer_start (X, -1, NULL, 0);
const char *who = purple_xfer_get_remote_user (X);
P = tgp_blist_lookup_peer_get (TLS, who);
- if (P) {
- switch (M->media.type) {
- case tgl_message_media_document:
- tgl_do_load_document (TLS, D, tgprpl_xfer_recv_on_finished, data);
- break;
-
- case tgl_message_media_document_encr:
- tgl_do_load_encr_document (TLS, M->media.encr_document, tgprpl_xfer_recv_on_finished, data);
- break;
-
- case tgl_message_media_audio:
- tgl_do_load_audio (TLS, D, tgprpl_xfer_recv_on_finished, data);
- break;
-
- case tgl_message_media_video:
- tgl_do_load_video (TLS, D, tgprpl_xfer_recv_on_finished, data);
- break;
+ g_return_if_fail(P);
- default:
- failure ("Unknown message media type: %d, XFER not possible.", M->media.type);
- break;
- }
- } else {
- warning ("User not found, not downloading...");
+ switch (M->media.type) {
+ case tgl_message_media_document:
+ tgl_do_load_document (TLS, D, tgprpl_xfer_recv_on_finished, data);
+ break;
+
+ case tgl_message_media_document_encr:
+ tgl_do_load_encr_document (TLS, M->media.encr_document, tgprpl_xfer_recv_on_finished, data);
+ break;
+
+ case tgl_message_media_audio:
+ tgl_do_load_audio (TLS, D, tgprpl_xfer_recv_on_finished, data);
+ break;
+
+ case tgl_message_media_video:
+ tgl_do_load_video (TLS, D, tgprpl_xfer_recv_on_finished, data);
+ break;
+
+ default:
+ failure ("Unknown message media type: %d, XFER not possible.", M->media.type);
+ return;
}
+
+ // Prevent the xfer data from getting freed after cancelling to allow the file transfer to complete
+ // without crashing. This is necessary cause loading the file in libtgl cannot be aborted once started.
+ purple_xfer_ref (X);
+
data->timer = purple_timeout_add (100, tgprpl_xfer_upload_progress, X);
+ data->loading = TRUE;
}
static void tgprpl_xfer_send_init (PurpleXfer *X) {
+ debug ("tgprpl_xfer_send_init(): sending xfer accepted.");
+
struct tgp_xfer_send_data *data;
const char *file, *localfile, *who;
tgl_peer_t *P;
data = X->data;
purple_xfer_start (X, -1, NULL, 0);
-
+
file = purple_xfer_get_filename (X);
localfile = purple_xfer_get_local_filename (X);
who = purple_xfer_get_remote_user (X);
@@ -208,6 +239,7 @@ static void tgprpl_xfer_send_init (PurpleXfer *X) {
if (tgl_get_peer_type (P->id) == TGL_PEER_ENCR_CHAT) {
purple_xfer_error (PURPLE_XFER_SEND, data->conn->pa, who,
_("Sorry, sending documents to encrypted chats not yet supported."));
+ purple_xfer_cancel_local (X);
return;
}
@@ -216,8 +248,14 @@ static void tgprpl_xfer_send_init (PurpleXfer *X) {
flags |= TGLMF_POST_AS_CHANNEL;
}
- tgl_do_send_document (data->conn->TLS, P->id, (char*) localfile, NULL, 0, flags, tgprpl_xfer_on_finished, data);
+ tgl_do_send_document (data->conn->TLS, P->id, (char*) localfile, NULL, 0,
+ flags, tgprpl_xfer_send_on_finished, data);
+
+ // see comment in tgprpl_xfer_recv_init()
+ purple_xfer_ref (X);
+
data->timer = purple_timeout_add (100, tgprpl_xfer_upload_progress, X);
+ data->loading = TRUE;
}
static void tgprpl_xfer_init_data (PurpleXfer *X, connection_data *conn, struct tgl_message *msg) {
@@ -232,33 +270,55 @@ static void tgprpl_xfer_init_data (PurpleXfer *X, connection_data *conn, struct
static void tgprpl_xfer_free_data (struct tgp_xfer_send_data *data) {
if (data->timer) {
- purple_input_remove(data->timer);
+ purple_input_remove (data->timer);
}
data->timer = 0;
g_free (data);
}
void tgprpl_xfer_free_all (connection_data *conn) {
- GList *xfers = purple_xfers_get_all();
+ GList *xfers = purple_xfers_get_all ();
while (xfers) {
PurpleXfer *xfer = xfers->data;
- struct tgp_xfer_send_data *data = xfer->data;
-
- if (data) {
- purple_xfer_cancel_local (xfer);
+
+ if (purple_xfer_get_account (xfer) == conn->pa) {
+ debug ("xfer: %s", xfer->filename);
+
+ // cancel all non-completed file tranfsers to avoid them from being called
+ // in future sessions, as they still contain references to already freed data.
+ if (! purple_xfer_is_canceled (xfer) && ! purple_xfer_is_completed (xfer)) {
+ purple_xfer_cancel_local (xfer);
+ }
+
+ // if a file transfer is still running while going offline, it will be canceled when
+ // cleaning up libtgl memory. Since canceled file transfers are being kept (see
+ // tgprpl_xfer_canceled() and tgprpl_xfer_recv_init()) those need to be freed now.
+ struct tgp_xfer_send_data *data = xfer->data;
+ if (data) {
+ if (data->loading) {
+ tgprpl_xfer_free_data (data);
+ xfer->data = NULL;
+ purple_xfer_unref (xfer);
+ } else {
+ g_warn_if_reached();
+ }
+ }
}
+
xfers = g_list_next(xfers);
}
}
PurpleXfer *tgprpl_new_xfer (PurpleConnection *gc, const char *who) {
debug ("tgprpl_new_xfer()");
+
PurpleXfer *X = purple_xfer_new (purple_connection_get_account (gc), PURPLE_XFER_SEND, who);
if (X) {
purple_xfer_set_init_fnc (X, tgprpl_xfer_send_init);
purple_xfer_set_cancel_send_fnc (X, tgprpl_xfer_canceled);
tgprpl_xfer_init_data (X, purple_connection_get_protocol_data (gc), NULL);
}
+
return X;
}
@@ -266,18 +326,19 @@ static PurpleXfer *tgprpl_new_xfer_recv (PurpleConnection *gc, const char *who)
PurpleXfer *X = purple_xfer_new (purple_connection_get_account (gc), PURPLE_XFER_RECEIVE, who);
purple_xfer_set_init_fnc (X, tgprpl_xfer_recv_init);
purple_xfer_set_cancel_recv_fnc (X, tgprpl_xfer_canceled);
+
return X;
}
void tgprpl_recv_file (PurpleConnection *gc, const char *who, struct tgl_message *M) {
debug ("tgprpl_recv_file()");
g_return_if_fail (who);
-
+
PurpleXfer *X = tgprpl_new_xfer_recv (gc, who);
const char *mime_type, *caption;
long long access_hash;
int flags, size;
-
+
if (M->media.type == tgl_message_media_document_encr) {
mime_type = M->media.encr_document->mime_type;
caption = M->media.encr_document->caption;
@@ -295,7 +356,7 @@ void tgprpl_recv_file (PurpleConnection *gc, const char *who, struct tgl_message
char *filename = tgp_strdup_determine_filename (mime_type, caption, flags, access_hash);
purple_xfer_set_filename (X, filename);
g_free (filename);
-
+
purple_xfer_set_size (X, size);
tgprpl_xfer_init_data (X, purple_connection_get_protocol_data (gc), M);
purple_xfer_request (X);
diff --git a/tgp-structs.h b/tgp-structs.h
index ecf68e4..576a0a9 100644
--- a/tgp-structs.h
+++ b/tgp-structs.h
@@ -57,7 +57,7 @@ typedef struct {
struct tgp_xfer_send_data {
int timer;
- int done;
+ int loading;
PurpleXfer *xfer;
connection_data *conn;
struct tgl_message *msg;