is there an hook or interface or whatever that could be used for extending token functionality of sharepoint? For example [Me] token is insufficient for me and I would like to for example develop my own token that can take values from user profiles. Is that possible?
There is no way to extend CAML queries. You can see all the existing tokens and possible query elements here:
Well, there are a couple of undocumented CAML Query attributes, but AFAIK nothing that can help in your case.
But there are other possible solutions.
Here I assume that you want to filter a list or a document library. In SharePoint, those objects are rendered via XsltListViewWebPart webpart. This is OOTB webpart, very flexible and powerful.
One solution here would be to set the Query for the XsltListViewWebPart dynamically from your custom webpart deployed to same page.
Another solution, the one I would prefer, is to use parameter bindings. The thing is, you can use parameters in the query. If you open a list view in SPD and select XsltListViewWebPart, there is "Parameters" button on the ribbon.
Using this functionality, you can define one or more parameters. They can come from Query string or from a control on the same page and also from some other places.
Later you can use those parameter in your query:
This will generate the following CAML query:
Additionally, it will generate the parameter binding, like this:
So in your case it's quite simple to create a control which will expose a property from the current user profile. Something like this:
(please replace "PropertyName" with your actual property name)
This control can be deployed either as a delegate control or you can put it straight to the list view page.
P.S. Truth be told, there is already such control in SharePoint, ProfilePropertyValue. Unfortunately, the parameter bingings can only grab values from some public properties of the control, but not from it's output. And unfortunately, ProfilePropertyValue only yields the value of the property to the page, and doesn't expose it to any of it's properties.