channels.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * channels.h -- part of channels.mod
  3. *
  4. */
  5. #ifndef _EGG_MOD_CHANNELS_CHANNELS_H
  6. #define _EGG_MOD_CHANNELS_CHANNELS_H
  7. #define MASKREASON_MAX 307 /* Max length of ban/invite/exempt/etc.
  8. reasons. */
  9. #define MASKREASON_LEN (MASKREASON_MAX + 1)
  10. #ifdef MAKING_CHANNELS
  11. #define PLSMNS(x) (x ? '+' : '-')
  12. static void check_expired_masks(void);
  13. static void tell_masks(const char type, int idx, bool show_inact, char *match, bool all = 0);
  14. static void get_mode_protect(struct chanset_t *chan, char *s, size_t ssiz);
  15. static void set_mode_protect(struct chanset_t *chan, char *set);
  16. static int count_mask(maskrec *);
  17. #endif /* MAKING_CHANNELS */
  18. namespace bd {
  19. class Stream;
  20. class String;
  21. }
  22. void remove_channel(struct chanset_t *);
  23. void add_chanrec_by_handle(struct userrec *, char *, char *);
  24. void get_handle_chaninfo(char *, char *, char *);
  25. void set_handle_chaninfo(struct userrec *, char *, char *, char *);
  26. struct chanuserrec *get_chanrec(struct userrec *u, char *);
  27. struct chanuserrec *add_chanrec(struct userrec *u, char *);
  28. void del_chanrec(struct userrec *, char *);
  29. void write_bans(bd::Stream&, int);
  30. void write_exempts(bd::Stream&, int);
  31. void write_chans(bd::Stream&, int, bool = 0);
  32. void write_chans_compat(bd::Stream&, int);
  33. bd::String channel_to_string(struct chanset_t* chan, bool force_inactive = 0);
  34. void write_invites(bd::Stream&, int);
  35. bool expired_mask(struct chanset_t *, char *);
  36. void set_handle_laston(char *, struct userrec *, time_t);
  37. int u_delmask(char type, struct chanset_t *c, char *who, int doit);
  38. bool u_addmask(char type, struct chanset_t *, char *, const char *, const char *, time_t, int);
  39. int u_sticky_mask(maskrec *, char *);
  40. int u_setsticky_mask(struct chanset_t *, maskrec *, char *, int, const char);
  41. int SplitList(char *, const char *, int *, const char ***);
  42. int channel_modify(char *, struct chanset_t *, int, char **, bool);
  43. int channel_add(char *, const char *, char *, bool = 0);
  44. void clear_channel(struct chanset_t *, bool);
  45. int u_equals_mask(maskrec *, char *);
  46. bool u_match_mask(struct maskrec *, const char *);
  47. bool ismasked(masklist *, const char *);
  48. bool ismodeline(masklist *, const char *);
  49. void channels_report(int, int);
  50. void channels_writeuserfile(bd::Stream&, int = 0);
  51. void rcmd_chans(char *, char *, char *);
  52. /* Macro's here because their functions were replaced by something more
  53. * generic. <cybah>
  54. */
  55. #define isbanned(chan, user) ismasked((chan)->channel.ban, user)
  56. #define isexempted(chan, user) ismasked((chan)->channel.exempt, user)
  57. #define isinvited(chan, user) ismasked((chan)->channel.invite, user)
  58. #define ischanban(chan, user) ismodeline((chan)->channel.ban, user)
  59. #define ischanexempt(chan, user) ismodeline((chan)->channel.exempt, user)
  60. #define ischaninvite(chan, user) ismodeline((chan)->channel.invite, user)
  61. #define ischanmask(type, chan, user) ismodeline(type == 'b' ? (chan)->channel.ban : type == 'e' ? (chan)->channel.exempt : (chan)->channel.invite, user)
  62. #define u_setsticky_ban(chan, host, sticky) u_setsticky_mask(chan, ((struct chanset_t *)chan) ? ((struct chanset_t *)chan)->bans : global_bans, host, sticky, 'b')
  63. #define u_setsticky_exempt(chan, host, sticky) u_setsticky_mask(chan, ((struct chanset_t *)chan) ? ((struct chanset_t *)chan)->exempts : global_exempts, host, sticky, 'e')
  64. #define u_setsticky_invite(chan, host, sticky) u_setsticky_mask(chan, ((struct chanset_t *)chan) ? ((struct chanset_t *)chan)->invites : global_invites, host, sticky, 'I')
  65. #endif /* _EGG_MOD_CHANNELS_CHANNELS_H */