mw_srvc_im.h
Go to the documentation of this file.
/*
Meanwhile - Unofficial Lotus Sametime Community Client Library
Copyright (C) 2004 Christopher (siege) O'Brien
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _MW_SRVC_IM_H
#define _MW_SRVC_IM_H
#include <glib.h>
#include "mw_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* identifier for the IM service */
#define mwService_IM 0x00001000
struct mwServiceIm;
struct mwConversation;
enum mwImClientType {
mwImClient_PLAIN = 0x00000001,
mwImClient_NOTESBUDDY = 0x00033453,
mwImClient_PRECONF = 0x00000019,
mwImClient_UNKNOWN = 0xffffffff,
};
enum mwImSendType {
mwImSend_PLAIN,
mwImSend_TYPING,
mwImSend_HTML,
mwImSend_SUBJECT,
mwImSend_MIME,
mwImSend_TIMESTAMP,
};
enum mwConversationState {
mwConversation_CLOSED,
mwConversation_PENDING,
mwConversation_OPEN,
mwConversation_UNKNOWN,
};
#define mwConversation_isState(conv, state) \
(mwConversation_getState(conv) == (state))
#define mwConversation_isClosed(conv) \
mwConversation_isState((conv), mwConversation_CLOSED)
#define mwConversation_isPending(conv) \
mwConversation_isState((conv), mwConversation_PENDING)
#define mwConversation_isOpen(conv) \
mwConversation_isState((conv), mwConversation_OPEN)
struct mwImHandler {
void (*conversation_opened)(struct mwConversation *conv);
void (*conversation_closed)(struct mwConversation *conv, guint32 err);
void (*conversation_recv)(struct mwConversation *conv,
enum mwImSendType type, gconstpointer msg);
void (*place_invite)(struct mwConversation *conv,
const char *message,
const char *title, const char *name);
void (*clear)(struct mwServiceIm *srvc);
};
struct mwServiceIm *mwServiceIm_new(struct mwSession *session,
struct mwImHandler *handler);
struct mwImHandler *mwServiceIm_getHandler(struct mwServiceIm *srvc);
struct mwConversation *mwServiceIm_getConversation(struct mwServiceIm *srvc,
struct mwIdBlock *target);
struct mwConversation *mwServiceIm_findConversation(struct mwServiceIm *srvc,
struct mwIdBlock *target);
gboolean mwServiceIm_supports(struct mwServiceIm *srvc,
enum mwImSendType type);
void mwServiceIm_setClientType(struct mwServiceIm *srvc,
enum mwImClientType type);
enum mwImClientType mwServiceIm_getClientType(struct mwServiceIm *srvc);
void mwConversation_open(struct mwConversation *conv);
void mwConversation_close(struct mwConversation *conv, guint32 err);
gboolean mwConversation_supports(struct mwConversation *conv,
enum mwImSendType type);
enum mwImClientType mwConversation_getClientType(struct mwConversation *conv);
enum mwConversationState mwConversation_getState(struct mwConversation *conv);
int mwConversation_send(struct mwConversation *conv,
enum mwImSendType type, gconstpointer send);
struct mwServiceIm *mwConversation_getService(struct mwConversation *conv);
struct mwLoginInfo *mwConversation_getTargetInfo(struct mwConversation *conv);
struct mwIdBlock *mwConversation_getTarget(struct mwConversation *conv);
void mwConversation_setEncrypted(struct mwConversation *conv,
gboolean useCipher);
gboolean mwConversation_isEncrypted(struct mwConversation *conv);
void mwConversation_setClientData(struct mwConversation *conv,
gpointer data, GDestroyNotify clean);
gpointer mwConversation_getClientData(struct mwConversation *conv);
void mwConversation_removeClientData(struct mwConversation *conv);
void mwConversation_free(struct mwConversation *conv);
#ifdef __cplusplus
}
#endif
#endif /* _MW_SRVC_IM_H */
mw_common.h
Common data types and functions for handling those types.
mwConversation_getClientType
enum mwImClientType mwConversation_getClientType(struct mwConversation *conv)
mwConversation_getService
struct mwServiceIm * mwConversation_getService(struct mwConversation *conv)
mwConversation_setEncrypted
void mwConversation_setEncrypted(struct mwConversation *conv, gboolean useCipher)
set whether outgoing messages should be encrypted using the negotiated cipher, if any
mwConversation_isEncrypted
gboolean mwConversation_isEncrypted(struct mwConversation *conv)
determine whether outgoing messages are being encrypted
mwServiceIm_findConversation
struct mwConversation * mwServiceIm_findConversation(struct mwServiceIm *srvc, struct mwIdBlock *target)
reference an existing conversation to target
mwConversation_open
void mwConversation_open(struct mwConversation *conv)
attempt to open a conversation.
mwConversation_close
void mwConversation_close(struct mwConversation *conv, guint32 err)
close a conversation.
mwConversation_getTargetInfo
struct mwLoginInfo * mwConversation_getTargetInfo(struct mwConversation *conv)
login information for conversation partner.
mwServiceIm_getConversation
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 ...
mwConversation_getState
enum mwConversationState mwConversation_getState(struct mwConversation *conv)
get the state of a conversation
mwServiceIm_new
struct mwServiceIm * mwServiceIm_new(struct mwSession *session, struct mwImHandler *handler)
mwConversation_free
void mwConversation_free(struct mwConversation *conv)
close and destroy the conversation and its backing channel, and call the optional client data cleanup...
mwConversation_removeClientData
void mwConversation_removeClientData(struct mwConversation *conv)
Remove any associated client data, calling the optional cleanup function if one was provided.
mwServiceIm_getHandler
struct mwImHandler * mwServiceIm_getHandler(struct mwServiceIm *srvc)
mwServiceIm_getClientType
enum mwImClientType mwServiceIm_getClientType(struct mwServiceIm *srvc)
mwConversation_getClientData
gpointer mwConversation_getClientData(struct mwConversation *conv)
Reference associated client data.
mwServiceIm_setClientType
void mwServiceIm_setClientType(struct mwServiceIm *srvc, enum mwImClientType type)
Set the default client type for the service.
mwConversation_supports
gboolean mwConversation_supports(struct mwConversation *conv, enum mwImSendType type)
determine whether a conversation supports the given message type
mwImSendType
mwImSendType
Types of supported messages.
Definition mw_srvc_im.h:84
mwImSend_TIMESTAMP
@ mwImSend_TIMESTAMP
char *, YYYY:MM:DD:HH:mm:SS format (NOTESBUDDY)
Definition mw_srvc_im.h:90
mwImSend_PLAIN
@ mwImSend_PLAIN
char *, plain-text message
Definition mw_srvc_im.h:85
mwImSend_HTML
@ mwImSend_HTML
char *, HTML formatted message (NOTESBUDDY)
Definition mw_srvc_im.h:87
mwImSend_TYPING
@ mwImSend_TYPING
gboolean, typing status
Definition mw_srvc_im.h:86
mwImSend_SUBJECT
@ mwImSend_SUBJECT
char *, conversation subject (NOTESBUDDY)
Definition mw_srvc_im.h:88
mwImSend_MIME
@ mwImSend_MIME
char *, MIME-encoded message (NOTESBUDDY)
Definition mw_srvc_im.h:89
mwConversationState
mwConversationState
Definition mw_srvc_im.h:96
mwConversation_UNKNOWN
@ mwConversation_UNKNOWN
unknown state
Definition mw_srvc_im.h:100
mwConversation_OPEN
@ mwConversation_OPEN
conversation is open
Definition mw_srvc_im.h:99
mwConversation_PENDING
@ mwConversation_PENDING
conversation is opening
Definition mw_srvc_im.h:98
mwConversation_CLOSED
@ mwConversation_CLOSED
conversation is not open
Definition mw_srvc_im.h:97
mwImClientType
mwImClientType
Definition mw_srvc_im.h:62
mwImClient_NOTESBUDDY
@ mwImClient_NOTESBUDDY
adds html, subject, mime
Definition mw_srvc_im.h:64
mwImClient_UNKNOWN
@ mwImClient_UNKNOWN
trouble determining type
Definition mw_srvc_im.h:66
mwImClient_PLAIN
@ mwImClient_PLAIN
text, typing
Definition mw_srvc_im.h:63
mwImClient_PRECONF
@ mwImClient_PRECONF
pre-conference, legacy
Definition mw_srvc_im.h:65
mwConversation_getTarget
struct mwIdBlock * mwConversation_getTarget(struct mwConversation *conv)
ID for conversation partner.
mwConversation_send
int mwConversation_send(struct mwConversation *conv, enum mwImSendType type, gconstpointer send)
send a message over an open conversation
mwServiceIm_supports
gboolean mwServiceIm_supports(struct mwServiceIm *srvc, enum mwImSendType type)
determine if the conversations created from this service will support a given send type
mwConversation_setClientData
void mwConversation_setClientData(struct mwConversation *conv, gpointer data, GDestroyNotify clean)
Associates client data with a conversation.
mwConversation
A conversation between the local service and a single other user.
mwIdBlock
Definition mw_common.h:178
mwImHandler
IM Service Handler.
Definition mw_srvc_im.h:120
mwImHandler::conversation_closed
void(* conversation_closed)(struct mwConversation *conv, guint32 err)
A conversation has been closed.
Definition mw_srvc_im.h:126
mwImHandler::place_invite
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
mwImHandler::conversation_opened
void(* conversation_opened)(struct mwConversation *conv)
A conversation has been successfully opened.
Definition mw_srvc_im.h:123
mwImHandler::conversation_recv
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
mwImHandler::clear
void(* clear)(struct mwServiceIm *srvc)
optional.
Definition mw_srvc_im.h:139
mwLoginInfo
Definition mw_common.h:123
mwServiceIm
An instance of the IM service.
mwSession
Represents a Sametime client session.