Blame src/mw_srvc_conf.h

Packit 16808d
Packit 16808d
/*
Packit 16808d
  Meanwhile - Unofficial Lotus Sametime Community Client Library
Packit 16808d
  Copyright (C) 2004  Christopher (siege) O'Brien
Packit 16808d
  
Packit 16808d
  This library is free software; you can redistribute it and/or
Packit 16808d
  modify it under the terms of the GNU Library General Public
Packit 16808d
  License as published by the Free Software Foundation; either
Packit 16808d
  version 2 of the License, or (at your option) any later version.
Packit 16808d
  
Packit 16808d
  This library is distributed in the hope that it will be useful,
Packit 16808d
  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 16808d
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 16808d
  Library General Public License for more details.
Packit 16808d
  
Packit 16808d
  You should have received a copy of the GNU Library General Public
Packit 16808d
  License along with this library; if not, write to the Free
Packit 16808d
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Packit 16808d
*/
Packit 16808d
Packit 16808d
#ifndef _MW_SRVC_CONF_H
Packit 16808d
#define _MW_SRVC_CONF_H
Packit 16808d
Packit 16808d
Packit 16808d
#include <glib/glist.h>
Packit 16808d
#include "mw_common.h"
Packit 16808d
Packit 16808d
Packit 16808d
#ifdef __cplusplus
Packit 16808d
extern "C" {
Packit 16808d
#endif
Packit 16808d
Packit 16808d
Packit 16808d
/** Type identifier for the conference service */
Packit 16808d
#define mwService_CONFERENCE  0x80000010
Packit 16808d
Packit 16808d
Packit 16808d
enum mwConferenceState {
Packit 16808d
  mwConference_NEW,      /**< new outgoing conference */
Packit 16808d
  mwConference_PENDING,  /**< outgoing conference pending creation */
Packit 16808d
  mwConference_INVITED,  /**< invited to incoming conference */
Packit 16808d
  mwConference_OPEN,     /**< conference open and active */
Packit 16808d
  mwConference_CLOSING,  /**< conference is closing */
Packit 16808d
  mwConference_ERROR,    /**< conference is closing due to error */
Packit 16808d
  mwConference_UNKNOWN,  /**< unable to determine conference state */
Packit 16808d
};
Packit 16808d
Packit 16808d
Packit 16808d
/** @struct mwServiceConference
Packit 16808d
    Instance of the multi-user conference service */
Packit 16808d
struct mwServiceConference;
Packit 16808d
Packit 16808d
Packit 16808d
/** @struct mwConference
Packit 16808d
    A multi-user chat */
Packit 16808d
struct mwConference;
Packit 16808d
Packit 16808d
Packit 16808d
/** Handler structure used to provide callbacks for an instance of the
Packit 16808d
    conferencing service */
Packit 16808d
struct mwConferenceHandler {
Packit 16808d
Packit 16808d
  /** triggered when we receive a conference invitation. Call
Packit 16808d
      mwConference_accept to accept the invitation and join the
Packit 16808d
      conference, or mwConference_close to reject the invitation.
Packit 16808d
Packit 16808d
      @param conf     the newly created conference
Packit 16808d
      @param inviter  the indentity of the user who sent the invitation
Packit 16808d
      @param invite   the invitation text
Packit 16808d
   */
Packit 16808d
  void (*on_invited)(struct mwConference *conf,
Packit 16808d
		     struct mwLoginInfo *inviter, const char *invite);
Packit 16808d
Packit 16808d
  /** triggered when we enter the conference. Provides the initial
Packit 16808d
      conference membership list as a GList of mwLoginInfo structures
Packit 16808d
Packit 16808d
      @param conf     the conference just joined
Packit 16808d
      @param members  mwLoginInfo list of existing conference members
Packit 16808d
  */
Packit 16808d
  void (*conf_opened)(struct mwConference *conf, GList *members);
Packit 16808d
Packit 16808d
  /** triggered when a conference is closed. This is typically when
Packit 16808d
      we've left it */
Packit 16808d
  void (*conf_closed)(struct mwConference *, guint32 reason);
Packit 16808d
Packit 16808d
  /** triggered when someone joins the conference */
Packit 16808d
  void (*on_peer_joined)(struct mwConference *, struct mwLoginInfo *);
Packit 16808d
Packit 16808d
  /** triggered when someone leaves the conference */
Packit 16808d
  void (*on_peer_parted)(struct mwConference *, struct mwLoginInfo *);
Packit 16808d
Packit 16808d
  /** triggered when someone says something */
Packit 16808d
  void (*on_text)(struct mwConference *conf,
Packit 16808d
		  struct mwLoginInfo *who, const char *what);
Packit 16808d
Packit 16808d
  /** typing notification */
Packit 16808d
  void (*on_typing)(struct mwConference *conf,
Packit 16808d
		    struct mwLoginInfo *who, gboolean typing);
Packit 16808d
Packit 16808d
  /** optional. called from mwService_free */
Packit 16808d
  void (*clear)(struct mwServiceConference *srvc);
Packit 16808d
};
Packit 16808d
Packit 16808d
Packit 16808d
/** Allocate a new conferencing service, attaching the given handler
Packit 16808d
    @param sess     owning session
Packit 16808d
    @param handler  handler providing call-back functions for the service
Packit 16808d
 */
Packit 16808d
struct mwServiceConference *
Packit 16808d
mwServiceConference_new(struct mwSession *sess,
Packit 16808d
			struct mwConferenceHandler *handler);
Packit 16808d
Packit 16808d
Packit 16808d
/** @returns the conference handler for the service */
Packit 16808d
struct mwConferenceHandler *
Packit 16808d
mwServiceConference_getHandler(struct mwServiceConference *srvc);
Packit 16808d
Packit 16808d
Packit 16808d
/** a mwConference list of the conferences in this service. The GList
Packit 16808d
    will need to be destroyed with g_list_free after use */
Packit 16808d
GList *mwServiceConference_getConferences(struct mwServiceConference *srvc);
Packit 16808d
Packit 16808d
Packit 16808d
/** Allocate a new conference, in state NEW with the given title.
Packit 16808d
    @see mwConference_create */
Packit 16808d
struct mwConference *mwConference_new(struct mwServiceConference *srvc,
Packit 16808d
				      const char *title);
Packit 16808d
Packit 16808d
Packit 16808d
/** @returns the owning service of a conference */
Packit 16808d
struct mwServiceConference *mwConference_getService(struct mwConference *conf);
Packit 16808d
Packit 16808d
Packit 16808d
/** @returns unique conference name */
Packit 16808d
const char *mwConference_getName(struct mwConference *conf);
Packit 16808d
Packit 16808d
Packit 16808d
/** @returns conference title */
Packit 16808d
const char *mwConference_getTitle(struct mwConference *conf);
Packit 16808d
Packit 16808d
Packit 16808d
/** a mwIdBlock list of the members of the conference. The GList will
Packit 16808d
    need to be free'd after use */
Packit 16808d
GList *mwConference_getMembers(struct mwConference *conf);
Packit 16808d
Packit 16808d
Packit 16808d
/** Initiate a conference. Conference must be in state NEW. If no name
Packit 16808d
    or title for the conference has been set, they will be
Packit 16808d
    generated. Conference will be placed into state PENDING. */
Packit 16808d
int mwConference_open(struct mwConference *conf);
Packit 16808d
Packit 16808d
Packit 16808d
/** Leave and close an existing conference, or reject an invitation.
Packit 16808d
    Triggers mwServiceConfHandler::conf_closed and free's the
Packit 16808d
    conference.
Packit 16808d
 */
Packit 16808d
int mwConference_destroy(struct mwConference *conf,
Packit 16808d
			 guint32 reason, const char *text);
Packit 16808d
Packit 16808d
Packit 16808d
#define mwConference_reject(c,r,t) \
Packit 16808d
  mwConference_destroy((c),(r),(t))
Packit 16808d
Packit 16808d
Packit 16808d
/** accept a conference invitation. Conference must be in the state
Packit 16808d
    INVITED. */
Packit 16808d
int mwConference_accept(struct mwConference *conf);
Packit 16808d
Packit 16808d
Packit 16808d
/** invite another user to an ACTIVE conference
Packit 16808d
    @param conf  conference
Packit 16808d
    @param who   user to invite
Packit 16808d
    @param text  invitation message
Packit 16808d
 */
Packit 16808d
int mwConference_invite(struct mwConference *conf,
Packit 16808d
			struct mwIdBlock *who, const char *text);
Packit 16808d
Packit 16808d
Packit 16808d
/** send a text message over an open conference */
Packit 16808d
int mwConference_sendText(struct mwConference *conf, const char *text);
Packit 16808d
Packit 16808d
Packit 16808d
/** send typing notification over an open conference */
Packit 16808d
int mwConference_sendTyping(struct mwConference *conf, gboolean typing);
Packit 16808d
Packit 16808d
Packit 16808d
/** associate arbitrary client data and an optional cleanup function
Packit 16808d
    with a conference. If there is already client data with a clear
Packit 16808d
    function, it will not be called. */
Packit 16808d
void mwConference_setClientData(struct mwConference *conf,
Packit 16808d
				gpointer data, GDestroyNotify clear);
Packit 16808d
Packit 16808d
Packit 16808d
/** reference associated client data */
Packit 16808d
gpointer mwConference_getClientData(struct mwConference *conf);
Packit 16808d
Packit 16808d
Packit 16808d
/** remove associated client data if any, and call the cleanup
Packit 16808d
    function on the data as necessary */
Packit 16808d
void mwConference_removeClientData(struct mwConference *conf);
Packit 16808d
Packit 16808d
Packit 16808d
#ifdef __cplusplus
Packit 16808d
}
Packit 16808d
#endif
Packit 16808d
				    
Packit 16808d
Packit 16808d
#endif /* _MW_SRVC_CONF_H */
Packit 16808d