Advertisement
Panakotta00

IRC_Client.h

Sep 6th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.52 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include <iostream> /* std::cout, std::cerr, std::endl */
  6. #include <string> /* std::string */
  7. #include <functional>
  8. #include <map>
  9. #include <vector>
  10. #include <cstdlib> /* exit */
  11. #include <cstdio> /* perror */
  12. #include <cstring> /* memcpy, memset */
  13.  
  14. #include <process.h>
  15. #include "AllowWindowsPlatformTypes.h"
  16. #include <winsock2.h>
  17. #include "HideWindowsPlatformTypes.h"
  18.  
  19. /*#include <sys/socket.h>
  20. #include <sys/types.h>
  21. #include <netinet/in.h>
  22. #include <arpa/inet.h>
  23. #include <netdb.h>
  24. #include <unistd.h>*/
  25.  
  26. using namespace std;
  27.  
  28. class WURST_API IRC_Client {
  29. public:
  30.     IRC_Client(int PORT, char *HOST, char *NICK, char *PASSWORD, char *CHANNEL);
  31.     ~IRC_Client();
  32.     void irc_connect();
  33.     void irc_disconnect();
  34.     void irc_send(const char *msg);
  35.     void irc_msg(string msg);
  36.     void addIrcCmd(string cmd, function<void(string)> func);
  37.     void addChatCmd(string cmd, function<void(map<string, string>, string)> func);
  38.     map<string, string> irc_getUserData(string str);
  39. private:
  40.     static const int MAX_LINE = 1024;
  41.     int PORT;
  42.     char *HOST;
  43.     char *NICK;
  44.     char *PASSWORD;
  45.     char *CHANNEL;
  46.     map<string, vector<function<void(string)>>> IRC_funcs;
  47.     map<string, vector<function<void(map<string, string>, string)>>> chat_funcs;
  48.  
  49.     void irc_pong(const string &buffer);
  50.     void irc_reciveLoop(void *param);
  51.     void irc_parse(string buffer);
  52.     void irc_identify();
  53.     void irc_functions(string buffer);
  54.     void chat_functions(string buffer);
  55. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement