meanwhile  1.1.0
Data Structures | Defines | Typedefs | Enumerations | Functions
mw_srvc_dir.h File Reference
#include <glib.h>
#include <glib/glist.h>

Go to the source code of this file.

Data Structures

struct  mwDirectoryHandler
 handles asynchronous events for a directory service instance More...
struct  mwDirectoryMember

Defines

#define _MW_SERV_DIR_H
#define DIR_SEARCH_ERROR   0x00000000
 return value of directory searches that fail
#define MW_DIRECTORY_IS_NEW(dir)   MW_DIRECTORY_IS_STATE((dir), mwDirectory_NEW)
#define MW_DIRECTORY_IS_OPEN(dir)   MW_DIRECTORY_IS_STATE((dir), mwDirectory_OPEN)
#define MW_DIRECTORY_IS_PENDING(dir)   MW_DIRECTORY_IS_STATE((dir), mwDirectory_PENDING)
#define MW_DIRECTORY_IS_STATE(dir, state)   (mwDirectory_getState(dir) == (state))
#define SERVICE_DIRECTORY   0x0000001a

Typedefs

typedef void(* mwSearchHandler )(struct mwDirectory *dir, guint32 code, guint32 offset, GList *members)
 Appropriate function signature for handling directory search results.

Enumerations

enum  mwDirectoryMemberType {
  mwDirectoryMember_USER = 0x0000,
  mwDirectoryMember_GROUP = 0x0001
}
enum  mwDirectoryState {
  mwDirectory_NEW,
  mwDirectory_PENDING,
  mwDirectory_OPEN,
  mwDirectory_ERROR,
  mwDirectory_UNKNOWN
}

Functions

GList * mwAddressBook_getDirectories (struct mwAddressBook *book)
 list of directories associated with address book.
const char * mwAddressBook_getName (struct mwAddressBook *book)
 the name of the address book
int mwDirectory_destroy (struct mwDirectory *dir)
 close and free the directory, and unassociate it with its owning address book and service
struct mwAddressBookmwDirectory_getAddressBook (struct mwDirectory *dir)
 reference owning address book
gpointer mwDirectory_getClientData (struct mwDirectory *dir)
 reference associated client data
struct mwServiceDirectorymwDirectory_getService (struct mwDirectory *dir)
 reference owning service
enum mwDirectoryState mwDirectory_getState (struct mwDirectory *dir)
struct mwDirectorymwDirectory_new (struct mwAddressBook *book)
 allocate a new directory based off the given address book
int mwDirectory_next (struct mwDirectory *dir)
 continue a search into its next results
int mwDirectory_open (struct mwDirectory *dir, mwSearchHandler cb)
 initialize a directory.
int mwDirectory_previous (struct mwDirectory *dir)
 continue a search into its previous results
void mwDirectory_removeClientData (struct mwDirectory *dir)
 remove and cleanup user data
int mwDirectory_search (struct mwDirectory *dir, const char *query)
 initiate a search on an open directory
void mwDirectory_setClientData (struct mwDirectory *dir, gpointer data, GDestroyNotify clear)
 set client data.
GList * mwServiceDirectory_getAddressBooks (struct mwServiceDirectory *srvc)
 most recent list of address books available in service
GList * mwServiceDirectory_getDirectories (struct mwServiceDirectory *srvc)
 list of directories in the service
struct mwDirectoryHandlermwServiceDirectory_getHandler (struct mwServiceDirectory *srvc)
 the handler associated with the service at its creation
struct mwServiceDirectorymwServiceDirectory_new (struct mwSession *session, struct mwDirectoryHandler *handler)
 Allocate a new directory service instance for use with session.
int mwServiceDirectory_refreshAddressBooks (struct mwServiceDirectory *srvc)
 submit a request to obtain an updated list of address books from service

Define Documentation

#define _MW_SERV_DIR_H
#define DIR_SEARCH_ERROR   0x00000000

return value of directory searches that fail

#define MW_DIRECTORY_IS_STATE (   dir,
  state 
)    (mwDirectory_getState(dir) == (state))
#define SERVICE_DIRECTORY   0x0000001a

Typedef Documentation

typedef void(* mwSearchHandler)(struct mwDirectory *dir, guint32 code, guint32 offset, GList *members)

Appropriate function signature for handling directory search results.


Enumeration Type Documentation

Enumerator:
mwDirectoryMember_USER 
mwDirectoryMember_GROUP 
Enumerator:
mwDirectory_NEW 

directory is created, but not open

mwDirectory_PENDING 

directory has in the process of opening

mwDirectory_OPEN 

directory is open

mwDirectory_ERROR 

error opening or using directory

mwDirectory_UNKNOWN 

error determining directory state


Function Documentation

GList* mwAddressBook_getDirectories ( struct mwAddressBook book)

list of directories associated with address book.

Note that the returned GList will need to be free'd after use

const char* mwAddressBook_getName ( struct mwAddressBook book)

the name of the address book

int mwDirectory_destroy ( struct mwDirectory dir)

close and free the directory, and unassociate it with its owning address book and service

struct mwAddressBook* mwDirectory_getAddressBook ( struct mwDirectory dir) [read]

reference owning address book

gpointer mwDirectory_getClientData ( struct mwDirectory dir)

reference associated client data

struct mwServiceDirectory* mwDirectory_getService ( struct mwDirectory dir) [read]

reference owning service

struct mwDirectory* mwDirectory_new ( struct mwAddressBook book) [read]

allocate a new directory based off the given address book

int mwDirectory_next ( struct mwDirectory dir)

continue a search into its next results

int mwDirectory_open ( struct mwDirectory dir,
mwSearchHandler  cb 
)

initialize a directory.

int mwDirectory_previous ( struct mwDirectory dir)

continue a search into its previous results

void mwDirectory_removeClientData ( struct mwDirectory dir)

remove and cleanup user data

int mwDirectory_search ( struct mwDirectory dir,
const char *  query 
)

initiate a search on an open directory

void mwDirectory_setClientData ( struct mwDirectory dir,
gpointer  data,
GDestroyNotify  clear 
)

set client data.

If there is an existing clear function, it will not be called

most recent list of address books available in service

list of directories in the service

the handler associated with the service at its creation

struct mwServiceDirectory* mwServiceDirectory_new ( struct mwSession session,
struct mwDirectoryHandler handler 
) [read]

Allocate a new directory service instance for use with session.

submit a request to obtain an updated list of address books from service