#define SPARSE 40
#define NONE 50
-void log(int level,char *text, ...);
+/* I'm not entirely happy with this, the ## before 'args' is a g++ extension.
+ * The problem is that if you #define log(l, x, args...) and then call it
+ * with only two parameters, you get do_log(l, x, ), which is a syntax error...
+ * The ## tells g++ to remove the trailing comma...
+ * If this is ever an issue, we can just have an #ifndef GCC then #define log(a...) do_log(a)
+ */
+#define STRINGIFY2(x) #x
+#define STRINGIFY(x) STRINGIFY2(x)
+#define log(l, x, args...) do_log(l, __FILE__ ":" STRINGIFY(__LINE__) ": " x, ##args)
+
+void do_log(int level, const char *text, ...);
void readfile(file_cache &F, const char* fname);
void Write(int sock,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 WriteChannelWithServ(const char* ServName, chanrec* Ptr, const char* text, ...);
void ChanExceptSender(chanrec* Ptr, userrec* user, char status, char* text, ...);
void WriteCommon(userrec *u, char* text, ...);
void WriteCommonExcept(userrec *u, char* text, ...);
void WriteTo_NoFormat(userrec *source, userrec *dest,const char *data);
void WriteChannel_NoFormat(chanrec* Ptr, userrec* user, const char* text);
void WriteChannelLocal_NoFormat(chanrec* Ptr, userrec* user, const char* text);
-void WriteChannelWithServ_NoFormat(char* ServName, chanrec* Ptr, const char* text);
+void WriteChannelWithServ_NoFormat(const char* ServName, chanrec* Ptr, const char* text);
void ChanExceptSender_NoFormat(chanrec* Ptr, userrec* user, char status, const char* text);
void WriteCommon_NoFormat(userrec *u, const char* text);
void WriteCommonExcept_NoFormat(userrec *u, const char* text);
void WriteOpers_NoFormat(const char* text);
-std::string GetServerDescription(char* servername);
+std::string GetServerDescription(const char* servername);
void WriteMode(const char* modes, int flags, const char* text, ...);
void NoticeAll(userrec *source, bool local_only, char* text, ...);
void ServerNoticeAll(char* text, ...);