|
@@ -22,6 +22,7 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.parser.irc;
|
24
|
24
|
|
|
25
|
+import com.dmdirc.parser.common.AwayState;
|
25
|
26
|
import com.dmdirc.parser.interfaces.ChannelClientInfo;
|
26
|
27
|
import com.dmdirc.parser.interfaces.ChannelInfo;
|
27
|
28
|
import com.dmdirc.parser.interfaces.ClientInfo;
|
|
@@ -61,20 +62,20 @@ public class ProcessWho extends IRCProcessor {
|
61
|
62
|
}
|
62
|
63
|
// Update away state
|
63
|
64
|
final String mode = token[8];
|
64
|
|
- final boolean isAway = mode.indexOf('G') != -1;
|
|
65
|
+ final AwayState isAway = (mode.indexOf('G') == -1) ? AwayState.HERE : AwayState.AWAY;
|
65
|
66
|
if (client.getAwayState() != isAway) {
|
|
67
|
+ final AwayState oldState = client.getAwayState();
|
66
|
68
|
client.setAwayState(isAway);
|
67
|
|
- if (!isAway) { client.setAwayReason(""); }
|
68
|
69
|
if (client == myParser.getLocalClient()) {
|
69
|
|
- callAwayState(client.getAwayState(), client.getAwayReason());
|
|
70
|
+ callAwayState(oldState, client.getAwayState(), client.getAwayReason());
|
70
|
71
|
} else {
|
71
|
|
- callAwayStateOther(client, isAway);
|
|
72
|
+ callAwayStateOther(client, oldState, isAway);
|
72
|
73
|
|
73
|
74
|
ChannelClientInfo iChannelClient;
|
74
|
75
|
for (ChannelInfo iChannel : myParser.getChannels()) {
|
75
|
76
|
iChannelClient = iChannel.getChannelClient(client);
|
76
|
77
|
if (iChannelClient != null) {
|
77
|
|
- callChannelAwayStateOther(iChannel,iChannelClient,isAway);
|
|
78
|
+ callChannelAwayStateOther(iChannel,iChannelClient,oldState,isAway);
|
78
|
79
|
}
|
79
|
80
|
}
|
80
|
81
|
}
|
|
@@ -86,12 +87,13 @@ public class ProcessWho extends IRCProcessor {
|
86
|
87
|
* Callback to all objects implementing the onAwayState Callback.
|
87
|
88
|
*
|
88
|
89
|
* @see IAwayState
|
89
|
|
- * @param currentState Set to true if we are now away, else false.
|
|
90
|
+ * @param oldState Old Away State
|
|
91
|
+ * @param currentState Current Away State
|
90
|
92
|
* @param reason Best guess at away reason
|
91
|
93
|
* @return true if a method was called, false otherwise
|
92
|
94
|
*/
|
93
|
|
- protected boolean callAwayState(boolean currentState, String reason) {
|
94
|
|
- return getCallbackManager().getCallbackType(AwayStateListener.class).call(currentState, reason);
|
|
95
|
+ protected boolean callAwayState(final AwayState oldState, final AwayState currentState, final String reason) {
|
|
96
|
+ return getCallbackManager().getCallbackType(AwayStateListener.class).call(oldState, currentState, reason);
|
95
|
97
|
}
|
96
|
98
|
|
97
|
99
|
/**
|
|
@@ -99,11 +101,12 @@ public class ProcessWho extends IRCProcessor {
|
99
|
101
|
*
|
100
|
102
|
* @see IAwayStateOther
|
101
|
103
|
* @param client Client this is for
|
102
|
|
- * @param state Away State (true if away, false if here)
|
|
104
|
+ * @param oldState Old Away State
|
|
105
|
+ * @param state Current Away State
|
103
|
106
|
* @return true if a method was called, false otherwise
|
104
|
107
|
*/
|
105
|
|
- protected boolean callAwayStateOther(final ClientInfo client, final boolean state) {
|
106
|
|
- return getCallbackManager().getCallbackType(OtherAwayStateListener.class).call(client, state);
|
|
108
|
+ protected boolean callAwayStateOther(final ClientInfo client, final AwayState oldState, final AwayState state) {
|
|
109
|
+ return getCallbackManager().getCallbackType(OtherAwayStateListener.class).call(client, oldState, state);
|
107
|
110
|
}
|
108
|
111
|
|
109
|
112
|
/**
|
|
@@ -112,11 +115,12 @@ public class ProcessWho extends IRCProcessor {
|
112
|
115
|
* @see IAwayStateOther
|
113
|
116
|
* @param channel Channel this is for
|
114
|
117
|
* @param channelClient ChannelClient this is for
|
115
|
|
- * @param state Away State (true if away, false if here)
|
|
118
|
+ * @param oldState Old Away State
|
|
119
|
+ * @param state Current Away State
|
116
|
120
|
* @return true if a method was called, false otherwise
|
117
|
121
|
*/
|
118
|
|
- protected boolean callChannelAwayStateOther(final ChannelInfo channel, final ChannelClientInfo channelClient, final boolean state) {
|
119
|
|
- return getCallbackManager().getCallbackType(ChannelOtherAwayStateListener.class).call(channel, channelClient, state);
|
|
122
|
+ protected boolean callChannelAwayStateOther(final ChannelInfo channel, final ChannelClientInfo channelClient, final AwayState oldState, final AwayState state) {
|
|
123
|
+ return getCallbackManager().getCallbackType(ChannelOtherAwayStateListener.class).call(channel, channelClient, oldState, state);
|
120
|
124
|
}
|
121
|
125
|
|
122
|
126
|
/**
|