string message)
{
var channel = (Channel) proxy;
- var group = channel.get_identifier ();
- var error = new GLib.Error ((Quark) domain, code, "%s", message);
- this.group_removed (group, error);
+ this.channel_group_personas_map.remove (channel);
+ this.channel_group_incoming_adds.remove (channel);
+
+ if (proxy == this.publish)
+ this.publish = null;
+ else if (proxy == this.subscribe)
+ this.subscribe = null;
+ else
+ {
- var error = new GLib.Error ((Quark) domain, code, message);
++ var error = new GLib.Error ((Quark) domain, code, "%s", message);
+ var name = channel.get_identifier ();
+ this.group_removed (name, error);
+ this.groups.remove (name);
+ }
+ }
+
+ private void ignore_by_handle_if_needed (uint handle)
+ {
+ unowned Tp.IntSet members;
+
+ if (this.subscribe != null)
+ {
+ members = this.subscribe.group_get_members ();
+ if (members.is_member (handle))
+ return;
- this.group_personas_map.remove (channel.get_identifier ());
- this.group_incoming_adds.remove (channel.get_identifier ());
+ members = this.subscribe.group_get_remote_pending ();
+ if (members.is_member (handle))
+ return;
+ }
- this.channels.remove (group);
+ if (this.publish != null)
+ {
+ members = this.publish.group_get_members ();
+ if (members.is_member (handle))
+ return;
+ }
+
+ var persona = this.handle_persona_map[handle];
+ this.ignore_persona (persona);
}
- private void channel_group_pend_incoming_adds (Channel channel,
- Array<uint> adds)
+ private void ignore_persona (Tpf.Persona? persona)
{
- var group = channel.get_identifier ();
+ if (persona == null)
+ return;
+
+ foreach (var entry in this.channel_group_incoming_adds)
+ {
+ var channel = (Channel) entry.key;
+ var members = this.channel_group_personas_map[channel];
+ if (members != null)
+ members.remove (persona);
+ }
+
+ foreach (var entry in this.group_outgoing_adds)
+ {
+ var name = (string) entry.key;
+ var members = this.group_outgoing_adds[name];
+ if (members != null)
+ members.remove (persona);
+ }
+ var personas = new GLib.List<Persona> ();
+ personas.append (persona);
+ this.personas_removed (personas);
+ this._personas.remove (persona.iid);
+ }
+
+ /**
+ * Remove the given persona from the server entirely
+ */
+ public override void remove_persona (Folks.Persona persona)
+ {
+ var tp_persona = (Tpf.Persona) persona;
+
+ try
+ {
+ this.ll.channel_group_change_membership (this.stored,
+ (Handle) tp_persona.contact.handle, false);
+ }
+ catch (GLib.Error e)
+ {
+ warning ("failed to remove persona '%s' (%s) from stored list: %s",
+ tp_persona.uid, tp_persona.alias, e.message);
+ }
+
+ try
+ {
+ this.ll.channel_group_change_membership (this.subscribe,
+ (Handle) tp_persona.contact.handle, false);
+ }
+ catch (GLib.Error e)
+ {
+ warning ("failed to remove persona '%s' (%s) from subscribe list: %s",
+ tp_persona.uid, tp_persona.alias, e.message);
+ }
+
+ try
+ {
+ this.ll.channel_group_change_membership (this.publish,
+ (Handle) tp_persona.contact.handle, false);
+ }
+ catch (GLib.Error e)
+ {
+ warning ("failed to remove persona '%s' (%s) from publish list: %s",
+ tp_persona.uid, tp_persona.alias, e.message);
+ }
+
+ var personas = new GLib.List<Persona> ();
+ personas.append (tp_persona);
+ this.personas_removed (personas);
+ }
+
+ /* Only non-group contact list channels should use create_personas == true,
+ * since the exposed set of Personas are meant to be filtered by them */
+ private void channel_group_pend_incoming_adds (Channel channel,
+ Array<uint> adds,
+ bool create_personas)
+ {
var adds_length = adds != null ? adds.length : 0;
if (adds_length >= 1)
{