meanwhile
1.1.0
|
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 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 00032 struct mwSession; 00033 00034 00035 #define SERVICE_DIRECTORY 0x0000001a 00036 00037 00041 struct mwServiceDirectory; 00042 00043 00048 struct mwAddressBook; 00049 00050 00054 struct mwDirectory; 00055 00056 00057 enum mwDirectoryState { 00058 mwDirectory_NEW, 00059 mwDirectory_PENDING, 00060 mwDirectory_OPEN, 00061 mwDirectory_ERROR, 00062 mwDirectory_UNKNOWN, 00063 }; 00064 00065 00067 #define DIR_SEARCH_ERROR 0x00000000 00068 00069 00070 #define MW_DIRECTORY_IS_STATE(dir, state) \ 00071 (mwDirectory_getState(dir) == (state)) 00072 00073 #define MW_DIRECTORY_IS_NEW(dir) \ 00074 MW_DIRECTORY_IS_STATE((dir), mwDirectory_NEW) 00075 00076 #define MW_DIRECTORY_IS_PENDING(dir) \ 00077 MW_DIRECTORY_IS_STATE((dir), mwDirectory_PENDING) 00078 00079 #define MW_DIRECTORY_IS_OPEN(dir) \ 00080 MW_DIRECTORY_IS_STATE((dir), mwDirectory_OPEN) 00081 00082 00083 enum mwDirectoryMemberType { 00084 mwDirectoryMember_USER = 0x0000, 00085 mwDirectoryMember_GROUP = 0x0001, 00086 }; 00087 00088 00089 struct mwDirectoryMember { 00090 guint16 type; 00091 char *id; 00092 char *long_name; 00093 char *short_name; 00094 guint16 foo; 00095 }; 00096 00097 00099 typedef void (*mwSearchHandler) 00100 (struct mwDirectory *dir, 00101 guint32 code, guint32 offset, GList *members); 00102 00103 00105 struct mwDirectoryHandler { 00106 00110 void (*on_book_list)(struct mwServiceDirectory *srvc, GList *books); 00111 00113 void (*dir_opened)(struct mwDirectory *dir); 00114 00116 void (*dir_closed)(struct mwDirectory *dir, guint32 reason); 00117 00119 void (*clear)(struct mwServiceDirectory *srvc); 00120 }; 00121 00122 00124 struct mwServiceDirectory * 00125 mwServiceDirectory_new(struct mwSession *session, 00126 struct mwDirectoryHandler *handler); 00127 00128 00130 struct mwDirectoryHandler * 00131 mwServiceDirectory_getHandler(struct mwServiceDirectory *srvc); 00132 00133 00135 GList *mwServiceDirectory_getAddressBooks(struct mwServiceDirectory *srvc); 00136 00137 00140 int mwServiceDirectory_refreshAddressBooks(struct mwServiceDirectory *srvc); 00141 00142 00144 GList *mwServiceDirectory_getDirectories(struct mwServiceDirectory *srvc); 00145 00146 00149 GList *mwAddressBook_getDirectories(struct mwAddressBook *book); 00150 00151 00153 const char *mwAddressBook_getName(struct mwAddressBook *book); 00154 00155 00157 struct mwDirectory *mwDirectory_new(struct mwAddressBook *book); 00158 00159 00160 enum mwDirectoryState mwDirectory_getState(struct mwDirectory *dir); 00161 00162 00165 void mwDirectory_setClientData(struct mwDirectory *dir, 00166 gpointer data, GDestroyNotify clear); 00167 00168 00170 gpointer mwDirectory_getClientData(struct mwDirectory *dir); 00171 00172 00174 void mwDirectory_removeClientData(struct mwDirectory *dir); 00175 00176 00178 struct mwServiceDirectory *mwDirectory_getService(struct mwDirectory *dir); 00179 00180 00182 struct mwAddressBook *mwDirectory_getAddressBook(struct mwDirectory *dir); 00183 00184 00186 int mwDirectory_open(struct mwDirectory *dir, mwSearchHandler cb); 00187 00188 00190 int mwDirectory_next(struct mwDirectory *dir); 00191 00192 00194 int mwDirectory_previous(struct mwDirectory *dir); 00195 00196 00198 int mwDirectory_search(struct mwDirectory *dir, const char *query); 00199 00200 00203 int mwDirectory_destroy(struct mwDirectory *dir); 00204 00205 00206 #ifdef __cplusplus 00207 } 00208 #endif 00209 00210 00211 #endif /* _MW_SRVC_DIR_H */