-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathirc.hh
More file actions
67 lines (56 loc) · 1.03 KB
/
irc.hh
File metadata and controls
67 lines (56 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef IRC_HH
#define IRC_HH
/*
* irc.hh
* Author: Mark Swoope
* Date: July 2017
*/
#include "socketstream/socketstream.hh"
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <cstdlib>
struct irc {
struct message {
struct {
std::string
nickname,
user,
host;
} origin;
std::string command;
std::vector<std::string> params;
void clear();
void str(const std::string& s);
std::string str() const;
};
class client {
public:
struct param_type {
std::string
host,
port,
nickname,
owner,
password;
};
client();
explicit client(const param_type& p);
virtual ~client();
const param_type* rdparam() const;
swoope::socketstream* rdstream();
bool is_open() const;
void open(const param_type& p);
bool read(message& msg);
void write(const message& msg);
void shutdown(std::ios_base::openmode how =
std::ios_base::out);
void close();
bool operator!() const;
private:
swoope::socketstream stream;
param_type param;
};
};
#endif