ekg2
|
00001 /* $Id: sessions.h 4589 2008-09-01 18:44:20Z peres $ */ 00002 00003 /* 00004 * (C) Copyright 2003 Wojtek Kaniewski <wojtekka@irc.pl> 00005 * 2004 Piotr Kupisiewicz <deli@rzepaknet.us> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License Version 2 as 00009 * published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __EKG_SESSIONS_H 00022 #define __EKG_SESSIONS_H 00023 00024 #include <time.h> 00025 00026 typedef enum { 00027 EKG_STATUS_NULL = 0x00, /* special value */ 00028 00029 /* These statuses should be considered as no-delivery */ 00030 EKG_STATUS_ERROR, /* used in Jabber */ 00031 EKG_STATUS_BLOCKED, /* used in GG */ 00032 00033 /* These statuses should be considered as 'not sure' */ 00034 EKG_STATUS_UNKNOWN, /* used in Jabber */ 00035 EKG_STATUS_NA, /* universal */ 00036 00037 /* These should be considered as 'probably available' */ 00038 EKG_STATUS_INVISIBLE, /* GG; hard to prioritize... */ 00039 EKG_STATUS_DND, /* Jabber */ 00040 EKG_STATUS_GONE, /* ICQ */ 00041 EKG_STATUS_XA, /* Jabber */ 00042 EKG_STATUS_AWAY, /* universal */ 00043 00044 /* These should be considered as 'sure available' */ 00045 EKG_STATUS_AVAIL, /* universal */ 00046 EKG_STATUS_FFC /* Jabber */ 00047 } status_t; 00048 00049 typedef struct session_param { 00050 struct session_param *next; 00051 00052 char *key; /* nazwa parametru */ 00053 char *value; /* wartość parametru */ 00054 } session_param_t; 00055 00059 typedef struct ekg_session { 00060 struct ekg_session *next; 00061 00062 /* public: */ 00063 void *plugin; /* ekg2-remote: OK */ 00064 char *uid; /* ekg2-remote: OK */ 00065 char *alias; /* ekg2-remote: OK */ 00066 void *__priv; /* ekg2-remote: NULL, OK */ 00067 struct userlist *userlist; 00068 00069 /* private: */ 00070 status_t status; 00071 char *descr; 00072 char *__password; /* ekg2-remote: NULL, ok */ 00073 00074 unsigned int connected : 1; /* ekg2-remote: OK */ 00075 unsigned int connecting : 2; 00076 unsigned int __autoaway : 1; /* ekg2-remote: 0, OK */ 00077 00078 time_t __activity; /* ekg2-remote: 0, OK */ 00079 time_t __last_conn; /* ekg2-remote: 0, OK */ 00080 00081 int __global_vars_count; /* ekg2-remote: 0, OK */ 00082 char **__values; /* ekg2-remote: NULL, OK */ 00083 session_param_t *__local_vars; /* ekg2-remote: NULL, OK */ 00084 00085 status_t __last_status; /* ekg2-remote: EKG_STATUS_NULL, OK */ 00086 char *__last_descr; /* ekg2-remote: NULL, OK */ 00087 int __flock_fd; /* ekg2-remote: (0), OK */ /* XXX, could be -1 */ 00088 } session_t; 00089 00090 extern session_t *sessions; 00091 00092 extern session_t *session_current; 00093 00094 session_t *session_find(const char *uid); 00095 00096 const char *session_uid_get(session_t *s); 00097 00098 session_t *remote_session_add(const char *uid, const char *plugin); 00099 int remote_session_remove(const char *uid); 00100 00101 void sessions_free(); 00102 00103 #endif /* __EKG_SESSIONS_H */ 00104 00105 /* 00106 * Local Variables: 00107 * mode: c 00108 * c-file-style: "k&r" 00109 * c-basic-offset: 8 00110 * indent-tabs-mode: t 00111 * End: 00112 */