View | Details | Raw Unified | Return to bug 278263 | Differences between
and this patch

Collapse All | Expand All

(-)b/net-im/tdlib-purple/files/patch-self-destructing-messages (+80 lines)
Added Link Here
1
The material part of https://github.com/ars3niy/tdlib-purple/pull/159 -- with the
2
default switched to TRUE (to show self-destruct messages out of the box).
3
4
	-mi
5
--- purple-info.h
6
+++ purple-info.h
7
@@ -40,6 +40,8 @@ namespace AccountOptions {
8
     constexpr gboolean    EnableSecretChatsDefault   = TRUE;
9
     constexpr const char *AnimatedStickers           = "animated-stickers";
10
     constexpr gboolean    AnimatedStickersDefault    = TRUE;
11
+    constexpr const char *ShowSelfDestruct           = "show-self-destruct";
12
+    constexpr gboolean    ShowSelfDestructDefault    = TRUE;
13
     constexpr const char *DownloadBehaviour          = "download-behaviour";
14
     constexpr const char *DownloadBehaviourHyperlink = "hyperlink";
15
     constexpr const char *DownloadBehaviourStandard  = "file-transfer";
16
--- receiving.cpp
17
+++ receiving.cpp
18
@@ -634,22 +634,37 @@ void showMessage(const td::td_api::chat &chat, IncomingMessage &fullMessage,
19
     messageInfo.repliedMessage = std::move(fullMessage.repliedMessage);
20
 
21
     if (message.ttl_ != 0) {
22
-        // TRANSLATOR: In-chat warning message
23
-        const char *text   = _("Received self-destructing message, not displayed due to lack of support");
24
-        std::string notice = makeNoticeWithSender(chat, messageInfo, text, account.purpleAccount);
25
-        showMessageText(account, chat, messageInfo, NULL, notice.c_str());
26
-        return;
27
+        if (purple_account_get_bool(account.purpleAccount, AccountOptions::ShowSelfDestruct, AccountOptions::ShowSelfDestructDefault)) {
28
+            // TRANSLATOR: In-chat warning message
29
+            const char *text   = _("Received self-destructing message, displaying anyway");
30
+            std::string notice = makeNoticeWithSender(chat, messageInfo, text, account.purpleAccount);
31
+            showMessageText(account, chat, messageInfo, NULL, notice.c_str());
32
+        } else {
33
+            // TRANSLATOR: In-chat warning message
34
+            const char *text   = _("Received self-destructing message, not displayed due to lack of support");
35
+            std::string notice = makeNoticeWithSender(chat, messageInfo, text, account.purpleAccount);
36
+            showMessageText(account, chat, messageInfo, NULL, notice.c_str());
37
+            return;
38
+        }
39
     }
40
 
41
     FileInfo fileInfo;
42
     getFileFromMessage(fullMessage, fileInfo);
43
     if (fileInfo.secret) {
44
-        // TRANSLATOR: In-chat warning message
45
-        std::string notice = formatMessage("Ignoring secret file ({})", fileInfo.description);
46
-        notice = makeNoticeWithSender(chat, messageInfo, notice.c_str(), account.purpleAccount);
47
-        showMessageText(account, chat, messageInfo, !fileInfo.caption.empty() ? fileInfo.caption.c_str() : nullptr,
48
-                        notice.c_str());
49
-        return;
50
+        if (purple_account_get_bool(account.purpleAccount, AccountOptions::ShowSelfDestruct, AccountOptions::ShowSelfDestructDefault)) {
51
+            // TRANSLATOR: In-chat warning message
52
+            std::string notice = formatMessage("Received secret file {}, displaying anyway", fileInfo.description);
53
+            notice = makeNoticeWithSender(chat, messageInfo, notice.c_str(), account.purpleAccount);
54
+            showMessageText(account, chat, messageInfo, !fileInfo.caption.empty() ? fileInfo.caption.c_str() : nullptr,
55
+                            notice.c_str());
56
+        } else {
57
+            // TRANSLATOR: In-chat warning message
58
+            std::string notice = formatMessage("Ignoring secret file ({})", fileInfo.description);
59
+            notice = makeNoticeWithSender(chat, messageInfo, notice.c_str(), account.purpleAccount);
60
+            showMessageText(account, chat, messageInfo, !fileInfo.caption.empty() ? fileInfo.caption.c_str() : nullptr,
61
+                            notice.c_str());
62
+            return;
63
+        }
64
     }
65
 
66
     switch (message.content_->get_id()) {
67
--- tdlib-purple.cpp
68
+++ tdlib-purple.cpp
69
@@ -1020,6 +1020,11 @@ static void tgprpl_init (PurplePlugin *plugin)
70
     prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, opt);
71
 #endif
72
 
73
+    // TRANSLATOR: Account settings, key (boolean)
74
+    opt = purple_account_option_bool_new(_("Show self-destructing messages anyway"), AccountOptions::ShowSelfDestruct,
75
+                                         AccountOptions::ShowSelfDestructDefault);
76
+    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, opt);
77
+
78
     if (canDisableReadReceipts()) {
79
         opt = purple_account_option_bool_new ("Send read receipts",
80
                                               AccountOptions::ReadReceipts,
(-)b/net-im/tdlib-purple/Makefile (-3 / +7 lines)
Lines 1-10 Link Here
1
PORTNAME=	tdlib-purple
1
PORTNAME=	tdlib-purple
2
DISTVERSIONPREFIX=	v
2
DISTVERSIONPREFIX=	v
3
DISTVERSION=	0.8.1
3
DISTVERSION=	0.8.1
4
PORTREVISION=	1
4
CATEGORIES=	net-im
5
CATEGORIES=	net-im
5
6
6
PATCH_SITES=	https://github.com/ars3niy/tdlib-purple/commit/
7
PATCH_SITES=	https://github.com/ars3niy/tdlib-purple/pull/
7
PATCHFILES+=	8c87b899ddbec32.patch:-p1 # https://github.com/ars3niy/tdlib-purple/pull/154
8
PATCHFILES=	129.diff:-p1	\
9
		154.diff:-p1 	\
10
		163.diff:-p1
11
PATCH_SITE_SUBDIR=${PORTNAME}
8
12
9
MAINTAINER=	mi@aldan.algebra.com
13
MAINTAINER=	mi@aldan.algebra.com
10
COMMENT=	Telegram plugin for libpurple, using tdlib
14
COMMENT=	Telegram plugin for libpurple, using tdlib
Lines 36-42 CMAKE_ON+= NoBundledLottie # Using graphics/rlottie Link Here
36
NLS_CMAKE_OFF+=	-DNoTranslations=1
40
NLS_CMAKE_OFF+=	-DNoTranslations=1
37
NLS_USES=	gettext-tools gettext-runtime
41
NLS_USES=	gettext-tools gettext-runtime
38
42
39
EXTRACT_AFTER_ARGS=--exclude rlottie --exclude fmt
43
EXTRACT_AFTER_ARGS=--exclude rlottie --exclude fmt --exclude .github
40
44
41
.include <bsd.port.options.mk>
45
.include <bsd.port.options.mk>
42
46
(-)b/net-im/tdlib-purple/distinfo (-3 / +7 lines)
Lines 1-5 Link Here
1
TIMESTAMP = 1702875649
1
TIMESTAMP = 1712597997
2
SHA256 (ars3niy-tdlib-purple-v0.8.1_GH0.tar.gz) = 8eb8b10c714368d7435d34ccda66a918e59c4cb4d2f49b6e16a246a78abd1a62
2
SHA256 (ars3niy-tdlib-purple-v0.8.1_GH0.tar.gz) = 8eb8b10c714368d7435d34ccda66a918e59c4cb4d2f49b6e16a246a78abd1a62
3
SIZE (ars3niy-tdlib-purple-v0.8.1_GH0.tar.gz) = 776564
3
SIZE (ars3niy-tdlib-purple-v0.8.1_GH0.tar.gz) = 776564
4
SHA256 (8c87b899ddbec32.patch) = b6861f1129a8e17564c2f4abfc264fc95801ad22d00326c3c05d3003fd1b3832
4
SHA256 (129.diff) = 7dc6e4a2957a59ba9c97c3ba8ffb9e599ed4ebe39ac859ba127e4b79a38d1d2e
5
SIZE (8c87b899ddbec32.patch) = 11742
5
SIZE (129.diff) = 4492
6
SHA256 (154.diff) = 95a6d82d796e41de97b5446963e1a747f0ff0f128b5e1d5a073140fe35dccea9
7
SIZE (154.diff) = 11297
8
SHA256 (163.diff) = 104dba0df7fc95bcd8a5a814033289676551cdcb88650047c7be881440a79dd4
9
SIZE (163.diff) = 1791

Return to bug 278263