Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Problem with lbdb and extra contacts hook
@ 2009-09-20 21:16 Ali Polatel
  2009-09-20 23:11 ` Ali Polatel
  0 siblings, 1 reply; 5+ messages in thread
From: Ali Polatel @ 2009-09-20 21:16 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [sup-talk] Problem with lbdb and extra contacts hook
  2009-09-20 21:16 [sup-talk] Problem with lbdb and extra contacts hook Ali Polatel
@ 2009-09-20 23:11 ` Ali Polatel
  2009-09-26 13:48   ` William Morgan
  2010-03-11 21:09   ` John Bent
  0 siblings, 2 replies; 5+ messages in thread
From: Ali Polatel @ 2009-09-20 23:11 UTC (permalink / raw)


Ali Polatel yazm??:
> 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

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

-- 
Regards,
Ali Polatel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [sup-talk] Problem with lbdb and extra contacts hook
  2009-09-20 23:11 ` Ali Polatel
@ 2009-09-26 13:48   ` William Morgan
  2010-03-11 21:09   ` John Bent
  1 sibling, 0 replies; 5+ messages in thread
From: William Morgan @ 2009-09-26 13:48 UTC (permalink / raw)


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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sup-talk] Problem with lbdb and extra contacts hook
  2009-09-20 23:11 ` Ali Polatel
  2009-09-26 13:48   ` William Morgan
@ 2010-03-11 21:09   ` John Bent
  2010-03-12  9:16     ` Gaute Hope
  1 sibling, 1 reply; 5+ messages in thread
From: John Bent @ 2010-03-11 21:09 UTC (permalink / raw)
  To: Ali Polatel; +Cc: sup-talk

Excerpts from Ali Polatel's message of Sun Sep 20 17:11:04 -0600 2009:
> Ali Polatel yazmış:
> > 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
> 
> Answering myself, removing return from the last line works as expected!
> I'll see if I can edit the wiki.
> 
By the way, I recently used this hook as well and found it really slow
so I rewrote it to parse the lbdb by hand instead of calling out to
lbdb.  For me, it went from 1.5s to 0.03s.  I edited the wiki as well.
Here's the hook:

file = File.open( ENV['HOME'] + "/.lbdb/m_inmail.list", "r" )
contacts = []
while file.gets
    email,name = split("\t")
    contacts << "#{name} <#{email}>"
end
file.close
contacts

John
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sup-talk] Problem with lbdb and extra contacts hook
  2010-03-11 21:09   ` John Bent
@ 2010-03-12  9:16     ` Gaute Hope
  0 siblings, 0 replies; 5+ messages in thread
From: Gaute Hope @ 2010-03-12  9:16 UTC (permalink / raw)
  To: sup-talk

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

Excerpts from John Bent's message of 2010-03-11 22:09:04 +0100:
> Excerpts from Ali Polatel's message of Sun Sep 20 17:11:04 -0600 2009:
> > Ali Polatel yazmış:
> > > 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
> >
> > Answering myself, removing return from the last line works as expected!
> > I'll see if I can edit the wiki.
> >
> By the way, I recently used this hook as well and found it really slow
> so I rewrote it to parse the lbdb by hand instead of calling out to
> lbdb.  For me, it went from 1.5s to 0.03s.  I edited the wiki as well.
> Here's the hook:
>
> file = File.open( ENV['HOME'] + "/.lbdb/m_inmail.list", "r" )
> contacts = []
> while file.gets
>     email,name = split("\t")
>     contacts << "#{name} <#{email}>"
> end
> file.close
> contacts

This doesn't do the same thou as far as I can see, your hook only uses
the addresses returned by the module using m_inmail.list; the former one
uses all configured modules.

- gaute

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-12  9:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-20 21:16 [sup-talk] Problem with lbdb and extra contacts hook Ali Polatel
2009-09-20 23:11 ` Ali Polatel
2009-09-26 13:48   ` William Morgan
2010-03-11 21:09   ` John Bent
2010-03-12  9:16     ` Gaute Hope

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox