mw_srvc_dir.h

Go to the documentation of this file.
00001 /*
00002   Meanwhile - Unofficial Lotus Sametime Community Client Library
00003   Copyright (C) 2004  Christopher (siege) O'Brien
00004   
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Library General Public
00007   License as published by the Free Software Foundation; either
00008   version 2 of the License, or (at your option) any later version.
00009   
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Library General Public License for more details.
00014   
00015   You should have received a copy of the GNU Library General Public
00016   License along with this library; if not, write to the Free
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 #ifndef _MW_SRVC_DIR_H
00021 #define _MW_SERV_DIR_H
00022 
00023 
00024 #include <glib.h>
00025 #include <glib/glist.h>
00026 
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 
00033 struct mwSession;
00034 
00035 
00036 #define SERVICE_DIRECTORY  0x0000001a
00037 
00038 
00042 struct mwServiceDirectory;
00043 
00044 
00049 struct mwAddressBook;
00050 
00051 
00055 struct mwDirectory;
00056 
00057 
00058 enum mwDirectoryState {
00059   mwDirectory_NEW,      
00060   mwDirectory_PENDING,  
00061   mwDirectory_OPEN,     
00062   mwDirectory_ERROR,    
00063   mwDirectory_UNKNOWN,  
00064 };
00065 
00066 
00068 #define DIR_SEARCH_ERROR  0x00000000
00069 
00070 
00071 #define MW_DIRECTORY_IS_STATE(dir, state) \
00072   (mwDirectory_getState(dir) == (state))
00073 
00074 #define MW_DIRECTORY_IS_NEW(dir) \
00075   MW_DIRECTORY_IS_STATE((dir), mwDirectory_NEW)
00076 
00077 #define MW_DIRECTORY_IS_PENDING(dir) \
00078   MW_DIRECTORY_IS_STATE((dir), mwDirectory_PENDING)
00079 
00080 #define MW_DIRECTORY_IS_OPEN(dir) \
00081   MW_DIRECTORY_IS_STATE((dir), mwDirectory_OPEN)
00082 
00083 
00084 enum mwDirectoryMemberType {
00085   mwDirectoryMember_USER   = 0x0000,
00086   mwDirectoryMember_GROUP  = 0x0001,
00087 };
00088 
00089 
00090 struct mwDirectoryMember {
00091   guint16 type;      
00092   char *id;          
00093   char *long_name;   
00094   char *short_name;  
00095   guint16 foo;       
00096 };
00097 
00098 
00100 typedef void (*mwSearchHandler)
00101      (struct mwDirectory *dir,
00102       guint32 code, guint32 offset, GList *members);
00103 
00104 
00106 struct mwDirectoryHandler {
00107 
00111   void (*on_book_list)(struct mwServiceDirectory *srvc, GList *books);
00112 
00114   void (*dir_opened)(struct mwDirectory *dir);
00115 
00117   void (*dir_closed)(struct mwDirectory *dir, guint32 reason);
00118 
00120   void (*clear)(struct mwServiceDirectory *srvc);
00121 };
00122 
00123 
00125 struct mwServiceDirectory *
00126 mwServiceDirectory_new(struct mwSession *session,
00127                        struct mwDirectoryHandler *handler);
00128 
00129 
00131 struct mwDirectoryHandler *
00132 mwServiceDirectory_getHandler(struct mwServiceDirectory *srvc);
00133 
00134 
00136 GList *mwServiceDirectory_getAddressBooks(struct mwServiceDirectory *srvc);
00137 
00138 
00141 int mwServiceDirectory_refreshAddressBooks(struct mwServiceDirectory *srvc);
00142 
00143 
00145 GList *mwServiceDirectory_getDirectories(struct mwServiceDirectory *srvc);
00146 
00147 
00150 GList *mwAddressBook_getDirectories(struct mwAddressBook *book);
00151 
00152 
00154 const char *mwAddressBook_getName(struct mwAddressBook *book);
00155 
00156 
00158 struct mwDirectory *mwDirectory_new(struct mwAddressBook *book);
00159 
00160 
00161 enum mwDirectoryState mwDirectory_getState(struct mwDirectory *dir);
00162 
00163 
00166 void mwDirectory_setClientData(struct mwDirectory *dir,
00167                                gpointer data, GDestroyNotify clear);
00168 
00169 
00171 gpointer mwDirectory_getClientData(struct mwDirectory *dir);
00172 
00173 
00175 void mwDirectory_removeClientData(struct mwDirectory *dir);
00176 
00177 
00179 struct mwServiceDirectory *mwDirectory_getService(struct mwDirectory *dir);
00180 
00181 
00183 struct mwAddressBook *mwDirectory_getAddressBook(struct mwDirectory *dir);
00184 
00185 
00187 int mwDirectory_open(struct mwDirectory *dir, mwSearchHandler cb);
00188 
00189 
00191 int mwDirectory_next(struct mwDirectory *dir);
00192 
00193 
00195 int mwDirectory_previous(struct mwDirectory *dir);
00196 
00197 
00199 int mwDirectory_search(struct mwDirectory *dir, const char *query);
00200 
00201 
00204 int mwDirectory_destroy(struct mwDirectory *dir);
00205 
00206 
00207 #ifdef __cplusplus
00208 }
00209 #endif
00210 
00211 
00212 #endif /* _MW_SRVC_DIR_H */

Generated on Wed May 23 23:43:23 2007 for meanwhile by  doxygen 1.5.2