From efb0f56598625642e2aabef52753168de5d82adc Mon Sep 17 00:00:00 2001 From: mjentsch Date: Sat, 23 May 2015 03:10:34 +0200 Subject: [PATCH] improve secret chat error handling for unsupported features --- tgp-ft.c | 11 +++++++++-- tgp-msg.c | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tgp-ft.c b/tgp-ft.c index 9cccbf7..f0ab7ea 100644 --- a/tgp-ft.c +++ b/tgp-ft.c @@ -175,8 +175,15 @@ static void tgprpl_xfer_send_init (PurpleXfer *X) { tgl_peer_t *P = find_peer_by_name (data->conn->TLS, who); if (P) { - tgl_do_send_document (data->conn->TLS, P->id, (char*) localfile, NULL, - 0, TGL_SEND_MSG_FLAG_DOCUMENT_AUTO, tgprpl_xfer_on_finished, data); + if (tgl_get_peer_type (P->id) != TGL_PEER_ENCR_CHAT) { + tgl_do_send_document (data->conn->TLS, P->id, (char*) localfile, NULL, + 0, TGL_SEND_MSG_FLAG_DOCUMENT_AUTO, tgprpl_xfer_on_finished, data); + } + else { + purple_notify_message (_telegram_protocol, PURPLE_NOTIFY_MSG_ERROR, "Not supported", + "Sorry, sending documents to encrypted chats not yet supported.", + NULL, NULL, NULL); + } } data->timer = purple_timeout_add (100, tgprpl_xfer_upload_progress, X); diff --git a/tgp-msg.c b/tgp-msg.c index fab41da..13654db 100644 --- a/tgp-msg.c +++ b/tgp-msg.c @@ -214,6 +214,11 @@ int tgp_msg_send (struct tgl_state *TLS, const char *message, tgl_peer_id_t to) gchar *img = NULL; gchar *stripped = NULL; if ((img = g_strrstr (message, "