There are no User-Quit events raised

Bug #1165828 reported by Compendium on 2013-04-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IRC.NET
Undecided
Alexander Regueiro

Bug Description

The IrcChannel.UserLeft event is only raised when a client "/part"s the channel, or closes the connection gracefully. If there's no such graceful closing of the connection, no Event is raised. This happens if the client of the user crashes, or the connections resets.

I fixed the problem temporarily by changing these lines:
(Note that I hooked the HandleUserQuit to the OnUserLeft event, in the mainline you may want to add a IrcChannel.UserQuit event? I'll look into that in the following days, and see if I can do it myself and submit a new patch, though)

--- src/IrcDotNet/IrcChannel.cs Sun Apr 07 19:40:29 2013
+++ src/IrcDotNet/IrcChannel.cs Sun Apr 07 19:26:42 2013
@@ -407,10 +407,11 @@
                 OnUserInvited(new IrcUserEventArgs(user));
         }

- internal void HandleUserQuit(IrcChannelUser channelUser)
+ internal void HandleUserQuit(IrcChannelUser channelUser, string comment)
         {
             lock (((ICollection)this.usersReadOnly).SyncRoot)
                 this.users.Remove(channelUser);
+ OnUserLeft(new IrcChannelUserEventArgs(channelUser, comment));
         }

         internal void HandleMessageReceived(IIrcMessageSource source, IList<IIrcMessageTarget> targets, string text)
--- src/IrcDotNet/IrcUser.cs Sun Apr 07 19:40:30 2013
+++ src/IrcDotNet/IrcUser.cs Sun Apr 07 19:26:54 2013
@@ -321,7 +321,7 @@
         internal void HandeQuit(string comment)
         {
             foreach (var cu in GetChannelUsers().ToArray())
- cu.Channel.HandleUserQuit(cu);
+ cu.Channel.HandleUserQuit(cu, comment);
             OnQuit(new IrcCommentEventArgs(comment));
         }

Alexander Regueiro (alexreg) wrote :

I think the event you want here is the Quit event of the IrcClient.User (IrcUser type), simply.

Changed in ircdotnet:
assignee: nobody → Alex Regueiro (alexreg)
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers