improve secret chat error handling for unsupported features
This commit is contained in:
parent
74f6b6e2f7
commit
efb0f56598
2 changed files with 14 additions and 2 deletions
11
tgp-ft.c
11
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);
|
||||
|
|
|
@ -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, "<IMG")) || (img = g_strrstr (message, "<img"))) {
|
||||
if (tgl_get_peer_type(to) == TGL_PEER_ENCR_CHAT) {
|
||||
tgp_msg_err_out (TLS, "Sorry, sending documents to encrypted chats not yet supported.", to);
|
||||
return 0;
|
||||
}
|
||||
|
||||
debug ("img found: %s", img);
|
||||
gchar *id;
|
||||
if ((id = g_strrstr (img, "ID=\"")) || (id = g_strrstr (img, "id=\""))) {
|
||||
|
|
Loading…
Add table
Reference in a new issue