Added token login and missing dependency
This commit is contained in:
@@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -381,6 +380,13 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//Settings
|
||||||
|
case "USER_SETTINGS_UPDATE":
|
||||||
|
{
|
||||||
|
//TODO: Process this
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
//Others
|
//Others
|
||||||
default:
|
default:
|
||||||
RaiseOnDebugMessage("Unknown WebSocket message type: " + e.Type);
|
RaiseOnDebugMessage("Unknown WebSocket message type: " + e.Type);
|
||||||
@@ -508,7 +514,17 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Auth
|
//Auth
|
||||||
public async Task Connect(string email, string password)
|
public async Task<string> Connect(string token)
|
||||||
|
{
|
||||||
|
_isStopping.Reset();
|
||||||
|
|
||||||
|
Http.Token = token;
|
||||||
|
await _webSocket.ConnectAsync(Endpoints.WebSocket_Hub, true);
|
||||||
|
|
||||||
|
_isReady = true;
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
public async Task<string> Connect(string email, string password)
|
||||||
{
|
{
|
||||||
_isStopping.Reset();
|
_isStopping.Reset();
|
||||||
|
|
||||||
@@ -522,8 +538,20 @@ namespace Discord
|
|||||||
_webSocket.Login();
|
_webSocket.Login();
|
||||||
|
|
||||||
_isReady = true;
|
_isReady = true;
|
||||||
}
|
return response.Token;
|
||||||
public async Task ConnectAnonymous(string username)
|
}
|
||||||
|
public async Task<string> Connect(string email, string password, string token)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await Connect(token);
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException) //Bad Token
|
||||||
|
{
|
||||||
|
return await Connect(email, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async Task<string> ConnectAnonymous(string username)
|
||||||
{
|
{
|
||||||
_isStopping.Reset();
|
_isStopping.Reset();
|
||||||
|
|
||||||
@@ -537,6 +565,7 @@ namespace Discord
|
|||||||
_webSocket.Login();
|
_webSocket.Login();
|
||||||
|
|
||||||
_isReady = true;
|
_isReady = true;
|
||||||
|
return response.Token;
|
||||||
}
|
}
|
||||||
public async Task Disconnect()
|
public async Task Disconnect()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
"dnxcore50": {
|
"dnxcore50": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Collections.Concurrent": "4.0.10",
|
"System.Collections.Concurrent": "4.0.10",
|
||||||
|
"System.Diagnostics.Debug": "4.0.10",
|
||||||
"System.IO.Compression": "4.0.0",
|
"System.IO.Compression": "4.0.0",
|
||||||
"System.Linq": "4.0.0",
|
"System.Linq": "4.0.0",
|
||||||
"System.Net.Requests": "4.0.10",
|
"System.Net.Requests": "4.0.10",
|
||||||
|
|||||||
Reference in New Issue
Block a user