I think we need to do some checks first:
1) heuristically detect type of "first" and of "second" (ie, check the NEMOQMLPLUGINS_SOCIAL_CONTENTITEMTYPE if it exists, otherwise do normal heuristic check, perhaps)
2) depending on the type, either look up the appropriate property (for a User/Friend, it's FACEBOOK_ONTOLOGY_USER_NAME, for an Album it's FACEBOOK_ONTOLOGY_ALBUM_NAME, for a Photo it's FACEBOOK_ONTOLOGY_PHOTO_NAME, for a Like it's FACEBOOK_ONTOLOGY_LIKE_USERNAME, for a Comment it's a two stage: FACEBOOK_ONTOLOGY_COMMENT_FROM then FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTNAME, etc).
3) do the comparison.

This ensures that the sorter works for more types than just User / Friend types.