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.112.182.8 with SMTP id ea8mr391304lbc.11.1411320004864; Sun, 21 Sep 2014 10:20:04 -0700 (PDT) X-BeenThere: supmua@googlegroups.com Received: by 10.180.103.8 with SMTP id fs8ls323153wib.48.canary; Sun, 21 Sep 2014 10:20:04 -0700 (PDT) X-Received: by 10.194.205.138 with SMTP id lg10mr24439wjc.5.1411320004580; Sun, 21 Sep 2014 10:20:04 -0700 (PDT) Return-Path: Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by gmr-mx.google.com with ESMTPS id fa3si1136293lbc.0.2014.09.21.10.20.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 21 Sep 2014 10:20:04 -0700 (PDT) Received-SPF: none (google.com: eg@gaute.vetsj.com does not designate permitted sender hosts) client-ip=209.85.217.179; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: eg@gaute.vetsj.com does not designate permitted sender hosts) smtp.mail=eg@gaute.vetsj.com Received: by mail-lb0-f179.google.com with SMTP id 10so4961953lbg.38 for ; Sun, 21 Sep 2014 10:20:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:references:in-reply-to :user-agent:message-id:mime-version:content-type :content-transfer-encoding; bh=RvrVsnVpFJRrFkWVo81DxY8FfhlZDzLyumZt6NbeWqI=; b=Og1H7dclXnh8T/MoIiWmH8fh8UOm65SuCXQkaF+2YkwLNWfKd78F4k0VqEmoD0PhBL rte6rd1J4+lJEgFi77G134saI0SdAgDlatHDQBJ8C/cDCN7oV+mbH3hpaNFXT30f+spf 3+asuaLNTTt0AIPAGRnPFa9Sikmrwr2uRcjq09DcGEM/8Lq6rRqni+AUy2AC2Qd2ocm4 +AuiZj2kSPhGXnXia9GMqPZJGzIeSrqZjUfsi9MDWpoi2i8FvFLuxYm6RpumoaDum2th VEeLaDHRaw16qCkzu+cSQNZq2Std8vXuy1uimj2gnCLSxVy9x+e15wof2yVJNCy3VZKD CR2Q== X-Gm-Message-State: ALoCoQks0H8XwK9+svnuZ+DuAQVIRDzvuUk5aaH+OE1MUWUW2zkOl06o4gUiUei4j4LuJGuqdzAe X-Received: by 10.112.34.239 with SMTP id c15mr2936550lbj.64.1411320004264; Sun, 21 Sep 2014 10:20:04 -0700 (PDT) Return-Path: Received: from localhost (cD572BF51.dhcp.as2116.net. [81.191.114.213]) by mx.google.com with ESMTPSA id r6sm2874292lbp.29.2014.09.21.10.20.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Sep 2014 10:20:02 -0700 (PDT) Date: Sun, 21 Sep 2014 17:20:06 +0000 From: Gaute Hope Subject: Re: [sup] Re: how to write interactive hook To: supmua@googlegroups.com References: <1410717805-sup-9254@ruthard-lappi> <1411071274-sup-3080@ruthard-lappi> <1411074468-astroid-3-ptv2hfgu1x-1239@strange> <1411151595-sup-2926@ruthard-lappi> In-Reply-To: <1411151595-sup-2926@ruthard-lappi> User-Agent: astroid/vb457ef13 (https://github.com/gauteh/astroid) Message-Id: <1411319662-astroid-1-fmtkb2haww-21321@strange> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Excerpts from Ruthard Baudach's message of September 19, 2014 20:41: >>=3D=3D Ausz=C3=BCge aus der Nachricht von Gaute Hope vom 2014-09-18 23:1= 0: >> 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 >> >=20 >> > 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 answ= er is >> > attached to compose-mode text >> > 5) after initializing sendmail by hitting y >>=20 >> 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. >=20 > For sure. >=20 > At the moment my drafted solution is: >=20 > ----------->%-------------------- > # signature.rb -- generate signature >=20 > 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 >=20 > $signature =3D nil >=20 > IO.popen(account.sendmail, "w:UTF-8") { |p| p.puts message } > if $? > return true > else > return false > end > ----------->%-------------------- >=20 > 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! >=20 > I'm afraid I have to tackle sup core code to get this working. I'll > report back if I get it to work, Setting up new hooks is not too complicated, have a look at some of the existing. Another option is to pass the message id (if it is persistent) to the signature hook, then when the message id changes you reset the hook state. I'm a bit reluctant to add new hooks for very seldomly used purposes, but the ones you describe above might be worth it. Cheers, Gaute =