cmds.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef _CMDS_H
  2. #define _CMDS_H
  3. #include "types.h"
  4. typedef struct {
  5. const char *name;
  6. const char *flags;
  7. Function func;
  8. const char *funcname;
  9. int type;
  10. } cmd_t;
  11. typedef struct {
  12. int type;
  13. const char *cmd;
  14. size_t garble_len;
  15. const char *desc;
  16. } help_t;
  17. typedef struct {
  18. const char *name;
  19. struct flag_record flags;
  20. int type;
  21. } mycmds;
  22. typedef struct {
  23. const char *name;
  24. // Function func;
  25. void (*func) (int, char *);
  26. int type;
  27. } botcmd_t;
  28. const botcmd_t *search_botcmd_t(const botcmd_t *table, const char* key, size_t elements);
  29. typedef struct cmd_pass {
  30. struct cmd_pass *next;
  31. char *name;
  32. char pass[SHA1_SALTED_LEN + 1];
  33. } cmd_pass_t;
  34. extern mycmds cmdlist[];
  35. extern int cmdi;
  36. static inline bool
  37. __attribute__((pure))
  38. is_restricted_cmd(const char* name)
  39. {
  40. if (name) {
  41. if (!HAVE_MDOP && !strcasecmp(name, "mmode"))
  42. return 1;
  43. }
  44. return 0;
  45. }
  46. #define findhelp(x) findcmd(x, 1)
  47. const help_t *findcmd(const char *lookup, bool care_about_type) __attribute__((pure));
  48. int check_dcc_attrs(struct userrec *, flag_t);
  49. int check_dcc_chanattrs(struct userrec *, char *, flag_t, flag_t);
  50. int stripmodes(const char *) __attribute__((pure));
  51. const char *stripmasktype(int);
  52. void gotremotecmd(char * forbot, char * frombot, char * fromhand, char * fromidx, char * cmd);
  53. void gotremotereply(char * frombot, char * tohand, char * toidx, char * ln);
  54. #endif /* !_CMDS_H */