aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2018-04-17 20:11:44 +0200
committerfiaxh <git@mx.ax.lt>2018-04-17 22:13:05 +0200
commitc656c7e9c274f3426527355320c0c22549c7792b (patch)
tree8f17679f6ef1fad0ea5f4a1713122a06b5b205c9 /libdino/src/service
parent105006c5f10e4c3cba7f0a6211215b07343e7c7d (diff)
downloaddino-c656c7e9c274f3426527355320c0c22549c7792b.tar.gz
dino-c656c7e9c274f3426527355320c0c22549c7792b.zip
small fixes
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/muc_manager.vala51
1 files changed, 32 insertions, 19 deletions
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index 8b5b8e7f..cd4ff852 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -151,57 +151,70 @@ public class MucManager : StreamInteractionModule, Object {
}
public string? get_room_name(Account account, Jid jid) {
- XmppStream? stream = stream_interactor.get_stream(account);
- return stream != null ? stream.get_flag(Xep.Muc.Flag.IDENTITY).get_room_name(jid) : null;
+ Xep.Muc.Flag? flag = get_muc_flag(account);
+ if (flag != null) {
+ return flag.get_room_name(jid);
+ }
+ return null;
}
public string? get_groupchat_subject(Jid jid, Account account) {
- XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) {
- return stream.get_flag(Xep.Muc.Flag.IDENTITY).get_muc_subject(jid.bare_jid);
+ Xep.Muc.Flag? flag = get_muc_flag(account);
+ if (flag != null) {
+ return flag.get_muc_subject(jid.bare_jid);
}
return null;
}
public Jid? get_real_jid(Jid jid, Account account) {
- XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) {
- return stream.get_flag(Xep.Muc.Flag.IDENTITY).get_real_jid(jid);
+ Xep.Muc.Flag? flag = get_muc_flag(account);
+ if (flag != null) {
+ return flag.get_real_jid(jid);
}
return null;
}
public Xep.Muc.Role? get_role(Jid jid, Account account) {
- XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) return stream.get_flag(Xep.Muc.Flag.IDENTITY).get_occupant_role(jid);
+ Xep.Muc.Flag? flag = get_muc_flag(account);
+ if (flag != null) {
+ return flag.get_occupant_role(jid);
+ }
return null;
}
public Xep.Muc.Affiliation? get_affiliation(Jid muc_jid, Jid jid, Account account) {
- XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) return stream.get_flag(Xep.Muc.Flag.IDENTITY).get_affiliation(muc_jid, jid);
+ Xep.Muc.Flag? flag = get_muc_flag(account);
+ if (flag != null) {
+ return flag.get_affiliation(muc_jid, jid);
+ }
return null;
}
public Gee.List<Jid>? get_offline_members(Jid jid, Account account) {
- XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) {
- return stream.get_flag(Xep.Muc.Flag.IDENTITY).get_offline_members(jid);
+ Xep.Muc.Flag? flag = get_muc_flag(account);
+ if (flag != null) {
+ return flag.get_offline_members(jid);
}
return null;
}
public Jid? get_own_jid(Jid muc_jid, Account account) {
- XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) {
- Xep.Muc.Flag? flag = stream.get_flag(Xep.Muc.Flag.IDENTITY);
- if (flag == null) return null;
+ Xep.Muc.Flag? flag = get_muc_flag(account);
+ if (flag != null) {
string? nick = flag.get_muc_nick(muc_jid);
if (nick != null) return muc_jid.with_resource(nick);
}
return null;
}
+ private Xep.Muc.Flag? get_muc_flag(Account account) {
+ XmppStream? stream = stream_interactor.get_stream(account);
+ if (stream != null) {
+ return stream.get_flag(Xep.Muc.Flag.IDENTITY);
+ }
+ return null;
+ }
+
public bool is_joined(Jid jid, Account account) {
return get_own_jid(jid, account) != null;
}