meanwhile 1.0.2
mw_srvc_store.h
Go to the documentation of this file.
00001 
00002 /*
00003   Meanwhile - Unofficial Lotus Sametime Community Client Library
00004   Copyright (C) 2004  Christopher (siege) O'Brien
00005   
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Library General Public
00008   License as published by the Free Software Foundation; either
00009   version 2 of the License, or (at your option) any later version.
00010   
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Library General Public License for more details.
00015   
00016   You should have received a copy of the GNU Library General Public
00017   License along with this library; if not, write to the Free
00018   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 */
00020 
00021 #ifndef _MW_SRVC_STORE_H
00022 #define _MW_SRVC_STORE_H
00023 
00024 
00025 #include <glib.h>
00026 #include "mw_common.h"
00027 
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 
00035 #define mwService_STORAGE  0x00000018
00036 
00037 
00042 struct mwServiceStorage;
00043 
00044 
00049 struct mwStorageUnit;
00050 
00051 
00053 #define LOTUS_RESERVED_LIMIT  0x186a0
00054 
00055 
00057 #define KEY_IS_LOTUS_RESERVED(key) \
00058   (((guint32) key) <= (LOTUS_RESERVED_LIMIT))
00059 
00060 
00064 enum mwStorageKey {
00065 
00067   mwStore_AWARE_LIST      = 0x00000000,
00068 
00070   mwStore_INVITE_CHAT     = 0x00000006,
00071 
00073   mwStore_INVITE_MEETING  = 0x0000000e,
00074 
00076   mwStore_AWAY_MESSAGES   = 0x00000050,
00077 
00079   mwStore_BUSY_MESSAGES   = 0x0000005a,
00080 
00082   mwStore_ACTIVE_MESSAGES = 0x00000064,
00083 };
00084 
00085 
00092 typedef void (*mwStorageCallback)
00093      (struct mwServiceStorage *srvc,
00094       guint32 result, struct mwStorageUnit *item,
00095       gpointer data);
00096 
00097 
00100 struct mwServiceStorage *mwServiceStorage_new(struct mwSession *);
00101 
00102 
00104 struct mwStorageUnit *mwStorageUnit_new(guint32 key);
00105 
00106 
00108 struct mwStorageUnit *mwStorageUnit_newOpaque(guint32 key,
00109                                               struct mwOpaque *data);
00110 
00111 
00114 struct mwStorageUnit *mwStorageUnit_newBoolean(guint32 key,
00115                                                gboolean val);
00116 
00117 
00118 struct mwStorageUnit *mwStorageUnit_newInteger(guint32 key,
00119                                                guint32 val);
00120 
00121 
00124 struct mwStorageUnit *mwStorageUnit_newString(guint32 key,
00125                                               const char *str);
00126 
00127 
00129 guint32 mwStorageUnit_getKey(struct mwStorageUnit *);
00130 
00131 
00135 gboolean mwStorageUnit_asBoolean(struct mwStorageUnit *, gboolean val);
00136 
00137 
00141 guint32 mwStorageUnit_asInteger(struct mwStorageUnit *, guint32 val);
00142 
00143 
00148 char *mwStorageUnit_asString(struct mwStorageUnit *);
00149 
00150 
00152 struct mwOpaque *mwStorageUnit_asOpaque(struct mwStorageUnit *);
00153 
00154 
00156 void mwStorageUnit_free(struct mwStorageUnit *);
00157 
00158       
00169 void mwServiceStorage_load(struct mwServiceStorage *srvc,
00170                            struct mwStorageUnit *item,
00171                            mwStorageCallback cb,
00172                            gpointer data, GDestroyNotify data_free);
00173 
00174 
00185 void mwServiceStorage_save(struct mwServiceStorage *srvc,
00186                            struct mwStorageUnit *item,
00187                            mwStorageCallback cb,
00188                            gpointer data, GDestroyNotify data_free);
00189 
00190 
00191 #ifdef __cplusplus
00192 }
00193 #endif
00194 
00195 
00196 #endif /* _MW_SRVC_STORE_H */