2001-12-14 09:13:43 +01:00
|
|
|
/*
|
|
|
|
* ngIRCd -- The Next Generation IRC Daemon
|
2012-01-21 19:59:57 +01:00
|
|
|
* Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
|
2001-12-14 09:13:43 +01:00
|
|
|
*
|
2002-12-12 13:23:43 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
* Please read the file COPYING, README and AUTHORS for more information.
|
2001-12-14 09:13:43 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __channel_h__
|
|
|
|
#define __channel_h__
|
|
|
|
|
2010-12-27 17:14:14 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Channel management (header)
|
|
|
|
*/
|
2001-12-14 09:13:43 +01:00
|
|
|
|
2002-03-25 20:11:01 +01:00
|
|
|
#if defined(__channel_c__) | defined(S_SPLINT_S)
|
2002-01-26 19:41:55 +01:00
|
|
|
|
2006-12-07 18:57:20 +01:00
|
|
|
#include "lists.h"
|
2002-03-12 15:37:51 +01:00
|
|
|
#include "defines.h"
|
2005-07-28 18:23:55 +02:00
|
|
|
#include "array.h"
|
2002-03-12 15:37:51 +01:00
|
|
|
|
2002-01-26 19:41:55 +01:00
|
|
|
typedef struct _CHANNEL
|
|
|
|
{
|
|
|
|
struct _CHANNEL *next;
|
2005-03-19 19:43:48 +01:00
|
|
|
char name[CHANNEL_NAME_LEN]; /* Name of the channel */
|
2002-12-17 00:05:24 +01:00
|
|
|
UINT32 hash; /* Hash of the (lowecase!) name */
|
2005-03-19 19:43:48 +01:00
|
|
|
char modes[CHANNEL_MODE_LEN]; /* Channel modes */
|
2005-07-28 18:23:55 +02:00
|
|
|
array topic; /* Topic of the channel */
|
2005-09-02 14:50:25 +02:00
|
|
|
#ifndef STRICT_RFC
|
2010-11-11 12:39:19 +01:00
|
|
|
time_t creation_time; /* Channel creation time */
|
2005-09-02 14:50:25 +02:00
|
|
|
time_t topic_time; /* Time when topic was set */
|
|
|
|
char topic_who[CLIENT_NICK_LEN];/* Nickname of user that set topic */
|
|
|
|
#endif
|
2005-03-19 19:43:48 +01:00
|
|
|
char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
|
2006-10-06 23:32:58 +02:00
|
|
|
unsigned long maxusers; /* Maximum number of members (mode "l") */
|
2006-12-07 18:57:20 +01:00
|
|
|
struct list_head list_bans; /* list head of banned users */
|
2012-01-21 19:59:57 +01:00
|
|
|
struct list_head list_excepts; /* list head of (ban) exception list */
|
2006-12-07 18:57:20 +01:00
|
|
|
struct list_head list_invites; /* list head of invited users */
|
2009-01-04 17:26:50 +01:00
|
|
|
array keyfile; /* Name of the channel key file */
|
2002-01-26 19:41:55 +01:00
|
|
|
} CHANNEL;
|
|
|
|
|
|
|
|
typedef struct _CLIENT2CHAN
|
|
|
|
{
|
|
|
|
struct _CLIENT2CHAN *next;
|
|
|
|
CLIENT *client;
|
|
|
|
CHANNEL *channel;
|
2008-05-08 03:15:04 +02:00
|
|
|
char modes[CHANNEL_MODE_LEN]; /* User-Modes in Channel */
|
2002-01-26 19:41:55 +01:00
|
|
|
} CL2CHAN;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
typedef POINTER CHANNEL;
|
|
|
|
typedef POINTER CL2CHAN;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2006-12-07 18:57:20 +01:00
|
|
|
GLOBAL struct list_head *Channel_GetListBans PARAMS((CHANNEL *c));
|
2012-01-21 19:59:57 +01:00
|
|
|
GLOBAL struct list_head *Channel_GetListExcepts PARAMS((CHANNEL *c));
|
2006-12-07 18:57:20 +01:00
|
|
|
GLOBAL struct list_head *Channel_GetListInvites PARAMS((CHANNEL *c));
|
2002-01-26 19:41:55 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void Channel_Init PARAMS(( void ));
|
|
|
|
GLOBAL void Channel_InitPredefined PARAMS(( void ));
|
|
|
|
GLOBAL void Channel_Exit PARAMS(( void ));
|
2001-12-14 09:13:43 +01:00
|
|
|
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL bool Channel_Join PARAMS(( CLIENT *Client, const char *Name ));
|
2008-02-05 17:31:35 +01:00
|
|
|
GLOBAL bool Channel_Part PARAMS(( CLIENT *Client, CLIENT *Origin, const char *Name, const char *Reason ));
|
2002-01-21 01:11:59 +01:00
|
|
|
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL void Channel_Quit PARAMS(( CLIENT *Client, const char *Reason ));
|
2002-06-01 16:36:05 +02:00
|
|
|
|
2008-08-18 16:27:56 +02:00
|
|
|
GLOBAL void Channel_Kick PARAMS((CLIENT *Peer, CLIENT *Target, CLIENT *Origin,
|
|
|
|
const char *Name, const char *Reason));
|
2002-01-21 01:11:59 +01:00
|
|
|
|
2011-12-28 15:07:24 +01:00
|
|
|
GLOBAL unsigned long Channel_CountVisible PARAMS((CLIENT *Client));
|
2006-10-06 23:32:58 +02:00
|
|
|
GLOBAL unsigned long Channel_MemberCount PARAMS(( CHANNEL *Chan ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Channel_CountForUser PARAMS(( CLIENT *Client ));
|
2002-01-16 23:09:07 +01:00
|
|
|
|
2006-10-06 23:32:58 +02:00
|
|
|
GLOBAL const char *Channel_Name PARAMS(( const CHANNEL *Chan ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char *Channel_Topic PARAMS(( CHANNEL *Chan ));
|
|
|
|
GLOBAL char *Channel_Key PARAMS(( CHANNEL *Chan ));
|
2006-10-06 23:32:58 +02:00
|
|
|
GLOBAL unsigned long Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
|
2002-02-27 21:32:10 +01:00
|
|
|
|
2008-11-23 00:39:32 +01:00
|
|
|
GLOBAL void Channel_SetTopic PARAMS(( CHANNEL *Chan, CLIENT *Client, const char *Topic ));
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL void Channel_SetModes PARAMS(( CHANNEL *Chan, const char *Modes ));
|
2008-11-23 00:39:32 +01:00
|
|
|
GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, const char *Key ));
|
2006-10-06 23:32:58 +02:00
|
|
|
GLOBAL void Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, unsigned long Count ));
|
2002-01-28 02:16:15 +01:00
|
|
|
|
2008-02-05 17:31:35 +01:00
|
|
|
GLOBAL CHANNEL *Channel_Search PARAMS(( const char *Name ));
|
2002-01-26 19:41:55 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL CHANNEL *Channel_First PARAMS(( void ));
|
2002-12-13 18:22:57 +01:00
|
|
|
GLOBAL CHANNEL *Channel_Next PARAMS(( CHANNEL *Chan ));
|
2002-01-28 02:16:15 +01:00
|
|
|
|
2002-12-13 18:22:57 +01:00
|
|
|
GLOBAL CL2CHAN *Channel_FirstMember PARAMS(( CHANNEL *Chan ));
|
|
|
|
GLOBAL CL2CHAN *Channel_NextMember PARAMS(( CHANNEL *Chan, CL2CHAN *Cl2Chan ));
|
|
|
|
GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS(( CLIENT *Client ));
|
|
|
|
GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT *Client, CL2CHAN *Cl2Chan ));
|
2002-01-26 19:41:55 +01:00
|
|
|
|
2002-12-13 18:22:57 +01:00
|
|
|
GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan ));
|
|
|
|
GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan ));
|
2002-01-26 19:41:55 +01:00
|
|
|
|
2006-10-02 23:55:49 +02:00
|
|
|
GLOBAL bool Channel_IsValidName PARAMS(( const char *Name ));
|
2002-02-06 17:49:10 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL bool Channel_ModeAdd PARAMS(( CHANNEL *Chan, char Mode ));
|
|
|
|
GLOBAL bool Channel_ModeDel PARAMS(( CHANNEL *Chan, char Mode ));
|
2013-08-04 19:28:04 +02:00
|
|
|
GLOBAL bool Channel_HasMode PARAMS(( CHANNEL *Chan, char Mode ));
|
|
|
|
GLOBAL char *Channel_Modes PARAMS(( CHANNEL *Chan ));
|
2002-02-11 02:00:22 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL bool Channel_UserModeAdd PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode ));
|
|
|
|
GLOBAL bool Channel_UserModeDel PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode ));
|
2013-08-04 19:28:04 +02:00
|
|
|
GLOBAL bool Channel_UserHasMode PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char *Channel_UserModes PARAMS(( CHANNEL *Chan, CLIENT *Client ));
|
2002-02-11 02:00:22 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL bool Channel_IsMemberOf PARAMS(( CHANNEL *Chan, CLIENT *Client ));
|
2002-02-27 16:21:21 +01:00
|
|
|
|
2008-08-17 14:59:36 +02:00
|
|
|
GLOBAL bool Channel_Write PARAMS((CHANNEL *Chan, CLIENT *From, CLIENT *Client,
|
|
|
|
const char *Command, bool SendErrors,
|
|
|
|
const char *Text));
|
2002-03-25 17:55:14 +01:00
|
|
|
|
2008-11-23 00:39:32 +01:00
|
|
|
GLOBAL CHANNEL *Channel_Create PARAMS(( const char *Name ));
|
2002-09-04 01:57:57 +02:00
|
|
|
|
2005-09-02 14:50:25 +02:00
|
|
|
#ifndef STRICT_RFC
|
|
|
|
GLOBAL unsigned int Channel_TopicTime PARAMS(( CHANNEL *Chan ));
|
|
|
|
GLOBAL char *Channel_TopicWho PARAMS(( CHANNEL *Chan ));
|
2010-11-11 12:39:19 +01:00
|
|
|
GLOBAL unsigned int Channel_CreationTime PARAMS(( CHANNEL *Chan ));
|
2005-09-02 14:50:25 +02:00
|
|
|
#endif
|
|
|
|
|
2012-01-21 19:59:57 +01:00
|
|
|
GLOBAL bool Channel_AddBan PARAMS((CHANNEL *c, const char *Mask));
|
|
|
|
GLOBAL bool Channel_AddExcept PARAMS((CHANNEL *c, const char *Mask));
|
|
|
|
GLOBAL bool Channel_AddInvite PARAMS((CHANNEL *c, const char *Mask,
|
|
|
|
bool OnlyOnce));
|
2001-12-14 09:13:43 +01:00
|
|
|
|
2006-12-07 18:57:20 +01:00
|
|
|
GLOBAL bool Channel_ShowBans PARAMS((CLIENT *client, CHANNEL *c));
|
2012-01-21 19:59:57 +01:00
|
|
|
GLOBAL bool Channel_ShowExcepts PARAMS((CLIENT *client, CHANNEL *c));
|
2006-12-07 18:57:20 +01:00
|
|
|
GLOBAL bool Channel_ShowInvites PARAMS((CLIENT *client, CHANNEL *c));
|
2008-11-14 00:42:58 +01:00
|
|
|
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL void Channel_LogServer PARAMS((const char *msg));
|
2008-11-17 23:27:06 +01:00
|
|
|
|
2009-01-01 22:26:13 +01:00
|
|
|
GLOBAL bool Channel_CheckKey PARAMS((CHANNEL *Chan, CLIENT *Client,
|
|
|
|
const char *Key));
|
|
|
|
|
2011-01-09 22:40:11 +01:00
|
|
|
GLOBAL void Channel_CheckAdminRights PARAMS((CHANNEL *Chan, CLIENT *Client,
|
|
|
|
CLIENT *Origin, bool *OnChannel,
|
|
|
|
bool *AdminOk, bool *UseServerMode));
|
|
|
|
|
2008-11-14 00:42:58 +01:00
|
|
|
#define Channel_IsLocal(c) (Channel_Name(c)[0] == '&')
|
2009-03-07 00:13:25 +01:00
|
|
|
#define Channel_IsModeless(c) (Channel_Name(c)[0] == '+')
|
2008-11-14 00:42:58 +01:00
|
|
|
|
2001-12-14 09:13:43 +01:00
|
|
|
#endif
|
2008-11-14 00:42:58 +01:00
|
|
|
|
2001-12-14 09:13:43 +01:00
|
|
|
/* -eof- */
|