meanwhile 1.0.2
|
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_IM_H 00022 #define _MW_SRVC_IM_H 00023 00024 00036 #include <glib.h> 00037 #include "mw_common.h" 00038 00039 00040 #ifdef __cplusplus 00041 extern "C" { 00042 #endif 00043 00044 00045 /* identifier for the IM service */ 00046 #define mwService_IM 0x00001000 00047 00048 00053 struct mwServiceIm; 00054 00055 00059 struct mwConversation; 00060 00061 00062 enum mwImClientType { 00063 mwImClient_PLAIN = 0x00000001, 00064 mwImClient_NOTESBUDDY = 0x00033453, 00065 mwImClient_PRECONF = 0x00000019, 00066 mwImClient_UNKNOWN = 0xffffffff, 00067 }; 00068 00069 00084 enum mwImSendType { 00085 mwImSend_PLAIN, 00086 mwImSend_TYPING, 00087 mwImSend_HTML, 00088 mwImSend_SUBJECT, 00089 mwImSend_MIME, 00090 mwImSend_TIMESTAMP, 00091 }; 00092 00093 00094 00096 enum mwConversationState { 00097 mwConversation_CLOSED, 00098 mwConversation_PENDING, 00099 mwConversation_OPEN, 00100 mwConversation_UNKNOWN, 00101 }; 00102 00103 00104 #define mwConversation_isState(conv, state) \ 00105 (mwConversation_getState(conv) == (state)) 00106 00107 #define mwConversation_isClosed(conv) \ 00108 mwConversation_isState((conv), mwConversation_CLOSED) 00109 00110 #define mwConversation_isPending(conv) \ 00111 mwConversation_isState((conv), mwConversation_PENDING) 00112 00113 #define mwConversation_isOpen(conv) \ 00114 mwConversation_isState((conv), mwConversation_OPEN) 00115 00116 00117 00120 struct mwImHandler { 00121 00123 void (*conversation_opened)(struct mwConversation *conv); 00124 00126 void (*conversation_closed)(struct mwConversation *conv, guint32 err); 00127 00129 void (*conversation_recv)(struct mwConversation *conv, 00130 enum mwImSendType type, gconstpointer msg); 00131 00134 void (*place_invite)(struct mwConversation *conv, 00135 const char *message, 00136 const char *title, const char *name); 00137 00139 void (*clear)(struct mwServiceIm *srvc); 00140 }; 00141 00142 00143 struct mwServiceIm *mwServiceIm_new(struct mwSession *session, 00144 struct mwImHandler *handler); 00145 00146 00147 struct mwImHandler *mwServiceIm_getHandler(struct mwServiceIm *srvc); 00148 00149 00152 struct mwConversation *mwServiceIm_getConversation(struct mwServiceIm *srvc, 00153 struct mwIdBlock *target); 00154 00155 00157 struct mwConversation *mwServiceIm_findConversation(struct mwServiceIm *srvc, 00158 struct mwIdBlock *target); 00159 00160 00163 gboolean mwServiceIm_supports(struct mwServiceIm *srvc, 00164 enum mwImSendType type); 00165 00166 00174 void mwServiceIm_setClientType(struct mwServiceIm *srvc, 00175 enum mwImClientType type); 00176 00177 00178 enum mwImClientType mwServiceIm_getClientType(struct mwServiceIm *srvc); 00179 00180 00186 void mwConversation_open(struct mwConversation *conv); 00187 00188 00191 void mwConversation_close(struct mwConversation *conv, guint32 err); 00192 00193 00195 gboolean mwConversation_supports(struct mwConversation *conv, 00196 enum mwImSendType type); 00197 00198 00199 enum mwImClientType mwConversation_getClientType(struct mwConversation *conv); 00200 00201 00208 enum mwConversationState mwConversation_getState(struct mwConversation *conv); 00209 00210 00212 int mwConversation_send(struct mwConversation *conv, 00213 enum mwImSendType type, gconstpointer send); 00214 00215 00217 struct mwServiceIm *mwConversation_getService(struct mwConversation *conv); 00218 00219 00222 struct mwLoginInfo *mwConversation_getTargetInfo(struct mwConversation *conv); 00223 00224 00226 struct mwIdBlock *mwConversation_getTarget(struct mwConversation *conv); 00227 00228 00231 void mwConversation_setEncrypted(struct mwConversation *conv, 00232 gboolean useCipher); 00233 00234 00236 gboolean mwConversation_isEncrypted(struct mwConversation *conv); 00237 00238 00245 void mwConversation_setClientData(struct mwConversation *conv, 00246 gpointer data, GDestroyNotify clean); 00247 00248 00254 gpointer mwConversation_getClientData(struct mwConversation *conv); 00255 00256 00263 void mwConversation_removeClientData(struct mwConversation *conv); 00264 00265 00268 void mwConversation_free(struct mwConversation *conv); 00269 00270 00271 #ifdef __cplusplus 00272 } 00273 #endif 00274 00275 00276 #endif /* _MW_SRVC_IM_H */