Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsIAbLDAPAutoCompFormatter Interface Reference

An interface for formatter LDAP messages to be used as nsAutoCompleteItems for use in RFC 2822 message headers. More...

import "nsIAbLDAPAutoCompFormatter.idl";

Inheritance diagram for nsIAbLDAPAutoCompFormatter:
Inheritance graph
[legend]
Collaboration diagram for nsIAbLDAPAutoCompFormatter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

nsIAutoCompleteItem format (in nsILDAPMessage aMessage)
 Returns an nsIAutoCompleteItem generated from the data in the given nsILDAPMessage.
void getAttributes (out unsigned long aCount,[retval, array, size_is(aCount)] out string aAttrs)
 Gets a list of all the LDAP attributes that should be requested from the LDAP server when a lookup is done.
nsIAutoCompleteItem formatException (in long aState, in nsresult aErrorCode)
 This method formats an error condition into an nsIAutoCompleteItem for display to the user.

Public Attributes

attribute AString nameFormat
 All three Format attributes are templates, which work as follows:
attribute AString addressFormat
attribute AString commentFormat
const long STATE_UNBOUND = 0
 Possible states that can be passed in aState to formatException.
const long STATE_INITIALIZING = 1
const long STATE_BINDING = 2
const long STATE_BOUND = 3
const long STATE_SEARCHING = 4

Detailed Description

An interface for formatter LDAP messages to be used as nsAutoCompleteItems for use in RFC 2822 message headers.

Definition at line 47 of file nsIAbLDAPAutoCompFormatter.idl.


Member Function Documentation

Returns an nsIAutoCompleteItem generated from the data in the given nsILDAPMessage.

Parameters:
aMessagemessage to be formatted
Returns:
resulting nsIAutoCompleteItem

This method formats an error condition into an nsIAutoCompleteItem for display to the user.

Specifically, the state that the session was in when the error occured (aState) is formatted into a general error message which is put in the value attribute of the item, and the specific error (aErrorCode) is formatted into another message which is put in an nsISupportsString in the param attribute of the item.

Parameters:
aStatestate of autocomplete session when error occurred
aErrorCodespecific error encountered
Returns:
newly generated item
void nsILDAPAutoCompFormatter::getAttributes ( out unsigned long  aCount,
[retval, array, size_is(aCount)] out string  aAttrs 
) [inherited]

Gets a list of all the LDAP attributes that should be requested from the LDAP server when a lookup is done.

This avoids wasting server time, bandwidth, and client time processing unused attributes.

Note that this is only required to be called by the nsILDAPAutoCompleteSession implementation when the nsILDAPAutoCompleteSession::formatter IDL attribute is set. . So if for some reason, the LDAP attributes to be returned by searches has to change (eg because the user changed a preference), the nsILDAPAutoCompleteSession::formatter IDL attribute should be re-set to the same object to force a new getAttributes() call.

Parameters:
aCountnumber of attributes in the array
aAttrslist of LDAP attributes to request

Member Data Documentation

Definition at line 85 of file nsIAbLDAPAutoCompFormatter.idl.

Definition at line 86 of file nsIAbLDAPAutoCompFormatter.idl.

All three Format attributes are templates, which work as follows:

Required LDAP attributes are delimited by curly braces, and optional LDAP attributes are determined by brackets. Backslash escapes any character, including itself. Someday perhaps we'll rev this interface and change these to a more flexible format; perhaps something regexp based.

If any of these are unset, components implementing this interface are free to choose reasonable defaults. As an example, the "@mozilla.org/ldap-autocomplete-formatter;1?type=addrbook" implementation currently happens to use the following default strings:

nameFormat: "[cn]" addressFormat: "{mail}" commentFormat: ""

and generates autocomplete items like this:

value: John Doe john..nosp@m.doe@.nosp@m.foo.o.nosp@m.rg comment: Foo Organization

Note that nsILDAPAutoCompFormatter::getAttributes() is only required to be called by the nsILDAPAutoCompleteSession implementation when the nsILDAPAutoCompleteSession::formatter IDL attribute is set. So if for some reason the format attributes exposed through this interface get changed (eg a user changes their prefs), it is the changing code's responsibly to re-set the nsILDAPAutoCompleteSession::formatter IDL attribute to the same object to force a new getAttributes() call.

Definition at line 84 of file nsIAbLDAPAutoCompFormatter.idl.

Definition at line 104 of file nsILDAPAutoCompFormatter.idl.

Definition at line 105 of file nsILDAPAutoCompFormatter.idl.

Definition at line 103 of file nsILDAPAutoCompFormatter.idl.

Definition at line 106 of file nsILDAPAutoCompFormatter.idl.

Possible states that can be passed in aState to formatException.

Definition at line 102 of file nsILDAPAutoCompFormatter.idl.


The documentation for this interface was generated from the following file: