Re: Online Address book

2008-02-14 Thread Matt Richards
On Tue, Feb 12, 2008 at 01:43:25AM +0100, Nathan Huesken wrote:
> Hi,
> 
> I am using mutt from different computers (like my laptop and the desktop PC 
> at home) and I am wondering if there is some way to always keep my address 
> book synchronized between the two computers.
> The coolest solution would be, if I could install some sort of database on my 
> vServer and make mutt query it everytime I need the address book (and also 
> add new addresses to it).
> 
> Is there some sort if solution for this kind of think?
> 
> Thanks!
> Nathan


Hello, I currently use ldap for an address book with mutt, 

I thought I would send you the scripts I use todo with what you will.

I have added the following lines to my .muttrc ...

## ldap search
set query_command="~/mutt-ldap-search.pl '%s'"

## adding addresses to ldap
macro index,pager a '/home/matt/bin/add2ldap'

Allowing me to search and also add addresses by pressing a

The mutt search perl script I found online somewhere, I did make a change to it 
allowing me to have entries without surnames, I just put surnames as '.' in 
this case.

and the add2ldap is a bash script I just chucked together, there prob a better 
way of writing it but it works :)

hth,

Matt.

-- 
Matt Richards
#!/bin/bash

echo Adding a new address to the LDAP database ...

if [ -z $1 ]; then
 echo I need an email address:
 read email
else
 email=$1
fi

if [ -z $email ]; then
 echo I really do need an email address!
 exit
fi

if [ -z $2 ]; then
 echo I need a First Name:
 read fname
else
 fname=$2
fi

if [ -z $3 ]; then
 echo I need a Second Name:
 read sname

 if [ -z $sname ]; then
  echo Using . for second name
  sname=.
 fi

else
 sname=$3
fi


echo "dn: mail=$email,ou=Contacts,o=mattstone
cn: $fname $sname
sn: $sname
givenName: $fname
mail: $email
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: organizationalPerson" | ldapadd -h 192.168.4.6 -D 
"uid=matt,ou=People,o=mattstone" -x -w "--PASSWD--"

#!/usr/bin/perl

# use strict;
use Net::LDAP;

use constant HOST => '192.168.4.6';
use constant BASE => 'ou=Contacts, o=mattstone';
use constant VERSION => 3;
use constant SCOPE => 'sub';

my $name;
my @attributes = qw( dn givenName sn mail );
{
print "Searching directory... ";
$name = shift || die;
my $filter = "(|(sn=$name*)(givenName=$name*))";
my $ldap = Net::LDAP->new( HOST, onerror => 'die' )
|| die "Cannot connect: $@";

#$ldap->bind(version => VERSION) or die "Cannot bind: $@";
 $ldap->bind( "uid=matt,ou=People,o=mattstone", password => "--PASSWD--" ) 
or die "Cannot bind: $@";

my $result = $ldap->search( base => BASE,
scope => SCOPE,
attrs => [EMAIL PROTECTED],
filter => $filter
);

my @entries = $result->entries;

$ldap->unbind();

print scalar @entries, " entries found.\n";

foreach my $entry ( @entries ) {
my @emailAddr = $entry->get_value('mail');
foreach my $addr (@emailAddr) {
print $addr , "\t";

if ($entry->get_value('sn') eq '.') {
 print $entry->get_value('givenName'), "\n";
} else {
 print $entry->get_value('givenName'), " ";
 print $entry->get_value('sn'), "\n";
}

}
}
}



signature.asc
Description: Digital signature


Re: Online Address book

2008-02-12 Thread Joseph
On 02/12/08, [EMAIL PROTECTED] wrote:
> Hi,
> 
> Thanks for your reply. ldap is running on my vServer. But I am not sure how 
> to setup lbdb to use ldap and mutt to use lbdb.
> Any advise where to look?
> 
> Thanks!
> Nathan
> 
> On Mon, Feb 11, 2008 at 09:04:00PM -0500, Raffi Khatchadourian wrote:
> > On Tue 12.Feb'08 at  1:43:25 +0100, Nathan Huesken wrote:
> >> I am using mutt from different computers (like my laptop and the desktop 
> >> PC at home) and I am wondering if there is some way to always keep my 
> >> address book synchronized between the two computers.
> >> The coolest solution would be, if I could install some sort of database on 
> >> my vServer and make mutt query it everytime I need the address book (and 
> >> also add new addresses to it).
> >>
> >> Is there some sort if solution for this kind of think?
> >
> > Using LDAP and lbdb kinda solves this problem.


Another solution is to setup svn on a server somewhere and then use that
to keep your addresses, muttrc files, and other home data you want to be
shared everywhere. I also keep my icewm files, alias setups and so on
there.

Make an alias that does svn ci of your files before starting mutt.


-- 
 
|respectfull, Joseph |
 


signature.asc
Description: Digital signature


Re: Online Address book

2008-02-12 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tuesday, February 12 at 03:03 PM, quoth [EMAIL PROTECTED]:
>Hi,
>
>Thanks for your reply. ldap is running on my vServer. But I am not sure how to 
>setup lbdb to use ldap and mutt to use lbdb.
>Any advise where to look?

http://www.spinnaker.de/lbdb/
and
http://www.spinnaker.de/lbdb/mutt_ldap_query.html

~Kyle
- -- 
This is my simple religion. There is no need for temples; no need for 
complicated philosophy. Our own brain, our own heart is our temple; 
the philosophy is kindness.
  -- Dalai Lama
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iD8DBQFHscYeBkIOoMqOI14RAvyGAKCyvSqirqlnrX2HmTBkqRiB29jIjQCg1T6j
V7dVRNi8vxtEXMoWFC8kQEQ=
=KCqx
-END PGP SIGNATURE-


Re: Online Address book

2008-02-12 Thread mutt
Hi,

Thanks for your reply. ldap is running on my vServer. But I am not sure how to 
setup lbdb to use ldap and mutt to use lbdb.
Any advise where to look?

Thanks!
Nathan

On Mon, Feb 11, 2008 at 09:04:00PM -0500, Raffi Khatchadourian wrote:
> On Tue 12.Feb'08 at  1:43:25 +0100, Nathan Huesken wrote:
>> I am using mutt from different computers (like my laptop and the desktop 
>> PC at home) and I am wondering if there is some way to always keep my 
>> address book synchronized between the two computers.
>> The coolest solution would be, if I could install some sort of database on 
>> my vServer and make mutt query it everytime I need the address book (and 
>> also add new addresses to it).
>>
>> Is there some sort if solution for this kind of think?
>
> Using LDAP and lbdb kinda solves this problem.


Re: Online Address book

2008-02-11 Thread Raffi Khatchadourian

On Tue 12.Feb'08 at  1:43:25 +0100, Nathan Huesken wrote:

I am using mutt from different computers (like my laptop and the desktop PC at 
home) and I am wondering if there is some way to always keep my address book 
synchronized between the two computers.
The coolest solution would be, if I could install some sort of database on my 
vServer and make mutt query it everytime I need the address book (and also add 
new addresses to it).

Is there some sort if solution for this kind of think?


Using LDAP and lbdb kinda solves this problem.