aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-11 01:40:42 +0100
committerfiaxh <git@mx.ax.lt>2017-03-11 01:40:42 +0100
commit1ccad732b9a783d8f0140373602b7c1b84d04198 (patch)
tree368df267ba013c03d01c06c78b6559fa59338be3 /libdino/src
parent95e8d126db06a183918b4db4e84013ff28f8b1f7 (diff)
downloaddino-1ccad732b9a783d8f0140373602b7c1b84d04198.tar.gz
dino-1ccad732b9a783d8f0140373602b7c1b84d04198.zip
Use typed identity in stream modules
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/service/avatar_manager.vala2
-rw-r--r--libdino/src/service/chat_interaction.vala4
-rw-r--r--libdino/src/service/connection_manager.vala4
-rw-r--r--libdino/src/service/message_manager.vala6
-rw-r--r--libdino/src/service/muc_manager.vala20
-rw-r--r--libdino/src/service/presence_manager.vala6
-rw-r--r--libdino/src/service/roster_manager.vala4
-rw-r--r--libdino/src/ui/chat_input.vala5
8 files changed, 23 insertions, 28 deletions
diff --git a/libdino/src/service/avatar_manager.vala b/libdino/src/service/avatar_manager.vala
index 0a141449..d0b25d3b 100644
--- a/libdino/src/service/avatar_manager.vala
+++ b/libdino/src/service/avatar_manager.vala
@@ -65,7 +65,7 @@ public class AvatarManager : StreamInteractionModule, Object {
pixbuf.save_to_buffer(out buffer, "png");
Core.XmppStream stream = stream_interactor.get_stream(account);
if (stream != null) {
- Xep.UserAvatars.Module.get_module(stream).publish_png(stream, buffer, pixbuf.width, pixbuf.height);
+ stream.get_module(Xep.UserAvatars.Module.IDENTITY).publish_png(stream, buffer, pixbuf.width, pixbuf.height);
on_user_avatar_received(account, account.bare_jid, Base64.encode(buffer));
}
} catch (Error e) {
diff --git a/libdino/src/service/chat_interaction.vala b/libdino/src/service/chat_interaction.vala
index cd6907fa..9d5c19e7 100644
--- a/libdino/src/service/chat_interaction.vala
+++ b/libdino/src/service/chat_interaction.vala
@@ -132,14 +132,14 @@ public class ChatInteraction : StreamInteractionModule, Object {
private void send_chat_marker(Conversation conversation, Entities.Message message, string marker) {
Core.XmppStream stream = stream_interactor.get_stream(conversation.account);
if (stream != null && Settings.instance().send_read && Xep.ChatMarkers.Module.requests_marking(message.stanza)) {
- Xep.ChatMarkers.Module.get_module(stream).send_marker(stream, message.stanza.from, message.stanza_id, message.get_type_string(), marker);
+ stream.get_module(Xep.ChatMarkers.Module.IDENTITY).send_marker(stream, message.stanza.from, message.stanza_id, message.get_type_string(), marker);
}
}
private void send_chat_state_notification(Conversation conversation, string state) {
Core.XmppStream stream = stream_interactor.get_stream(conversation.account);
if (stream != null && Settings.instance().send_read) {
- Xep.ChatStateNotifications.Module.get_module(stream).send_state(stream, conversation.counterpart.to_string(), state);
+ stream.get_module(Xep.ChatStateNotifications.Module.IDENTITY).send_state(stream, conversation.counterpart.to_string(), state);
}
}
}
diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala
index 92827296..c95e42e3 100644
--- a/libdino/src/service/connection_manager.vala
+++ b/libdino/src/service/connection_manager.vala
@@ -153,7 +153,7 @@ public class ConnectionManager {
private void check_reconnect(Account account) {
PingResponseListenerImpl ping_response_listener = new PingResponseListenerImpl(this, account);
Core.XmppStream stream = stream_states[account].stream;
- Xep.Ping.Module.get_module(stream).send_ping(stream, account.domainpart, ping_response_listener);
+ stream.get_module(Xep.Ping.Module.IDENTITY).send_ping(stream, account.domainpart, ping_response_listener);
Timeout.add_seconds(5, () => {
if (stream_states[account].stream != stream) return false;
@@ -203,7 +203,7 @@ public class ConnectionManager {
Xmpp.Presence.Stanza presence = new Xmpp.Presence.Stanza();
presence.type_ = Xmpp.Presence.Stanza.TYPE_UNAVAILABLE;
try {
- Presence.Module.get_module(stream_states[account].stream).send_presence(stream_states[account].stream, presence);
+ stream_states[account].stream.get_module(Presence.Module.IDENTITY).send_presence(stream_states[account].stream, presence);
stream_states[account].stream.disconnect();
} catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
}
diff --git a/libdino/src/service/message_manager.vala b/libdino/src/service/message_manager.vala
index 76a05f9e..07a35a49 100644
--- a/libdino/src/service/message_manager.vala
+++ b/libdino/src/service/message_manager.vala
@@ -171,7 +171,7 @@ public class MessageManager : StreamInteractionModule, Object {
if (message.encryption == Entities.Message.Encryption.PGP) {
string? key_id = PgpManager.get_instance(stream_interactor).get_key_id(conversation.account, message.counterpart);
if (key_id != null) {
- bool encrypted = Xep.Pgp.Module.get_module(stream).encrypt(new_message, key_id);
+ bool encrypted = stream.get_module(Xep.Pgp.Module.IDENTITY).encrypt(new_message, key_id);
if (!encrypted) {
message.marked = Entities.Message.Marked.WONTSEND;
return;
@@ -179,9 +179,9 @@ public class MessageManager : StreamInteractionModule, Object {
}
}
if (delayed) {
- Xmpp.Xep.DelayedDelivery.Module.get_module(stream).set_message_delay(new_message, message.time);
+ stream.get_module(Xmpp.Xep.DelayedDelivery.Module.IDENTITY).set_message_delay(new_message, message.time);
}
- Xmpp.Message.Module.get_module(stream).send_message(stream, new_message);
+ stream.get_module(Xmpp.Message.Module.IDENTITY).send_message(stream, new_message);
message.stanza_id = new_message.id;
message.stanza = new_message;
} else {
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index 74467077..8e894211 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -28,27 +28,27 @@ public class MucManager : StreamInteractionModule, Object {
public void join(Account account, Jid jid, string nick, string? password = null) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xep.Muc.Module.get_module(stream).enter(stream, jid.bare_jid.to_string(), nick, password, new MucEnterListenerImpl(this, jid, nick, account));
+ if (stream != null) stream.get_module(Xep.Muc.Module.IDENTITY).enter(stream, jid.bare_jid.to_string(), nick, password, new MucEnterListenerImpl(this, jid, nick, account));
}
public void part(Account account, Jid jid) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xep.Muc.Module.get_module(stream).exit(stream, jid.bare_jid.to_string());
+ if (stream != null) stream.get_module(Xep.Muc.Module.IDENTITY).exit(stream, jid.bare_jid.to_string());
}
public void change_subject(Account account, Jid jid, string subject) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xep.Muc.Module.get_module(stream).change_subject(stream, jid.bare_jid.to_string(), subject);
+ if (stream != null) stream.get_module(Xep.Muc.Module.IDENTITY).change_subject(stream, jid.bare_jid.to_string(), subject);
}
public void change_nick(Account account, Jid jid, string new_nick) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xep.Muc.Module.get_module(stream).change_nick(stream, jid.bare_jid.to_string(), new_nick);
+ if (stream != null) stream.get_module(Xep.Muc.Module.IDENTITY).change_nick(stream, jid.bare_jid.to_string(), new_nick);
}
public void kick(Account account, Jid jid, string nick) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xep.Muc.Module.get_module(stream).kick(stream, jid.bare_jid.to_string(), nick);
+ if (stream != null) stream.get_module(Xep.Muc.Module.IDENTITY).kick(stream, jid.bare_jid.to_string(), nick);
}
public ArrayList<Jid>? get_occupants(Jid jid, Account account) {
@@ -76,28 +76,28 @@ public class MucManager : StreamInteractionModule, Object {
public void get_bookmarks(Account account, Xep.Bookmarks.ConferencesRetrieveResponseListener listener) {
Core.XmppStream? stream = stream_interactor.get_stream(account);
if (stream != null) {
- Xep.Bookmarks.Module.get_module(stream).get_conferences(stream, listener);
+ stream.get_module(Xep.Bookmarks.Module.IDENTITY).get_conferences(stream, listener);
}
}
public void add_bookmark(Account account, Xep.Bookmarks.Conference conference) {
Core.XmppStream? stream = stream_interactor.get_stream(account);
if (stream != null) {
- Xep.Bookmarks.Module.get_module(stream).add_conference(stream, conference);
+ stream.get_module(Xep.Bookmarks.Module.IDENTITY).add_conference(stream, conference);
}
}
public void replace_bookmark(Account account, Xep.Bookmarks.Conference was, Xep.Bookmarks.Conference replace) {
Core.XmppStream? stream = stream_interactor.get_stream(account);
if (stream != null) {
- Xep.Bookmarks.Module.get_module(stream).replace_conference(stream, was, replace);
+ stream.get_module(Xep.Bookmarks.Module.IDENTITY).replace_conference(stream, was, replace);
}
}
public void remove_bookmark(Account account, Xep.Bookmarks.Conference conference) {
Core.XmppStream? stream = stream_interactor.get_stream(account);
if (stream != null) {
- Xep.Bookmarks.Module.get_module(stream).remove_conference(stream, conference);
+ stream.get_module(Xep.Bookmarks.Module.IDENTITY).remove_conference(stream, conference);
}
}
@@ -158,7 +158,7 @@ public class MucManager : StreamInteractionModule, Object {
private void on_stream_negotiated(Account account) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xep.Bookmarks.Module.get_module(stream).get_conferences(stream, new BookmarksRetrieveResponseListener(this, account));
+ if (stream != null) stream.get_module(Xep.Bookmarks.Module.IDENTITY).get_conferences(stream, new BookmarksRetrieveResponseListener(this, account));
}
private void on_pre_message_received(Entities.Message message, Conversation conversation) {
diff --git a/libdino/src/service/presence_manager.vala b/libdino/src/service/presence_manager.vala
index be1e00fc..fd78496f 100644
--- a/libdino/src/service/presence_manager.vala
+++ b/libdino/src/service/presence_manager.vala
@@ -57,17 +57,17 @@ public class PresenceManager : StreamInteractionModule, Object {
public void request_subscription(Account account, Jid jid) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xmpp.Presence.Module.get_module(stream).request_subscription(stream, jid.bare_jid.to_string());
+ if (stream != null) stream.get_module(Xmpp.Presence.Module.IDENTITY).request_subscription(stream, jid.bare_jid.to_string());
}
public void approve_subscription(Account account, Jid jid) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xmpp.Presence.Module.get_module(stream).approve_subscription(stream, jid.bare_jid.to_string());
+ if (stream != null) stream.get_module(Xmpp.Presence.Module.IDENTITY).approve_subscription(stream, jid.bare_jid.to_string());
}
public void deny_subscription(Account account, Jid jid) {
Core.XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) Xmpp.Presence.Module.get_module(stream).deny_subscription(stream, jid.bare_jid.to_string());
+ if (stream != null) stream.get_module(Xmpp.Presence.Module.IDENTITY).deny_subscription(stream, jid.bare_jid.to_string());
}
public static PresenceManager? get_instance(StreamInteractor stream_interactor) {
diff --git a/libdino/src/service/roster_manager.vala b/libdino/src/service/roster_manager.vala
index 6f6f402a..720a746a 100644
--- a/libdino/src/service/roster_manager.vala
+++ b/libdino/src/service/roster_manager.vala
@@ -41,12 +41,12 @@ namespace Dino {
public void remove_jid(Account account, Jid jid) {
Core.XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) Xmpp.Roster.Module.get_module(stream).remove_jid(stream, jid.bare_jid.to_string());
+ if (stream != null) stream.get_module(Xmpp.Roster.Module.IDENTITY).remove_jid(stream, jid.bare_jid.to_string());
}
public void add_jid(Account account, Jid jid, string? handle) {
Core.XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) Xmpp.Roster.Module.get_module(stream).add_jid(stream, jid.bare_jid.to_string(), handle);
+ if (stream != null) stream.get_module(Xmpp.Roster.Module.IDENTITY).add_jid(stream, jid.bare_jid.to_string(), handle);
}
public static RosterManager? get_instance(StreamInteractor stream_interactor) {
diff --git a/libdino/src/ui/chat_input.vala b/libdino/src/ui/chat_input.vala
index cc4fd24a..5030fcea 100644
--- a/libdino/src/ui/chat_input.vala
+++ b/libdino/src/ui/chat_input.vala
@@ -68,11 +68,6 @@ public class ChatInput : Grid {
case "/nick":
MucManager.get_instance(stream_interactor).change_nick(conversation.account, conversation.counterpart, token[1]);
break;
- case "/ping": // TODO remove this
- Xep.Ping.Module.get_module(stream_interactor.get_stream(conversation.account))
- .send_ping(stream_interactor.get_stream(conversation.account), @"$(conversation.counterpart.bare_jid)/$(token[1])");
- Xep.Ping.Module.get_module(stream_interactor.get_stream(conversation.account)).get_id();
- break;
case "/topic":
MucManager.get_instance(stream_interactor).change_subject(conversation.account, conversation.counterpart, token[1]);
break;