server.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // MicroIRCd
  2. #include "deps.h"
  3. #define _CRT_SECURE_NO_WARNINGS
  4. #define MAX_CLIENTS 32
  5. #define BUF_SIZE 4096
  6. #define printf _log
  7. typedef struct {
  8. int sock;
  9. struct sockaddr_in addr;
  10. int len;
  11. char buf[BUF_SIZE];
  12. int state;
  13. char nickname[16];
  14. char username[32];
  15. char hostname[32];
  16. char realname[32];
  17. char servername[32];
  18. char chanlist[BUF_SIZE];
  19. } client_t;
  20. char *serv = "localhost";
  21. client_t clients[MAX_CLIENTS];
  22. int num_clients;
  23. int str_split(char **arr, char *str, char *d);
  24. int CL_COUNT(char *list);
  25. char *strchr_n(char *str, int n);
  26. char *CL_HEAD(char *list, int n);
  27. char *CL_TAIL(char *list, int n);
  28. char *CL_ITEM(char *list, int n);
  29. int CL_ISSET(char *list, char *key);
  30. int CL_SET(char *list, char *key);
  31. int CL_CLR(char *list, char *key);
  32. int CL_MATCH(char *c1, char *c2);
  33. client_t *get_user_by_nickname(char *nickname);
  34. int get_userlist_by_chan(char *userlist, char *chan);
  35. char *unquote(char *str);
  36. void reply(client_t * cl, char *dest, char *fmt, ...);
  37. int string_to_argv(char **argv, char *str, int size);
  38. int die(int code);