Constraints icons in the outliner

Hi! Sorry, since this is probably quite a basic/stupid question, I’m working with Jendrzych to make custom icons for the constraints, and I wanted to try to define them in the code.

Copying looking at the modifiers code I was able to add the correct icon for each constraint in rna_constraints.c, to have them in the add menu and in the box template;
for object constraints I also managed to define them in outliner_draw, but now I’m stuck with the bone ones.

Basically I don’t know how to access the correct bPoseChannel from the armature’s list.
I’m not even sure is this approach is possible, due to how many levels of parenthood there could be in bones, but this is where I am at the moment:

case TSE_CONSTRAINT: {
        Object *ob = (Object *)tselem->id;
        
        if (ob->mode & OB_MODE_POSE) { /*placeholder filter for testing*/
          
          bPoseChannel *pchan = BLI_findlink(&ob->pose->chanbase, ???);
          
          bConstraint *con = BLI_findlink(&pchan->constraints, tselem->nr-1000);

          switch ((eBConstraint_Types)con->type) {
            case CONSTRAINT_TYPE_SIZELIKE:
              data.icon = ICON_CON_SIZELIKE;
              break;
            //every other case
            default:
              data.icon = ICON_DOT;
              break;  
          }
        }
        else { /*object constraints*/
          bConstraint *con = BLI_findlink(&ob->constraints, tselem->nr);
          
          switch ((eBConstraint_Types)con->type) {
            case CONSTRAINT_TYPE_CAMERASOLVER:
              data.icon = ICON_CON_CAMERASOLVER;
              break;
            //every other case

I’m also not sure on how to filter object/bone constraints, is there a way to see whether the tree element is “owned” by a bone without too many passages?
Otherwise would having two separate TSE types in DNA_outliner_types.h be acceptable?