anchor.diff:  -module(directory).
  --export([lookupphone/1, lookupmail/1]).
  +-export([lookupphone/1, lookupmail/1, ldapmailsearch/2]).
   
   lookupphone("9532") ->
       "Magnus Ahltorp";
  
positive.code: lookupphone(Phone) ->
      "Okänd".
  
  ldapsearch(Mail) ->
      {ok, Handle} = eldap:open(["ldap.kth.se"], []),
      ok = eldap:simple_bind(Handle, "dc=kth, dc=se", ""),
      Filter = eldap:equalityMatch("mail", Mail),
      {ok, Result} = eldap:search(Handle, [{base, "dc=kth, dc=se"},
  					 {filter, Filter},
  					 {attributes,["uid"]}]),
      eldap:close(Handle),
      {eldap_search_result, List, _} = Result,
      case List of
  	[] ->
  	    none;
  	[{eldap_entry, _, Attributes} | _] ->
  	    {value, {"uid", [Uid | _]}} = lists:keysearch("uid", 1, Attributes),
  	    Uid
      end.
  
  do_recv(Sock, Text) ->
  
negative.code:     end.
  
  lookupmail(Mail) ->
      case ldapmailsearch(Mail ++ "@kth.se", "uid") of
  	none ->
  	    lookupkthid(Mail);
  	KTHid ->
  