diff --git a/contrib/telega-adblock.el b/contrib/telega-adblock.el index 4f55a92..dfb4316 100644 --- a/contrib/telega-adblock.el +++ b/contrib/telega-adblock.el @@ -39,9 +39,9 @@ ;; - {{{user-option(telega-adblock-chat-order-if-last-message-ignored, 2)}}} ;; - {{{user-option(telega-adblock-verbose, 2)}}} ;; - {{{user-option(telega-adblock-max-distance, 2)}}} -;; - {{{user-option(telega-adblock-forwarded-messages, 2)}}} ;; - {{{user-option(telega-adblock-block-msg-temex, 2)}}} ;; - {{{user-option(telega-adblock-allow-msg-temex, 2)}}} +;; - {{{user-option(telega-adblock-predicates, 2)}}} ;; TODO: ;; - "invisible" links, example: https://t.me/botoid/1058351 @@ -68,12 +68,6 @@ :type 'telega-chat-temex :group 'telega-adblock) -(defcustom telega-adblock-forwarded-messages t - "Non-nil to block messages forwarded from other channels. -Block them even if a message has no links at all." - :type 'boolean - :group 'telega-adblock) - (defcustom telega-adblock-max-distance 4 "Maximum string-distance for self-link. Used for heuristics to avoid blocking non-advert messages in some channels. @@ -94,8 +88,19 @@ the rootbuf." (string :tag "Custom order")) :group 'telega-adblock) +(defcustom telega-adblock-predicates + '(telega-adblock-msg-by-temex-p + telega-adblock-msg-forwarded-p + telega-adblock-msg-has-erid-p + telega-adblock-msg-has-advert-links-p) + "List of predicates to check message for advertisements. +Each predicate accepts single argument - message. +If any of predicates returns non-nil, then message contains advert." + :type '(list function) + :group 'telega-adblock) + (defcustom telega-adblock-block-msg-temex nil - "Message's matching this temex will be ignored by adblock." + "Message temex for `telega-adblock-msg-by-temex-p' predicate." :type 'telega-msg-temex :options '((contains "#advert")) :group 'telega-adblock) @@ -112,6 +117,9 @@ the rootbuf." :type 'boolean :group 'telega-adblock) +(defvar telega-adblock-msg-extracted-links nil + "Bound to the list of links extracted during `telega-adblock-msg-ignore-p'.") + ;; TODO: heuristics about multiple links to same url ;; to block messages like https://t.me/c/1127375190/3747 @@ -219,10 +227,9 @@ another domain." "Return non-nil if LINK-SPEC is an advertisement link. LINK-SPEC is a cons cell, where car is text under the link and cdr is an URL." - (when (and - (not (telega-adblock--link-internal-p chat link-spec)) - (or (telega-adblock--link-other-channel-p chat link-spec) - (telega-adblock--link-cheating-p link-spec))) + (when (and (not (telega-adblock--link-internal-p chat link-spec)) + (or (telega-adblock--link-other-channel-p chat link-spec) + (telega-adblock--link-cheating-p link-spec))) (if telega-adblock-verbose (message "telega: Blocking advert link: %s in %s" (cdr link-spec) (telega-chat-title chat)) @@ -230,6 +237,10 @@ an URL." (cdr link-spec) (telega-chat-title chat))) t)) +(defun telega-adblock-msg-by-temex-p (msg) + "Return non-nil if MSG matches `telega-adblock-block-msg-temex'." + (telega-msg-match-p msg telega-adblock-block-msg-temex)) + (defun telega-adblock-msg-forwarded-p (msg) "Return non-nil if MSG is forwarded from another channel." (when-let ((fwd-origin (telega--tl-get msg :forward_info :origin)) @@ -239,24 +250,39 @@ an URL." ;; Allow self-forwards (not (eq orig-chat-id (plist-get msg :chat_id))))) -(defun telega-adblock-msg-has-advert-links-p (msg chat) +(defun telega-adblock-msg-has-advert-links-p (msg) "Return non-nil if MSG has at least one advert link." ;; NOTE: We group links by the URL, and block only if all ;; links to the URL are advertisements. - (seq-some (lambda (url-group) - (seq-every-p (apply-partially #'telega-adblock-link-advert-p chat) - (cdr url-group))) - (seq-group-by #'cdr (telega-adblock-msg-extract-links msg)))) + (let ((msg-chat (telega-msg-chat msg))) + (seq-some (lambda (url-group) + (seq-every-p (lambda (link-spec) + (telega-adblock-link-advert-p msg-chat link-spec)) + (cdr url-group))) + (seq-group-by #'cdr (telega-adblock-msg-extract-links msg))))) + +(defun telega-adblock-msg-has-erid-p (msg) + "Return non-nil if MSG text contains ERID label." + (or (telega-msg-match-p msg '(contains "\\")) + ;; NOTE: also check links in the message to have "erid" get + ;; parameter + (seq-some (lambda (link-spec) + (assoc "erid" + (url-parse-query-string + (or (cdr (url-path-and-query + (url-generic-parse-url (cdr link-spec)))) + "")))) + telega-adblock-msg-extracted-links))) (defun telega-adblock-msg-ignore-p (msg) "Return non-nil if message MSG is advert message." - (when-let ((chat (telega-msg-chat msg 'offline))) - (and (telega-chat-match-p chat telega-adblock-for) - (not (telega-msg-match-p msg telega-adblock-allow-msg-temex)) - (or (and telega-adblock-forwarded-messages - (telega-adblock-msg-forwarded-p msg)) - (telega-msg-match-p msg telega-adblock-block-msg-temex) - (telega-adblock-msg-has-advert-links-p msg chat))))) + (and (telega-chat-match-p (telega-msg-chat msg) telega-adblock-for) + (not (telega-msg-match-p msg telega-adblock-allow-msg-temex)) + (let ((telega-adblock-msg-extracted-links + (telega-adblock-msg-extract-links msg)) + (telega-msg-ignore-predicates + telega-adblock-predicates)) + (telega-msg-run-ignore-predicates msg)))) (defun telega-adblock--chat-order-if-last-msg-ignored (orig-fun chat &rest args) "Advice for `telega-chat-order' to return custom order. diff --git a/contrib/telega-mnz.el b/contrib/telega-mnz.el index a36144a..f10d6a0 100644 --- a/contrib/telega-mnz.el +++ b/contrib/telega-mnz.el @@ -119,7 +119,6 @@ See docstring for `display-buffer' for the value meaning." (diff . diff-mode) ; not in language-detection (elixir . elixir-mode) (elisp . emacs-lisp-mode) - (emacslisp . emacs-lisp-mode) (erlang . erlang-mode) (fortran . fortran-mode) (go . go-mode) diff --git a/docs/index.html b/docs/index.html index e5e4491..548f630 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,10 +3,10 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Telega Manual (v0.8.230) +Telega Manual (v0.8.240) @@ -36,7 +36,7 @@
@@ -2002,7 +2002,7 @@

