     # included (in accordance with XEP-0030, the category and type MUST be
     # included.
 
-    # not implemented yet
+    propertySort( ids, "category" )
+    propertySort( ids, "type" )
+    propertySort( ids, "lang" )
 
     # 3. For each identity, append the 'category/type/lang/name' to S, followed by
     # the '<' character.
 
-    S += "client/pc//#{conn.disco._identities[0].name}<"
+    for key, id of ids
+      S += "#{id.category}/#{id.type}/#{id.lang}/#{id.name}<"
 
     # 4. Sort the supported service discovery features.
-    
-    features = conn.disco._features
+
     features.sort()
 
     # 5. For each feature, append the feature to S, followed by the '<' character.

Strophe.addConnectionPlugin 'caps', (->

  conn = null

  init = ( c ) ->
    conn = c
    Strophe.addNamespace 'CAPS', "http://jabber.org/protocol/caps"
    conn.disco.addFeature Strophe.NS.CAPS
    conn.disco.addFeature Strophe.NS.DISCO_INFO
    conn.disco.addIdentity "client", "pc", "strophe", ""

  addNode = (feature) -> conn.disco.addFeature feature

  sendPres = -> conn.send $pres().c "c",
    xmlns: Strophe.NS.CAPS
    hash: "sha-1"
    node: conn.disco._identities[0].name
    ver: generateVerificationString()

  generateVerificationString = ->

    # 1. Initialize an empty string S.



    #  c) For each field other than FORM_TYPE:

    #     i.  Append the value of the "var" attribute, followed by the '<'
    #         character.

    # not implemented yet

    #    ii.  Sort values by the XML character data of the <value/> element.

    # not implemented yet

    #   iii.  For each <value/> element, append the XML character data, followed by
    #         the '<' character.

    # not implemented yet

