diff options
author | fiaxh <git@mx.ax.lt> | 2017-06-16 14:29:02 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-06-17 16:13:23 +0200 |
commit | 26973c89e391de673b6ac1db024a3098b1191393 (patch) | |
tree | eb17d5006c1e70e7e88b71700455c40081b4af47 /xmpp-vala/src/module/xep | |
parent | 7bbbb738fdb233f4ad91ffdd7d9247b28849d715 (diff) | |
download | dino-26973c89e391de673b6ac1db024a3098b1191393.tar.gz dino-26973c89e391de673b6ac1db024a3098b1191393.zip |
Set jid handle in ContactDetails, use LabelHybrids more, remove edit from StartConversation
Diffstat (limited to 'xmpp-vala/src/module/xep')
-rw-r--r-- | xmpp-vala/src/module/xep/0045_muc/flag.vala | 9 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0045_muc/module.vala | 14 |
2 files changed, 19 insertions, 4 deletions
diff --git a/xmpp-vala/src/module/xep/0045_muc/flag.vala b/xmpp-vala/src/module/xep/0045_muc/flag.vala index cf729bf9..00383407 100644 --- a/xmpp-vala/src/module/xep/0045_muc/flag.vala +++ b/xmpp-vala/src/module/xep/0045_muc/flag.vala @@ -8,6 +8,7 @@ public class Flag : XmppStreamFlag { public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "muc"); private HashMap<string, Gee.List<Feature>> room_features = new HashMap<string, Gee.List<Feature>>(); + private HashMap<string, string> room_names = new HashMap<string, string>(); private HashMap<string, string> enter_ids = new HashMap<string, string>(); private HashMap<string, string> own_nicks = new HashMap<string, string>(); @@ -18,6 +19,8 @@ public class Flag : XmppStreamFlag { private HashMap<string, HashMap<string, Affiliation>> affiliations = new HashMap<string, HashMap<string, Affiliation>>(); private HashMap<string, Role> occupant_role = new HashMap<string, Role>(); + public string? get_room_name(string jid) { return room_names.has_key(jid) ? room_names[jid] : null; } + public bool has_room_feature(string jid, Feature feature) { return room_features.has_key(jid) && room_features[jid].contains(feature); } @@ -59,6 +62,10 @@ public class Flag : XmppStreamFlag { public string? get_muc_subject(string bare_jid) { return subjects[bare_jid]; } + internal void set_room_name(string jid, string name) { + room_names[jid] = name; + } + internal void set_room_features(string jid, Gee.List<Feature> features) { room_features[jid] = features; } @@ -121,4 +128,4 @@ public class Flag : XmppStreamFlag { internal override string get_id() { return IDENTITY.id; } } -}
\ No newline at end of file +} diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index 82a7d7a6..951ec7d1 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -10,6 +10,7 @@ private const string NS_URI_OWNER = NS_URI + "#owner"; private const string NS_URI_USER = NS_URI + "#user"; public enum MucEnterError { + NONE, PASSWORD_REQUIRED, BANNED, ROOM_DOESNT_EXIST, @@ -64,7 +65,7 @@ public class Module : XmppStreamModule { public signal void room_configuration_changed(XmppStream stream, string jid, StatusCode code); public signal void room_entered(XmppStream stream, string jid, string nick); - public signal void room_enter_error(XmppStream stream, string jid, MucEnterError error); + public signal void room_enter_error(XmppStream stream, string jid, MucEnterError? error); // TODO "?" shoudln't be necessary (vala bug), remove someday public signal void self_removed_from_room(XmppStream stream, string jid, StatusCode code); public signal void removed_from_room(XmppStream stream, string jid, StatusCode? code); @@ -213,7 +214,7 @@ public class Module : XmppStreamModule { string bare_jid = get_bare_jid(presence.from); ErrorStanza? error_stanza = presence.get_error(); if (flag.get_enter_id(bare_jid) == presence.id) { - MucEnterError? error = null; + MucEnterError error = MucEnterError.NONE; switch (error_stanza.condition) { case ErrorStanza.CONDITION_NOT_AUTHORIZED: if (ErrorStanza.TYPE_AUTH == error_stanza.type_) error = MucEnterError.PASSWORD_REQUIRED; @@ -240,7 +241,7 @@ public class Module : XmppStreamModule { if (ErrorStanza.TYPE_CANCEL == error_stanza.type_) error = MucEnterError.USE_RESERVED_ROOMNICK; break; } - if (error != null) room_enter_error(stream, bare_jid, error); + if (error != MucEnterError.NONE) room_enter_error(stream, bare_jid, error); flag.finish_muc_enter(bare_jid); } } @@ -312,6 +313,13 @@ public class Module : XmppStreamModule { Gee.List<Feature> features = new ArrayList<Feature>(); if (query_result != null) { + + foreach (ServiceDiscovery.Identity identity in query_result.identities) { + if (identity.category == "conference") { + stream.get_flag(Flag.IDENTITY).set_room_name(jid, identity.name); + } + } + foreach (string feature in query_result.features) { Feature? parsed = null; switch (feature) { |