Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up warnings #100

Merged
merged 1 commit into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion SlackAPI/RPCMessages/SearchResponseFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace SlackAPI
public class SearchResponseFiles : Response
{
public string query;
SearchResponseMessagesContainer messages;
}

public class SearchResponseFilesContainer
Expand Down
1 change: 0 additions & 1 deletion SlackAPI/RPCMessages/SearchResponseMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace SlackAPI
public class SearchResponseMessages : Response
{
public string query;
SearchResponseMessagesContainer messages;
}

public class SearchResponseMessagesContainer
Expand Down
23 changes: 11 additions & 12 deletions SlackAPI/SlackClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ namespace SlackAPI
{
/// <summary>
/// SlackClient is intended to solely handle RPC (HTTP-based) functionality. Does not handle WebSocket connectivity.
///
///
/// For WebSocket connectivity, refer to <see cref="SlackAPI.SlackSocketClient"/>
/// </summary>
public class SlackClient
{
readonly string APIToken;
bool authWorks = false;

const string APIBaseLocation = "https://slack.com/api/";
const int Timeout = 5000;
Expand Down Expand Up @@ -121,7 +120,7 @@ internal static Uri GetSlackUri(string path, Tuple<string, string>[] getParamete
{
string parameters = getParameters
.Where(x => x.Item2 != null)
.Select(new Func<Tuple<string, string>, string>(a =>
.Select(new Func<Tuple<string, string>, string>(a =>
{
try
{
Expand Down Expand Up @@ -194,7 +193,7 @@ public static void FindTeam(Action<FindTeamResponse> callback, string team)

public static void AuthSignin(Action<AuthSigninResponse> callback, string userId, string teamId, string password)
{
APIRequest(callback, new Tuple<string, string>[] {
APIRequest(callback, new Tuple<string, string>[] {
new Tuple<string,string>("user", userId),
new Tuple<string,string>("team", teamId),
new Tuple<string,string>("password", password)
Expand Down Expand Up @@ -244,7 +243,7 @@ public void GetFiles(Action<FileListResponse> callback, string userId = null, Da
if (!types.HasFlag(FileTypes.all))
{
FileTypes[] values = (FileTypes[])Enum.GetValues(typeof(FileTypes));

StringBuilder building = new StringBuilder();
bool first = true;
for (int i = 0; i < values.Length; ++i)
Expand Down Expand Up @@ -277,7 +276,7 @@ void GetHistory<K>(Action<K> historyCallback, string channel, DateTime? latest =
{
List<Tuple<string,string>> parameters = new List<Tuple<string,string>>();
parameters.Add(new Tuple<string, string>("channel", channel));

if(latest.HasValue)
parameters.Add(new Tuple<string, string>("latest", latest.Value.ToProperTimeStamp()));
if(oldest.HasValue)
Expand Down Expand Up @@ -316,7 +315,7 @@ public void GetFileInfo(Action<FileInfoResponse> callback, string fileId, int? p
List<Tuple<string,string>> parameters = new List<Tuple<string,string>>();

parameters.Add(new Tuple<string,string>("file", fileId));

if(count.HasValue)
parameters.Add(new Tuple<string,string>("count", count.Value.ToString()));

Expand Down Expand Up @@ -489,7 +488,7 @@ public void SearchFiles(Action<SearchResponseFiles> callback, string query, Sear

public void GetStars(Action<StarListResponse> callback, string userId = null, int? count = null, int? page = null){
List<Tuple<string,string>> parameters = new List<Tuple<string,string>>();

if(!string.IsNullOrEmpty(userId))
parameters.Add(new Tuple<string,string>("user", userId));

Expand Down Expand Up @@ -540,7 +539,7 @@ public void GetInfo(Action<UserInfoResponse> callback, string user)
APIRequestWithToken(callback, new Tuple<string, string>("user", user));
}

#endregion
#endregion

public void EmitLogin(Action<LoginResponse> callback, string agent = "Inumedia.SlackAPI")
{
Expand Down Expand Up @@ -633,7 +632,7 @@ public void PostMessage(
parameters.Add(new Tuple<string, string>("icon_emoji", icon_emoji));

parameters.Add(new Tuple<string, string>("as_user", as_user.ToString()));

if (!string.IsNullOrEmpty(thread_ts))
parameters.Add(new Tuple<string, string>("thread_ts", thread_ts));

Expand Down Expand Up @@ -732,8 +731,8 @@ public static Uri GetAuthorizeUri(string clientId, SlackScope scopes, string red

return GetSlackUri("https://slack.com/oauth/authorize", new Tuple<string, string>[] { new Tuple<string, string>("client_id", clientId),
new Tuple<string, string>("redirect_uri", redirectUri),
new Tuple<string, string>("state", state),
new Tuple<string, string>("scope", theScopes),
new Tuple<string, string>("state", state),
new Tuple<string, string>("scope", theScopes),
new Tuple<string, string>("team", team)});
}

Expand Down
10 changes: 5 additions & 5 deletions SlackAPI/SlackSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,12 @@ public void Close()
{
this.socket.Abort();
}
catch (Exception ex)
{

}
catch (Exception)
{
// ignored
}

if (Interlocked.CompareExchange(ref closedEmitted, 1, 0) == 0 && ConnectionClosed != null)
if (Interlocked.CompareExchange(ref closedEmitted, 1, 0) == 0 && ConnectionClosed != null)
ConnectionClosed();
}
}
Expand Down
4 changes: 1 addition & 3 deletions SlackAPI/SlackSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class SlackSocketClient : SlackClient

bool HelloReceived;
public const int PingInterval = 3000;
int pinging;
Timer pingingThread;

public long PingRoundTripMilliseconds { get; private set; }
public bool IsReady { get { return HelloReceived; } }
Expand Down Expand Up @@ -113,7 +111,7 @@ public void HandlePongReceived(Pong pong)
public void HandleReactionAdded(ReactionAdded reactionAdded)
{
if (OnReactionAdded != null)
OnReactionAdded(reactionAdded);
OnReactionAdded(reactionAdded);
}

public void HandleHello(Hello hello)
Expand Down
1 change: 0 additions & 1 deletion SlackAPI/SlackTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace SlackAPI
public class SlackTaskClient
{
readonly string APIToken;
bool authWorks = false;

const string APIBaseLocation = "https://slack.com/api/";
const int Timeout = 5000;
Expand Down