client-cap.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. * Please read the file COPYING, README and AUTHORS for more information.
  10. */
  11. #define __client_cap_c__
  12. #include "portab.h"
  13. /**
  14. * @file
  15. * Functions to deal with IRC Capabilities
  16. */
  17. #include <assert.h>
  18. #include "conn.h"
  19. #include "log.h"
  20. #include "client-cap.h"
  21. GLOBAL int
  22. Client_Cap(CLIENT *Client)
  23. {
  24. assert (Client != NULL);
  25. return Client->capabilities;
  26. }
  27. GLOBAL void
  28. Client_CapSet(CLIENT *Client, int Cap)
  29. {
  30. assert(Client != NULL);
  31. assert(Cap >= 0);
  32. Client->capabilities = Cap;
  33. LogDebug("Set new capability of \"%s\" to %d.",
  34. Client_ID(Client), Client->capabilities);
  35. }
  36. GLOBAL void
  37. Client_CapAdd(CLIENT *Client, int Cap)
  38. {
  39. assert(Client != NULL);
  40. assert(Cap > 0);
  41. Client->capabilities |= Cap;
  42. LogDebug("Add capability %d, new capability of \"%s\" is %d.",
  43. Cap, Client_ID(Client), Client->capabilities);
  44. }
  45. GLOBAL void
  46. Client_CapDel(CLIENT *Client, int Cap)
  47. {
  48. assert(Client != NULL);
  49. assert(Cap > 0);
  50. Client->capabilities &= ~Cap;
  51. LogDebug("Delete capability %d, new capability of \"%s\" is %d.",
  52. Cap, Client_ID(Client), Client->capabilities);
  53. }
  54. /* -eof- */