Skip to content

Commit

Permalink
Remove CallbackNotFoundException, tidy up Query.
Browse files Browse the repository at this point in the history
We don't need to reregister on nick change now, as we get all
the events anyway and filter them manually.
  • Loading branch information
csmith committed Feb 1, 2015
1 parent 5eae2f4 commit 8c91a4c
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/com/dmdirc/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package com.dmdirc;

import com.dmdirc.commandparser.CommandType;
import com.dmdirc.events.AppErrorEvent;
import com.dmdirc.events.CommandErrorEvent;
import com.dmdirc.events.QueryActionEvent;
import com.dmdirc.events.QueryClosedEvent;
Expand All @@ -36,9 +35,7 @@
import com.dmdirc.interfaces.PrivateChat;
import com.dmdirc.interfaces.User;
import com.dmdirc.interfaces.WindowModel;
import com.dmdirc.logger.ErrorLevel;
import com.dmdirc.parser.common.CallbackManager;
import com.dmdirc.parser.common.CallbackNotFoundException;
import com.dmdirc.parser.common.CompositionState;
import com.dmdirc.parser.events.CompositionStateChangeEvent;
import com.dmdirc.parser.events.NickChangeEvent;
Expand Down Expand Up @@ -187,14 +184,7 @@ private void updateTitle() {
*/
public void reregister() {
final CallbackManager callbackManager = connection.getParser().get().getCallbackManager();
final String nick = getNickname();

try {
callbackManager.subscribe(this);
} catch (CallbackNotFoundException ex) {
getEventBus().publishAsync(new AppErrorEvent(ErrorLevel.HIGH, ex,
"Unable to get query events", ex.getMessage()));
}
callbackManager.subscribe(this);
}

@Handler
Expand All @@ -205,17 +195,6 @@ public void onNickChanged(final NickChangeEvent event) {
final ClientInfo client = event.getClient();
final String oldNick = event.getOldNick();
if (client.getNickname().equals(getNickname())) {
final CallbackManager callbackManager = connection.getParser().get().getCallbackManager();

// TODO: Not specific now.
try {
callbackManager.subscribe(this);
} catch (CallbackNotFoundException ex) {
getEventBus().publishAsync(
new AppErrorEvent(ErrorLevel.HIGH, ex, "Unable to get query events",
ex.getMessage()));
}

connection.updateQuery(this, oldNick, client.getNickname());

getEventBus().publish(new QueryNickChangeEvent(this, oldNick, client.getNickname()));
Expand Down

0 comments on commit 8c91a4c

Please sign in to comment.