]> jfr.im git - irc/rizon/acid.git/commitdiff
Add EventUserIntroduce for introducing users regardless of bursting
authorOrillion <redacted>
Sat, 23 Jun 2018 17:59:07 +0000 (19:59 +0200)
committerOrillion <redacted>
Sat, 23 Jun 2018 17:59:07 +0000 (19:59 +0200)
acid/src/main/java/net/rizon/acid/core/Acidictive.java
acid/src/main/java/net/rizon/acid/events/EventUserIntroduce.java [new file with mode: 0644]
acid/src/main/java/net/rizon/acid/messages/UID.java

index b504dff17a9ccb3cfe1d34f55cf646fb06f6c98c..ce200283bc1e4be1d51911dd2ec66d32e3f5e1f8 100644 (file)
@@ -35,6 +35,7 @@ import net.rizon.acid.events.EventServerLink;
 import net.rizon.acid.events.EventServerNotice;
 import net.rizon.acid.events.EventSync;
 import net.rizon.acid.events.EventUserConnect;
+import net.rizon.acid.events.EventUserIntroduce;
 import net.rizon.acid.events.EventWebIRC;
 import net.rizon.acid.events.ExceptionHandler;
 import net.rizon.acid.logging.LoggerUtils;
@@ -171,11 +172,19 @@ public class Acidictive extends AcidCore
                Protocol.eob();
        }
 
-       public static void onNick(User user)
+       public static void onNick(User user, boolean isBursting)
        {
-               EventUserConnect event = new EventUserConnect();
-               event.setUser(user);
-               eventBus.post(event);
+               // Always fire this event
+               EventUserIntroduce eui = new EventUserIntroduce(user);
+               eventBus.post(eui);
+
+               if (!isBursting)
+               {
+                       // Only fire when not bursting
+                       EventUserConnect event = new EventUserConnect();
+                       event.setUser(user);
+                       eventBus.post(event);
+               }
        }
 
        public static void onNickChange(User user, String oldnick)
diff --git a/acid/src/main/java/net/rizon/acid/events/EventUserIntroduce.java b/acid/src/main/java/net/rizon/acid/events/EventUserIntroduce.java
new file mode 100644 (file)
index 0000000..432c04c
--- /dev/null
@@ -0,0 +1,24 @@
+package net.rizon.acid.events;
+
+import net.rizon.acid.core.User;
+
+/**
+ * Event used when a user is introduced to the network. This can be either from
+ * a connect or after a burst.
+ *
+ * @author orillion <orillion@rizon.net>
+ */
+public class EventUserIntroduce
+{
+       private final User user;
+
+       public EventUserIntroduce(User user)
+       {
+               this.user = user;
+       }
+
+       public User getUser()
+       {
+               return user;
+       }
+}
index 1d2a19f794f085371e5e8290ffacacf29d9642c4..7dd462d02d6a93856fd0a416c60d035abaa12eb3 100644 (file)
@@ -21,7 +21,7 @@ public class UID extends Message
        {
                User user = new User(params[0], params[4], params[9], params[5], params[10], source, Integer.parseInt(params[2]), Integer.parseInt(params[2]), params[3], params[7], params[6]);
                UserList.increaseHost(params[6]);
-               if (source.isBursting() == false)
-                       Acidictive.onNick(user);
+
+               Acidictive.onNick(user, source.isBursting());
        }
-}
\ No newline at end of file
+}