summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-15 03:03:23 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-15 03:03:23 +0000
commiteb4229deed0281ae566ef7e55a144e5d3183a4b2 (patch)
treeb99c2b78da26b68e04dcccba5bc6efb55706d237 /include
parent84b6d82413c71c845c97279ea9150089cd9f8b5a (diff)
Moved a ton of functions into helperfuncs.h to speed up recompiles
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1383 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/hashcomp.h89
-rw-r--r--include/helperfuncs.h72
-rw-r--r--include/inspircd.h56
3 files changed, 163 insertions, 54 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
new file mode 100644
index 000000000..0611cf239
--- /dev/null
+++ b/include/hashcomp.h
@@ -0,0 +1,89 @@
+#ifndef _HASHCOMP_H_
+#define _HASHCOMP_H_
+
+#include "inspircd.h"
+#include "inspircd_io.h"
+#include "inspircd_util.h"
+#include "inspircd_config.h"
+
+#ifdef GCC3
+#include <ext/hash_map>
+#else
+#include <hash_map>
+#endif
+
+#ifdef GCC3
+#define nspace __gnu_cxx
+#else
+#define nspace std
+#endif
+
+using namespace std;
+
+namespace nspace
+{
+#ifdef GCC34
+ template<> struct hash<in_addr>
+#else
+ template<> struct nspace::hash<in_addr>
+#endif
+ {
+ size_t operator()(const struct in_addr &a) const
+ {
+ size_t q;
+ memcpy(&q,&a,sizeof(size_t));
+ return q;
+ }
+ };
+#ifdef GCC34
+ template<> struct hash<string>
+#else
+ template<> struct nspace::hash<string>
+#endif
+ {
+ size_t operator()(const string &s) const
+ {
+ char a[MAXBUF];
+ static struct hash<const char *> strhash;
+ strlcpy(a,s.c_str(),MAXBUF);
+ strlower(a);
+ return strhash(a);
+ }
+ };
+}
+
+
+struct StrHashComp
+{
+
+ bool operator()(const string& s1, const string& s2) const
+ {
+ char a[MAXBUF],b[MAXBUF];
+ strlcpy(a,s1.c_str(),MAXBUF);
+ strlcpy(b,s2.c_str(),MAXBUF);
+ strlower(a);
+ strlower(b);
+ return (strcasecmp(a,b) == 0);
+ }
+
+};
+
+struct InAddr_HashComp
+{
+
+ bool operator()(const in_addr &s1, const in_addr &s2) const
+ {
+ size_t q;
+ size_t p;
+
+ memcpy(&q,&s1,sizeof(size_t));
+ memcpy(&p,&s2,sizeof(size_t));
+
+ return (q == p);
+ }
+
+};
+
+
+
+#endif
diff --git a/include/helperfuncs.h b/include/helperfuncs.h
new file mode 100644
index 000000000..b7078f56a
--- /dev/null
+++ b/include/helperfuncs.h
@@ -0,0 +1,72 @@
+#ifndef _HELPER_H_
+#define _HELPER_H_
+
+#include "dynamic.h"
+#include "base.h"
+#include "ctables.h"
+#include "users.h"
+#include "channels.h"
+#include <string>
+#include <deque>
+#include <sstream>
+
+void log(int level,char *text, ...);
+void readfile(file_cache &F, const char* fname);
+void Write(int sock,char *text, ...);
+void WriteServ(int sock, char* text, ...);
+void WriteFrom(int sock, userrec *user,char* text, ...);
+void WriteTo(userrec *source, userrec *dest,char *data, ...);
+void WriteChannel(chanrec* Ptr, userrec* user, char* text, ...);
+void WriteChannelLocal(chanrec* Ptr, userrec* user, char* text, ...);
+void WriteChannelWithServ(char* ServName, chanrec* Ptr, char* text, ...);
+void ChanExceptSender(chanrec* Ptr, userrec* user, char* text, ...);
+std::string GetServerDescription(char* servername);
+void WriteCommon(userrec *u, char* text, ...);
+void WriteCommonExcept(userrec *u, char* text, ...);
+void WriteOpers(char* text, ...);
+void NoticeAllOpers(userrec *source, bool local_only, char* text, ...);
+bool ChanAnyOnThisServer(chanrec *c,char* servername);
+bool CommonOnThisServer(userrec* u,const char* servername);
+void NetSendToCommon(userrec* u, char* s);
+void NetSendToAll(char* s);
+void NetSendToAll_WithSum(char* s,char* u);
+void NetSendToAllAlive(char* s);
+void NetSendToOne(char* target,char* s);
+void NetSendToAllExcept(const char* target,char* s);
+void NetSendToAllExcept_WithSum(const char* target,char* s,char* u);
+void WriteMode(const char* modes, int flags, const char* text, ...);
+void NoticeAll(userrec *source, bool local_only, char* text, ...);
+void WriteWallOps(userrec *source, bool local_only, char* text, ...);
+void strlower(char *n);
+userrec* Find(std::string nick);
+chanrec* FindChan(const char* chan);
+long GetMaxBans(char* name);
+void purge_empty_chans(userrec* u);
+char* chanmodes(chanrec *chan);
+void userlist(userrec *user,chanrec *c);
+int usercount_i(chanrec *c);
+int usercount(chanrec *c);
+char* Passwd(userrec *user);
+bool IsDenied(userrec *user);
+void send_error(char *s);
+void Error(int status);
+int usercnt(void);
+int registered_usercount(void);
+int usercount_invisible(void);
+int usercount_opers(void);
+int usercount_unknown(void);
+long chancount(void);
+long count_servs(void);
+long servercount(void);
+long local_count();
+void ShowMOTD(userrec *user);
+void ShowRULES(userrec *user);
+bool AllModulesReportReady(userrec* user);
+char islast(const char* s);
+long map_count(const char* s);
+void createcommand(char* cmd, handlerfunc f, char flags, int minparams,char* source);
+void SetupCommandTable(void);
+bool DirValid(char* dirandfile);
+std::string GetFullProgDir(char** argv, int argc);
+
+#endif
diff --git a/include/inspircd.h b/include/inspircd.h
index 4a6e98437..27c90cce8 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -87,28 +87,8 @@ typedef void (handlerfunc) (char**, int, userrec*);
/* prototypes */
int InspIRCd(char** argv, int argc);
int InitConfig(void);
-void Error(int status);
-void send_error(char *s);
void ReadConfig(bool bail,userrec* user);
-void strlower(char *n);
-
-void WriteOpers(char* text, ...);
-void WriteMode(const char* modes, int flags, const char* text, ...);
-void log(int level, char *text, ...);
-void Write(int sock,char *text, ...);
-void WriteServ(int sock, char* text, ...);
-void WriteFrom(int sock, userrec *user,char* text, ...);
-void WriteTo(userrec *source, userrec *dest,char *data, ...);
-void WriteChannel(chanrec* Ptr, userrec* user, char* text, ...);
-void ChanExceptSender(chanrec* Ptr, userrec* user, char* text, ...);
-void WriteCommon(userrec *u, char* text, ...);
-void WriteCommonExcept(userrec *u, char* text, ...);
-void WriteWallOps(userrec *source, bool local_only, char* text, ...);
-void WriteChannelLocal(chanrec* Ptr, userrec* user, char* text, ...);
-void WriteChannelWithServ(char* ServerName, chanrec* Ptr, char* text, ...);
-char* chanmodes(chanrec *chan);
-userrec* Find(std::string nick);
-chanrec* FindChan(const char* chan);
+
std::string getservername();
std::string getserverdesc();
std::string getnetworkname();
@@ -127,55 +107,22 @@ chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool
void force_nickchange(userrec* user,const char* newnick);
void kill_link(userrec *user,const char* r);
void kill_link_silent(userrec *user,const char* r);
-int usercount(chanrec *c);
void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user);
long GetRevision();
int loop_call(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins);
void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason);
-void purge_empty_chans(userrec* user);
-char* Passwd(userrec *user);
-bool IsDenied(userrec *user);
void AddWhoWas(userrec* u);
-void userlist(userrec *user,chanrec *c);
-std::string GetServerDescription(char* servername);
-int usercnt(void);
-int registered_usercount(void);
-int usercount_invisible(void);
-int usercount_opers(void);
-int usercount_unknown(void);
-long chancount(void);
-long count_servs(void);
-long servercount(void);
-long local_count();
-void ShowMOTD(userrec *user);
-void ShowRULES(userrec *user);
-int usercount(chanrec *c);
-int usercount_i(chanrec *c);
void update_stats_l(int fd,int data_out);
void ConnectUser(userrec *user);
void DoSplitEveryone();
-char islast(const char* s);
-long map_count(const char* s);
userrec* ReHashNick(char* Old, char* New);
-long GetMaxBans(char* name);
bool LoadModule(const char* filename);
bool UnloadModule(const char* filename);
char* ModuleError();
void NoticeAll(userrec *source, bool local_only, char* text, ...);
void NoticeAllOpers(userrec *source, bool local_only, char* text, ...);
-// mesh network functions
-
-void NetSendToCommon(userrec* u, char* s);
-void NetSendToAll(char* s);
-void NetSendToAll_WithSum(char* s,char* u);
-void NetSendToAllAlive(char* s);
-void NetSendToOne(char* target,char* s);
-void NetSendToAllExcept(const char* target,char* s);
-void NetSendToAllExcept_WithSum(const char* target,char* s,char* u);
void NetSendMyRoutingTable();
-bool ChanAnyOnThisServer(chanrec *c,char* servername);
-bool CommonOnThisServer(userrec* u,const char* servername);
void DoSplit(const char* params);
void RemoveServer(const char* name);
void DoSync(serverrec* serv, char* tcp_host);
@@ -185,3 +132,4 @@ void DoSync(serverrec* serv, char* tcp_host);
void AddOper(userrec* user);
void DeleteOper(userrec* user);
+void handle_version(char **parameters, int pcnt, userrec *user);