Browse Source

Made variable and field names consistent

pull/369/head
ObsidianMinor 8 years ago
parent
commit
4d6d08f0d6
4 changed files with 10 additions and 11 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Users/IUser.cs
  2. +7
    -7
      src/Discord.Net.WebSocket/ClientState.cs
  3. +2
    -2
      src/Discord.Net.WebSocket/DiscordSocketClient.cs
  4. +0
    -1
      src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs

+ 1
- 1
src/Discord.Net.Core/Entities/Users/IUser.cs View File

@@ -24,7 +24,7 @@ namespace Discord
/// <summary> Adds this user as a friend, this will remove a block </summary> /// <summary> Adds this user as a friend, this will remove a block </summary>
Task AddFriendAsync(RequestOptions options = null); Task AddFriendAsync(RequestOptions options = null);
/// <summary> Blocks this user, and removes friend relation </summary>
/// <summary> Blocks this user, and removes the user as a friend </summary>
Task BlockUserAsync(RequestOptions options = null); Task BlockUserAsync(RequestOptions options = null);
/// <summary> Removes the relationship of this user </summary> /// <summary> Removes the relationship of this user </summary>
Task RemoveRelationshipAsync(RequestOptions options = null); Task RemoveRelationshipAsync(RequestOptions options = null);


+ 7
- 7
src/Discord.Net.WebSocket/ClientState.cs View File

@@ -16,7 +16,7 @@ namespace Discord.WebSocket
private readonly ConcurrentDictionary<ulong, SocketDMChannel> _dmChannels; private readonly ConcurrentDictionary<ulong, SocketDMChannel> _dmChannels;
private readonly ConcurrentDictionary<ulong, SocketGuild> _guilds; private readonly ConcurrentDictionary<ulong, SocketGuild> _guilds;
private readonly ConcurrentDictionary<ulong, SocketGlobalUser> _users; private readonly ConcurrentDictionary<ulong, SocketGlobalUser> _users;
private readonly ConcurrentDictionary<ulong, SocketRelationship> _relations;
private readonly ConcurrentDictionary<ulong, SocketRelationship> _relationships;
private readonly ConcurrentHashSet<ulong> _groupChannels; private readonly ConcurrentHashSet<ulong> _groupChannels;


internal IReadOnlyCollection<SocketChannel> Channels => _channels.ToReadOnlyCollection(); internal IReadOnlyCollection<SocketChannel> Channels => _channels.ToReadOnlyCollection();
@@ -24,7 +24,7 @@ namespace Discord.WebSocket
internal IReadOnlyCollection<SocketGroupChannel> GroupChannels => _groupChannels.Select(x => GetChannel(x) as SocketGroupChannel).ToReadOnlyCollection(_groupChannels); internal IReadOnlyCollection<SocketGroupChannel> GroupChannels => _groupChannels.Select(x => GetChannel(x) as SocketGroupChannel).ToReadOnlyCollection(_groupChannels);
internal IReadOnlyCollection<SocketGuild> Guilds => _guilds.ToReadOnlyCollection(); internal IReadOnlyCollection<SocketGuild> Guilds => _guilds.ToReadOnlyCollection();
internal IReadOnlyCollection<SocketGlobalUser> Users => _users.ToReadOnlyCollection(); internal IReadOnlyCollection<SocketGlobalUser> Users => _users.ToReadOnlyCollection();
internal IReadOnlyCollection<SocketRelationship> Relationships => _relations.ToReadOnlyCollection();
internal IReadOnlyCollection<SocketRelationship> Relationships => _relationships.ToReadOnlyCollection();


internal IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels => internal IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels =>
_dmChannels.Select(x => x.Value as ISocketPrivateChannel).Concat( _dmChannels.Select(x => x.Value as ISocketPrivateChannel).Concat(
@@ -39,7 +39,7 @@ namespace Discord.WebSocket
_dmChannels = new ConcurrentDictionary<ulong, SocketDMChannel>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(dmChannelCount * CollectionMultiplier)); _dmChannels = new ConcurrentDictionary<ulong, SocketDMChannel>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(dmChannelCount * CollectionMultiplier));
_guilds = new ConcurrentDictionary<ulong, SocketGuild>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(guildCount * CollectionMultiplier)); _guilds = new ConcurrentDictionary<ulong, SocketGuild>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(guildCount * CollectionMultiplier));
_users = new ConcurrentDictionary<ulong, SocketGlobalUser>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(estimatedUsersCount * CollectionMultiplier)); _users = new ConcurrentDictionary<ulong, SocketGlobalUser>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(estimatedUsersCount * CollectionMultiplier));
_relations = new ConcurrentDictionary<ulong, SocketRelationship>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(AverageRelationshipsPerUser * CollectionMultiplier));
_relationships = new ConcurrentDictionary<ulong, SocketRelationship>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(AverageRelationshipsPerUser * CollectionMultiplier));
_groupChannels = new ConcurrentHashSet<ulong>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(10 * CollectionMultiplier)); _groupChannels = new ConcurrentHashSet<ulong>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(10 * CollectionMultiplier));
} }


@@ -133,17 +133,17 @@ namespace Discord.WebSocket


internal SocketRelationship GetRelationship(ulong id) internal SocketRelationship GetRelationship(ulong id)
{ {
if (_relations.TryGetValue(id, out SocketRelationship value))
if (_relationships.TryGetValue(id, out SocketRelationship value))
return value; return value;
return null; return null;
} }
internal void AddRelationship(SocketRelationship relation)
internal void AddRelationship(SocketRelationship relationship)
{ {
_relations[relation.User.Id] = relation;
_relationships[relationship.User.Id] = relationship;
} }
internal SocketRelationship RemoveRelationship(ulong id) internal SocketRelationship RemoveRelationship(ulong id)
{ {
if (_relations.TryRemove(id, out SocketRelationship value))
if (_relationships.TryRemove(id, out SocketRelationship value))
return value; return value;
return null; return null;
} }


+ 2
- 2
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -1685,9 +1685,9 @@ namespace Discord.WebSocket
} }
internal SocketRelationship AddRelationship(Relationship model, ClientState state) internal SocketRelationship AddRelationship(Relationship model, ClientState state)
{ {
var relation = SocketRelationship.Create(this, state, model);
var relationship = SocketRelationship.Create(this, state, model);
state.AddRelationship(SocketRelationship.Create(this, state, model)); state.AddRelationship(SocketRelationship.Create(this, state, model));
return relation;
return relationship;
} }
internal SocketRelationship RemoveRelationship(ulong id) internal SocketRelationship RemoveRelationship(ulong id)
{ {


+ 0
- 1
src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs View File

@@ -1,6 +1,5 @@
using Discord.Rest; using Discord.Rest;
using System; using System;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Model = Discord.API.User; using Model = Discord.API.User;
using PresenceModel = Discord.API.Presence; using PresenceModel = Discord.API.Presence;


Loading…
Cancel
Save