+
 MSG1                              <--- msg sent on 27dec
 -------(28 December 2020)------   <--- date break
 MSG2                              <--- msg sent on 28dec
@@ -2393,7 +2393,7 @@ 

+
 MSG1                              <--- msg sent on 27dec
 -------(28 December 2020)------   <--- date break
 MSG2                              <--- msg sent on 28dec
@@ -2584,7 +2584,7 @@ 

-
+
 ```<language-name>
 first line of multiline preformatted code
 second line
@@ -2616,7 +2616,7 @@ 

+
 #+begin_src <language-name>
 code line
 next code line
@@ -3532,7 +3532,7 @@ 

-
+
 [⏪] [⏩] [2×] [Stop] 
 
@@ -3540,44 +3540,14 @@

-
0 (telega-msg--vvnote-stop)

-Stop playing media message. -

- -

-(fn MSG) -

-
<, , (telega-msg--vvnote-rewind-10-backward)

-Rewind 10 seconds backward. -

- -

-(fn MSG) -

-
>, . (telega-msg--vvnote-rewind-10-forward)

-Rewind 10 seconds forward. -

- -

-(fn MSG) -

-
x (telega-msg--vvnote-play-speed-toggle)

-Toggle playback speed for the media message. -Only two modes are available: normal speed and x2 speed. -

- -

-(fn MSG) -

-
9, 8, 7, 6, 5, 4, 3, 2, 1 (telega-msg--vvnote-rewind-part)

-Rewind to the N's 10 part of the message duration. +

0 (telega-msg--vvnote-stop)
Stop playing media message.
+
<, , (telega-msg--vvnote-rewind-10-backward)
Rewind 10 seconds backward.
+
>, . (telega-msg--vvnote-rewind-10-forward)
Rewind 10 seconds forward.
+
x (telega-msg--vvnote-play-speed-toggle)
Toggle playback speed for the media message. +Only two modes are available: normal speed and x2 speed.
+
9, 8, 7, 6, 5, 4, 3, 2, 1 (telega-msg--vvnote-rewind-part)
Rewind to the N's 10 part of the message duration. I.e. if you press 7, then you will jump to 70% of the message -duration. -

- -

-(fn MSG) -

+duration.

@@ -4733,7 +4703,7 @@

+
 https://github.com/zevlg/telega.el/issues/105
 https://gitlab.com/jessieh/mood-line/issues/6
 https://www.youtube.com/watch?v=0m2jR6_eMkU
@@ -5267,43 +5237,51 @@ 

4

  • -User Option: telega-adblock-forwarded-messages +User Option: telega-adblock-block-msg-temex

    -Non-nil to block messages forwarded from other channels. -Block them even if a message has no links at all. +Message temex for telega-adblock-msg-by-temex-p predicate.

    -Default value: t +Default value: nil

  • -User Option: telega-adblock-block-msg-temex +User Option: telega-adblock-allow-msg-temex

    -Message's matching this temex will be ignored by adblock. +Message's matching this temex will be allowed.

    -Default value: nil +Default value: (or is-reply-to-msg is-reply-to-story post-with-comments)

  • -User Option: telega-adblock-allow-msg-temex +User Option: telega-adblock-predicates

    -Message's matching this temex will be allowed. +List of predicates to check message for advertisements. +Each predicate accepts single argument - message. +If any of predicates returns non-nil, then message contains advert.

    -Default value: (or is-reply-to-msg is-reply-to-story post-with-comments) -

  • +Default value: +

    +
    +
    (telega-adblock-msg-by-temex-p telega-adblock-msg-forwarded-p
    +                               telega-adblock-msg-has-erid-p
    +                               telega-adblock-msg-has-advert-links-p)
    +
    +

    +

    telega-channels-export.el – Export Telegam channels to OPML

    diff --git a/docs/telega-manual.org b/docs/telega-manual.org index a5eb801..4afe5dd 100644 --- a/docs/telega-manual.org +++ b/docs/telega-manual.org @@ -1,5 +1,5 @@ #+options: timestamp:nil \n:t num:nil ellit-cid:t -#+title: Telega Manual (v0.8.230) +#+title: Telega Manual (v0.8.240) #+author: Zajcev Evgeny #+startup: showall @@ -241,7 +241,7 @@ Thanks to [[https://t.me/ritsch_master][=@ritsch_master=]] [[https://core.telegram.org/tdlib][TDLib]] is the library for building Telegram clients. It requires a large amount of memory to be built. Make sure you are using TDLib -version greater or equal to 1.8.23. +version greater or equal to 1.8.24. On MacOS you can install a pre-built =TDLib= package using homebrew from [[https://brew.sh][brew.sh]]. Just run: @@ -463,7 +463,12 @@ Default value: "~/.telega" add ~:language_pack_id~ option. Only writable options can be set. See: https://core.telegram.org/tdlib/options - Default value: ~(:online t :localization_target "tdesktop")~ + Default value: + #+begin_src emacs-lisp + (:online t :localization_target "tdesktop" :use_storage_optimizer + :false :ignore_file_names :false) + #+end_src + - User Option: ~telega-proxies~ List of proxies. @@ -751,12 +756,10 @@ Telega prefix map bindings: Default value: ~(and main unread)~ - @@html:@@w@@html:@@ (~telega-browse-url~) :: - Open the URL. - If URL can be opened directly inside telega, then do it. + Open the ~URL~. + If ~URL~ can be opened directly inside telega, then do it. Invite links and link to users can be directly opened in telega. - If IN-WEB-BROWSER is non-nil then force opening in web browser. - - (fn URL &optional IN-WEB-BROWSER) + If ~IN-WEB-BROWSER~ is non-nil then force opening in web browser. * Root Buffer :PROPERTIES: @@ -2643,28 +2646,18 @@ control buttons to control media playback parameters: For fast access to media controls you can you next bindings: - @@html:@@0@@html:@@ (~telega-msg--vvnote-stop~) :: Stop playing media message. - - (fn MSG) - @@html:@@<@@html:@@, @@html:@@,@@html:@@ (~telega-msg--vvnote-rewind-10-backward~) :: Rewind 10 seconds backward. - - (fn MSG) - @@html:@@>@@html:@@, @@html:@@.@@html:@@ (~telega-msg--vvnote-rewind-10-forward~) :: Rewind 10 seconds forward. - - (fn MSG) - @@html:@@x@@html:@@ (~telega-msg--vvnote-play-speed-toggle~) :: Toggle playback speed for the media message. Only two modes are available: normal speed and x2 speed. - - (fn MSG) - @@html:@@9@@html:@@, @@html:@@8@@html:@@, @@html:@@7@@html:@@, @@html:@@6@@html:@@, @@html:@@5@@html:@@, @@html:@@4@@html:@@, @@html:@@3@@html:@@, @@html:@@2@@html:@@, @@html:@@1@@html:@@ (~telega-msg--vvnote-rewind-part~) :: Rewind to the N's 10 part of the message duration. I.e. if you press 7, then you will jump to 70% of the message duration. - (fn MSG) - To play/pause media messages use @@html:@@RET@@html:@@. Also, @@html:@@l@@html:@@, @@html:@@ @@html:@@ (~telega-msg-copy-link~) command supports linking to the currently playing (or paused at) moment. @@ -3720,15 +3713,9 @@ Customizable options: Set it to less value if you see some advert messages not being blocked. Default value: ~4~ -- User Option: ~telega-adblock-forwarded-messages~ - - Non-nil to block messages forwarded from other channels. - Block them even if a message has no links at all. - - Default value: ~t~ - User Option: ~telega-adblock-block-msg-temex~ - Message's matching this temex will be ignored by adblock. + Message temex for ~telega-adblock-msg-by-temex-p~ predicate. Default value: ~nil~ - User Option: ~telega-adblock-allow-msg-temex~ @@ -3736,6 +3723,19 @@ Customizable options: Message's matching this temex will be allowed. Default value: ~(or is-reply-to-msg is-reply-to-story post-with-comments)~ +- User Option: ~telega-adblock-predicates~ + + List of predicates to check message for advertisements. + Each predicate accepts single argument - message. + If any of predicates returns non-nil, then message contains advert. + + Default value: + #+begin_src emacs-lisp + (telega-adblock-msg-by-temex-p telega-adblock-msg-forwarded-p + telega-adblock-msg-has-erid-p + telega-adblock-msg-has-advert-links-p) + #+end_src + ** /telega-channels-export.el/ -- Export Telegam channels to OPML :PROPERTIES: diff --git a/etc/Dockerfile b/etc/Dockerfile index 25bd3c5..884ea9b 100644 --- a/etc/Dockerfile +++ b/etc/Dockerfile @@ -21,7 +21,7 @@ ARG telega_branch=master RUN set +x && apk update && apk upgrade && \ apk add --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf php cmake -RUN echo "TDLib v1.8.23-fb27c7c0b" > tdlib-version && \ +RUN echo "TDLib v1.8.24-437c2d0c6" > tdlib-version && \ git clone https://github.com/tdlib/td.git && \ cd td && \ git checkout ${tdlib_branch} && \ diff --git a/etc/langs/en.plist b/etc/langs/en.plist index 72ebdf4..4eb1230 100644 --- a/etc/langs/en.plist +++ b/etc/langs/en.plist @@ -112,6 +112,10 @@ Example: 23 y.o. designer from San Francisco") :zero_value "No answers" :one_value "{count} answer" :other_value "{count} answers") + ("lng_polls_closed" + :value "Final results") + ("lng_polls_stop" + :value "Stop poll") ("lng_polls_stop_warning" :value "If you stop this poll now, nobody will be able to vote in it anymore. This action cannot be undone.") ("lng_polls_solution_title" @@ -743,6 +747,9 @@ Example: 23 y.o. designer from San Francisco") :value "Files") ;; #5584 - https://translations.telegram.org/en/search?lang_pack=tdesktop&l=screenshot5584 + ("lng_mute_duration_hours" + :one_value "For {count} hour" + :other_value "For {count} hours") ("lng_mute_duration_forever" :value "Forever") ("lng_mute_box_tip" @@ -1495,6 +1502,12 @@ You can send them an invite link as message instead.") ("lng_profile_similar_channels" :one_value "{count} similar channel" :other_value "{count} similar channels") + ("lng_sent_date" + :value "Sent: {date}") + ("lng_forwarded_date" + :value "Original: {date}") + ("lng_inline_bot_via" + :value "via {inline_bot}") ;; Chat Background ("lng_action_set_wallpaper" diff --git a/telega-chat.el b/telega-chat.el index e8c60da..06e77e4 100644 --- a/telega-chat.el +++ b/telega-chat.el @@ -1992,7 +1992,7 @@ Use this to surrond header with some prefix and suffix." :with-brackets-p t)) :name (telega-tl-str action-bar :title)) (telega-ins " ") - (telega-ins--date-full (plist-get action-bar :request_date)) + (telega-ins--date (plist-get action-bar :request_date) 'date-long) ))) (defun telega-chatbuf-footer-action-bar () @@ -2143,8 +2143,8 @@ Use this to surrond header with some prefix and suffix." (when (> (plist-get group-call :scheduled_start_date) 0) (telega-ins " " (telega-symbol 'alarm) (telega-i18n "lng_group_call_scheduled_status") ": ") - (telega-ins--date-iso8601 - (plist-get group-call :scheduled_start_date)) + (telega-ins--date + (plist-get group-call :scheduled_start_date) 'date-time) ;; Start Now (telega-ins " ") (telega-ins--box-button (telega-i18n "lng_group_call_start_now") @@ -3738,7 +3738,8 @@ Return last inserted ewoc node." telega-chatbuf--chat (telega-fmt-text (telega-ins--as-string - (telega-ins--date-full (plist-get msg :date))) + (telega-ins--date + (plist-get msg :date) 'date-long)) '(:@type "textEntityTypeBold"))))))) (setq node (ewoc-enter-after telega-chatbuf--ewoc node msg)) diff --git a/telega-core.el b/telega-core.el index 43ea86e..7f4b0ed 100644 --- a/telega-core.el +++ b/telega-core.el @@ -87,7 +87,7 @@ (:can_change_info . "lng_rights_group_info") (:can_invite_users . "lng_rights_chat_add_members") (:can_pin_messages . "lng_rights_group_pin") - (:can_manage_topics . "lng_rights_group_topics"))) + (:can_create_topics . "lng_rights_group_add_topics"))) (defconst telega-chat--admin-permissions '((:can_be_edited . "lng_rights_edit_admin") @@ -1766,16 +1766,14 @@ If COLUMN is nil or less then current column, then current column is used." "Describe item with TITLE." (declare (indent 1)) (let ((title-sym (gensym "title"))) - `(let ((,title-sym ,title)) + `(let ((,title-sym (string-trim-right ,title ": ?"))) ;; Right align title name to 14th column ;; as in `package--print-help-section' function (telega-ins--line-wrap-prefix (make-string (max 0 (- 12 (string-width ,title-sym))) ?\s) (telega-ins--with-face 'telega-describe-item-title (telega-ins ,title-sym) - (if (eq ?: (char-before)) - (telega-ins " ") - (telega-ins ": "))) + (telega-ins ": ")) ,@body) (telega-ins "\n")))) diff --git a/telega-customize.el b/telega-customize.el index e4e2e71..74b6750 100644 --- a/telega-customize.el +++ b/telega-customize.el @@ -99,7 +99,8 @@ At least `telega-database-dir' should be customized for each account." :group 'telega) (defcustom telega-options-plist - (list :online t :localization_target "tdesktop") + (list :online t :localization_target "tdesktop" + :use_storage_optimizer :false :ignore_file_names :false) "*Plist of options to set. To use custom language pack (from \"tdesktop\" localization target), add `:language_pack_id' option. @@ -136,11 +137,6 @@ Implies `telega-use-chat-info-database' set to non-nil." :type 'boolean :group 'telega) -(defcustom telega-enable-storage-optimizer nil - "Non-nil to automatically delete old files in background." - :type 'boolean - :group 'telega) - (defcustom telega-proxies nil "*List of proxies. Format is: @@ -167,15 +163,27 @@ where PROXY-TYPE is one of: :type 'integer :group 'telega) -(defcustom telega-old-date-format "%D.%M.%Y" - "Format for old dates in the chat buffer. -Date considered \"old\" if older then one week from now. -Resulting string must be no longer then 8 chars. Format specifiers: -%D - Two digits for a day. -%M - Two digits for a month. -%Y - Two digits for a year relative to 2000." - :package-version '(telega . "0.7.22") - :type 'string +(defcustom telega-date-format-alist + '((today . "%H:%M") + (this-week . "%a") + (old . "%d.%m.%y") + (date . "%d.%m.%y") + (time . "%H:%M") + (date-time . "%d.%m.%y %a %H:%M") + (date-long . "%d %B %Y")) + "Alist of date and time formats. +Key is one of `today', `this-week', `old', `full', `full-no-time'. +Value is a format accepted by `format-time-string'." + :package-version '(telega . "0.8.240") + :type '(alist :key-type + (choice (const :tag "If date is today" today) + (const :tag "If date is on this week" this-week) + (const :tag "If date is older than this week" old) + (const :tag "Format for the date only" date) + (const :tag "Long format for the date only" date-long) + (const :tag "Format for the time only" time) + (const :tag "Full date with time" date-time)) + :value-type string) :group 'telega) (defcustom telega-help-messages t @@ -1474,8 +1482,9 @@ different days. Such as: ("send-by" has-default-sender telega-chatbuf-attach-send-by) ("custom-emoji" - (eval - (telega-user-match-p (telega-user-me) 'is-premium)) + (or saved-messages + (eval + (telega-user-match-p (telega-user-me) 'is-premium))) telega-chatbuf-attach-custom-emoji) ("delimiter" (return t) telega-chatbuf-attach-delimiter) diff --git a/telega-emoji.el b/telega-emoji.el index 8b01b23..feb55d3 100644 --- a/telega-emoji.el +++ b/telega-emoji.el @@ -293,7 +293,8 @@ Actually return STICKER's full type info." (when (eq (telega--tl-type reaction-type) 'reactionTypeCustomEmoji) (plist-get reaction-type :custom_emoji_id)))) - (telega--tl-get msg :interaction_info :reactions)) + (telega--tl-get msg :interaction_info :reactions + :reactions)) ;; Custom emojis for special messages (cl-case (telega--tl-type content) @@ -477,15 +478,17 @@ Do not fetch custom emojis for ignored messages." (dolist (sset-info telega--stickersets-custom-emojis) (cl-assert (eq (telega--tl-type (plist-get sset-info :sticker_type)) 'stickerTypeCustomEmoji)) - (telega-ins (telega-stickerset-title sset-info 'raw) ":\n") - (let ((cb (telega--gen-ins-continuation-callback 'loading - (lambda (stickers) - (telega-ins--sticker-list - stickers :custom-action custom-action))))) - (telega-stickerset-get (plist-get sset-info :id) nil - (lambda (sset) - (funcall cb (mapcar #'telega-custom-emoji-from-sticker - (plist-get sset :stickers)))))) + (telega-ins--with-face 'telega-describe-item-title + (telega-ins (telega-stickerset-title sset-info 'raw) ":\n")) + (telega-ins--line-wrap-prefix " " + (let ((cb (telega--gen-ins-continuation-callback 'loading + (lambda (stickers) + (telega-ins--sticker-list + stickers :custom-action custom-action))))) + (telega-stickerset-get (plist-get sset-info :id) nil + (lambda (sset) + (funcall cb (mapcar #'telega-custom-emoji-from-sticker + (plist-get sset :stickers))))))) (telega-ins "\n"))) (defun telega-custom-emoji-choose (custom-action) diff --git a/telega-i18n.el b/telega-i18n.el index 9a3595e..cf7b8ac 100644 --- a/telega-i18n.el +++ b/telega-i18n.el @@ -46,7 +46,8 @@ (defconst telega-i18n--alias-alist '(("telega_show" . "lng_usernames_activate_confirm") - ("telega_loading" . "lng_profile_loading")) + ("telega_loading" . "lng_profile_loading") + ("telega_for_n_hours" . "lng_mute_duration_hours")) "i18n names aliases alist.") (defconst telega-i18n--en-strings nil diff --git a/telega-info.el b/telega-info.el index f28694a..b8af2ac 100644 --- a/telega-info.el +++ b/telega-info.el @@ -271,7 +271,7 @@ If OFFLINE-P is non-nil, then do not send a request to telega-server." (when-let ((patron (telega-msg-sender-patron-p user))) (telega-ins-describe-item "Telega Patron Since" - (telega-ins--date-full (plist-get patron :since_date)))) + (telega-ins--date (plist-get patron :since_date) 'date-long))) (telega-ins-describe-item "Id" (telega-ins-fmt (if telega-debug @@ -281,7 +281,8 @@ If OFFLINE-P is non-nil, then do not send a request to telega-server." (when (telega-me-p user) ;; Saved Messages (telega-ins-describe-item "Logged in" - (telega-ins--date-full (plist-get telega--options :authorization_date))) + (telega-ins--date + (plist-get telega--options :authorization_date) 'date-long)) (telega-ins--account-ttl)) (let ((relationship (telega-ins--as-string diff --git a/telega-inline.el b/telega-inline.el index 4b6885d..19d23fb 100644 --- a/telega-inline.el +++ b/telega-inline.el @@ -72,6 +72,12 @@ "Action to take when KBD-BUTTON is pressed." (let ((kbd-type (plist-get kbd-button :type))) (cl-ecase (telega--tl-type kbd-type) + (keyboardButtonTypeWebApp + (telega-browse-url + (telega--getWebAppUrl (telega-msg-sender msg) + :url (telega-tl-str kbd-type :url)) + 'in-browser)) + (keyboardButtonTypeText ;; A simple button, with text that should be sent ;; when the button is pressed diff --git a/telega-ins.el b/telega-ins.el index cf22b52..e95da92 100644 --- a/telega-ins.el +++ b/telega-ins.el @@ -239,48 +239,33 @@ single argument - slice number, starting from 0." "Insert FILESIZE in human readable format." (telega-ins (file-size-human-readable filesize))) -(defun telega-ins--date (timestamp) +(defun telega-ins--date (timestamp &optional fmt-type) "Insert TIMESTAMP. -Format is: -- HH:MM if today -- Mon/Tue/.. if on this week -- DD.MM.YY otherwise (uses `telega-old-date-format')" - (let* ((dtime (decode-time timestamp)) - (current-ts (telega-time-seconds)) - (ctime (decode-time current-ts)) - (today00 (telega--time-at00 current-ts ctime))) - (if (and (> timestamp today00) - (< timestamp (+ today00 (* 24 60 60)))) - (telega-ins-fmt "%02d:%02d" (nth 2 dtime) (nth 1 dtime)) - - (let* ((week-day (nth 6 ctime)) - (mdays (+ week-day - (- (if (< week-day telega-week-start-day) 7 0) - telega-week-start-day))) - (week-start00 (telega--time-at00 - (- current-ts (* mdays 24 3600))))) - (if (and (> timestamp week-start00) - (< timestamp (+ week-start00 (* 7 24 60 60)))) - (telega-ins (nth (nth 6 dtime) telega-i18n-weekday-names)) - - (telega-ins - (format-spec telega-old-date-format - (format-spec-make - ?D (format "%02d" (nth 3 dtime)) - ?M (format "%02d" (nth 4 dtime)) - ?Y (format "%02d" (- (nth 5 dtime) 2000))))))) - ))) +Use date format from `telega-date-format-alist' corresponding to FMT-TYPE. +By default FMT-TYPE is determined by TIMESTAMP value." + (unless fmt-type + (let* ((current-ts (telega-time-seconds)) + (ctime (decode-time current-ts)) + (today00 (telega--time-at00 current-ts ctime))) + (if (and (> timestamp today00) + (< timestamp (+ today00 (* 24 60 60)))) + (setq fmt-type 'today) + + (let* ((week-day (nth 6 ctime)) + (mdays (+ week-day + (- (if (< week-day telega-week-start-day) 7 0) + telega-week-start-day))) + (week-start00 (telega--time-at00 + (- current-ts (* mdays 24 3600))))) + (if (and (> timestamp week-start00) + (< timestamp (+ week-start00 (* 7 24 60 60)))) + (setq fmt-type 'this-week) + (setq fmt-type 'old)))))) -(defun telega-ins--date-iso8601 (timestamp) - "Insert TIMESTAMP in ISO8601 format." - (telega-ins (format-time-string "%FT%T%z" timestamp))) - -(defun telega-ins--date-full (timestamp) - "Insert TIMESTAMP in full format - DAY MONTH YEAR." - (cl-destructuring-bind (day month year) - (seq-subseq (decode-time timestamp) 3 6) - (telega-ins-fmt "%d %s %d" - day (nth month (assq 'full telega-i18n-month-names)) year))) + (telega-ins + (format-time-string (or (cdr (assq fmt-type telega-date-format-alist)) + "%FT%T%z") + timestamp))) (defun telega-ins--date-relative (timestamp) "Insert relative date for the timestamp." @@ -299,7 +284,8 @@ Format is: :time formatted-time)) (t (telega-ins-i18n "lng_mediaview_date_time" - :date (telega-ins--as-string (telega-ins--date-full timestamp)) + :date (telega-ins--as-string + (telega-ins--date timestamp 'date-long)) :time formatted-time))) )) @@ -1387,8 +1373,12 @@ Return `non-nil' if WEB-PAGE has been inserted." (anonymous-p "lng_polls_anonymous") (quiz-p "lng_polls_public_quiz") (t "lng_polls_public")))) - (when (and quiz-p (plist-get poll-type :explanation)) - (telega-ins " " (telega-symbol 'bulp))) + (when (and quiz-p (telega-tl-str poll-type :explanation)) + (telega-ins " ") + (telega-ins--text-button (telega-symbol 'bulp) + 'action (lambda (_button) + (message "telega: %s" + (telega-tl-str poll-type :explanation))))) ;; I18N: polls_votes_count -> {count} votes (telega-ins ", " (telega-i18n (if quiz-p "lng_polls_answers_count" @@ -1400,7 +1390,9 @@ Return `non-nil' if WEB-PAGE has been inserted." (telega-ins--image (telega-msg-sender-avatar-image-one-line (telega-msg-sender rv))))) (when closed-p - (telega-ins ", " (propertize "closed" 'face 'error))) + (telega-ins ", ") + (telega-ins--with-face 'error + (telega-ins-i18n "lng_polls_closed"))) (when (and (not closed-p) (plist-get msg :can_be_edited)) (telega-ins " ") (telega-ins--box-button (concat "Close " (if quiz-p "Quiz" "Poll")) @@ -1649,8 +1641,8 @@ If NO-THUMBNAIL-P is non-nil, then do not insert thumbnail." (telega-ins--with-face 'bold (telega-ins (telega-i18n "lng_prizes_date") "\n")) (telega-ins--line-wrap-prefix " " - (telega-ins--date-iso8601 - (plist-get ga-params :winners_selection_date))) + (telega-ins--date + (plist-get ga-params :winners_selection_date) 'date-time)) (when (> (telega-time-seconds) (plist-get ga-params :winners_selection_date)) @@ -1887,7 +1879,7 @@ Special messages are determined with `telega-msg-special-p'." "lng_action_group_call_scheduled_group") :from sender-name :date (telega-ins--as-string - (telega-ins--date-iso8601 (plist-get content :start_date))))) + (telega-ins--date (plist-get content :start_date) 'date-time)))) (messageVideoChatStarted (telega-ins-i18n "lng_action_group_call_started_group" :from sender-name)) @@ -1996,8 +1988,12 @@ Special messages are determined with `telega-msg-special-p'." (let* ((gifter-user-id (plist-get content :gifter_user_id)) (gifter (unless (telega-zerop gifter-user-id) (telega-user-get gifter-user-id))) - (from-me (telega-me-p sender)) - (sticker (plist-get content :sticker))) + (sticker (plist-get content :sticker)) + (currency (plist-get content :currency)) + (cost + (format "%.2f%s " (/ (plist-get content :amount) 100.0) + (or (cdr (assoc currency telega-currency-symbols-alist)) + currency)))) (when sticker (telega-ins--image (telega-sticker--image sticker @@ -2007,10 +2003,10 @@ Special messages are determined with `telega-msg-special-p'." (telega-ins-i18n "lng_action_gift_received_me" :user (telega-msg-sender-title--special (telega-chat-user (telega-msg-chat msg))) - :cost (propertize "TODO" 'face 'bold)) + :cost (propertize cost 'face 'bold)) (telega-ins-i18n "lng_action_gift_received" :user sender-name - :cost (propertize "TODO" 'face 'bold))))) + :cost (propertize cost 'face 'bold))))) (messageChatSetBackground (let ((only-self-p (plist-get content :only_for_self)) (sender-me-p (telega-me-p sender))) @@ -2061,7 +2057,8 @@ Special messages are determined with `telega-msg-special-p'." (telega-ins " ") (if-let ((send-date (plist-get scheduled :send_date))) (telega-ins-i18n "telega_scheduled_at_date" - :date (telega-ins--as-string (telega-ins--date-iso8601 send-date))) + :date (telega-ins--as-string + (telega-ins--date send-date 'date-time))) (telega-ins-i18n "telega_scheduled_when_online")) (telega-ins "\n")) @@ -2420,23 +2417,23 @@ argument - MSG to insert additional information after header." ")")))) ;; via - (let* ((via-bot-user-id (plist-get msg :via_bot_user_id)) - (via-bot (unless (zerop via-bot-user-id) - (telega-user-get via-bot-user-id)))) - (when via-bot - (telega-ins " via ") - ;; Use custom :action for clickable @bot link - (telega-ins--text-button (telega-user-title via-bot 'username) - 'face 'telega-link ;no button outline please - :action (lambda (_msg_ignored) - (telega-describe-user via-bot))))) + (when-let* ((via-bot-user-id (plist-get msg :via_bot_user_id)) + (via-bot (unless (zerop via-bot-user-id) + (telega-user-get via-bot-user-id))) + (bot-title (telega-ins--as-string + ;; Use custom :action for clickable @bot link + (telega-ins--text-button + (telega-user-title via-bot 'username) + 'face 'telega-username + :action (lambda (_msg_ignored) + (telega-describe-user via-bot)))))) + (telega-ins " " (telega-i18n "lng_inline_bot_via" + :inline_bot bot-title))) ;; Edited date (let ((edited-date (plist-get msg :edit_date))) (unless (zerop edited-date) - (telega-ins " " (telega-i18n "lng_edited") - " " (telega-i18n "lng_schedule_at") - " ") + (telega-ins " " (telega-i18n "lng_edited") " ") (telega-ins--date (plist-get msg :edit_date)))) ;; Interaction info @@ -2574,12 +2571,12 @@ Return user, chat or string with the sender title." (origin-chat-id (plist-get origin :chat_id)) (origin-msg-id (plist-get origin :message_id)) (origin-sender-id (plist-get origin :sender_user_id)) - (from-chat-id (plist-get fwd-info :from_chat_id)) - (from-msg-id (plist-get fwd-info :from_message_id)) - (chat-id (if (and from-chat-id (not (zerop from-chat-id))) + (from-chat-id (telega--tl-get fwd-info :source :chat_id)) + (chat-id (if (not (telega-zerop from-chat-id)) from-chat-id origin-chat-id)) - (msg-id (if (and from-msg-id (not (zerop from-msg-id))) + (from-msg-id (telega--tl-get fwd-info :source :message_id)) + (msg-id (if (not (telega-zerop from-msg-id)) from-msg-id origin-msg-id))) (cond ((and chat-id msg-id (not (zerop chat-id)) (not (zerop msg-id))) @@ -2614,11 +2611,16 @@ Return user, chat or string with the sender title." (if (memq 'forward telega-chat-aux-inline-symbols) (telega-ins (telega-symbol 'forward) " ") (telega-ins-i18n "lng_forwarded" :user "")) - (let ((origin (plist-get fwd-info :origin))) - (telega-ins--msg-sender-chat-date (telega--msg-origin-sender origin) - :from-chat-id (plist-get fwd-info :from_chat_id) + (let ((origin (plist-get fwd-info :origin)) + (source (plist-get fwd-info :source))) + (telega-ins--msg-sender-chat-date + (or (when-let ((src-sender (plist-get source :sender_id))) + (telega-msg-sender src-sender)) + (telega--msg-origin-sender origin)) + :from-chat-id (plist-get source :chat_id) :signature (telega-tl-str origin :author_signature) - :date (plist-get fwd-info :date))) + :date (or (plist-get source :date) + (plist-get fwd-info :date)))) (telega-ins "\n"))))) (defun telega-ins--msg-reply-to-message-inline (msg &optional reply-to) @@ -3659,10 +3661,11 @@ Return non-nil if restrictions has been inserted." (when (eq (telega--tl-type my-status) 'chatMemberStatusRestricted) (let* ((until (plist-get my-status :restricted_until_date)) (until-date (unless (zerop until) - (format-time-string - (downcase telega-old-date-format) until))) + (telega-ins--as-string + (telega-ins--date until 'date)))) (until-time (unless (zerop until) - (format-time-string "%H:%M" until))) + (telega-ins--as-string + (telega-ins--date until 'time)))) (perms (plist-get my-status :permissions))) (cond ((not (plist-get perms :can_send_basic_messages)) (if (and until-date until-time) @@ -3780,7 +3783,8 @@ MSG-REACTION is the `messageReaction' TDLib object." "Inserter for the message's MSG reactions." (let (ret) (unless reactions - (setq reactions (telega--tl-get msg :interaction_info :reactions))) + (setq reactions (telega--tl-get msg :interaction_info :reactions + :reactions))) (seq-doseq (msg-reaction reactions) (when ret (telega-ins " ")) diff --git a/telega-msg.el b/telega-msg.el index 24f3e79..2fa88c8 100644 --- a/telega-msg.el +++ b/telega-msg.el @@ -323,7 +323,8 @@ For use by interactive commands." "Return reaction chosen by me for the message MSG." (mapcar (telega--tl-prop :type) (seq-filter (telega--tl-prop :is_chosen) - (telega--tl-get msg :interaction_info :reactions)))) + (telega--tl-get msg :interaction_info :reactions + :reactions)))) (defun telega-msg-chat (msg &optional offline-p) "Return chat for the MSG. @@ -938,8 +939,8 @@ non-nil." (telega-ins "\n\n") (telega-ins-i18n "lng_prizes_how_when_finish" :date (telega-ins--as-string - (telega-ins--date-iso8601 - (plist-get ga-params :winners_selection_date))) + (telega-ins--date + (plist-get ga-params :winners_selection_date) 'date-time)) :winners (if (plist-get ga-params :only_new_members) (telega-i18n "lng_prizes_winners_new_of_one" :count (plist-get content :winner_count) @@ -952,8 +953,9 @@ non-nil." :with-username-p t :with-brackets-p t))) :start_date (telega-ins--as-string - (telega-ins--date-iso8601 - (plist-get ga-info :creation_date)))) + (telega-ins--date + (plist-get ga-info :creation_date) + 'date-time))) ;; TODO "")) (telega-ins "\n\n") @@ -1695,6 +1697,21 @@ Requires administrator rights in the chat." (list :@type "chatMemberStatusBanned" :banned_until_date 0))))) +(defun telega-ins--message-read-date (msg-read-date) + "Inserter for the MessageReadDate structure." + (cl-ecase (telega--tl-type msg-read-date) + (messageReadDateRead + (telega-ins--date (plist-get msg-read-date :read_date) 'date-time)) + (messageReadDateUnread + (telega-ins "Unread")) + (messageReadDateTooOld + (telega-ins "Too Old")) + (messageReadDateUserPrivacyRestricted + (telega-ins "User restricted")) + (messageReadDateMyPrivacyRestricted + (telega-ins "You restricted")) + )) + (defun telega-describe-message (msg &optional for-thread-p) "Show info about message at point." (interactive (list (telega-msg-for-interactive) @@ -1706,8 +1723,13 @@ Requires administrator rights in the chat." ;; change on async requests (setq telega--help-win-param msg-id) - (telega-ins-describe-item "Date(ISO8601)" - (telega-ins--date-iso8601 (plist-get msg :date))) + (telega-ins-describe-item (telega-i18n "lng_sent_date" :date "") + (telega-ins--date (plist-get msg :date) 'date-time)) + (when (plist-get msg :can_get_read_date) + (telega-ins-describe-item "Read Date" + (telega--getMessageReadDate msg + (telega--gen-ins-continuation-callback 'loading + #'telega-ins--message-read-date)))) (telega-ins-describe-item "Chat-id" (telega-ins-fmt "%d" chat-id)) (telega-ins-describe-item "Message-id" @@ -1816,6 +1838,11 @@ Requires administrator rights in the chat." (telega-ins--date-relative (plist-get viewer :view_date)))) msg-id)))) + (when-let ((fwd-info (plist-get msg :forward_info))) + (telega-ins "\n") + (telega-ins-describe-item (telega-i18n "lng_forwarded_date" :date "") + (telega-ins--date (plist-get fwd-info :date) 'date-time))) + (when (and (listp telega-debug) (memq 'info telega-debug)) (let ((print-length nil)) (telega-ins "\n---DEBUG---\n") @@ -1879,13 +1906,13 @@ Requires administrator rights in the chat." (telega-ins--with-face 'diff-removed (telega-ins "Orig")) (telega-ins " message at: ") - (telega-ins--date-iso8601 (plist-get msg-old :date)) + (telega-ins--date (plist-get msg-old :date) 'date-time) (telega-ins "\n") (telega-ins--with-face 'diff-added (telega-ins "Edit")) (telega-ins " message at: ") - (telega-ins--date-iso8601 (plist-get msg-new :edit_date)) + (telega-ins--date (plist-get msg-new :edit_date) 'date-time) (telega-ins "\n") (telega-ins "-- Diff --\n") diff --git a/telega-obsolete.el b/telega-obsolete.el index ba41564..aca9c67 100644 --- a/telega-obsolete.el +++ b/telega-obsolete.el @@ -231,6 +231,17 @@ nil "0.8.231") +(telega-obsolete--variable 'telega-adblock-forwarded-messages + 'telega-adblock-predicates + "0.8.232") + +(telega-obsolete--variable 'telega-enable-storage-optimizer + 'telega-options-plist + "0.8.240") +(telega-obsolete--variable 'telega-old-date-format + 'telega-date-format-alist + "0.8.240") + ;; Check some obsolete var/fun is used (cl-eval-when (eval load) (dolist (obsolete-var telega-obsolete--variables) diff --git a/telega-sticker.el b/telega-sticker.el index 5985418..3e64e9a 100644 --- a/telega-sticker.el +++ b/telega-sticker.el @@ -588,31 +588,37 @@ stickers for the EMOJI." (setq telega-help-win--emoji emoji) ;; NOTE: use callbacks for async stickers loading - (telega-ins-fmt "Custom Emoji for %s:\n" emoji) - (telega--getStickers emoji - :chat for-chat - :tl-sticker-type '(:@type "stickerTypeCustomEmoji") - :callback (telega--gen-ins-continuation-callback 'loading - (lambda (stickers &rest args) - (apply #'telega-ins--sticker-list - (mapcar #'telega-custom-emoji-from-sticker - stickers) - args)))) - - (unless custom-emojis-only - (telega-ins "\n") - (telega-ins "\nInstalled Stickers:\n") + (telega-ins--with-face 'telega-describe-item-title + (telega-ins-fmt "Custom Emoji for %s:\n" emoji)) + (telega-ins--line-wrap-prefix " " (telega--getStickers emoji + :chat for-chat + :tl-sticker-type '(:@type "stickerTypeCustomEmoji") :callback (telega--gen-ins-continuation-callback 'loading - #'telega-ins--sticker-list)) + (lambda (stickers &rest args) + (apply #'telega-ins--sticker-list + (mapcar #'telega-custom-emoji-from-sticker + stickers) + args))))) + (unless custom-emojis-only (telega-ins "\n") - (telega-ins "\nPublic Stickers:\n") - (telega--searchStickers emoji - :callback - (telega--gen-ins-continuation-callback 'loading - #'telega-ins--sticker-list))) - ))) + (telega-ins--with-face 'telega-describe-item-title + (telega-ins "Installed Stickers:\n")) + (telega-ins--line-wrap-prefix " " + (telega--getStickers emoji + :callback (telega--gen-ins-continuation-callback 'loading + #'telega-ins--sticker-list)) + (telega-ins "\n")) + + (telega-ins--with-face 'telega-describe-item-title + (telega-ins "Public Stickers:\n")) + (telega-ins--line-wrap-prefix " " + (telega--searchStickers emoji + :callback + (telega--gen-ins-continuation-callback 'loading + #'telega-ins--sticker-list)))) + ))) (defun telega-stickerset--minibuf-post-command () "Function to complete stickerset for `completion-in-region-function'." diff --git a/telega-tdlib.el b/telega-tdlib.el index 2af9aba..98cf3f8 100644 --- a/telega-tdlib.el +++ b/telega-tdlib.el @@ -1507,8 +1507,6 @@ New slow mode DELAY for the chat must be one of 0, 10, 30, 60, :device_model "Emacs" :system_version emacs-version :application_version telega-version - :enable_storage_optimizer telega-enable-storage-optimizer - :ignore_file_names :false ))) (defun telega--parseTextEntities (text parse-mode) @@ -2907,7 +2905,8 @@ Mode activates for (defun telega--boostChat (chat &rest slot-ids) (telega-server--send (list :@type "boostChat" - :chat_id (plist-get chat :id)))) + :chat_id (plist-get chat :id) + :slot_ids (apply 'vector reactions)))) (defun telega--getChatBoostLinkInfo (url &optional callback) (telega-server--call @@ -2984,6 +2983,27 @@ URL to open after a link of the type internalLinkTypeWebApp is clicked." :allow_write_access allow-write-access-p) callback)) +(cl-defun telega--getWebAppUrl (bot-user &key (url "") tdlib-theme app-name + callback) + "Return an HTTPS URL of a Web App to open." + (declare (indent 1)) + (with-telega-server-reply (reply) + (telega-tl-str reply :url) + (list :@type "getWebAppUrl" + :bot_user_id (plist-get bot-user :id) + :url url + :theme tdlib-theme + :app-name app-name) + callback)) + +(defun telega--getMessageReadDate (msg &optional callback) + (declare (indent 1)) + (telega-server--call + (list :@type "getMessageReadDate" + :chat_id (plist-get msg :chat_id) + :message_id (plist-get msg :id)) + callback)) + (provide 'telega-tdlib) ;;; telega-tdlib.el ends here diff --git a/telega-topic.el b/telega-topic.el index 4c482be..16d17b4 100644 --- a/telega-topic.el +++ b/telega-topic.el @@ -206,7 +206,7 @@ :action #'telega-chat-button-action) (telega-ins "\n") (telega-ins "Created: ") - (telega-ins--date-iso8601 (plist-get topic-info :creation_date)) + (telega-ins--date (plist-get topic-info :creation_date) 'date-time) (telega-ins "\n") (telega-ins (telega-i18n "lng_topic_author_badge") ": ") (telega-ins--msg-sender diff --git a/telega-util.el b/telega-util.el index ff5dbdf..ac38aa0 100644 --- a/telega-util.el +++ b/telega-util.el @@ -2701,12 +2701,17 @@ If FOR-PARAM is specified, then insert only if (eq telega--help-win-param for-param)) (telega-help-win--rm-tdlib-callback telega-server--callback-extra) - (let ((inhibit-read-only t)) + (let ((inhibit-read-only t) + ;; NOTE: retain text properties of the + ;; "Loading..." label + (text-props (when show-loading-p + (text-properties-at marker)))) (when show-loading-p (delete-region marker (+ marker marker-len))) (telega-save-excursion (goto-char marker) - (apply insert-func insert-args)))))))))) + (telega-ins--with-props text-props + (apply insert-func insert-args))))))))))) (defun telega-translate-region (beg end &optional choose-language-p inplace-p) "Translate region using Telegram API. diff --git a/telega-webpage.el b/telega-webpage.el index 3e31d1c..3ed8035 100644 --- a/telega-webpage.el +++ b/telega-webpage.el @@ -307,7 +307,7 @@ Keymap: (when (zerop publish-date) (setq publish-date (time-to-seconds))) (telega-ins " • ") - (telega-ins--date-full publish-date)) + (telega-ins--date publish-date 'date-long)) (telega-ins "\n") (when photo-image (telega-ins--image photo-image 2)) @@ -378,7 +378,7 @@ Keymap: (let ((publish-date (plist-get pb :publish_date))) (when (zerop publish-date) (setq publish-date (time-to-seconds))) - (telega-ins--date-full publish-date))) + (telega-ins--date publish-date 'date-long))) (telega-ins "\n")) (pageBlockHeader (telega-ins--with-face 'telega-webpage-header diff --git a/telega.el b/telega.el index 62eb766..6f60056 100644 --- a/telega.el +++ b/telega.el @@ -8,10 +8,10 @@ ;; Keywords: comm ;; Package-Requires: ((emacs "27.1") (visual-fill-column "1.9") (rainbow-identifiers "0.2.2")) ;; URL: https://github.com/zevlg/telega.el -;; Version: 0.8.231 -(defconst telega-version "0.8.231") +;; Version: 0.8.240 +(defconst telega-version "0.8.240") (defconst telega-server-min-version "0.7.7") -(defconst telega-tdlib-min-version "1.8.23") +(defconst telega-tdlib-min-version "1.8.24") (defconst telega-tdlib-max-version nil) (defconst telega-tdlib-releases '("1.8.0" . "1.9.0") @@ -229,6 +229,11 @@ If `\\[universal-argument]' is specified, then do not pop to root buffer." (telega-server--start) (telega-i18n-init) + ;; Some options are better to set before calling setTdlibParameters + ;; ref: https://t.me/tdlibchat/136047 + (telega--tl-dolist ((prop-name value) telega-options-plist) + (telega--setOption prop-name value)) + ;; For telega-auto-download-mode and network statistics (unless (eq 'other telega-network-type) (telega-set-network-type telega-network-type)) @@ -258,9 +263,6 @@ Works only if current state is `authorizationStateWaitCode'." (defun telega--authorization-ready () "Called when tdlib is ready to receive queries." - (telega--tl-dolist ((prop-name value) telega-options-plist) - (telega--setOption prop-name value)) - ;; In case language pack id has not yet been selected, then select ;; suggested one or fallback to "en" (unless (plist-get telega--options :language_pack_id)