This repository has been archived by the owner on Jan 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
otalk.cpp
125 lines (97 loc) · 3.05 KB
/
otalk.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include <iostream>
#include "./include/LuaState.h"
#include "otalk.hpp"
OTalk::OTalk(std::string path) {
state.doFile(path + "/wrapper.lua");
state["init"](path);
verse = state["c"];
emit = state["emit"];
}
void OTalk::step() {
state["step"]();
}
void OTalk::connect(std::string jid) {
jid = jid;
//connecting anonymously
state["connect"](jid);
}
void OTalk::connect(std::string jid, std::string password) {
jid = jid;
password = password;
state["connect"](jid, password);
}
void OTalk::close() {
state["close"]();
}
void OTalk::on(std::string name, std::function<void(lua::Value)> callback) {
state["on"](name, callback);
}
void OTalk::checkTalkyVersion(std::string mucHost) {
state["checkTalkyVersion"](mucHost);
}
lua::Value OTalk::joinRoom(std::string rjid, std::string nick, std::string password) {
return state["joinRoom"](rjid, nick, password);
}
void OTalk::leaveRoom(std::string message) {
state["leaveRoom"](message);
}
void OTalk::setRoomKey(std::string rjid, std::string key) {
state["setRoomKey"](rjid, key);
}
lua::Value OTalk::getRooms() {
return state["getRooms"]();
}
lua::Value OTalk::getParticipants(std::string room) {
return state["getParticipants"](room);
}
void OTalk::createSession(std::string sid, std::string peer) {
state["createSession"](sid, peer);
}
void OTalk::startSDPSession(std::string sid, std::string sdp) {
// state.lock();
state["startSession"](sid, sdp);
// state.unlock();
}
void OTalk::acceptSDPSession(std::string sid, std::string sdp) {
state["acceptSession"](sid, sdp);
}
void OTalk::addSource(std::string sid, std::string sdp) {
state["addSource"](sid, sdp);
}
void OTalk::removeSource(std::string sid, std::string sdp) {
state["removeSource"](sid, sdp);
}
void OTalk::activateSession(std::string sid) {
state["activateSession"](sid);
}
void OTalk::muteSession(std::string sid, std::string creator, std::string media) {
state["muteSession"](sid, creator, media);
}
void OTalk::unmuteSession(std::string sid, std::string creator, std::string media) {
state["unmuteSession"](sid, creator, media);
}
void OTalk::ringSession(std::string sid) {
state["ringSession"](sid);
}
void OTalk::holdSession(std::string sid) {
state["holdSession"](sid);
}
void OTalk::resumeSession(std::string sid) {
state["resumeSession"](sid);
}
void OTalk::endSession(std::string sid, std::string reason, bool notify) {
state["endSession"](sid, reason, notify);
}
bool OTalk::outgoingSessionExists(std::string jid) {
bool sessionExists =state["outgoingSessionExistsForJID"](jid);
return sessionExists;
}
void OTalk::endSessionsForJID(std::string jid, std::string reason, bool notify) {
state["endSessionsForJID"](jid, reason, notify);
}
void OTalk::addCandidate(std::string sid, std::string mid, std::string mline, std::string candidate) {
state["addCandidate"](sid, mid, mline, candidate);
}
void OTalk::logEvent(std::string eventName, std::string muc, std::string metadata) {
state["logEvent"](eventName, muc, metadata);
}