meanwhile 1.1.0
mw_srvc_im.h
Go to the documentation of this file.
1
2/*
3 Meanwhile - Unofficial Lotus Sametime Community Client Library
4 Copyright (C) 2004 Christopher (siege) O'Brien
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public
17 License along with this library; if not, write to the Free
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/
20
21#ifndef _MW_SRVC_IM_H
22#define _MW_SRVC_IM_H
23
24
36#include <glib.h>
37#include "mw_common.h"
38
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44
45/* identifier for the IM service */
46#define mwService_IM 0x00001000
47
48
53struct mwServiceIm;
54
55
59struct mwConversation;
60
61
63 mwImClient_PLAIN = 0x00000001,
64 mwImClient_NOTESBUDDY = 0x00033453,
65 mwImClient_PRECONF = 0x00000019,
66 mwImClient_UNKNOWN = 0xffffffff,
67};
68
69
92
93
94
102
103
104#define mwConversation_isState(conv, state) \
105 (mwConversation_getState(conv) == (state))
106
107#define mwConversation_isClosed(conv) \
108 mwConversation_isState((conv), mwConversation_CLOSED)
109
110#define mwConversation_isPending(conv) \
111 mwConversation_isState((conv), mwConversation_PENDING)
112
113#define mwConversation_isOpen(conv) \
114 mwConversation_isState((conv), mwConversation_OPEN)
115
116
117
121
123 void (*conversation_opened)(struct mwConversation *conv);
124
126 void (*conversation_closed)(struct mwConversation *conv, guint32 err);
127
129 void (*conversation_recv)(struct mwConversation *conv,
130 enum mwImSendType type, gconstpointer msg);
131
134 void (*place_invite)(struct mwConversation *conv,
135 const char *message,
136 const char *title, const char *name);
137
139 void (*clear)(struct mwServiceIm *srvc);
140};
141
142
143struct mwServiceIm *mwServiceIm_new(struct mwSession *session,
144 struct mwImHandler *handler);
145
146
148
149
153 struct mwIdBlock *target);
154
155
158 struct mwIdBlock *target);
159
160
163gboolean mwServiceIm_supports(struct mwServiceIm *srvc,
164 enum mwImSendType type);
165
166
175 enum mwImClientType type);
176
177
179
180
187
188
191void mwConversation_close(struct mwConversation *conv, guint32 err);
192
193
196 enum mwImSendType type);
197
198
200
201
209
210
213 enum mwImSendType type, gconstpointer send);
214
215
218
219
223
224
227
228
232 gboolean useCipher);
233
234
237
238
246 gpointer data, GDestroyNotify clean);
247
248
255
256
264
265
269
270
271#ifdef __cplusplus
272}
273#endif
274
275
276#endif /* _MW_SRVC_IM_H */
Common data types and functions for handling those types.
enum mwImClientType mwConversation_getClientType(struct mwConversation *conv)
struct mwServiceIm * mwConversation_getService(struct mwConversation *conv)
void mwConversation_setEncrypted(struct mwConversation *conv, gboolean useCipher)
set whether outgoing messages should be encrypted using the negotiated cipher, if any
gboolean mwConversation_isEncrypted(struct mwConversation *conv)
determine whether outgoing messages are being encrypted
struct mwConversation * mwServiceIm_findConversation(struct mwServiceIm *srvc, struct mwIdBlock *target)
reference an existing conversation to target
void mwConversation_open(struct mwConversation *conv)
attempt to open a conversation.
void mwConversation_close(struct mwConversation *conv, guint32 err)
close a conversation.
struct mwLoginInfo * mwConversation_getTargetInfo(struct mwConversation *conv)
login information for conversation partner.
struct mwConversation * mwServiceIm_getConversation(struct mwServiceIm *srvc, struct mwIdBlock *target)
reference an existing conversation to target, or create a new conversation to target if one does not ...
enum mwConversationState mwConversation_getState(struct mwConversation *conv)
get the state of a conversation
struct mwServiceIm * mwServiceIm_new(struct mwSession *session, struct mwImHandler *handler)
void mwConversation_free(struct mwConversation *conv)
close and destroy the conversation and its backing channel, and call the optional client data cleanup...
void mwConversation_removeClientData(struct mwConversation *conv)
Remove any associated client data, calling the optional cleanup function if one was provided.
struct mwImHandler * mwServiceIm_getHandler(struct mwServiceIm *srvc)
enum mwImClientType mwServiceIm_getClientType(struct mwServiceIm *srvc)
gpointer mwConversation_getClientData(struct mwConversation *conv)
Reference associated client data.
void mwServiceIm_setClientType(struct mwServiceIm *srvc, enum mwImClientType type)
Set the default client type for the service.
gboolean mwConversation_supports(struct mwConversation *conv, enum mwImSendType type)
determine whether a conversation supports the given message type
mwImSendType
Types of supported messages.
Definition mw_srvc_im.h:84
@ mwImSend_TIMESTAMP
char *, YYYY:MM:DD:HH:mm:SS format (NOTESBUDDY)
Definition mw_srvc_im.h:90
@ mwImSend_PLAIN
char *, plain-text message
Definition mw_srvc_im.h:85
@ mwImSend_HTML
char *, HTML formatted message (NOTESBUDDY)
Definition mw_srvc_im.h:87
@ mwImSend_TYPING
gboolean, typing status
Definition mw_srvc_im.h:86
@ mwImSend_SUBJECT
char *, conversation subject (NOTESBUDDY)
Definition mw_srvc_im.h:88
@ mwImSend_MIME
char *, MIME-encoded message (NOTESBUDDY)
Definition mw_srvc_im.h:89
mwConversationState
Definition mw_srvc_im.h:96
@ mwConversation_UNKNOWN
unknown state
Definition mw_srvc_im.h:100
@ mwConversation_OPEN
conversation is open
Definition mw_srvc_im.h:99
@ mwConversation_PENDING
conversation is opening
Definition mw_srvc_im.h:98
@ mwConversation_CLOSED
conversation is not open
Definition mw_srvc_im.h:97
mwImClientType
Definition mw_srvc_im.h:62
@ mwImClient_NOTESBUDDY
adds html, subject, mime
Definition mw_srvc_im.h:64
@ mwImClient_UNKNOWN
trouble determining type
Definition mw_srvc_im.h:66
@ mwImClient_PLAIN
text, typing
Definition mw_srvc_im.h:63
@ mwImClient_PRECONF
pre-conference, legacy
Definition mw_srvc_im.h:65
struct mwIdBlock * mwConversation_getTarget(struct mwConversation *conv)
ID for conversation partner.
int mwConversation_send(struct mwConversation *conv, enum mwImSendType type, gconstpointer send)
send a message over an open conversation
gboolean mwServiceIm_supports(struct mwServiceIm *srvc, enum mwImSendType type)
determine if the conversations created from this service will support a given send type
void mwConversation_setClientData(struct mwConversation *conv, gpointer data, GDestroyNotify clean)
Associates client data with a conversation.
A conversation between the local service and a single other user.
Definition mw_common.h:178
IM Service Handler.
Definition mw_srvc_im.h:120
void(* conversation_closed)(struct mwConversation *conv, guint32 err)
A conversation has been closed.
Definition mw_srvc_im.h:126
void(* place_invite)(struct mwConversation *conv, const char *message, const char *title, const char *name)
Handle a Place invitation.
Definition mw_srvc_im.h:134
void(* conversation_opened)(struct mwConversation *conv)
A conversation has been successfully opened.
Definition mw_srvc_im.h:123
void(* conversation_recv)(struct mwConversation *conv, enum mwImSendType type, gconstpointer msg)
A message has been received on a conversation.
Definition mw_srvc_im.h:129
void(* clear)(struct mwServiceIm *srvc)
optional.
Definition mw_srvc_im.h:139
Definition mw_common.h:123
An instance of the IM service.
Represents a Sametime client session.