-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdsconvoprotocol.h
41 lines (29 loc) · 1.05 KB
/
dsconvoprotocol.h
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
#ifndef DSCONVOPROTOCOL_H
#define DSCONVOPROTOCOL_H
#include <QPair>
#include <QByteArray>
#include <QString>
#include <istream>
#include "protobuf/dsconvo.pb.h"
namespace DSConvo {
namespace Protocol {
typedef QPair<DSConvoProtocol::DSConvoMessage::MessageType,
google::protobuf::Message*> ParsedMessage;
struct MessageBroadcast {
QString username;
QString displayName;
QString message;
};
auto const INVALID_PAYLOAD = reinterpret_cast<google::protobuf::Message*>(-1);
bool parseMessage(std::istream*, ParsedMessage&);
QByteArray makeHelloRequest(const std::string&);
QByteArray makeHelloReply(DSConvoProtocol::HelloReplyPayload::HelloReplyError,
const std::string& = std::string());
QByteArray makeMessageRequest(const std::string&);
QByteArray makeMessageBroadcast(const std::string&, const std::string&,
const std::string&);
QByteArray makeGoodbye();
} // namespace DSConvo::Protocol
QString formatMessage(const Protocol::MessageBroadcast &m);
} // namespace DSConvo
#endif