Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
neoXMPP #1
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
Subject: Delete Contact Group
I am using the Matrix XMPP Library for .NET.

I couldn't find anything related to deleting contact group in the documentation. Is there a way to delete a contact group with all the contacts available under the group?
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
There is no "delete contact group" in XMPP. There is also no create contact group in XMPP.
Groups are always directly assigned to a contact, and a client build the group list while receiving the contacts by checking every group a contact is assigned to.

This means in your case you have to loop over your contacts and Send a delete request for every contact which is assigned to the group you want to get rid of.
Avatar
neoXMPP #3
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
When I add a contact to a group, it gets created automatically if the group name does not exist. That's neat.

For removing contacts from a group, I can look through. No problem. But it does not get auto-deleted when all contacts are removed. There is just no way to remove/delete a group?
Avatar
Alex #4
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The server stores the single contacts which looks like the following:

  1. <item jid="alex@ag-software.net" name="Alex" subscription="both">
  2.    <group>AG-Software</group>
  3.    <group>XMPP</group>
  4. </item>

It stores either the complete xml or maps this to some other format or database.

When you login it sends you all these contacts, and you build the group list yourself from this info.
The groups are like labels or tags.

This means if the last contact is gone which has group "XXX" then this group is also automatically gone.
So when you login then the clients asks the server for all your contacts, it does not additionally ask "which groups exist".

Does this answer your question? Its hard to explain ;-)
Avatar
neoXMPP #5
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex. If I understand correctly, it is left to the server to decide how to store/handle the labels/groups. I think in the case of Cisco, it creates a group entry XXX for the user who created it. And like you said, tags the contacts to XXX. Deleting users from the group removes the tagging part but the database entry for group is never deleted unless the user does it on his Jabber client.

This is killing the user experience of my project here, I'm trying to build some bots that will help users create (and delete) contact groups based on Exchange DL name and members.
Avatar
Alex #6
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by neoXMPP:
... but the database entry for group is never deleted unless the user does it on his Jabber client.

there is no "Delete Group Entry" in the XMPP protocol. So the group cannot be deleted directly.

Some clients have a delete group feature in the UI. But what they do when you click on delete group is either:
1) loop all contacts in this group and send a contact update to the server which removes the contact from this group.
2) loop all contacts in this group and remove them completely from the roster

Whether the do 1 or 2 also depends on whether the client support multiple groups per contact. A client can be assigned to multiple groups. But many clients don't support this feature and read only the first group and display the contact in the first group they find in the UI.
Avatar
neoXMPP #7
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
Cisco Presence Server allows me to add same contact as part of more than one group. Cisco client (Jabber) also allows deleting a group (which deletes all contacts within the group). While this works fine from the client. I would've liked to have the same capability via the Matrix or some other API. I'm not sure if Cisco's own presence SDK has this feature but that SDK works only from browser (Javascript) and I am developing a c# app.
Avatar
Alex #8
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Look at the XML which is passing the wire when you execute this functions in the Cisco client.
Everything this client does you can also do with MatriX.

edit:
The may have custom extensions for this. We can see this in the XML logs and then tell you how to build these packets with MatriX.
This post was edited on 2013-05-23, 16:41 by Alex.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS