SPARK-2355: Migrate Time and Version

This commit is contained in:
Sergey Ponomarev
2025-10-19 14:15:25 +03:00
committed by Guus der Kinderen
parent ec36454460
commit 667fb8c998
2 changed files with 12 additions and 8 deletions

View File

@ -36,6 +36,7 @@ import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.time.ZonedDateTime;
import java.util.Collection;
import java.util.Date;
@ -60,12 +61,11 @@ public class JabberVersion implements Plugin {
try
{
if (iq instanceof Time && iq.getType() == IQ.Type.get) {
Time time = new Time();
time.setStanzaId(iq.getStanzaId());
Time time = Time.builder(iq.getStanzaId())
.ofType(IQ.Type.result)
.set(ZonedDateTime.now()).build();
time.setFrom(iq.getTo());
time.setTo(iq.getFrom());
time.setTime(new Date());
time.setType(IQ.Type.result);
// Send Time
SparkManager.getConnection().sendStanza(time);

View File

@ -33,6 +33,7 @@ import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.time.ZonedDateTime;
public class VersionViewer {
@ -94,8 +95,9 @@ public class VersionViewer {
final XMPPConnection connection = SparkManager.getConnection();
// Load Version
final Version versionRequest = new Version();
versionRequest.setType(IQ.Type.get);
final Version versionRequest = Version.builder(connection)
.ofType(IQ.Type.get)
.build();
versionRequest.setTo(jid);
connection.sendIqRequestAsync(versionRequest)
@ -112,8 +114,10 @@ public class VersionViewer {
});
// Time
final Time time = new Time();
time.setType(IQ.Type.get);
final Time time = Time.builder(connection)
.ofType(IQ.Type.get)
.set(ZonedDateTime.now())
.build();
time.setTo(jid);
connection.sendIqRequestAsync(time)