jabber_s/xjab_presence.h

00001 /*
00002  * $Id$
00003  *
00004  * XJAB module
00005  *
00006  *
00007  * Copyright (C) 2001-2003 FhG Fokus
00008  *
00009  * This file is part of ser, a free SIP server.
00010  *
00011  * ser is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version
00015  *
00016  * For a license to use the ser software under conditions
00017  * other than those described here, or to purchase support for this
00018  * software, please contact iptel.org by e-mail at the following addresses:
00019  *    info@iptel.org
00020  *
00021  * ser is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  * GNU General Public License for more details.
00025  *
00026  * You should have received a copy of the GNU General Public License 
00027  * along with this program; if not, write to the Free Software 
00028  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00029  */
00030 
00031 #ifndef _XJAB_PRESENCE_H_
00032 #define _XJAB_PRESENCE_H_
00033 
00034 #include "../../str.h"
00035 #include "xjab_base.h"
00036 
00037 #define XJ_PS_CHECK                     -1
00038 #define XJ_PS_OFFLINE           0
00039 #define XJ_PS_ONLINE            1
00040 #define XJ_PS_TERMINATED        2
00041 #define XJ_PS_REFUSED           3
00042 
00043 #define XJ_PRES_STATUS_NULL             0
00044 #define XJ_PRES_STATUS_SUBS             1
00045 #define XJ_PRES_STATUS_WAIT             2
00046 
00047 typedef struct _xj_pres_cell
00048 {
00049         int key;
00050         str userid;
00051         int state;
00052         int status;
00053         pa_callback_f cbf;
00054         void *cbp;
00055         struct _xj_pres_cell *prev;
00056         struct _xj_pres_cell *next;
00057 } t_xj_pres_cell, *xj_pres_cell;
00058 
00059 typedef struct _xj_pres_list
00060 {
00061         int nr;
00062         xj_pres_cell clist;
00063 } t_xj_pres_list, *xj_pres_list;
00064 
00065 xj_pres_cell xj_pres_cell_new();
00066 void xj_pres_cell_free(xj_pres_cell);
00067 void xj_pres_cell_free_all(xj_pres_cell);
00068 int xj_pres_cell_init(xj_pres_cell, str*, pa_callback_f, void*);
00069 int xj_pres_cell_init(xj_pres_cell, str*, pa_callback_f, void*);
00070 int xj_pres_cell_update(xj_pres_cell, pa_callback_f, void*);
00071 
00072 xj_pres_list xj_pres_list_init();
00073 void xj_pres_list_free(xj_pres_list);
00074 xj_pres_cell xj_pres_list_add(xj_pres_list, xj_pres_cell);
00075 int xj_pres_list_del(xj_pres_list, str*);
00076 xj_pres_cell xj_pres_list_check(xj_pres_list, str*);
00077 void xj_pres_list_notifyall(xj_pres_list,int);
00078 
00079 #endif
00080