-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMsnp.cpp
73 lines (54 loc) · 1.35 KB
/
Msnp.cpp
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
68
69
70
71
72
#include "Msnp.h"
#include <string>
using namespace std;
Msnp::Msnp(){
this->EL = "\r\n";
this->_trid = 1;
// private $_commandListener = null;
}
void Msnp::setConnectionHandle(ConnectionHandle *connectionHandle) {
this->connectionHandle = connectionHandle;
}
void Msnp::send(string cmd){
this->connectionHandle->send(cmd);
///this->onCommandSended(cmd); //TODO:
this->_trid++;
}
string Msnp::challenger(string chl){
//TODO md5
return "29409134351025259292";
}
void Msnp::execute(string msg){
}
void Msnp::login(string username, string password){
}
void Msnp::connect(string host, int port){
this->connectionHandle->connect(host, port);
}
void Msnp::disconnect(){
this->connectionHandle->disconnect();
}
void Msnp::listen(){
while (this->connectionHandle->hasMoreCommands()) {
string command = this->connectionHandle->nextCommand();
/*
if (trim($command) != "") {
$this->execute($command);
$this->onCommandReceived($command);
}
*/
}
}
void Msnp::addCommandListener(CommandListener *commandListener){
this->commandListener = commandListener;
}
void Msnp::onCommandReceived(string command){
if (this->commandListener == NULL){
this->commandListener->onCommandReceived(command);
}
}
void Msnp::onCommandSended(string command){
if (this->commandListener == NULL){
this->commandListener->onCommandSended(command);
}
}