client-cap.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. * Copyright (c)2001-2012 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 "imp.h"
  18. #include <assert.h>
  19. #include "defines.h"
  20. #include "conn.h"
  21. #include "client.h"
  22. #include "log.h"
  23. #include "exp.h"
  24. #include "client-cap.h"
  25. GLOBAL int
  26. Client_Cap(CLIENT *Client)
  27. {
  28. assert (Client != NULL);
  29. return Client->capabilities;
  30. }
  31. GLOBAL void
  32. Client_CapSet(CLIENT *Client, int Cap)
  33. {
  34. assert(Client != NULL);
  35. assert(Cap >= 0);
  36. Client->capabilities = Cap;
  37. LogDebug("Set new capability of \"%s\" to %d.",
  38. Client_ID(Client), Client->capabilities);
  39. }
  40. GLOBAL void
  41. Client_CapAdd(CLIENT *Client, int Cap)
  42. {
  43. assert(Client != NULL);
  44. assert(Cap > 0);
  45. Client->capabilities |= Cap;
  46. LogDebug("Add capability %d, new capability of \"%s\" is %d.",
  47. Cap, Client_ID(Client), Client->capabilities);
  48. }
  49. GLOBAL void
  50. Client_CapDel(CLIENT *Client, int Cap)
  51. {
  52. assert(Client != NULL);
  53. assert(Cap > 0);
  54. Client->capabilities &= ~Cap;
  55. LogDebug("Delete capability %d, new capability of \"%s\" is %d.",
  56. Cap, Client_ID(Client), Client->capabilities);
  57. }
  58. /* -eof- */