Annotation of ircnowd/src/ngircd/channel.h, Revision 1.1.1.1
1.1 tomglok 1: /*
2: * ngIRCd -- The Next Generation IRC Daemon
3: * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
4: *
5: * This program is free software; you can redistribute it and/or modify
6: * it under the terms of the GNU General Public License as published by
7: * the Free Software Foundation; either version 2 of the License, or
8: * (at your option) any later version.
9: * Please read the file COPYING, README and AUTHORS for more information.
10: */
11:
12: #ifndef __channel_h__
13: #define __channel_h__
14:
15: /**
16: * @file
17: * Channel management (header)
18: */
19:
20: #if defined(__channel_c__) | defined(S_SPLINT_S)
21:
22: #include "lists.h"
23: #include "defines.h"
24: #include "array.h"
25:
26: typedef struct _CHANNEL
27: {
28: struct _CHANNEL *next;
29: char name[CHANNEL_NAME_LEN]; /* Name of the channel */
30: UINT32 hash; /* Hash of the (lowecase!) name */
31: char modes[CHANNEL_MODE_LEN]; /* Channel modes */
32: array topic; /* Topic of the channel */
33: #ifndef STRICT_RFC
34: time_t creation_time; /* Channel creation time */
35: time_t topic_time; /* Time when topic was set */
36: char topic_who[CLIENT_NICK_LEN];/* Nickname of user that set topic */
37: #endif
38: char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
39: unsigned long maxusers; /* Maximum number of members (mode "l") */
40: struct list_head list_bans; /* list head of banned users */
41: struct list_head list_excepts; /* list head of (ban) exception list */
42: struct list_head list_invites; /* list head of invited users */
43: array keyfile; /* Name of the channel key file */
44: } CHANNEL;
45:
46: typedef struct _CLIENT2CHAN
47: {
48: struct _CLIENT2CHAN *next;
49: CLIENT *client;
50: CHANNEL *channel;
51: char modes[CHANNEL_MODE_LEN]; /* User-Modes in Channel */
52: } CL2CHAN;
53:
54: #else
55:
56: typedef POINTER CHANNEL;
57: typedef POINTER CL2CHAN;
58:
59: #endif
60:
61: GLOBAL struct list_head *Channel_GetListBans PARAMS((CHANNEL *c));
62: GLOBAL struct list_head *Channel_GetListExcepts PARAMS((CHANNEL *c));
63: GLOBAL struct list_head *Channel_GetListInvites PARAMS((CHANNEL *c));
64:
65: GLOBAL void Channel_Init PARAMS(( void ));
66: GLOBAL void Channel_InitPredefined PARAMS(( void ));
67: GLOBAL void Channel_Exit PARAMS(( void ));
68:
69: GLOBAL bool Channel_Join PARAMS(( CLIENT *Client, const char *Name ));
70: GLOBAL bool Channel_Part PARAMS(( CLIENT *Client, CLIENT *Origin, const char *Name, const char *Reason ));
71:
72: GLOBAL void Channel_Quit PARAMS(( CLIENT *Client, const char *Reason ));
73:
74: GLOBAL void Channel_Kick PARAMS((CLIENT *Peer, CLIENT *Target, CLIENT *Origin,
75: const char *Name, const char *Reason));
76:
77: GLOBAL unsigned long Channel_CountVisible PARAMS((CLIENT *Client));
78: GLOBAL unsigned long Channel_MemberCount PARAMS(( CHANNEL *Chan ));
79: GLOBAL int Channel_CountForUser PARAMS(( CLIENT *Client ));
80:
81: GLOBAL const char *Channel_Name PARAMS(( const CHANNEL *Chan ));
82: GLOBAL char *Channel_Topic PARAMS(( CHANNEL *Chan ));
83: GLOBAL char *Channel_Key PARAMS(( CHANNEL *Chan ));
84: GLOBAL unsigned long Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
85:
86: GLOBAL void Channel_SetTopic PARAMS(( CHANNEL *Chan, CLIENT *Client, const char *Topic ));
87: GLOBAL void Channel_SetModes PARAMS(( CHANNEL *Chan, const char *Modes ));
88: GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, const char *Key ));
89: GLOBAL void Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, unsigned long Count ));
90:
91: GLOBAL CHANNEL *Channel_Search PARAMS(( const char *Name ));
92:
93: GLOBAL CHANNEL *Channel_First PARAMS(( void ));
94: GLOBAL CHANNEL *Channel_Next PARAMS(( CHANNEL *Chan ));
95:
96: GLOBAL CL2CHAN *Channel_FirstMember PARAMS(( CHANNEL *Chan ));
97: GLOBAL CL2CHAN *Channel_NextMember PARAMS(( CHANNEL *Chan, CL2CHAN *Cl2Chan ));
98: GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS(( CLIENT *Client ));
99: GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT *Client, CL2CHAN *Cl2Chan ));
100:
101: GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan ));
102: GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan ));
103:
104: GLOBAL bool Channel_IsValidName PARAMS(( const char *Name ));
105:
106: GLOBAL bool Channel_ModeAdd PARAMS(( CHANNEL *Chan, char Mode ));
107: GLOBAL bool Channel_ModeDel PARAMS(( CHANNEL *Chan, char Mode ));
108: GLOBAL bool Channel_HasMode PARAMS(( CHANNEL *Chan, char Mode ));
109: GLOBAL char *Channel_Modes PARAMS(( CHANNEL *Chan ));
110:
111: GLOBAL bool Channel_UserModeAdd PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode ));
112: GLOBAL bool Channel_UserModeDel PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode ));
113: GLOBAL bool Channel_UserHasMode PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode ));
114: GLOBAL char *Channel_UserModes PARAMS(( CHANNEL *Chan, CLIENT *Client ));
115:
116: GLOBAL bool Channel_IsMemberOf PARAMS(( CHANNEL *Chan, CLIENT *Client ));
117:
118: GLOBAL bool Channel_Write PARAMS((CHANNEL *Chan, CLIENT *From, CLIENT *Client,
119: const char *Command, bool SendErrors,
120: const char *Text));
121:
122: GLOBAL CHANNEL *Channel_Create PARAMS(( const char *Name ));
123:
124: #ifndef STRICT_RFC
125: GLOBAL unsigned int Channel_TopicTime PARAMS(( CHANNEL *Chan ));
126: GLOBAL char *Channel_TopicWho PARAMS(( CHANNEL *Chan ));
127: GLOBAL unsigned int Channel_CreationTime PARAMS(( CHANNEL *Chan ));
128: #endif
129:
130: GLOBAL bool Channel_AddBan PARAMS((CHANNEL *c, const char *Mask, const char *who));
131: GLOBAL bool Channel_AddExcept PARAMS((CHANNEL *c, const char *Mask, const char *who));
132: GLOBAL bool Channel_AddInvite PARAMS((CHANNEL *c, const char *Mask,
133: bool OnlyOnce, const char *who));
134:
135: GLOBAL bool Channel_ShowBans PARAMS((CLIENT *client, CHANNEL *c));
136: GLOBAL bool Channel_ShowExcepts PARAMS((CLIENT *client, CHANNEL *c));
137: GLOBAL bool Channel_ShowInvites PARAMS((CLIENT *client, CHANNEL *c));
138:
139: GLOBAL void Channel_LogServer PARAMS((const char *msg));
140:
141: GLOBAL bool Channel_CheckKey PARAMS((CHANNEL *Chan, CLIENT *Client,
142: const char *Key));
143:
144: GLOBAL void Channel_CheckAdminRights PARAMS((CHANNEL *Chan, CLIENT *Client,
145: CLIENT *Origin, bool *OnChannel,
146: bool *AdminOk, bool *UseServerMode));
147:
148: #define Channel_IsLocal(c) (Channel_Name(c)[0] == '&')
149: #define Channel_IsModeless(c) (Channel_Name(c)[0] == '+')
150:
151: #endif
152:
153: /* -eof- */
CVSweb