jabber_k/xjab_presence.h

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