From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: jami-bot and org-jami-bot Date: Thu, 28 Dec 2023 13:33:55 -0800 Message-ID: References: <875y0i7e43.fsf@hoowl.se> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36618"; mail-complaints-to="usenet@ciao.gmane.io" To: Hanno Perrey , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 28 22:35:00 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rIy1r-0009H8-Tc for ged-emacs-devel@m.gmane-mx.org; Thu, 28 Dec 2023 22:35:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rIy0w-00039r-HZ; Thu, 28 Dec 2023 16:34:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rIy0v-00039T-20 for emacs-devel@gnu.org; Thu, 28 Dec 2023 16:34:01 -0500 Original-Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rIy0r-0005qq-S2 for emacs-devel@gnu.org; Thu, 28 Dec 2023 16:34:00 -0500 Original-Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-555144cd330so3302417a12.2 for ; Thu, 28 Dec 2023 13:33:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703799236; x=1704404036; darn=gnu.org; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc:subject:date:message-id:reply-to; bh=A0xyUVtmAHBciK0Kh+A28qnroft9SQUlOpx2j/bvo4E=; b=D593f/nA2CMh+slyJvzBai2LGKrZyTEkG1hgiM0gFJcS849syspEz4lMY0WzZgdwNk HeAa0ZSz9badhc2iFfCmpbk1DjE2+CTSaKIhf/0wuaFSDuQpvqi7iHKcW1XeLvrCVgNI 3TY4G/YiNul8kXHPvxYmwWyIwp7484PCo275YnhgyqdSEr0BVuTUctRhkh/G6JbSBhbo 0uLQtUBzx/4IquEm5XWU//8sPuCkqo05VKMUnLhQ9yk0H6x9VRSQ+kW7vnWzz9yOUNxd hkLxev2ZFOEgav5Jvxbfi5rAsPRPxjXK6opsbDoiFVuBGVw7TN/JvrJcjt8GAu2GEHE/ 1igQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703799236; x=1704404036; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=A0xyUVtmAHBciK0Kh+A28qnroft9SQUlOpx2j/bvo4E=; b=YLN8h0C2SMRCJEAtzq+H8bkDR8GiAcQkQJGJYjKebwYCCbBwgknkdxJqKxYSKkygRs Q9g3WoeYEfqfYVrZrRT5+E7ZVCZTMrKUJGbTc2cl6XXkQVjPsi14J2SiHuwgj5GLdOvJ lHdCJyiFq8WG2f5JbErUz2FEDkJEw5INlcb7P9aACtWgDC1WPNAvxPHVrY+jPmmon+w9 fNmuZBfCFOXVO7IqgTk1Wlq53lwWv+3GgNrHKX6cZrzFnTLgnF+J43/IFUyOlXSicoP/ m1U5G6fLfyYqbV1DuuzYnmhmh86wPKNemnvcZDzX62BdFxrt0oLMSgPiLwWNaVsXmYmJ vnFA== X-Gm-Message-State: AOJu0YxHwXaYZAaDXERDRZuPSlmDglRpebgRfO0FhJZMk7B6yi4yWDld v374yqlZSuwWtWgjiy+cNhKWzz2tHyxjZu7MjctC6qyVlH4= X-Google-Smtp-Source: AGHT+IHTGq/tZq74vwiwXS8XaGf0vuw3tsKOcy+fgx1ZCxm6ElWbwO/y09wyYc0cF/EdGjXtTWQBcFv2G4kD9lzo4Uw= X-Received: by 2002:a50:d782:0:b0:54c:4837:a64c with SMTP id w2-20020a50d782000000b0054c4837a64cmr7378785edi.57.1703799235672; Thu, 28 Dec 2023 13:33:55 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 28 Dec 2023 13:33:55 -0800 In-Reply-To: <875y0i7e43.fsf@hoowl.se> Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:314293 Archived-At: Hanno Perrey writes: > I would like to propose two tightly-coupled packages for inclusion into > ELPA: jami-bot and org-jami-bot. > > jami-bot is an extendable chat bot for the distributed, private > messenger Jami. It interacts with the locally-installed Jami daemon via > D-Bus and reacts to both plain text messages and file transfers sent to > local accounts. > > org-jami-bot builds upon jami-bot and extends it with Org mode capture > functionality for text messages and images. It allows to schedule agenda > items at specific dates, compose multi-measure captures and capture > images -- all by sending a message via the GNU Jami messenger. > > I would like to keep maintaining both packages at their current > repositories: > > - https://gitlab.com/hperrey/jami-bot > - https://gitlab.com/hperrey/org-jami-bot > > I have signed the copyright paperwork with the FSF already and changed > the copyright in the respective files for both packages. Sounds great. Since Jami is a GNU project, it's a no-brainer that we should have support for it in a GNU ELPA package. I enjoyed your blog posts about it too, and could easily see myself using something like this myself. In other words, I don't see any reason why it couldn't go in. > As this is the first time I am proposing a package for ELPA, any > guidance on the process and feedback would be highly welcome! Just some stylistic remarks: 1. Add .elpaignore files to both repositories containing, on a line of its own: LICENSE 2. Here are some proposed changes, for your consideration. This makes the package better follow some of our conventions: diff --git a/org-jami-bot.el b/org-jami-bot.el index 9cee94f..6d2f515 100644 --- a/org-jami-bot.el +++ b/org-jami-bot.el @@ -1,7 +1,7 @@ ;;; org-jami-bot.el --- Capture GNU Jami messages as notes and todos in Org mode -*- lexical-binding: t; -*- -;; + ;; Copyright (C) 2023 Free Software Foundation, Inc. -;; + ;; Author: Hanno Perrey ;; Maintainer: Hanno Perrey ;; Created: April 16, 2023 @@ -10,46 +10,46 @@ ;; Keywords: comm, outlines, org-capture, jami ;; Homepage: https://gitlab.com/hperrey/org-jami-bot ;; Package-Requires: ((emacs "28.1") (jami-bot "0.0.1")) -;; + ;; This file is not part of GNU Emacs. ;; -;; This program is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. ;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + ;;; Commentary: ;; ;; `org-jami-bot' builds upon `jami-bot' and extends it with Org mode capture -;; functionality for text messages and images. It allows to schedule agenda +;; functionality for text messages and images. It allows to schedule agenda ;; items at specific dates, compose multi-measure captures and capture images -- ;; all by sending a message via the GNU Jami messenger. ;; ;; `org-jami-bot' provides multi-message capture from within the Jami messenger ;; app -- that is, a capture process that consists of several messages and can -;; include even images and other files. The process is started by sending the +;; include even images and other files. The process is started by sending the ;; command "!start" followed by the title of the capture and finished by sending -;; "!done". Once the multi-message capture session is started, every following -;; message is simply added. This includes images which will be downloaded and -;; stored locally. A reference in the form of a link will be included in the +;; "!done". Once the multi-message capture session is started, every following +;; message is simply added. This includes images which will be downloaded and +;; stored locally. A reference in the form of a link will be included in the ;; notes. ;; ;; Every command consists of an exclamation mark and a single word, for example: ;; "!help" which shows the available commands or "!today" which captures the -;; remainder of the message as a todo entry scheduled today. Everything else is +;; remainder of the message as a todo entry scheduled today. Everything else is ;; treated as a normal message (and captured verbatim). ;; ;; Files sent separately as a single message are captured as links to the -;; locally downloaded file and tagged as =FILE=. In principle, further automatic -;; processing (e.g. OCR) could easily be integrated. Any received file will also +;; locally downloaded file and tagged as =FILE=. In principle, further automatic +;; processing (e.g. OCR) could easily be integrated. Any received file will also ;; be added to the variable =org-stored-links= and can then be easily inserted ;; as link in any Org mode document using =C-c C-l=. ;; @@ -113,8 +113,8 @@ CONVERSATION and ACCOUNT. Further plain text messages processed by `org-jami-bot--capture-plain-messsage' or files received by `org-jami-bot--capture-file' will be added to this capture -buffer. The actual capture needs to happen through a separate -function, e.g. `org-jami-bot--command-function-done'. Return a +buffer. The actual capture needs to happen through a separate +function, e.g. `org-jami-bot--command-function-done'. Return a reply string informing correspondent about how to finish capture by sending '!done'." (let* ((buf (format "*jami-capture-%s-%s*" account conversation)) @@ -203,7 +203,7 @@ CONVERSATION for jami ACCOUNT." (defun org-jami-bot--command-function-today (_account _conversation msg) "Capture body of message as todo entry scheduled today. - Returns a reply string as confirmation. MSG is the full message + Returns a reply string as confirmation. MSG is the full message in CONVERSATION id for ACCOUNT id." (let* ((body (cadr (assoc-string "body" msg))) (lines (string-lines body)) @@ -223,10 +223,10 @@ CONVERSATION for jami ACCOUNT." "Capture body as todo entry and schedule it on the date given after the command. The entry will be scheduled according to the first line of the -MSG body immediately following the command string. The date will +MSG body immediately following the command string. The date will be parsed through `org-read-date' and supports the same -string-to-date conversations. Returns a reply string as -confirmation. ACCOUNT and CONVERSATION are not used." +string-to-date conversations. Returns a reply string as +confirmation. ACCOUNT and CONVERSATION are not used." (let* ((body (cadr (assoc-string "body" msg))) (lines (string-lines body)) (swhen (org-read-date nil nil (car lines))) @@ -245,9 +245,9 @@ confirmation. ACCOUNT and CONVERSATION are not used." (defun org-jami-bot-default-setup () "Set up `org-jami-bot' with default values. - Create a capture template, extend `jami-bot' commands via - `jami-bot-command-function-alist' and add hooks to - `jami-bot'." +Create a capture template, extend `jami-bot' commands via +`jami-bot-command-function-alist' and add hooks to +`jami-bot'." (if (assoc org-jami-bot-capture-key org-capture-templates) (message "Capture template referred to by \"%s\" key already defined!" org-jami-bot-capture-key) diff --git a/jami-bot.el b/jami-bot.el index c453469..32e13f1 100644 --- a/jami-bot.el +++ b/jami-bot.el @@ -1,7 +1,7 @@ ;;; jami-bot.el --- An extendable chat bot for the private messenger GNU Jami -*- lexical-binding: t; -*- -;; + ;; Copyright (C) 2023 Free Software Foundation, Inc. -;; + ;; Author: Hanno Perrey ;; Maintainer: Hanno Perrey ;; Created: April 15, 2023 @@ -10,27 +10,27 @@ ;; Keywords: comm, jami, messenger, chat bot, dbus ;; Homepage: https://gitlab.com/hperrey/jami-bot ;; Package-Requires: ((emacs "27.1")) -;; + ;; This file is not part of GNU Emacs. ;; -;; This program is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. ;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + ;;; Commentary: ;; -;; An extendable chat bot for the distributed, private messenger Jami. It +;; An extendable chat bot for the distributed, private messenger Jami. It ;; interacts with the locally-installed Jami daemon via D-Bus and reacts to -;; both plain text messages and file transfers sent to local accounts. Further +;; both plain text messages and file transfers sent to local accounts. Further ;; processing of either or both can be configured by adding functions to the ;; abnormal hooks, `jami-bot-text-message-functions' and ;; `jami-bot-data-transfer-functions', respectively. @@ -40,7 +40,7 @@ ;; Further commands than the ones included can be configured by mapping them to ;; functions through `jami-bot-command-function-alist'. ;; -;; Set up `jami-bot' by executing `jami-bot-register'. This will set up the +;; Set up `jami-bot' by executing `jami-bot-register'. This will set up the ;; message handler, `jami-bot--messageReceived-handler', to be called on the ;; `messageReceived' D-Bus signal. ;; @@ -51,11 +51,11 @@ (defvar jami-bot-account-user-names nil "List of account user names that `jami-bot' handles messages for. - If set to nil then `jami-bot' will react to any message - send to a local account. The user name is also sometimes - referred to as address in Jami and should be a 40 - character has such as - \"badac18e13ec1a6e1266600e457859afebfb9c46\".") +If set to nil then `jami-bot' will react to any message +send to a local account. The user name is also sometimes +referred to as address in Jami and should be a 40 +character has such as +\"badac18e13ec1a6e1266600e457859afebfb9c46\".") (defvar jami-bot-command-function-alist '(("!ping" . jami-bot--command-function-ping) @@ -63,15 +63,15 @@ "Alist mapping command strings in message body to functions to be executed. Each command needs to start with an exclamation mark '!' and -consist of a single (lowercase) word. The corresponding function needs to accept -the account id, the conversation id and the message alist as +consist of a single (lowercase) word. The corresponding function needs to +accept the account id, the conversation id and the message alist as arguments and return a string (that is sent as reply to the original message).") (defvar jami-bot-text-message-functions nil "A list of functions that will be called when processing a plain text message. Functions must take the ACCOUNT and CONVERSATION ids as well as -the actual MSG as arguments. Their return value will be ignored.") +the actual MSG as arguments. Their return value will be ignored.") (defvar jami-bot-download-path "~/jami/" "Path in which to store files downloaded from conversations. @@ -83,21 +83,21 @@ Will be created if not existing yet.") Functions must take the ACCOUNT and CONVERSATION ids as well as the actual MSG and the local downloaded file name, DLNAME, as -arguments. Their return value will be ignored.") +arguments. Their return value will be ignored.") (defvar jami-bot--jami-local-account-ids nil "List of `jami' local accounts user ids and name pairs. -Caches output of dbus-methods 'getAccountList' and -'getAccountDetails'. For internal use in `jami-bot'.") +Caches output of dbus-methods \"getAccountList\" and +\"getAccountDetails\". For internal use in `jami-bot'.") (defun jami-bot--messageReceived-handler (account conversation msg) "Handle messages from Jami's `messageReceived' D-Bus signal. - ACCOUNT and CONVERSATION are the corresponding ids to which the - MSG belongs to. The latter contains additional fields such as - `author' and `body'. The field `type' is used to identify which - function to call for further processing." +ACCOUNT and CONVERSATION are the corresponding ids to which the +MSG belongs to. The latter contains additional fields such as +`author' and `body'. The field `type' is used to identify which +function to call for further processing." ;; make sure we are not reacting to messages sent from our own local ;; account(s) or accounts we are not to monitor (unless jami-bot--jami-local-account-ids @@ -160,7 +160,7 @@ Caches output of dbus-methods 'getAccountList' and "Ping the Jami daemon and register `jami-bot' handler for receiving messages." (interactive) (or (dbus-ping :session "cx.ring.Ring") - (error "Jami Daemon (jamid) not available through dbus. Please check Jami installation")) + (error "Jami Daemon (jamid) not available through dbus. Please check Jami installation")) (dbus-register-signal :session "cx.ring.Ring" "/cx/ring/Ring/ConfigurationManager" "cx.ring.Ring.ConfigurationManager" @@ -171,7 +171,7 @@ Caches output of dbus-methods 'getAccountList' and "Process plain text messages and parse the message body for commands. ACCOUNT and CONVERSATION are the corresponding ids to which the - message MSG belongs to. Messages containing commands must start + message MSG belongs to. Messages containing commands must start with an exclamation mark (\"!\") followed by the single-word command. Each command is mapped to a function via `jami-bot-command-function-alist' which will be executed when @@ -210,10 +210,10 @@ Caches output of dbus-methods 'getAccountList' and account conversation msg)))) (defun jami-bot--command-function-ping (_account _conversation msg) - "Return the string 'pong!' followed by the message's body. + "Return the string \"pong!\" followed by the message body. -Example for a basic jami bot command handling function. Acts on MSG -received via _ACCOUNT in _CONVERSATION. The latter two are unused." +Example for a basic jami bot command handling function. Acts on MSG +received via _ACCOUNT in _CONVERSATION. The latter two are unused." (let ((body (cadr (assoc-string "body" msg)))) (format "pong! %s" body))) @@ -230,10 +230,10 @@ which are used." (defun jami-bot--process-data-transfer (account conversation msg) "Process data transfer from received messages. - Downloads files to the path given by `jami-bot-download-path' - and calls the abnormal hook `jami-bot-data-transfer-functions' - for further processing. ACCOUNT and CONVERSATION are the - corresponding ids to which the message MSG belongs to." +Downloads files to the path given by `jami-bot-download-path' +and calls the abnormal hook `jami-bot-data-transfer-functions' +for further processing. ACCOUNT and CONVERSATION are the +corresponding ids to which the message MSG belongs to." (let* ((id (cadr (assoc-string "id" msg))) (fileid (cadr (assoc-string "fileId" msg))) (filename (cadr (assoc-string "displayName" msg))) @@ -254,7 +254,7 @@ which are used." ,method ,@(when args args)))) (defun jami-bot-send-message (account conversation text &optional reply) - "Add TEXT to CONVERSATION via ACCOUNT. REPLY specifies a message id." + "Add TEXT to CONVERSATION via ACCOUNT. REPLY specifies a message id." (jami-bot--dbus-cfgmgr-call-method "sendMessage" account conversation