added basic ssl support to ircu
[ircu2.10.12-pk.git] / include / s_user.h
index 47fee6c3f74a759d0b1f3e91208b91fd80a5bcf6..63ed134d2c52bf193e39799344a673533a2a29f3 100644 (file)
@@ -1,18 +1,32 @@
-#ifndef S_USER_H
-#define S_USER_H
-
-/*=============================================================================
- * Macro's
+/** @file s_user.h
+ * @brief Miscellaneous user-related helper functions.
+ * @version $Id$
  */
+#ifndef INCLUDED_s_user_h
+#define INCLUDED_s_user_h
+#ifndef INCLUDED_sys_types_h
+#include <sys/types.h>
+#define INCLUDED_sys_types_h
+#endif
+
+struct Client;
+struct User;
+struct Channel;
+struct MsgBuf;
+struct Flags;
 
 /*
- * Nick flood limit
+ * Macros
+ */
+
+/**
+ * Nick flood limit.
  * Minimum time between nick changes.
  * (The first two changes are allowed quickly after another however).
  */
 #define NICK_DELAY 30
 
-/*
+/**
  * Target flood time.
  * Minimum time between target changes.
  * (MAXTARGETS are allowed simultaneously however).
 
 /* return values for hunt_server() */
 
-#define HUNTED_NOSUCH  (-1)    /* if the hunted server is not found */
-#define HUNTED_ISME    0       /* if this server should execute the command */
-#define HUNTED_PASS    1       /* if message passed onwards successfully */
+#define HUNTED_NOSUCH   (-1)    /**< if the hunted server is not found */
+#define HUNTED_ISME     0       /**< if this server should execute the command */
+#define HUNTED_PASS     1       /**< if message passed onwards successfully */
+
+/* send sets for send_umode() */
+#define ALL_UMODES 0  /**< both local and global user modes */
+#define SEND_UMODES 1  /**< global user modes only */
+#define SEND_UMODES_BUT_OPER 2  /**< global user modes except for FLAG_OPER */
 
 /* used when sending to #mask or $mask */
 
-#define MATCH_SERVER  1
-#define MATCH_HOST    2
+#define MATCH_SERVER  1 /**< flag for relay_masked_message (etc) to indicate the mask matches a server name */
+#define MATCH_HOST    2 /**< flag for relay_masked_message (etc) to indicate the mask matches host name */
+
+/* used for parsing user modes */
+#define ALLOWMODES_ANY 0 /**< Allow any user mode */
+#define ALLOWMODES_DEFAULT  1 /**< Only allow the subset of modes that are legit defaults */
 
-/*=============================================================================
- * Proto types
+/** Formatter function for send_user_info().
+ * @param who Client being displayed.
+ * @param sptr Client requesting information.
+ * @param buf Message buffer that should receive the response text.
  */
+typedef void (*InfoFormatter)(struct Client* who, struct Client *sptr, struct MsgBuf* buf);
 
-extern int m_umode(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int is_silenced(aClient *sptr, aClient *acptr);
-extern int hunt_server(int, aClient *cptr, aClient *sptr,
-    char *command, int server, int parc, char *parv[]);
-extern aClient *next_client(aClient *next, char *ch);
-extern int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_private(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_notice(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_wallchops(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_cprivmsg(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_cnotice(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_user(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_quit(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_away(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_ping(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_pong(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_pass(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_userhost(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_userip(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern int m_ison(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern char *umode_str(aClient *cptr);
-extern void send_umode(aClient *cptr, aClient *sptr, int old, int sendmask);
-extern int del_silence(aClient *sptr, char *mask);
-extern int m_silence(aClient *cptr, aClient *sptr, int parc, char *parv[]);
-extern void set_snomask(aClient *, snomask_t, int);
+/*
+ * Prototypes
+ */
+extern struct User* make_user(struct Client *cptr);
+extern void         free_user(struct User *user);
+extern int          register_user(struct Client* cptr, struct Client *sptr);
+
+extern void         user_count_memory(size_t* count_out, size_t* bytes_out);
+
+extern int set_nick_name(struct Client* cptr, struct Client* sptr,
+                         const char* nick, int parc, char* parv[]);
+extern void send_umode_out(struct Client* cptr, struct Client* sptr,
+                          struct Flags* old, int prop);
+extern int whisper(struct Client* source, const char* nick,
+                   const char* channel, const char* text, int is_notice);
+extern void send_user_info(struct Client* to, char* names, int rpl,
+                           InfoFormatter fmt);
+
+extern int hide_hostmask(struct Client *cptr, unsigned int flags);
+extern int set_user_mode(struct Client *cptr, struct Client *sptr,
+                         int parc, char *parv[], int allow_modes);
+extern int is_silenced(struct Client *sptr, struct Client *acptr);
+extern int hunt_server_cmd(struct Client *from, const char *cmd,
+                          const char *tok, struct Client *one,
+                          int MustBeOper, const char *pattern, int server,
+                          int parc, char *parv[]);
+extern int hunt_server_prio_cmd(struct Client *from, const char *cmd,
+                               const char *tok, struct Client *one,
+                               int MustBeOper, const char *pattern,
+                               int server, int parc, char *parv[]);
+extern struct Client* next_client(struct Client* next, const char* ch);
+extern char *umode_str(struct Client *cptr);
+extern void send_umode(struct Client *cptr, struct Client *sptr,
+                       struct Flags *old, int sendset);
+extern void set_snomask(struct Client *, unsigned int, int);
 extern int is_snomask(char *);
-extern int check_target_limit(aClient *sptr, void *target, const char *name,
+extern int check_target_limit(struct Client *sptr, void *target, const char *name,
     int created);
-extern void add_target(aClient *sptr, void *target);
+extern void add_target(struct Client *sptr, void *target);
+extern unsigned int umode_make_snomask(unsigned int oldmask, char *arg,
+                                       int what);
+extern int send_supported(struct Client *cptr);
+
+#define NAMES_ALL 1 /**< List all users in channel */
+#define NAMES_VIS 2 /**< List only visible users in non-secret channels */
+#define NAMES_EON 4 /**< Add an 'End Of Names' reply to the end */
+#define NAMES_DEL 8 /**< Show delayed joined users only */
 
-extern struct SLink *opsarray[];
+void do_names(struct Client* sptr, struct Channel* chptr, int filter);
 
-#endif /* S_USER_H */
+#endif /* INCLUDED_s_user_h */