-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauthTest.js
153 lines (127 loc) · 3.37 KB
/
authTest.js
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
var gc = null;
window.onload = loaded;
function loaded(e){
gc = gopherClient;
//SERVER CONNECTION LISTENERS
gc.addEventListener(gc.events.connected, connected);
gc.addEventListener(gc.events.disconnected, disconnected);
//SIGNUP/LOGIN LISTENERS
gc.addEventListener(gc.events.login, onLogin);
gc.addEventListener(gc.events.logout, onLogout);
gc.addEventListener(gc.events.signup, onSignup);
//AUTOLOGGING LISTENERS
gc.addEventListener(gc.events.autologInit, onAutoLogInit);
gc.addEventListener(gc.events.autologFailed, onAutoLogFail);
gc.addEventListener(gc.events.autologNoFile, onAutoLogNoFile);
//ACCOUNT ACTION LISTENERS
gc.addEventListener(gc.events.accountInfoChange, onInfoChange);
gc.addEventListener(gc.events.accountDelete, onDeleteAccount);
gc.addEventListener(gc.events.passwordChange, onPasswordChange);
//ROOM LISTENERS
//gc.addEventListener(gc.events.joined, joined);
//CONNECT
gc.connect("localhost", 8080, false);
}
function closeMic(){
gc.voiceChat.closeMic();
}
function connected(){
console.log("connected!");
//userName, password, customCols
gc.signup("Cheekspreadr", "l2pdmger", {email: "hewiefreeman@gmail.com"});
//userName, isGuest, password, rememberMe, customCols
//gc.login("dominiquedebergue@gmail.com", "l2pdmger");
//userName, password, customCols
//gc.deleteAccount("Bobby McGee", "ftwomg");
}
function disconnected(){
console.log("DISCONNECTED!");
}
function onSignup(success, error){
if(success){
console.log("Sign up success!");
}else{
console.log(error);
}
}
function onLogin(loginName, error){
if(loginName){
console.log("Login success! As:"+loginName);
//password, newPassword, customCols
//gc.changePassword("ftwomg", "ftwdmg");
//password, customCols
//gc.changeAccountInfo("l2pdmger", {email:"dominiquedebergue@gmail.com"});
//
//gc.logout();
}else{
console.log(error)
}
}
function onLogout(success, error){
if(success){
console.log("You have been logged out.");
//password, newPassword, customCols
//gc.changePassword("ftwomg", "ftwdmg");
}else{
console.log(error)
}
}
function onDeleteAccount(success, error){
if(success){
console.log("Delete account success!");
}else{
console.log(error);
}
}
function onPasswordChange(success, error){
if(success){
console.log("Password change success!");
}else{
console.log(error);
}
}
function onInfoChange(success, error){
if(success){
console.log("Password change success!");
}else{
console.log(error);
}
}
function onAutoLogInit(){
console.log("Initializing Auto-Log");
}
function onAutoLogFail(){
console.log("Auto-Log failed");
}
function onAutoLogNoFile(){
console.log("Auto-Log Has No File");
//userName, isGuest, password, rememberMe, customCols
//gc.login("dominiquedebergue@gmail.com", "l2pdmger", true);
}
/*function joined(success, error){
if(success){
console.log("Join room success!");
gc.voiceChat.setBufferSize(gc.voiceChat.BUFFER_SIZE_LARGE);
//MAKE BUTTON CLICKABLE TO SEND AUDIO STREAM
document.getElementById("box").onclick = function(){
gc.voiceChat.startVoiceChannels();
}
var micOn = false;
window.onkeydown = function(e){
if(!micOn){
console.log(gc.voiceChat.openMic());
micOn = true;
}
}
window.onkeyup = function(e){
if(micOn){
console.log(gc.voiceChat.closeMic());
micOn = false;
}
}
//////////////////////////////////////////////
}else{
console.log(error)
}
}
*/