| @@ -5,8 +5,8 @@ namespace Discord | |||||
| { | { | ||||
| public partial class DiscordClient | public partial class DiscordClient | ||||
| { | { | ||||
| public event EventHandler Connected = delegate { }; | |||||
| public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { }; | |||||
| public event EventHandler LoggedIn = delegate { }; | |||||
| //public event EventHandler<DisconnectedEventArgs> LoggedOut = delegate { }; | |||||
| public event EventHandler<ChannelEventArgs> ChannelCreated = delegate { }; | public event EventHandler<ChannelEventArgs> ChannelCreated = delegate { }; | ||||
| public event EventHandler<ChannelEventArgs> ChannelDestroyed = delegate { }; | public event EventHandler<ChannelEventArgs> ChannelDestroyed = delegate { }; | ||||
| public event EventHandler<ChannelUpdatedEventArgs> ChannelUpdated = delegate { }; | public event EventHandler<ChannelUpdatedEventArgs> ChannelUpdated = delegate { }; | ||||
| @@ -31,10 +31,10 @@ namespace Discord | |||||
| public event EventHandler<UserUpdatedEventArgs> UserUpdated = delegate { }; | public event EventHandler<UserUpdatedEventArgs> UserUpdated = delegate { }; | ||||
| public event EventHandler<UserEventArgs> UserUnbanned = delegate { }; | public event EventHandler<UserEventArgs> UserUnbanned = delegate { }; | ||||
| private void OnConnected() | |||||
| => OnEvent(Connected); | |||||
| private void OnDisconnected(bool wasUnexpected, Exception ex) | |||||
| => OnEvent(Disconnected, new DisconnectedEventArgs(wasUnexpected, ex)); | |||||
| private void OnLoggedIn() | |||||
| => OnEvent(LoggedIn); | |||||
| /*private void OnLoggedOut(bool wasUnexpected, Exception ex) | |||||
| => OnEvent(LoggedOut, new DisconnectedEventArgs(wasUnexpected, ex));*/ | |||||
| private void OnChannelCreated(Channel channel) | private void OnChannelCreated(Channel channel) | ||||
| => OnEvent(ChannelCreated, new ChannelEventArgs(channel)); | => OnEvent(ChannelCreated, new ChannelEventArgs(channel)); | ||||
| @@ -143,7 +143,7 @@ namespace Discord | |||||
| if (State == ConnectionState.Connecting) | if (State == ConnectionState.Connecting) | ||||
| EndConnect(); | EndConnect(); | ||||
| }; | }; | ||||
| GatewaySocket.Disconnected += (s, e) => OnDisconnected(e.WasUnexpected, e.Exception); | |||||
| //GatewaySocket.Disconnected += (s, e) => OnDisconnected(e.WasUnexpected, e.Exception); | |||||
| GatewaySocket.ReceivedDispatch += (s, e) => OnReceivedEvent(e); | GatewaySocket.ReceivedDispatch += (s, e) => OnReceivedEvent(e); | ||||
| if (Config.UseMessageQueue) | if (Config.UseMessageQueue) | ||||
| @@ -259,7 +259,7 @@ namespace Discord | |||||
| _connectedEvent.Set(); | _connectedEvent.Set(); | ||||
| SendStatus(); | SendStatus(); | ||||
| OnConnected(); | |||||
| OnLoggedIn(); | |||||
| } | } | ||||
| /// <summary> Disconnects from the Discord server, canceling any pending requests. </summary> | /// <summary> Disconnects from the Discord server, canceling any pending requests. </summary> | ||||
| @@ -879,19 +879,16 @@ namespace Discord | |||||
| break; | break; | ||||
| case "MESSAGE_ACK": | case "MESSAGE_ACK": | ||||
| { | { | ||||
| if (Config.MessageCacheSize > 0) | |||||
| if (Config.Mode == DiscordMode.Client) | |||||
| { | { | ||||
| var data = e.Payload.ToObject<MessageAckEvent>(Serializer); | var data = e.Payload.ToObject<MessageAckEvent>(Serializer); | ||||
| var channel = GetChannel(data.ChannelId); | var channel = GetChannel(data.ChannelId); | ||||
| if (channel != null) | if (channel != null) | ||||
| { | { | ||||
| var msg = channel.GetMessage(data.MessageId, null); | var msg = channel.GetMessage(data.MessageId, null); | ||||
| if (msg != null) | |||||
| { | |||||
| if (Config.LogEvents) | |||||
| Logger.Verbose($"Message Ack: {channel.Server?.Name ?? "[Private]"}/{channel.Name}"); | |||||
| OnMessageAcknowledged(msg); | |||||
| } | |||||
| if (Config.LogEvents) | |||||
| Logger.Verbose($"Message Ack: {channel.Server?.Name ?? "[Private]"}/{channel.Name}"); | |||||
| OnMessageAcknowledged(msg); | |||||
| } | } | ||||
| else | else | ||||
| Logger.Warning("MESSAGE_ACK referenced an unknown channel."); | Logger.Warning("MESSAGE_ACK referenced an unknown channel."); | ||||