]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/mode.h
08ac335971547f175fb8b1a446e78b5b28ab7a9e
[user/henk/code/inspircd.git] / include / mode.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #ifndef __MODE_H
18 #define __MODE_H
19
20 // include the common header files
21
22 #include <typeinfo>
23 #include <iostream>
24 #include <string>
25 #include <deque>
26 #include <sstream>
27 #include <vector>
28 #include "users.h"
29 #include "channels.h"
30 #include "ctables.h"
31
32 enum UserModeBits {
33         UM_INVISIBLE = 1,
34         UM_SERVERNOTICE = 2,
35         UM_WALLOPS = 4
36 };
37
38 class ModeParser
39 {
40  private:
41         char* GiveOps(userrec *user,char *dest,chanrec *chan,int status);
42         char* GiveHops(userrec *user,char *dest,chanrec *chan,int status);
43         char* GiveVoice(userrec *user,char *dest,chanrec *chan,int status);
44         char* TakeOps(userrec *user,char *dest,chanrec *chan,int status);
45         char* TakeHops(userrec *user,char *dest,chanrec *chan,int status);
46         char* TakeVoice(userrec *user,char *dest,chanrec *chan,int status);
47         char* AddBan(userrec *user,char *dest,chanrec *chan,int status);
48         char* TakeBan(userrec *user,char *dest,chanrec *chan,int status);
49         userrec* SanityChecks(userrec *user,char *dest,chanrec *chan,int status);
50         char* Grant(userrec *d,chanrec *chan,int MASK);
51         char* Revoke(userrec *d,chanrec *chan,int MASK);
52  public:
53         std::string CompressModes(std::string modes,bool channelmodes);
54         void ProcessModes(char **parameters,userrec* user,chanrec *chan,int status, int pcnt, bool servermode, bool silent, bool local);
55         bool AllowedUmode(char umode, char* sourcemodes,bool adding,bool serveroverride);
56         bool ProcessModuleUmode(char umode, userrec* source, void* dest, bool adding);
57         void ServerMode(char **parameters, int pcnt, userrec *user);
58 };
59
60 class cmd_mode : public command_t
61 {
62  public:
63         cmd_mode () : command_t("MODE",0,1) { }
64         void Handle(char **parameters, int pcnt, userrec *user);
65 };
66
67 #endif