瀏覽代碼

Add ServerInviteExpiredEvent.

pull/269/head
Greg Holmes 9 年之前
父節點
當前提交
60c60a35b4
共有 2 個檔案被更改,包括 56 行新增0 行删除
  1. 2
    0
      src/com/dmdirc/Server.java
  2. 54
    0
      src/com/dmdirc/events/ServerInviteExpiredEvent.java

+ 2
- 0
src/com/dmdirc/Server.java 查看文件

@@ -32,6 +32,7 @@ import com.dmdirc.events.ServerConnectErrorEvent;
32 32
 import com.dmdirc.events.ServerConnectedEvent;
33 33
 import com.dmdirc.events.ServerConnectingEvent;
34 34
 import com.dmdirc.events.ServerDisconnectedEvent;
35
+import com.dmdirc.events.ServerInviteExpiredEvent;
35 36
 import com.dmdirc.interfaces.Connection;
36 37
 import com.dmdirc.interfaces.InviteListener;
37 38
 import com.dmdirc.interfaces.User;
@@ -1299,6 +1300,7 @@ public class Server extends FrameContainer implements Connection {
1299 1300
     public void removeInvite(final Invite invite) {
1300 1301
         synchronized (invites) {
1301 1302
             invites.remove(invite);
1303
+            getEventBus().publishAsync(new ServerInviteExpiredEvent(this, invite));
1302 1304
 
1303 1305
             synchronized (listeners) {
1304 1306
                 for (InviteListener listener : listeners.get(InviteListener.class)) {

+ 54
- 0
src/com/dmdirc/events/ServerInviteExpiredEvent.java 查看文件

@@ -0,0 +1,54 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.events;
24
+
25
+import com.dmdirc.Invite;
26
+import com.dmdirc.interfaces.Connection;
27
+
28
+/**
29
+ * Fired when an @link Invite} is expired.
30
+ */
31
+public class ServerInviteExpiredEvent extends ServerEvent {
32
+
33
+    private final Invite invite;
34
+
35
+    public ServerInviteExpiredEvent(final Connection connection, final Invite invite) {
36
+        super(connection);
37
+        this.invite = invite;
38
+    }
39
+
40
+    public ServerInviteExpiredEvent(final long timestamp, final Connection connection,
41
+            final Invite invite) {
42
+        super(timestamp, connection);
43
+        this.invite = invite;
44
+    }
45
+
46
+    /**
47
+     * Returns the {@link Invite} that has been expired.
48
+     *
49
+     * @return Expired @link Invite}
50
+     */
51
+    public Invite getInvite() {
52
+        return invite;
53
+    }
54
+}

Loading…
取消
儲存