aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/core/xmpp_stream.vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/core/xmpp_stream.vala')
-rw-r--r--xmpp-vala/src/core/xmpp_stream.vala18
1 files changed, 9 insertions, 9 deletions
diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala
index 6c364e80..09e973bd 100644
--- a/xmpp-vala/src/core/xmpp_stream.vala
+++ b/xmpp-vala/src/core/xmpp_stream.vala
@@ -1,6 +1,6 @@
using Gee;
-namespace Xmpp.Core {
+namespace Xmpp {
public errordomain IOStreamError {
READ,
@@ -13,7 +13,7 @@ public errordomain IOStreamError {
public class XmppStream {
public const string NS_URI = "http://etherx.jabber.org/streams";
- public string remote_name;
+ public Jid remote_name;
public XmppLog log = new XmppLog();
public StanzaNode? features { get; private set; default = new StanzaNode.build("features", NS_URI); }
@@ -43,13 +43,13 @@ public class XmppStream {
}
public async void connect(string? remote_name = null) throws IOStreamError {
- if (remote_name != null) this.remote_name = (!)remote_name;
+ if (remote_name != null) this.remote_name = Jid.parse(remote_name);
attach_negotation_modules();
try {
int min_priority = -1;
ConnectionProvider? best_provider = null;
foreach (ConnectionProvider connection_provider in connection_providers) {
- int? priority = yield connection_provider.get_priority(remote_name);
+ int? priority = yield connection_provider.get_priority(this.remote_name);
if (priority != null && (priority < min_priority || min_priority == -1)) {
min_priority = priority;
best_provider = connection_provider;
@@ -60,7 +60,7 @@ public class XmppStream {
stream = yield best_provider.connect(this);
}
if (stream == null) {
- stream = yield (new SocketClient()).connect_async(new NetworkService("xmpp-client", "tcp", this.remote_name));
+ stream = yield (new SocketClient()).connect_async(new NetworkService("xmpp-client", "tcp", this.remote_name.to_string()));
}
if (stream == null) {
throw new IOStreamError.CONNECT("client.connect() returned null");
@@ -187,7 +187,7 @@ public class XmppStream {
private async void setup() throws IOStreamError {
StanzaNode outs = new StanzaNode.build("stream", "http://etherx.jabber.org/streams")
- .put_attribute("to", remote_name)
+ .put_attribute("to", remote_name.to_string())
.put_attribute("version", "1.0")
.put_attribute("xmlns", "jabber:client")
.put_attribute("stream", "http://etherx.jabber.org/streams", XMLNS_URI);
@@ -349,7 +349,7 @@ public abstract class XmppStreamNegotiationModule : XmppStreamModule {
}
public abstract class ConnectionProvider {
- public async abstract int? get_priority(string remote_name);
+ public async abstract int? get_priority(Jid remote_name);
public async abstract IOStream? connect(XmppStream stream);
public abstract string get_id();
}
@@ -357,11 +357,11 @@ public abstract class ConnectionProvider {
public class StartTlsConnectionProvider : ConnectionProvider {
private SrvTarget? srv_target;
- public async override int? get_priority(string remote_name) {
+ public async override int? get_priority(Jid remote_name) {
GLib.List<SrvTarget>? xmpp_target = null;
try {
GLibFixes.Resolver resolver = GLibFixes.Resolver.get_default();
- xmpp_target = yield resolver.lookup_service_async("xmpp-client", "tcp", remote_name, null);
+ xmpp_target = yield resolver.lookup_service_async("xmpp-client", "tcp", remote_name.to_string(), null);
} catch (Error e) {
return null;
}