|
@@ -31,6 +31,7 @@ import com.dmdirc.parser.common.DefaultStringConverter;
|
31
|
31
|
import com.dmdirc.parser.common.ParserError;
|
32
|
32
|
import com.dmdirc.parser.common.QueuePriority;
|
33
|
33
|
import com.dmdirc.parser.interfaces.ChannelInfo;
|
|
34
|
+import com.dmdirc.parser.interfaces.ClientInfo;
|
34
|
35
|
import com.dmdirc.parser.interfaces.LocalClientInfo;
|
35
|
36
|
import com.dmdirc.parser.interfaces.StringConverter;
|
36
|
37
|
import com.dmdirc.parser.interfaces.callbacks.AwayStateListener;
|
|
@@ -241,7 +242,7 @@ public class XmppParser extends BaseSocketAwareParser {
|
241
|
242
|
newArgs[2] = getLocalClient().getNickname();
|
242
|
243
|
System.arraycopy(args, 0, newArgs, 3, args.length);
|
243
|
244
|
|
244
|
|
- getCallback(NumericListener.class).onNumeric(null, null, numeric, newArgs);
|
|
245
|
+ getCallback(NumericListener.class).onNumeric(this, new Date(), numeric, newArgs);
|
245
|
246
|
}
|
246
|
247
|
|
247
|
248
|
@Override
|
|
@@ -448,7 +449,7 @@ public class XmppParser extends BaseSocketAwareParser {
|
448
|
449
|
|
449
|
450
|
setServerName(connection.getServiceName());
|
450
|
451
|
|
451
|
|
- getCallback(ServerReadyListener.class).onServerReady(null, null);
|
|
452
|
+ getCallback(ServerReadyListener.class).onServerReady(this, new Date());
|
452
|
453
|
|
453
|
454
|
for (RosterEntry contact : connection.getRoster().getEntries()) {
|
454
|
455
|
getClient(contact.getUser()).setRosterEntry(contact);
|
|
@@ -461,7 +462,7 @@ public class XmppParser extends BaseSocketAwareParser {
|
461
|
462
|
fakeChannel.updateContacts(contacts.values());
|
462
|
463
|
|
463
|
464
|
contacts.values().stream().filter(XmppClientInfo::isAway).forEach(client ->
|
464
|
|
- getCallback(OtherAwayStateListener.class).onAwayStateOther(null, null,
|
|
465
|
+ getCallback(OtherAwayStateListener.class).onAwayStateOther(this, new Date(),
|
465
|
466
|
client, AwayState.UNKNOWN, AwayState.AWAY));
|
466
|
467
|
}
|
467
|
468
|
} catch (XMPPException ex) {
|
|
@@ -480,7 +481,7 @@ public class XmppParser extends BaseSocketAwareParser {
|
480
|
481
|
error.setException(ex);
|
481
|
482
|
}
|
482
|
483
|
|
483
|
|
- getCallback(ConnectErrorListener.class).onConnectError(null, null, error);
|
|
484
|
+ getCallback(ConnectErrorListener.class).onConnectError(this, new Date(), error);
|
484
|
485
|
}
|
485
|
486
|
}
|
486
|
487
|
|
|
@@ -490,7 +491,7 @@ public class XmppParser extends BaseSocketAwareParser {
|
490
|
491
|
* @param client The client whose state is changing
|
491
|
492
|
* @param isBack True if the client is coming back, false if they're going away
|
492
|
493
|
*/
|
493
|
|
- public void handleAwayStateChange(final XmppClientInfo client, final boolean isBack) {
|
|
494
|
+ public void handleAwayStateChange(final ClientInfo client, final boolean isBack) {
|
494
|
495
|
LOG.debug("Handling away state change for {} to {}", client.getNickname(), isBack);
|
495
|
496
|
|
496
|
497
|
if (useFakeChannel) {
|
|
@@ -510,7 +511,7 @@ public class XmppParser extends BaseSocketAwareParser {
|
510
|
511
|
connection.sendPacket(new Presence(Presence.Type.available, reason,
|
511
|
512
|
priority, Presence.Mode.away));
|
512
|
513
|
|
513
|
|
- getCallback(AwayStateListener.class).onAwayState(null, null,
|
|
514
|
+ getCallback(AwayStateListener.class).onAwayState(this, new Date(),
|
514
|
515
|
AwayState.HERE, AwayState.AWAY, reason);
|
515
|
516
|
}
|
516
|
517
|
|
|
@@ -521,7 +522,7 @@ public class XmppParser extends BaseSocketAwareParser {
|
521
|
522
|
connection.sendPacket(new Presence(Presence.Type.available, null,
|
522
|
523
|
priority, Presence.Mode.available));
|
523
|
524
|
|
524
|
|
- getCallback(AwayStateListener.class).onAwayState(null, null,
|
|
525
|
+ getCallback(AwayStateListener.class).onAwayState(this, new Date(),
|
525
|
526
|
AwayState.AWAY, AwayState.HERE, null);
|
526
|
527
|
}
|
527
|
528
|
|
|
@@ -565,13 +566,13 @@ public class XmppParser extends BaseSocketAwareParser {
|
565
|
566
|
|
566
|
567
|
@Override
|
567
|
568
|
public void connectionClosed() {
|
568
|
|
- getCallback(SocketCloseListener.class).onSocketClosed(null, null);
|
|
569
|
+ getCallback(SocketCloseListener.class).onSocketClosed(XmppParser.this, new Date());
|
569
|
570
|
}
|
570
|
571
|
|
571
|
572
|
@Override
|
572
|
573
|
public void connectionClosedOnError(final Exception excptn) {
|
573
|
574
|
// TODO: Handle exception
|
574
|
|
- getCallback(SocketCloseListener.class).onSocketClosed(null, null);
|
|
575
|
+ getCallback(SocketCloseListener.class).onSocketClosed(XmppParser.this, new Date());
|
575
|
576
|
}
|
576
|
577
|
|
577
|
578
|
@Override
|
|
@@ -633,7 +634,7 @@ public class XmppParser extends BaseSocketAwareParser {
|
633
|
634
|
@Override
|
634
|
635
|
public void processMessage(final Chat chat, final Message msg) {
|
635
|
636
|
if (msg.getType() == Message.Type.error) {
|
636
|
|
- getCallback(NumericListener.class).onNumeric(null, null,
|
|
637
|
+ getCallback(NumericListener.class).onNumeric(XmppParser.this, new Date(),
|
637
|
638
|
404, new String[]{
|
638
|
639
|
":xmpp", "404", getLocalClient().getNickname(),
|
639
|
640
|
msg.getFrom(),
|
|
@@ -644,11 +645,11 @@ public class XmppParser extends BaseSocketAwareParser {
|
644
|
645
|
|
645
|
646
|
if (msg.getBody() != null) {
|
646
|
647
|
if (msg.getBody().startsWith("/me ")) {
|
647
|
|
- getCallback(PrivateActionListener.class).onPrivateAction(null,
|
648
|
|
- null, msg.getBody().substring(4), msg.getFrom());
|
|
648
|
+ getCallback(PrivateActionListener.class).onPrivateAction(XmppParser.this,
|
|
649
|
+ new Date(), msg.getBody().substring(4), msg.getFrom());
|
649
|
650
|
} else {
|
650
|
|
- getCallback(PrivateMessageListener.class).onPrivateMessage(null,
|
651
|
|
- null, msg.getBody(), msg.getFrom());
|
|
651
|
+ getCallback(PrivateMessageListener.class).onPrivateMessage(XmppParser.this,
|
|
652
|
+ new Date(), msg.getBody(), msg.getFrom());
|
652
|
653
|
}
|
653
|
654
|
}
|
654
|
655
|
}
|
|
@@ -673,7 +674,8 @@ public class XmppParser extends BaseSocketAwareParser {
|
673
|
674
|
}
|
674
|
675
|
|
675
|
676
|
getCallback(CompositionStateChangeListener.class)
|
676
|
|
- .onCompositionStateChanged(null, null, state, chat.getParticipant());
|
|
677
|
+ .onCompositionStateChanged(XmppParser.this, new Date(), state,
|
|
678
|
+ chat.getParticipant());
|
677
|
679
|
}
|
678
|
680
|
|
679
|
681
|
}
|
|
@@ -689,9 +691,11 @@ public class XmppParser extends BaseSocketAwareParser {
|
689
|
691
|
@Override
|
690
|
692
|
public void processPacket(final Packet packet) {
|
691
|
693
|
if (callback.equals(DataOutListener.class)) {
|
692
|
|
- getCallback(DataOutListener.class).onDataOut(null, null, packet.toXML(), true);
|
|
694
|
+ getCallback(DataOutListener.class).onDataOut(XmppParser.this, new Date(),
|
|
695
|
+ packet.toXML(), true);
|
693
|
696
|
} else {
|
694
|
|
- getCallback(DataInListener.class).onDataIn(null, null, packet.toXML());
|
|
697
|
+ getCallback(DataInListener.class).onDataIn(XmppParser.this, new Date(),
|
|
698
|
+ packet.toXML());
|
695
|
699
|
}
|
696
|
700
|
}
|
697
|
701
|
|