rewrote IRC cache parser to be (hopefully) more stable
[NeonServV5.git] / src / ChanUser.h
1 /* ChanUser.h - NeonServ v5.4
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
26 #define CHANUSERFLAG_OPPED_OR_VOICED (CHANUSERFLAG_OPPED | CHANUSERFLAG_HALFOPPED | CHANUSERFLAG_VOICED)
27
28 struct ChanNode;
29 struct UserNode;
30 struct NeonSpamNode;
31
32 struct ChanUser {
33     unsigned char flags;
34     struct ChanNode *chan;
35     struct UserNode *user;
36     
37     int visCount; //visible counter - if this is 0, the ChanUser gets removed
38     
39     int chageEvents;
40     time_t changeTime;
41     
42     struct NeonSpamNode *spamnode;
43     
44     struct ChanUser *next_user;
45     struct ChanUser *next_chan;
46 };
47
48 #ifndef DND_FUNCTIONS
49 struct ChanUser* addChanUser(struct ChanNode *chan, struct UserNode *user);
50 struct ChanUser* addInvisibleChanUser(struct ChanNode *chan, struct UserNode *user);
51 /* MODULAR ACCESSIBLE */ int isUserOnChan(struct UserNode *user, struct ChanNode *chan);
52 /* MODULAR ACCESSIBLE */ struct ChanUser* getChanUser(struct UserNode *user, struct ChanNode *chan);
53 /* MODULAR ACCESSIBLE */ struct ChanUser* getChannelUsers(struct ChanNode *chan, struct ChanUser *last);
54 /* MODULAR ACCESSIBLE */ struct ChanUser* getUserChannels(struct UserNode *user, struct ChanUser *last);
55 void delChanUser(struct ChanUser *chanuser, int freeChanUser);
56 void removeChanUserFromLists(struct ChanUser *chanuser, int remove_from_userlist, int remove_from_channellist, int freeChanUser);
57 void freeChanUser(struct ChanUser *chanuser);
58 #endif
59 #endif