diff options
author | j.r | 2021-04-22 10:53:01 +0200 |
---|---|---|
committer | j.r | 2021-04-22 10:53:01 +0200 |
commit | b2632d555610c737b7dc471f549ca1395a15112c (patch) | |
tree | c41cc1da4cc4a321561df619ff120d041f7fd01b | |
parent | f38d99883ee547a9f0fca424857b665d2923a436 (diff) | |
download | aur-b2632d555610c737b7dc471f549ca1395a15112c.tar.gz |
telegram-tg(-git): bump to 0.11.0
patches for python-telegram version are not needed anymore
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | 0001-Change-setup.py-to-accept-new-python-telegram-ver.patch | 23 | ||||
-rw-r--r-- | 0002-Fix-compatibility-with-new-libtd-version.patch | 181 | ||||
-rw-r--r-- | PKGBUILD | 15 |
4 files changed, 8 insertions, 221 deletions
@@ -1,12 +1,12 @@ pkgbase = telegram-tg pkgdesc = terminal telegram client that really works - pkgver = 0.8.0 + pkgver = 0.11.0 pkgrel = 1 url = https://github.com/paul-nameless/tg arch = any license = Unlicense makedepends = python-setuptools - depends = python-telegram + depends = python-telegram=0.14.0 depends = python3 optdepends = libnotify: for notifications, you could also use other programs: see config optdepends = ffmpeg: to record voice msgs and upload videos correctly @@ -15,10 +15,8 @@ pkgbase = telegram-tg optdepends = nnn: can be used to choose file when sending, customizable with FILE_PICKER_CMD optdepends = fzf: to create groups and secret chats, used for single and multiple user selection conflicts = telegram-tg-git - source = telegram-tg-0.8.0.tar.gz::https://github.com/paul-nameless/tg/archive/v0.8.0.tar.gz - source = 0001-Change-setup.py-to-accept-new-python-telegram-ver.patch - md5sums = 4456e09339b7070c9f03e6944b400db7 - md5sums = 7b9a556ce7d2203fbee32442a96d73bc + source = telegram-tg-0.11.0.tar.gz::https://github.com/paul-nameless/tg/archive/v0.11.0.tar.gz + md5sums = f4a5ee804d02f4ef035fcb138c905aed pkgname = telegram-tg diff --git a/0001-Change-setup.py-to-accept-new-python-telegram-ver.patch b/0001-Change-setup.py-to-accept-new-python-telegram-ver.patch deleted file mode 100644 index d5e8e746ad8e..000000000000 --- a/0001-Change-setup.py-to-accept-new-python-telegram-ver.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0b4663c21a1dac223872f16473840b9daf446d8b Mon Sep 17 00:00:00 2001 -From: "j.r" <j.r@jugendhacker.de> -Date: Tue, 29 Dec 2020 14:44:26 +0100 -Subject: [PATCH 1/2] Change setup.py to accept new python-telegram ver - ---- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index e1aea71..e98daa1 100644 ---- a/setup.py -+++ b/setup.py -@@ -22,5 +22,5 @@ setup( - packages=["tg"], - entry_points={"console_scripts": ["tg = tg.__main__:main"]}, - python_requires=">=3.8", -- install_requires=["python-telegram==0.12.0"], -+ install_requires=["python-telegram>=0.12.0"], - ) --- -2.30.1 - diff --git a/0002-Fix-compatibility-with-new-libtd-version.patch b/0002-Fix-compatibility-with-new-libtd-version.patch deleted file mode 100644 index 45c124849cd6..000000000000 --- a/0002-Fix-compatibility-with-new-libtd-version.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 24dc62ca6ed1cff0e7a0124aa24f8388f7c034f1 Mon Sep 17 00:00:00 2001 -From: hexyoungs <chuxdesign@hotmail.com> -Date: Wed, 25 Nov 2020 16:07:50 +0800 -Subject: [PATCH 2/2] Fix compatibility with new libtd version - -Based on the work of chux0519 here: https://github.com/chux0519/tg ---- - tg/controllers.py | 2 +- - tg/models.py | 13 ++++++++++--- - tg/msg.py | 2 +- - tg/update_handlers.py | 22 +++++++++++++++++----- - tg/views.py | 10 +++++----- - 5 files changed, 34 insertions(+), 15 deletions(-) - -diff --git a/tg/controllers.py b/tg/controllers.py -index 300e3d2..ae8deab 100644 ---- a/tg/controllers.py -+++ b/tg/controllers.py -@@ -869,7 +869,7 @@ class Controller: - return - - # notify -- if self.model.is_me(msg["sender_user_id"]): -+ if self.model.is_me(msg["sender"].get("user_id")): - return - user = self.model.users.get_user(msg.sender_id) - name = f"{user['first_name']} {user['last_name']}" -diff --git a/tg/models.py b/tg/models.py -index 882bcd4..0808448 100644 ---- a/tg/models.py -+++ b/tg/models.py -@@ -175,7 +175,8 @@ class Model: - return False - - def can_be_deleted(self, chat_id: int, msg: Dict[str, Any]) -> bool: -- if chat_id == msg["sender_user_id"]: -+ c_id = msg["sender"].get("chat_id") or msg["sender"].get("user_id") -+ if chat_id == c_id: - return msg["can_be_deleted_only_for_self"] - return msg["can_be_deleted_for_all_users"] - -@@ -436,6 +437,12 @@ class ChatModel: - chat_id = chat["id"] - if chat_id in self.chat_ids: - return -+ -+ if len(chat["positions"]) > 0: -+ chat["order"] = chat["positions"][0]["order"] -+ else: -+ chat["order"] = 0 #str(sys.maxsize) -+ - if int(chat["order"]) == 0: - self.inactive_chats[chat_id] = chat - return -@@ -811,10 +818,10 @@ class UserModel: - if user_id == 0: - return "" - user = self.get_user(user_id) -- if user["first_name"] and user["last_name"]: -+ if user.get("first_name") and user.get("last_name"): - return f'{user["first_name"]} {user["last_name"]}'[:20] - -- if user["first_name"]: -+ if user.get("first_name"): - return f'{user["first_name"]}'[:20] - - if user.get("username"): -diff --git a/tg/msg.py b/tg/msg.py -index deb5288..3084c6c 100644 ---- a/tg/msg.py -+++ b/tg/msg.py -@@ -218,7 +218,7 @@ class MsgProxy: - - @property - def sender_id(self) -> int: -- return self.msg["sender_user_id"] -+ return self.msg["sender"].get("user_id") or self.msg["sender"].get("chat_id") - - @property - def forward(self) -> Optional[Dict[str, Any]]: -diff --git a/tg/update_handlers.py b/tg/update_handlers.py -index fa42c0a..2799709 100644 ---- a/tg/update_handlers.py -+++ b/tg/update_handlers.py -@@ -78,7 +78,7 @@ def update_new_message(controller: Controller, update: Dict[str, Any]) -> None: - - controller.notify_for_message(msg.chat_id, msg) - -- -+#outdated - @update_handler("updateChatOrder") - def update_chat_order(controller: Controller, update: Dict[str, Any]) -> None: - current_chat_id = controller.model.current_chat_id -@@ -88,6 +88,16 @@ def update_chat_order(controller: Controller, update: Dict[str, Any]) -> None: - if controller.model.chats.update_chat(chat_id, order=order): - controller.refresh_current_chat(current_chat_id) - -+@update_handler("updateChatPosition") -+def update_chat_position(controller: Controller, update: Dict[str, Any]) -> None: -+ current_chat_id = controller.model.current_chat_id -+ chat_id = update["chat_id"] -+ info = {} -+ info["order"] = update["position"]["order"] -+ if "is_pinned" in update: -+ info["is_pinned"] = update["is_pinned"] -+ if controller.model.chats.update_chat(chat_id, **info): -+ controller.refresh_current_chat(current_chat_id) - - @update_handler("updateChatTitle") - def update_chat_title(controller: Controller, update: Dict[str, Any]) -> None: -@@ -189,12 +199,14 @@ def update_chat_last_message( - # according to documentation it can be null - log.warning("last_message is null: %s", update) - return -- order = update["order"] -+ -+ info = {} -+ info["last_message"] = last_message -+ if len(update["positions"]) > 0: -+ info["order"] = update["positions"][0]["order"] - - current_chat_id = controller.model.current_chat_id -- if controller.model.chats.update_chat( -- chat_id, last_message=last_message, order=order -- ): -+ if controller.model.chats.update_chat(chat_id, **info): - controller.refresh_current_chat(current_chat_id) - - -diff --git a/tg/views.py b/tg/views.py -index d4806e2..64ad1fa 100644 ---- a/tg/views.py -+++ b/tg/views.py -@@ -240,7 +240,7 @@ class ChatView: - msg = chat.get("last_message") - if ( - msg -- and self.model.is_me(msg["sender_user_id"]) -+ and self.model.is_me(msg["sender"].get("user_id")) - and msg["id"] > chat["last_read_outbox_message_id"] - and not self.model.is_me(chat["id"]) - ): -@@ -248,7 +248,7 @@ class ChatView: - flags.append("unseen") - elif ( - msg -- and self.model.is_me(msg["sender_user_id"]) -+ and self.model.is_me(msg["sender"].get("user_id")) - and msg["id"] <= chat["last_read_outbox_message_id"] - ): - flags.append("seen") -@@ -259,7 +259,7 @@ class ChatView: - if self.model.users.is_online(chat["id"]): - flags.append("online") - -- if chat["is_pinned"]: -+ if "is_pinned" in chat and chat["is_pinned"]: - flags.append("pinned") - - if chat["notification_settings"]["mute_for"]: -@@ -363,7 +363,7 @@ class MsgView: - return f"\n | photo: {web['url']}" - name = web["site_name"] - title = web["title"] -- description = web["description"].replace("\n", "") -+ description = web["description"]["text"].replace("\n", "") - url = f"\n | {name}: {title}" - if description: - url += f"\n | {description}" -@@ -584,7 +584,7 @@ def get_last_msg( - if not last_msg: - return None, "<No messages yet>" - return ( -- last_msg["sender_user_id"], -+ last_msg["sender"].get("user_id"), - parse_content(MsgProxy(last_msg), users), - ) - --- -2.30.1 - @@ -1,13 +1,13 @@ # Maintainer: j.r <j.r@jugendhacker.de> _pkgname=tg pkgname=telegram-$_pkgname -pkgver=0.8.0 +pkgver=0.11.0 pkgrel=1 pkgdesc="terminal telegram client that really works" arch=('any') url="https://github.com/paul-nameless/tg" license=('Unlicense') -depends=('python-telegram' 'python3') +depends=('python-telegram=0.14.0' 'python3') makedepends=('python-setuptools') optdepends=( 'libnotify: for notifications, you could also use other programs: see config' @@ -18,15 +18,8 @@ optdepends=( 'fzf: to create groups and secret chats, used for single and multiple user selection' ) conflicts=('telegram-tg-git') -source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz" - "0001-Change-setup.py-to-accept-new-python-telegram-ver.patch") -md5sums=('4456e09339b7070c9f03e6944b400db7' - '7b9a556ce7d2203fbee32442a96d73bc') - -prepare() { - cd "${_pkgname}-${pkgver}" - patch -p1 -i ${srcdir}/0001-Change-setup.py-to-accept-new-python-telegram-ver.patch -} +source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz") +md5sums=('f4a5ee804d02f4ef035fcb138c905aed') build() { cd "$_pkgname-$pkgver" |