| 1 |
sysadm |
1.1 |
/*
|
| 2 |
|
|
* Copyright (C) 1998 Mark Baysinger (mbaysing@ucsd.edu)
|
| 3 |
|
|
* Copyright (C) 1998,1999,2000,2001 Ross Combs (rocombs@cs.nmsu.edu)
|
| 4 |
|
|
* Copyright (C) 2000 Marco Ziech (mmz@gmx.net)
|
| 5 |
|
|
*
|
| 6 |
|
|
* This program is free software; you can redistribute it and/or
|
| 7 |
|
|
* modify it under the terms of the GNU General Public License
|
| 8 |
|
|
* as published by the Free Software Foundation; either version 2
|
| 9 |
|
|
* of the License, or (at your option) any later version.
|
| 10 |
|
|
*
|
| 11 |
|
|
* This program is distributed in the hope that it will be useful,
|
| 12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 14 |
|
|
* GNU General Public License for more details.
|
| 15 |
|
|
*
|
| 16 |
|
|
* You should have received a copy of the GNU General Public License
|
| 17 |
|
|
* along with this program; if not, write to the Free Software
|
| 18 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 19 |
|
|
*/
|
| 20 |
|
|
#ifndef INCLUDED_CHANNEL_TYPES
|
| 21 |
|
|
#define INCLUDED_CHANNEL_TYPES
|
| 22 |
|
|
|
| 23 |
|
|
#ifdef JUST_NEED_TYPES
|
| 24 |
|
|
# include "common/bn_type.h"
|
| 25 |
|
|
#else
|
| 26 |
|
|
# define JUST_NEED_TYPES
|
| 27 |
|
|
# include "common/bn_type.h"
|
| 28 |
|
|
# undef JUST_NEED_TYPES
|
| 29 |
|
|
#endif
|
| 30 |
|
|
|
| 31 |
|
|
# include "account.h"
|
| 32 |
|
|
|
| 33 |
|
|
#ifdef CHANNEL_INTERNAL_ACCESS
|
| 34 |
|
|
|
| 35 |
|
|
#ifdef JUST_NEED_TYPES
|
| 36 |
|
|
# include <stdio.h>
|
| 37 |
|
|
# include "connection.h"
|
| 38 |
|
|
# include "common/list.h"
|
| 39 |
|
|
#else
|
| 40 |
|
|
# define JUST_NEED_TYPES
|
| 41 |
|
|
# include <stdio.h>
|
| 42 |
|
|
# include "connection.h"
|
| 43 |
|
|
# include "common/list.h"
|
| 44 |
|
|
# undef JUST_NEED_TYPES
|
| 45 |
|
|
#endif
|
| 46 |
|
|
|
| 47 |
|
|
#endif
|
| 48 |
|
|
|
| 49 |
|
|
#ifdef CHANNEL_INTERNAL_ACCESS
|
| 50 |
|
|
typedef struct channelmember
|
| 51 |
|
|
{
|
| 52 |
|
|
/* standalone mode */
|
| 53 |
|
|
t_connection * connection;
|
| 54 |
|
|
struct channelmember * next;
|
| 55 |
|
|
} t_channelmember;
|
| 56 |
|
|
#endif
|
| 57 |
|
|
|
| 58 |
|
|
typedef enum
|
| 59 |
|
|
{
|
| 60 |
|
|
channel_flags_none=0x00,
|
| 61 |
|
|
channel_flags_public=0x01,
|
| 62 |
|
|
channel_flags_moderated=0x02,
|
| 63 |
|
|
channel_flags_restricted=0x04,
|
| 64 |
|
|
channel_flags_thevoid=0x08,
|
| 65 |
|
|
channel_flags_system=0x10,
|
| 66 |
|
|
channel_flags_official=0x20,
|
| 67 |
|
|
channel_flags_permanent=0x40,
|
| 68 |
|
|
channel_flags_allowbots=0x80,
|
| 69 |
|
|
channel_flags_allowopers=0x100,
|
| 70 |
|
|
channel_flags_clan=0x200,
|
| 71 |
|
|
channel_flags_autoname=0x400
|
| 72 |
|
|
} t_channel_flags;
|
| 73 |
|
|
|
| 74 |
|
|
typedef struct channel
|
| 75 |
|
|
#ifdef CHANNEL_INTERNAL_ACCESS
|
| 76 |
|
|
{
|
| 77 |
|
|
char const * name;
|
| 78 |
|
|
char const * shortname; /* short "alias" for permanent channels, NULL if none */
|
| 79 |
|
|
char const * country;
|
| 80 |
|
|
char const * realmname;
|
| 81 |
|
|
t_channel_flags flags;
|
| 82 |
|
|
int maxmembers;
|
| 83 |
|
|
int currmembers;
|
| 84 |
|
|
char const * clienttag;
|
| 85 |
|
|
unsigned int id;
|
| 86 |
|
|
t_channelmember * memberlist;
|
| 87 |
|
|
t_list * banlist; /* of char * */
|
| 88 |
|
|
char * logname; /* NULL if not logged */
|
| 89 |
|
|
FILE * log; /* NULL if not logging */
|
| 90 |
|
|
}
|
| 91 |
|
|
#endif
|
| 92 |
|
|
t_channel;
|
| 93 |
|
|
|
| 94 |
|
|
#endif
|
| 95 |
|
|
|
| 96 |
|
|
#ifndef JUST_NEED_TYPES
|
| 97 |
|
|
#ifndef INCLUDED_CHANNEL_PROTOS
|
| 98 |
|
|
#define INCLUDED_CHANNEL_PROTOS
|
| 99 |
|
|
|
| 100 |
|
|
#define JUST_NEED_TYPES
|
| 101 |
|
|
#include "connection.h"
|
| 102 |
|
|
#include "message.h"
|
| 103 |
|
|
#include "common/list.h"
|
| 104 |
|
|
#undef JUST_NEED_TYPES
|
| 105 |
|
|
|
| 106 |
|
|
#define CHANNEL_NAME_BANNED "THE VOID"
|
| 107 |
|
|
#define CHANNEL_NAME_KICKED "THE VOID"
|
| 108 |
|
|
#define CHANNEL_NAME_CHAT "Chat"
|
| 109 |
|
|
|
| 110 |
|
|
extern int channel_set_userflags(t_connection * c);
|
| 111 |
|
|
extern t_channel * channel_create(char const * fullname, char const * shortname, char const * clienttag, int permflag, int botflag, int operflag, int logflag, char const * country, char const * realmname, int maxmembers, int moderated, int clan,int autoname) ;
|
| 112 |
|
|
extern int channel_destroy(t_channel * channel, t_elem ** elem);
|
| 113 |
|
|
extern char const * channel_get_name(t_channel const * channel);
|
| 114 |
|
|
extern char const * channel_get_shortname(t_channel const * channel);
|
| 115 |
|
|
extern char const * channel_get_clienttag(t_channel const * channel);
|
| 116 |
|
|
extern t_channel_flags channel_get_flags(t_channel const * channel);
|
| 117 |
|
|
extern int channel_set_flags(t_channel * channel, t_channel_flags flags);
|
| 118 |
|
|
extern int channel_get_permanent(t_channel const * channel);
|
| 119 |
|
|
extern unsigned int channel_get_channelid(t_channel const * channel);
|
| 120 |
|
|
extern int channel_set_channelid(t_channel * channel, unsigned int channelid);
|
| 121 |
|
|
extern int channel_add_connection(t_channel * channel, t_connection * connection);
|
| 122 |
|
|
extern int channel_del_connection(t_channel * channel, t_connection * connection);
|
| 123 |
|
|
extern void channel_update_latency(t_connection * conn);
|
| 124 |
|
|
extern void channel_update_userflags(t_connection * conn);
|
| 125 |
|
|
extern void channel_message_log(t_channel const * channel, t_connection * me, int fromuser, char const * text);
|
| 126 |
|
|
extern void channel_message_send(t_channel const * channel, t_message_type type, t_connection * conn, char const * text);
|
| 127 |
|
|
extern int channel_ban_user(t_channel * channel, char const * user);
|
| 128 |
|
|
extern int channel_unban_user(t_channel * channel, char const * user);
|
| 129 |
|
|
extern int channel_check_banning(t_channel const * channel, t_connection const * user);
|
| 130 |
|
|
extern int channel_rejoin(t_connection * conn);
|
| 131 |
|
|
extern t_list * channel_get_banlist(t_channel const * channel);
|
| 132 |
|
|
extern int channel_get_length(t_channel const * channel);
|
| 133 |
|
|
extern int channel_get_max(t_channel const * channel);
|
| 134 |
|
|
extern int channel_get_curr(t_channel const * channel);
|
| 135 |
|
|
extern int channel_conn_is_tmpOP(t_channel const * channel, t_connection * c);
|
| 136 |
|
|
extern int channel_conn_has_tmpVOICE(t_channel const * channel, t_connection * c);
|
| 137 |
|
|
extern t_connection * channel_get_first(t_channel const * channel);
|
| 138 |
|
|
extern t_connection * channel_get_next(void);
|
| 139 |
|
|
|
| 140 |
|
|
extern int channellist_create(void);
|
| 141 |
|
|
extern int channellist_destroy(void);
|
| 142 |
|
|
extern int channellist_reload(void);
|
| 143 |
|
|
extern t_list * channellist(void);
|
| 144 |
|
|
extern t_channel * channellist_find_channel_by_name(char const * name, char const * locale, char const * realmname);
|
| 145 |
|
|
extern t_channel * channellist_find_channel_bychannelid(unsigned int channelid);
|
| 146 |
|
|
extern int channellist_get_length(void);
|
| 147 |
|
|
|
| 148 |
|
|
#endif
|
| 149 |
|
|
#endif
|