From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 118255255552 X-Google-Groups: supmua X-Google-Thread: 3030fda1bf,de37ab03d5293e7 X-Google-Attributes: gid3030fda1bf,domainid0,public,googlegroup X-Google-NewGroupId: yes X-Received: by 10.180.183.165 with SMTP id en5mr1270678wic.1.1411314229508; Sun, 21 Sep 2014 08:43:49 -0700 (PDT) X-BeenThere: supmua@googlegroups.com Received: by 10.180.82.200 with SMTP id k8ls316687wiy.46.gmail; Sun, 21 Sep 2014 08:43:49 -0700 (PDT) X-Received: by 10.180.160.169 with SMTP id xl9mr1269319wib.7.1411314229121; Sun, 21 Sep 2014 08:43:49 -0700 (PDT) Return-Path: Received: from mout.web.de (mout.web.de. [212.227.15.3]) by gmr-mx.google.com with ESMTPS id us10si777946lbc.1.2014.09.21.08.43.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Sep 2014 08:43:49 -0700 (PDT) Received-SPF: pass (google.com: domain of ruthard.baudach@web.de designates 212.227.15.3 as permitted sender) client-ip=212.227.15.3; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ruthard.baudach@web.de designates 212.227.15.3 as permitted sender) smtp.mail=ruthard.baudach@web.de Received: from localhost ([94.217.197.109]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0McFcd-1Xlt8l1P3n-00JZKa for ; Sun, 21 Sep 2014 17:43:48 +0200 From: Ruthard Baudach To: supmua Subject: Re: [sup] Re: how to write interactive hook In-reply-to: <1411074468-astroid-3-ptv2hfgu1x-1239@strange> References: <1410717805-sup-9254@ruthard-lappi> <1411071274-sup-3080@ruthard-lappi> <1411074468-astroid-3-ptv2hfgu1x-1239@strange> Date: Fri, 19 Sep 2014 20:41:51 +0200 Message-Id: <1411151595-sup-2926@ruthard-lappi> User-Agent: Sup/0.19.0 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; boundary="=-1411152122-92094-1307-6726-1-=" X-Provags-ID: V03:K0:uXuuoTkCj3oWZ2TFtEu1VqNgXdM3ctKPt8vkp6LSlzNPS9Ut5SW WbHVJWMGTDY6bAuuFksC880mV/Wm2/S2MMv7sKubpARd3+jn8Z3GEM18O2qZmqKrZ5jfkvS 0JGQTWSD3j9sjDXMs8n7/gFRE4VngY+R06UhY9esi2AjXOmw5yLUKYVz82HGD6PplXg0L7a Fh4U7796uFex2+TiGE0KQ== X-UI-Out-Filterresults: notjunk:1; --=-1411152122-92094-1307-6726-1-= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable >=3D=3D Ausz=C3=BCge aus der Nachricht von Gaute Hope vom 2014-09-18 23:= 10: > Excerpts from Ruthard Baudach's message of September 18, 2014 22:15: > > Works, but the hook seems to be called =E2=80=93 or at least > > ask_many_with_completions asks when > > = > > 1) sup enters compose mode > > 2) sup calls the external editor > > 3)4) two times when sup regains control =E2=80=93 only the second ans= wer is > > attached to compose-mode text > > 5) after initializing sendmail by hitting y > = > It is probably called every time the message needs to be generated. If > you could figure out a way to save the state for the message then you > could just return the previously selected one on the subsequent calls. For sure. At the moment my drafted solution is: ----------->%-------------------- # signature.rb -- generate signature unless $signature $signature =3D BufferManager.ask_many_with_completions :sign, "Choose= signature: ", ["One","Two","Three"] end 'Signature: ' + $signature ----------->%-------------------- # sendemail.rb =E2=80=93 send mail $signature =3D nil IO.popen(account.sendmail, "w:UTF-8") { |p| p.puts message } if $? return true else return false end ----------->%-------------------- Now I just needed a discard-message and a safe-draft hook to set the signature to nil in these cases, and everything was fine! I'm afraid I have to tackle sup core code to get this working. I'll report back if I get it to work, Happy supping, Ruthard -- = Signature: One --=-1411152122-92094-1307-6726-1-= Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJUHHj6AAoJEA852hysWsbCv/YH/jIcaIZB8/3TZC3399Ly7LHz wpzlNEhtBfX2vHURIhsvLQDkfNOS3zGXy5f8VYCrbVz3ISOBNO5aKBV+Jr3oPF3r GCRGmrgMDss2If82nZKFzqW497U693H2I1AlMYsARv1Mf6rlMFoQQXJVwP9nLx8C 1Z4XJJGYDsrkLoXajyPKYouGXZPfnJMrUSXaSl1CE9xSq2Ieg3UKv/duTukKPF/k UKwOdzvbeCj+j55o87ugOKXGNBFDEC7pD2jxUHDqiKm/0J2sRBeB8s9/tg70HbJG iC0xcKN6Dkc8nK3P3HTRyEogxWdlNNPnGZ5qG3Ie6EmbrhPd9qGB/WbI/2dI/34= =bape -----END PGP SIGNATURE----- --=-1411152122-92094-1307-6726-1-=--