fix possible crash on user deletion
[srvx.git] / src / helpfile.h
index d7336fa423baeacf0bd03657840b7be573faa840..435f5b4ddf69449f9502c37e3d886306feea5698 100644 (file)
@@ -1,11 +1,12 @@
 /* helpfile.h - Help file loading and display
  * Copyright 2000-2004 srvx Development Team
  *
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of srvx.
+ *
+ * srvx is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.  Important limitations are
- * listed in the COPYING file that accompanies this software.
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -13,7 +14,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, email srvx-maintainers@srvx.net.
+ * along with srvx; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
 #if !defined(HELPFILE_H)
@@ -27,8 +29,8 @@ struct string_list;
 
 extern struct userNode *message_dest; /* message destination; useful in expansion callbacks */
 
-#define MIN_LINE_SIZE          40
-#define MAX_LINE_SIZE          450
+#define MIN_LINE_SIZE       40
+#define MAX_LINE_SIZE       450
 
 #define TABLE_REPEAT_HEADERS 0x0001 /* repeat the headers for each columnset? */
 #define TABLE_PAD_LEFT       0x0002 /* pad cells on the left? */
@@ -70,6 +72,12 @@ struct language
 extern struct language *lang_C;
 extern struct dict *languages;
 
+#define MSG_TYPE_NOTICE    0
+#define MSG_TYPE_PRIVMSG   1
+#define MSG_TYPE_WALLCHOPS 2
+#define MSG_TYPE_NOXLATE   4
+#define MSG_TYPE_MULTILINE 8
+
 int send_message(struct userNode *dest, struct userNode *src, const char *message, ...);
 int send_message_type(int msg_type, struct userNode *dest, struct userNode *src, const char *message, ...);
 int send_target_message(int msg_type, const char *dest, struct userNode *src, const char *format, ...);
@@ -78,9 +86,15 @@ int send_help(struct userNode *dest, struct userNode *src, struct helpfile *hf,
  * irc_send is either irc_privmsg or irc_notice; NULL means figure it out. */
 void table_send(struct userNode *from, const char *to, unsigned int size, irc_send_func irc_send, struct helpfile_table table);
 
-#define send_channel_message(CHANNEL, ARGS...) send_target_message(5, (CHANNEL)->name, ARGS)
-#define send_channel_notice(CHANNEL, ARGS...) send_target_message(4, (CHANNEL)->name, ARGS)
-#define send_channel_wallchops(CHANNEL, ARGS...) send_target_message(6, (CHANNEL)->name, ARGS)
+#if defined(GCC_VARMACROS)
+# define send_channel_message(CHANNEL, ARGS...) send_target_message(5, (CHANNEL)->name, ARGS)
+# define send_channel_notice(CHANNEL, ARGS...) send_target_message(4, (CHANNEL)->name, ARGS)
+# define send_channel_wallchops(CHANNEL, ARGS...) send_target_message(6, (CHANNEL)->name, ARGS)
+#elif defined(C99_VARMACROS)
+# define send_channel_message(CHANNEL, ...) send_target_message(5, (CHANNEL)->name, __VA_ARGS__)
+# define send_channel_notice(CHANNEL, ...) send_target_message(4, (CHANNEL)->name, __VA_ARGS__)
+# define send_channel_wallchops(CHANNEL, ...) send_target_message(6, (CHANNEL)->name, __VA_ARGS__)
+#endif
 
 struct message_entry
 {
@@ -92,6 +106,7 @@ struct language *language_find(const char *name);
 const char *language_find_message(struct language *lang, const char *msgid);
 #define handle_find_message(HANDLE, MSGID) language_find_message((HANDLE) ? (HANDLE)->language : lang_C, (MSGID))
 #define user_find_message(USER, MSGID) language_find_message((USER)->handle_info ? (USER)->handle_info->language : lang_C, (MSGID))
+void helpfile_init(void);
 void helpfile_finalize(void);
 
 struct helpfile *open_helpfile(const char *fname, expand_func_t expand);