]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/helperfuncs.h
Add support for channelmode +i
[user/henk/code/inspircd.git] / include / helperfuncs.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 _HELPER_H_
18 #define _HELPER_H_
19
20 #include "dynamic.h"
21 #include "base.h"
22 #include "ctables.h"
23 #include "users.h"
24 #include "channels.h"
25 #include "typedefs.h"
26 #include <string>
27 #include <deque>
28 #include <sstream>
29
30 /** Flags for use with log()
31  */
32 #define DEBUG 10
33 #define VERBOSE 20
34 #define DEFAULT 30
35 #define SPARSE 40
36 #define NONE 50
37
38 /* I'm not entirely happy with this, the ## before 'args' is a g++ extension.
39  * The problem is that if you #define log(l, x, args...) and then call it
40  * with only two parameters, you get do_log(l, x, ), which is a syntax error...
41  * The ## tells g++ to remove the trailing comma...
42  * If this is ever an issue, we can just have an #ifndef GCC then #define log(a...) do_log(a)
43  */
44 #define STRINGIFY2(x) #x
45 #define STRINGIFY(x) STRINGIFY2(x) 
46 #define log(l, x, args...) do_log(l, __FILE__ ":" STRINGIFY(__LINE__) ": " x, ##args)
47
48 void do_log(int level, const char *text, ...);
49 void readfile(file_cache &F, const char* fname);
50
51 void Write(int sock,char *text, ...);
52 void WriteServ(int sock, char* text, ...);
53 void WriteFrom(int sock, userrec *user,char* text, ...);
54 void WriteTo(userrec *source, userrec *dest,char *data, ...);
55 void WriteChannel(chanrec* Ptr, userrec* user, char* text, ...);
56 void WriteChannelLocal(chanrec* Ptr, userrec* user, char* text, ...);
57 void WriteChannelWithServ(const char* ServName, chanrec* Ptr, const char* text, ...);
58 void ChanExceptSender(chanrec* Ptr, userrec* user, char status, char* text, ...);
59 void WriteCommon(userrec *u, char* text, ...);
60 void WriteCommonExcept(userrec *u, char* text, ...);
61 void WriteOpers(const char* text, ...);
62
63 void Write_NoFormat(int sock,const char *text);
64 void WriteServ_NoFormat(int sock, const char* text);
65 void WriteFrom_NoFormat(int sock, userrec *user,const char* text);
66 void WriteTo_NoFormat(userrec *source, userrec *dest,const char *data);
67 void WriteChannel_NoFormat(chanrec* Ptr, userrec* user, const char* text);
68 void WriteChannelLocal_NoFormat(chanrec* Ptr, userrec* user, const char* text);
69 void WriteChannelWithServ_NoFormat(const char* ServName, chanrec* Ptr, const char* text);
70 void ChanExceptSender_NoFormat(chanrec* Ptr, userrec* user, char status, const char* text);
71 void WriteCommon_NoFormat(userrec *u, const char* text);
72 void WriteCommonExcept_NoFormat(userrec *u, const char* text);
73 void WriteOpers_NoFormat(const char* text);
74
75 std::string GetServerDescription(const char* servername);
76 void WriteMode(const char* modes, int flags, const char* text, ...);
77 void NoticeAll(userrec *source, bool local_only, char* text, ...);
78 void ServerNoticeAll(char* text, ...);
79 void ServerPrivmsgAll(char* text, ...);
80 void WriteWallOps(userrec *source, bool local_only, char* text, ...);
81 void strlower(char *n);
82 userrec* Find(const std::string &nick);
83 userrec* Find(const char* nick);
84 chanrec* FindChan(const char* chan);
85 long GetMaxBans(char* name);
86 void purge_empty_chans(userrec* u);
87 char* chanmodes(chanrec *chan, bool showkey);
88 void userlist(userrec *user,chanrec *c);
89 int usercount_i(chanrec *c);
90 int usercount(chanrec *c);
91 ConnectClass GetClass(userrec *user);
92 void send_error(char *s);
93 void Error(int status);
94 int usercnt(void);
95 int registered_usercount(void);
96 int usercount_invisible(void);
97 int usercount_opers(void);
98 int usercount_unknown(void);
99 long chancount(void);
100 long local_count();
101 void ShowMOTD(userrec *user);
102 void ShowRULES(userrec *user);
103 bool AllModulesReportReady(userrec* user);
104 bool DirValid(char* dirandfile);
105 bool FileExists(const char* file);
106 char* CleanFilename(char* name);
107 std::string GetFullProgDir(char** argv, int argc);
108 int InsertMode(std::string &output, const char* modes, unsigned short section);
109 bool IsValidChannelName(const char *);
110
111 int charlcat(char* x,char y,int z);
112 bool charremove(char* mp, char remove);
113
114 #endif