Skip to content

Commit

Permalink
Initial support for TDLib 1.8.29
Browse files Browse the repository at this point in the history
- [enh] Set `telega-root-show-avatars`, `telega-user-show-avatars` and `telega-chat-show-avatars` to non-nil only if `svg` is available.  Fixes https://t.me/emacs_telega/45063

- [new] Display stickers in webpage containing link to stickerset

- [new] Custom emojis in polls via `C-c C-e' while reading question/option.

- [add] `telega-view-recommended-channels` root view to view recommended channels.  Bound to `v r` by default

- [add] I18N for "Mute For" strings

- [fix] Years old calculation in the `telega-ins--birthdate`

- [fix] Return correct chat permissions (`telega-chat-member-my-permissions`) for chats with comments to channel posts in case me is not member.

Version -> 0.8.290
  • Loading branch information
zevlg committed May 15, 2024
1 parent 99477b0 commit 009e5ce
Show file tree
Hide file tree
Showing 21 changed files with 451 additions and 288 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![CI test](https://github.com/zevlg/telega.el/workflows/CI/badge.svg)](https://github.com/zevlg/telega.el/actions) [![DOCKER image build](https://github.com/zevlg/telega.el/workflows/DOCKER/badge.svg)](https://github.com/zevlg/telega.el/actions) [![Telegram chat](https://img.shields.io/badge/chat-%40emacs__telega-%2335ADE1?logo=telegram)](https://t.me/emacs_telega) [![TDLib](https://img.shields.io/badge/TDLib-v1.8.25-%2335ADE1)](https://github.com/tdlib/td) [![MELPA](https://melpa.org/packages/telega-badge.svg)](https://melpa.org/#/telega) [![MELPA Stable](http://stable.melpa.org/packages/telega-badge.svg)](http://stable.melpa.org/#/telega) [![GNU Guix](https://img.shields.io/badge/GNU%20Guix-0.8.230-blue)](https://packages.guix.gnu.org/packages/emacs-telega/) [![Open Collective](https://img.shields.io/opencollective/backers/telega?logo=opencollective)](https://opencollective.com/telega)
[![CI test](https://github.com/zevlg/telega.el/workflows/CI/badge.svg)](https://github.com/zevlg/telega.el/actions) [![DOCKER image build](https://github.com/zevlg/telega.el/workflows/DOCKER/badge.svg)](https://github.com/zevlg/telega.el/actions) [![Telegram chat](https://img.shields.io/badge/chat-%40emacs__telega-%2335ADE1?logo=telegram)](https://t.me/emacs_telega) [![TDLib](https://img.shields.io/badge/TDLib-v1.8.29-%2335ADE1)](https://github.com/tdlib/td) [![MELPA](https://melpa.org/packages/telega-badge.svg)](https://melpa.org/#/telega) [![MELPA Stable](http://stable.melpa.org/packages/telega-badge.svg)](http://stable.melpa.org/#/telega) [![GNU Guix](https://img.shields.io/badge/GNU%20Guix-0.8.230-blue)](https://packages.guix.gnu.org/packages/emacs-telega/) [![Open Collective](https://img.shields.io/opencollective/backers/telega?logo=opencollective)](https://opencollective.com/telega)

[![Backers](https://opencollective.com/telega/backers.svg?avatarHeight=32&width=600)](https://opencollective.com/telega)

Expand Down
2 changes: 1 addition & 1 deletion contrib/telega-adblock.el
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ cdr is the URL."

(defun telega-adblock--link-other-channel-p (chat link-spec)
"Return non-nil if link points to another channel."
(when-let* ((tme-internal-link (telega-tme-open (cdr link-spec) 'convert))
(when-let* ((tme-internal-link (telega-tme-open (cdr link-spec) 'offline))
;; NOTE: to avoid errors like:
;; string-prefix-p: Wrong type argument: stringp,
;; (:@type "internalLinkTypeWebApp" ..)
Expand Down
32 changes: 19 additions & 13 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions docs/telega-manual.org
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#+options: timestamp:nil \n:t num:nil ellit-cid:t
#+title: Telega Manual (v0.8.255)
#+title: Telega Manual (v0.8.290)
#+author: Zajcev Evgeny
#+startup: showall

Expand Down Expand Up @@ -244,7 +244,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.24.
version greater or equal to 1.8.29.

On MacOS you can install a pre-built =TDLib= package using homebrew
from [[https://brew.sh][brew.sh]]. Just run:
Expand Down Expand Up @@ -524,6 +524,8 @@ for that variables. Most notable options are:
want to create X frames to show images.
See https://zevlg.github.io/telega.el/#settings-for-emacs-as-daemon

Set to ~imagemagick~ to use ImageMagick to handle images (not recommended).

- User Option: ~telega-emoji-font-family~

Font to use for emoji image generation using ~telega-emoji-create-svg~.
Expand Down Expand Up @@ -961,6 +963,9 @@ view.
- @@html:<kbd>@@v *@@html:</kbd>@@ (~telega-view-favorite-messages~) ::
View favorite messages in all the chats.

- @@html:<kbd>@@v r@@html:</kbd>@@ (~telega-view-recommended-channels~) ::
View channels recommended to me.

Important customizable options:
- User Option: ~telega-root-default-view-function~

Expand Down
20 changes: 20 additions & 0 deletions etc/langs/en.plist
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ Example: 23 y.o. designer from San Francisco")
("lng_admin_badge"
:value "admin")
("lng_polls_create_title"
:value "New poll")
("lng_polls_create_multiple_choice"
:value "Multiple Answers")
("lng_polls_create_anonymous"
Expand Down Expand Up @@ -396,6 +398,8 @@ Example: 23 y.o. designer from San Francisco")
:value "Location")
("lng_info_location_label"
:value "Location")
("lng_live_location"
:value "Live Location")
("lng_manage_linked_channel"
:value "Linked channel")
Expand Down Expand Up @@ -762,6 +766,10 @@ Example: 23 y.o. designer from San Francisco")
:value "Files")
;; #5584 - https://translations.telegram.org/en/search?lang_pack=tdesktop&l=screenshot5584
("lng_mute_menu_duration"
:value "Mute for...")
("lng_mute_menu_duration_any"
:value "Mute for {duration}")
("lng_mute_duration_hours"
:one_value "For {count} hour"
:other_value "For {count} hours")
Expand Down Expand Up @@ -1353,6 +1361,9 @@ You can send them an invite link as message instead.")
:one_value "{count} day"
:other_value "{count} days")
("lng_settings_channel_label"
:value "Personal channel")
("lng_manage_messages_ttl_never"
:value "Off")
("lng_manage_messages_ttl_after_custom"
Expand Down Expand Up @@ -1656,4 +1667,13 @@ You can send them an invite link as message instead.")
({count} year old)"
:other_value "{date}
({count} years old)")
;; Business
("lng_business_subtitle_sponsored"
:value "Ads in Channels")
("lng_business_button_sponsored"
:value "Do Not Hide Ads")
("lng_business_about_sponsored"
:value "As a Premium subscriber, you don’t see any ads on Telegram, but you can turn them on, for example, to view your own ads that you launched on the {link}")
)
82 changes: 40 additions & 42 deletions telega-chat.el
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,11 @@ Combines chat permissions and admin/owner permissions."
(chatMemberStatusRestricted
(setq perms (plist-get status :permissions)))

(chatMemberStatusLeft
(setq perms nil))))
;; NOTE: In comments group me might be non-member, but still
;; able to send messages
;; (chatMemberStatusLeft
;; (setq perms nil))
))
perms))

(defun telega-chat-title (chat &optional no-badges)
Expand Down Expand Up @@ -508,12 +511,17 @@ Pass non-nil OFFLINE-P argument to avoid any async requests."
"Asynchronously fetch pinned stories for the chatbuf."
(when (telega-chatbuf-match-p telega-story-show-pinned-stories-for)
(cond ((telega-chatbuf-match-p 'has-pinned-stories)
(telega--getChatPinnedStories telega-chatbuf--chat nil nil
(let ((chat telega-chatbuf--chat))
(lambda (stories)
(plist-put chat :telega-pinned-stories
(append (plist-get stories :stories) nil))
(with-telega-chatbuf chat
(telega--getChatPostedToChatPageStories telega-chatbuf--chat nil nil
(lambda-with-current-buffer (stories)
(let* ((pinned-ids (plist-get stories :pinned_story_ids))
(pinned-stories
(seq-filter (lambda (story)
(seq-contains-p
pinned-ids (plist-get story :id)))
(plist-get stories :stories))))
(plist-put telega-chatbuf--chat :telega-pinned-stories
pinned-stories)
(when pinned-stories
(telega-chatbuf--chat-update "pinned-stories"))))))

((plist-get telega-chatbuf--chat :telega-pinned-stories)
Expand Down Expand Up @@ -931,12 +939,13 @@ Specify non-nil BAN to ban this user in this CHAT."
'face 'telega-shadow))
(unless muted-p
(telega-ins " ")
(telega-ins--box-button "Mute For"
(telega-ins--box-button (telega-i18n "lng_mute_menu_duration")
:value chat
:action (lambda (chat)
(telega-chat-toggle-muted
chat (telega-completing-read-mute-for
"Disable notifications for: ")))))
(telega-i18n "lng_mute_menu_duration_any"
:duration ": "))))))
(telega-ins "\n"))

;; Show Preview
Expand Down Expand Up @@ -4187,14 +4196,14 @@ MARKUP-NAME names a markup function from
((eq (telega--tl-type attach) 'telegaLinkPreviewOptions)
(setq link-preview-options (plist-get attach :options)))

;; Some real attachment:
;; 1) If attachment followed by plain text, then it might be
;; a caption for the attachment, in this case add caption
;; to the attachment.
;; 2) Special case is for forwarded messages, new caption can
;; be supplied for the forwarded message only if forwarded
;; message as copy and original caption is removed (`C-u C-u
;; f' behaviour)
;; Some real attachment:
;; 1) If attachment followed by plain text, then it might be
;; a caption for the attachment, in this case add caption
;; to the attachment.
;; 2) Special case is for forwarded messages, new caption can
;; be supplied for the forwarded message only if forwarded
;; message as copy and original caption is removed (`C-u C-u
;; f' behaviour)
(t
(when (and (or (memq (telega--tl-type attach)
'(inputMessageAnimation
Expand Down Expand Up @@ -4884,19 +4893,14 @@ Return nil if CHAT has no linked chat."
(defun telega-chatbuf-attach-location (location &optional live-secs)
"Attach location to the chatbuf input.
If `\\[universal-argument]' is given, then attach live location."
(interactive (list (with-telega-chatbuf-action "ChoosingLocation"
(if current-prefix-arg
(telega-read-live-location "Live Location")
(telega-read-location (telega-i18n "lng_maps_point"))))
(when current-prefix-arg
(let* ((choices `(("1 min" . 60)
("15 min" . ,(* 15 60))
("1 hour" . ,(* 60 60))
("8 hours" . ,(* 8 60 60))))
(live-for (funcall telega-completing-read-function
"Live for: "
(mapcar 'car choices) nil t)))
(cdr (assoc live-for choices))))))
(interactive
(list (with-telega-chatbuf-action "ChoosingLocation"
(if current-prefix-arg
(telega-read-live-location (telega-i18n "lng_live_location"))
(telega-read-location (telega-i18n "lng_maps_point"))))
(when current-prefix-arg
(telega-completing-read-duration "Live for: "
`(60 ,(* 15 60) ,(* 60 60) ,(* 8 60 60) #x7FFFFFFF)))))

(telega-chatbuf-input-insert
(nconc (list :@type "inputMessageLocation"
Expand Down Expand Up @@ -5213,13 +5217,7 @@ Uses `telega-screenshot-function' to take a screenshot."
EMOJI - emoji string to use instead of emoji associated with the STICKER."
(cl-assert (telega-custom-emoji-sticker-p sticker))
(telega-chatbuf-input-insert
(propertize
(or emoji (telega-tl-str sticker :emoji))
:tl-entity-type (list :@type "textEntityTypeCustomEmoji"
:custom_emoji_id (telega-custom-emoji-id sticker))
'display (when telega-use-images
(telega-sticker--image sticker))
'rear-nonsticky t)))
(telega-custom-emoji-as-string sticker emoji)))

(defun telega-chatbuf-animation-insert (animation)
"Attach ANIMATION to the input."
Expand Down Expand Up @@ -5367,14 +5365,14 @@ ANONYMOUS-P - Non-nil to create anonymous poll.
ALLOW-MULTIPLE-ANSWERS-P - Non-nil to allow multiple answers.
OPTIONS - List of strings representing poll options."
(interactive
(let ((poll-q (read-string
(let ((poll-q (telega-read-string-with-custom-emojis
(concat (telega-i18n "lng_polls_public")
" "
(telega-i18n "lng_polls_create_question")
": ")))
(optidx 1) opt poll-opts)
(while (not (string-empty-p
(setq opt (read-string
(setq opt (telega-read-string-with-custom-emojis
(format "Option %d): " optidx)))))
(setq poll-opts (append poll-opts (list opt)))
(cl-incf optidx))
Expand All @@ -5387,12 +5385,12 @@ OPTIONS - List of strings representing poll options."

(telega-chatbuf-input-insert
(list :@type "inputMessagePoll"
:question question
:question (telega-string-fmt-text question)
:is_anonymous (if anonymous-p t :false)
:type (list :@type "pollTypeRegular"
:allow_multiple_answers
(if allow-multiple-answers-p t :false))
:options (apply 'vector options))))
:options (apply #'vector (mapcar #'telega-string-fmt-text options)))))

(defun telega-chatbuf-attach-scheduled (timestamp)
"Mark content as scheduled.
Expand Down
Loading

0 comments on commit 009e5ce

Please sign in to comment.