mw_srvc_dir.h
Go to the documentation of this file.
/*
Meanwhile - Unofficial Lotus Sametime Community Client Library
Copyright (C) 2004 Christopher (siege) O'Brien
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _MW_SRVC_DIR_H
#define _MW_SRVC_DIR_H
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif
struct mwSession;
#define SERVICE_DIRECTORY 0x0000001a
struct mwServiceDirectory;
struct mwAddressBook;
struct mwDirectory;
enum mwDirectoryState {
mwDirectory_NEW,
mwDirectory_PENDING,
mwDirectory_OPEN,
mwDirectory_ERROR,
mwDirectory_UNKNOWN,
};
#define DIR_SEARCH_ERROR 0x00000000
#define MW_DIRECTORY_IS_STATE(dir, state) \
(mwDirectory_getState(dir) == (state))
#define MW_DIRECTORY_IS_NEW(dir) \
MW_DIRECTORY_IS_STATE((dir), mwDirectory_NEW)
#define MW_DIRECTORY_IS_PENDING(dir) \
MW_DIRECTORY_IS_STATE((dir), mwDirectory_PENDING)
#define MW_DIRECTORY_IS_OPEN(dir) \
MW_DIRECTORY_IS_STATE((dir), mwDirectory_OPEN)
enum mwDirectoryMemberType {
mwDirectoryMember_USER = 0x0000,
mwDirectoryMember_GROUP = 0x0001,
};
struct mwDirectoryMember {
guint16 type;
char *id;
char *long_name;
char *short_name;
guint16 foo;
};
typedef void (*mwSearchHandler)
(struct mwDirectory *dir,
guint32 code, guint32 offset, GList *members);
struct mwDirectoryHandler {
void (*on_book_list)(struct mwServiceDirectory *srvc, GList *books);
void (*dir_opened)(struct mwDirectory *dir);
void (*dir_closed)(struct mwDirectory *dir, guint32 reason);
void (*clear)(struct mwServiceDirectory *srvc);
};
struct mwServiceDirectory *
mwServiceDirectory_new(struct mwSession *session,
struct mwDirectoryHandler *handler);
struct mwDirectoryHandler *
mwServiceDirectory_getHandler(struct mwServiceDirectory *srvc);
GList *mwServiceDirectory_getAddressBooks(struct mwServiceDirectory *srvc);
int mwServiceDirectory_refreshAddressBooks(struct mwServiceDirectory *srvc);
GList *mwServiceDirectory_getDirectories(struct mwServiceDirectory *srvc);
GList *mwAddressBook_getDirectories(struct mwAddressBook *book);
const char *mwAddressBook_getName(struct mwAddressBook *book);
struct mwDirectory *mwDirectory_new(struct mwAddressBook *book);
enum mwDirectoryState mwDirectory_getState(struct mwDirectory *dir);
void mwDirectory_setClientData(struct mwDirectory *dir,
gpointer data, GDestroyNotify clear);
gpointer mwDirectory_getClientData(struct mwDirectory *dir);
void mwDirectory_removeClientData(struct mwDirectory *dir);
struct mwServiceDirectory *mwDirectory_getService(struct mwDirectory *dir);
struct mwAddressBook *mwDirectory_getAddressBook(struct mwDirectory *dir);
int mwDirectory_open(struct mwDirectory *dir, mwSearchHandler cb);
int mwDirectory_next(struct mwDirectory *dir);
int mwDirectory_previous(struct mwDirectory *dir);
int mwDirectory_search(struct mwDirectory *dir, const char *query);
int mwDirectory_destroy(struct mwDirectory *dir);
#ifdef __cplusplus
}
#endif
#endif /* _MW_SRVC_DIR_H */
mwSearchHandler
void(* mwSearchHandler)(struct mwDirectory *dir, guint32 code, guint32 offset, GList *members)
Appropriate function signature for handling directory search results.
Definition mw_srvc_dir.h:99
mwServiceDirectory_getAddressBooks
GList * mwServiceDirectory_getAddressBooks(struct mwServiceDirectory *srvc)
most recent list of address books available in service
mwDirectoryMemberType
mwDirectoryMemberType
Definition mw_srvc_dir.h:82
mwDirectoryMember_GROUP
@ mwDirectoryMember_GROUP
Definition mw_srvc_dir.h:84
mwDirectoryMember_USER
@ mwDirectoryMember_USER
Definition mw_srvc_dir.h:83
mwServiceDirectory_refreshAddressBooks
int mwServiceDirectory_refreshAddressBooks(struct mwServiceDirectory *srvc)
submit a request to obtain an updated list of address books from service
mwDirectory_removeClientData
void mwDirectory_removeClientData(struct mwDirectory *dir)
remove and cleanup user data
mwDirectory_getService
struct mwServiceDirectory * mwDirectory_getService(struct mwDirectory *dir)
reference owning service
mwServiceDirectory_getHandler
struct mwDirectoryHandler * mwServiceDirectory_getHandler(struct mwServiceDirectory *srvc)
the handler associated with the service at its creation
mwAddressBook_getName
const char * mwAddressBook_getName(struct mwAddressBook *book)
the name of the address book
mwDirectoryState
mwDirectoryState
Definition mw_srvc_dir.h:56
mwDirectory_ERROR
@ mwDirectory_ERROR
error opening or using directory
Definition mw_srvc_dir.h:60
mwDirectory_UNKNOWN
@ mwDirectory_UNKNOWN
error determining directory state
Definition mw_srvc_dir.h:61
mwDirectory_OPEN
@ mwDirectory_OPEN
directory is open
Definition mw_srvc_dir.h:59
mwDirectory_NEW
@ mwDirectory_NEW
directory is created, but not open
Definition mw_srvc_dir.h:57
mwDirectory_PENDING
@ mwDirectory_PENDING
directory has in the process of opening
Definition mw_srvc_dir.h:58
mwDirectory_getClientData
gpointer mwDirectory_getClientData(struct mwDirectory *dir)
reference associated client data
mwDirectory_open
int mwDirectory_open(struct mwDirectory *dir, mwSearchHandler cb)
initialize a directory.
mwDirectory_search
int mwDirectory_search(struct mwDirectory *dir, const char *query)
initiate a search on an open directory
mwServiceDirectory_getDirectories
GList * mwServiceDirectory_getDirectories(struct mwServiceDirectory *srvc)
list of directories in the service
mwDirectory_getState
enum mwDirectoryState mwDirectory_getState(struct mwDirectory *dir)
mwAddressBook_getDirectories
GList * mwAddressBook_getDirectories(struct mwAddressBook *book)
list of directories associated with address book.
mwDirectory_setClientData
void mwDirectory_setClientData(struct mwDirectory *dir, gpointer data, GDestroyNotify clear)
set client data.
mwDirectory_getAddressBook
struct mwAddressBook * mwDirectory_getAddressBook(struct mwDirectory *dir)
reference owning address book
mwDirectory_new
struct mwDirectory * mwDirectory_new(struct mwAddressBook *book)
allocate a new directory based off the given address book
mwDirectory_next
int mwDirectory_next(struct mwDirectory *dir)
continue a search into its next results
mwDirectory_destroy
int mwDirectory_destroy(struct mwDirectory *dir)
close and free the directory, and unassociate it with its owning address book and service
mwServiceDirectory_new
struct mwServiceDirectory * mwServiceDirectory_new(struct mwSession *session, struct mwDirectoryHandler *handler)
Allocate a new directory service instance for use with session.
mwDirectory_previous
int mwDirectory_previous(struct mwDirectory *dir)
continue a search into its previous results
mwAddressBook
server-side collection of users and groups.
mwDirectoryHandler
handles asynchronous events for a directory service instance
Definition mw_srvc_dir.h:104
mwDirectoryHandler::on_book_list
void(* on_book_list)(struct mwServiceDirectory *srvc, GList *books)
handle receipt of the address book list from the service.
Definition mw_srvc_dir.h:109
mwDirectoryHandler::clear
void(* clear)(struct mwServiceDirectory *srvc)
optional.
Definition mw_srvc_dir.h:118
mwDirectoryHandler::dir_closed
void(* dir_closed)(struct mwDirectory *dir, guint32 reason)
triggered when a directory has been closed
Definition mw_srvc_dir.h:115
mwDirectoryHandler::dir_opened
void(* dir_opened)(struct mwDirectory *dir)
triggered when a directory has been successfully opened
Definition mw_srvc_dir.h:112
mwDirectoryMember
Definition mw_srvc_dir.h:88
mwDirectoryMember::foo
guint16 foo
unknown
Definition mw_srvc_dir.h:93
mwDirectoryMember::id
char * id
proper ID for member
Definition mw_srvc_dir.h:90
mwDirectoryMember::short_name
char * short_name
short name of member
Definition mw_srvc_dir.h:92
mwDirectoryMember::long_name
char * long_name
full name of member (USER type only)
Definition mw_srvc_dir.h:91
mwDirectoryMember::type
guint16 type
Definition mw_srvc_dir.h:89
mwDirectory
searchable directory, based off of an address book
mwServiceDirectory
the directory service.
mwSession
Represents a Sametime client session.