1 /* $Id: channels.h 295 2005-12-16 19:44:24Z tsaviran $ 2 * ------------------------------------------------------- 3 * Copyright 2002-2005 Tommi Saviranta <wnd@iki.fi> 4 * (C) 2002 Lee Hardy <lee@leeh.co.uk> 5 * (C) 1998-2002 Sebastian Kienzl <zap@riot.org> 6 * ------------------------------------------------------- 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 */ 17 18 #ifndef CHANNELS_H_ 19 #define CHANNELS_H_ 20 21 #ifdef HAVE_CONFIG_H 22 #include <config.h> 23 #endif /* ifdef HAVE_CONFIG_H */ 24 25 #include "llist.h" 26 #include "conntype.h" 27 28 #include <stdio.h> 29 30 31 32 enum { 33 LIST_PASSIVE = 0, 34 LIST_ACTIVE, 35 LIST_OLD 36 }; 37 38 #define JOINTRIES_UNSET -1 39 40 struct channel_log { 41 int type; 42 FILE *file; 43 }; 44 45 typedef struct { 46 /* 47 * name is the real name of a channel. This field should differ from 48 * simplename only in case of a safe channel or such. If the channel is 49 * a safe channel, name can be something like "!ONZGEfoobar" while 50 * simplename is "!foobar". simplename is used e.g. for logging and 51 * joining the channel. name and simplename will point to the same 52 * address if they're the same; simple_set will be set once it have 53 * been checked if they should differ. 54 */ 55 char *name; 56 char *simple_name; 57 int name_set; /* real name have been set */ 58 int simple_set; /* simple name have been set */ 59 char *topic; /* Channel topic. */ 60 char *topicwho; /* Topic set by ... */ 61 char *topicwhen; /* Topic set in ... */ 62 char *key; /* Channel key. */ 63 int jointries; /* Remaining # of jointries */ 64 #ifdef AUTOMODE 65 /* 66 * oper: 67 * 0: not operator and we know it 68 * 1: operator and we know it 69 * -1: don't know if we're operator 70 */ 71 int oper; 72 llist_list mode_queue; /* Queue for channel modes. */ 73 #endif /* AUTOMODE */ 74 #ifdef QUICKLOG 75 int hasqlog; /* Channel has qlog. */ 76 #endif /* QUICKLOG */ 77 struct channel_log *log; 78 } channel_type; 79 80 struct llist_list; 81 extern llist_list active_channels; 82 extern llist_list passive_channels; 83 extern llist_list old_channels; 84 85 void channel_free(channel_type *chan); 86 channel_type *channel_add(const char *channel, const char *key, const int list); 87 void channel_rem(channel_type *chptr, const int list); 88 void channel_drop_all(const int keeplog); 89 channel_type *channel_find(const char *name, int list); 90 void channel_join_list(const int list, const int rejoin, 91 connection_type *client); 92 93 int channel_is_name(const char *name); 94 95 void channel_topic(channel_type *chan, const char *topic); 96 void channel_when(channel_type *chan, const char *who, const char *when); 97 98 char *channel_simplify_name(const char *chan); 99 100 #ifdef OBSOLETE 101 extern unsigned int channel_hash(char *); 102 #endif /* OBSOLETE */ 103 104 105 106 #endif /* ifndef CHANNELS_H_ */ 107