Subject: [sup-talk] Problem with lbdb and extra contacts hook

From: [email-masked] (Ali Polatel)
Date: Mon, 21 Sep 2009 00:16:34 +0300

Hello,
I've just started using sup and I'm really loving it.
Thanks for the great software.

I have a problem with extra-contact-addresses hook and lbdb.
Using the hook in the wiki:
contacts = []
`lbdbq |awk -F"\t" '{print $2 , "<"$1">"}'`.each { |c| contacts.push(c) }
return contacts

I get error running hook and here's the message that appears in the log:
[Sun Sep 20 23:50:17 +0300 2009] hook: error running hook: unexpected return
[Sun Sep 20 23:50:17 +0300 2009] hook:
/home/alip/.sup/hooks/extra-contact-addresses.rb:7:in `__run'
/home/alip/src/sup/lib/sup/hook.rb:42:in `__run'
/home/alip/src/sup/lib/sup/hook.rb:82:in `run'
/home/alip/src/sup/lib/sup/util.rb:520:in `send'
/home/alip/src/sup/lib/sup/util.rb:520:in `method_missing'
/home/alip/src/sup/lib/sup/buffer.rb:540:in `ask_for_contacts'
/home/alip/src/sup/lib/sup/util.rb:520:in `send'
/home/alip/src/sup/lib/sup/util.rb:520:in `method_missing'
/home/alip/src/sup/lib/sup/modes/compose-mode.rb:24:in `spawn_nicely'
/home/alip/src/sup/bin/sup:282

This is with current master 68bf6a277c5fdefb3b9d6a4b5d4dfbce3f9f9ccf

-- 
Regards,
Ali Polatel

---

From: [email-masked] (Ali Polatel)
Date: Mon, 21 Sep 2009 02:11:04 +0300

> `lbdbq |awk -F"\t" '{print $2 , "<"$1">"}'`.each { |c| contacts.push(c) }

Answering myself, removing return from the last line works as expected!
I'll see if I can edit the wiki.

-- 
Regards,
Ali Polatel

---

From: [email-masked] (William Morgan)
Date: Sat, 26 Sep 2009 06:48:04 -0700

Reformatted excerpts from Ali Polatel's message of 2009-09-20:
> Answering myself, removing return from the last line works as
> expected!  I'll see if I can edit the wiki.

Yep, that was the problem. Hooks shouldn't call return. Nice work. :)
-- 
William <wmorgan-sup at masanjin.net>