(thanks to the people reading git and excessively exploiting this bug... It was undet...
[NeonServV5.git] / src / ChanUser.h
1 /* ChanUser.h - NeonServ v5.6
2  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
3  * 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License 
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
16  */
17 #ifndef _ChanUser_h
18 #define _ChanUser_h
19 #include "main.h"
20
21 #define CHANUSERFLAG_OPPED     0x01
22 #define CHANUSERFLAG_VOICED    0x02
23 #define CHANUSERFLAG_INVISIBLE 0x04
24 #define CHANUSERFLAG_HALFOPPED 0x08
25 #define CHANUSERFLAG_PARTING   0x10
26
27 #define CHANUSERFLAG_OPPED_OR_VOICED (CHANUSERFLAG_OPPED | CHANUSERFLAG_HALFOPPED | CHANUSERFLAG_VOICED)
28
29 struct ChanNode;
30 struct UserNode;
31 struct NeonSpamNode;
32
33 struct ChanUser {
34     unsigned char flags;
35     struct ChanNode *chan;
36     struct UserNode *user;
37     
38     int visCount : 8; //visible counter - if this is 0, the ChanUser gets removed
39     int old_visCount : 8;
40     
41     int chageEvents;
42     time_t changeTime;
43     
44     struct NeonSpamNode *spamnode;
45     
46     struct ChanUser *next_user;
47     struct ChanUser *next_chan;
48 };
49
50 #ifndef DND_FUNCTIONS
51 struct ChanUser* addChanUser(struct ChanNode *chan, struct UserNode *user);
52 struct ChanUser* addInvisibleChanUser(struct ChanNode *chan, struct UserNode *user);
53 /* MODULAR ACCESSIBLE */ int isUserOnChan(struct UserNode *user, struct ChanNode *chan);
54 /* MODULAR ACCESSIBLE */ struct ChanUser* getChanUser(struct UserNode *user, struct ChanNode *chan);
55 /* MODULAR ACCESSIBLE */ struct ChanUser* getChannelUsers(struct ChanNode *chan, struct ChanUser *last);
56 /* MODULAR ACCESSIBLE */ struct ChanUser* getUserChannels(struct UserNode *user, struct ChanUser *last);
57 void delChanUser(struct ChanUser *chanuser, int freeChanUser);
58 void removeChanUserFromLists(struct ChanUser *chanuser, int remove_from_userlist, int remove_from_channellist, int freeChanUser);
59 void freeChanUser(struct ChanUser *chanuser);
60 #endif
61 #endif