Today I noticed something odd in the webquery response for “servergrouplist”. The IconID for the server group “Server Admin” was “-947781735”. But that was quite impossible since IconIDs are unsigned integers. I also tried the same with the “raw” server query and it too reported the wrong iconID. The voice client however showed me the correct IconID, which is “3347185561”. After some thinking I noticed how these two are linked together. “-947781735” is the signed integer equivalent for the unsigned integer “3347185561”. So this seems like a type conversion error somewhere in a shared code base for both queries, since both showed the same - false - iconID and the voice client showed the correct one. Intresting two note here is, that this bug only appeard on this particular “Server Admin” group (not the template!). The icon is correctly named in the channel 0:
“name=icon_3347185561 size=345 datetime=1608256865 type=1”
Is this a known bug or did I find something new here? I would appreciated your feedback on this, since this makes the code for downloading group icons pretty ugly and sometimes breaks my parser, too.
Btw: If I changed the icon to something different, it works. This might be a result, that this icon was the first one added to the server and also was first used as a channel icon, if this changes anything.
Thank you in advance for your reply,
Philipp
That’s not an error or bug. That’s by design.
Only when icons are set as channel or server icon you will get a positive value there.
The icon set as a permission in groups or clients will show a negative value in case the icon is bigger than 32 bit signed.
Mentioned this last year in old forum.
4 Likes
First of all: Thank you for this fast response.
However, I have still a few questions here:
Why does it work for all the other Groups? And why can the Voice client show the correct value?
Also
Does that mean the icon itself (filesize) or the randomly assigned id of the icon?
I get why you don’t want to, well judging by your linked response, fix this, but why return the group icon ID anyway, if there is no real way of saying if the response is valid or not.
Furthermore - as a workaround - wouldn’t it be valid to convert a wrong iconID back to the correct one before sending it back to the user? As I explained in my original post, they are, well sortof, the same number, just in different types.
Thanks again for your quick response and I am looking forward to hearing from you again.
I do not see a reason why the same icon (the one you report here) set on other groups shows a different result on groups.
Technically the icon ID is not wrong. It’s in the range of the mentioned 32 bit int.
And if we would convert it in the Query then we must touch the whole permission system. This is still not worth it. Actually as a positive value you would not be able to set such icons as permissions as their value is bigger than the value the permission allows to set.
In client it is easy to show something more user friendly as it is in the server itself where the permissions are handled.
Note:
The template group can not (or should not) have your icon set! The one will only will work on virtual servers where the icon is uploaded.
The filename itself is the result of the crc32 checksum of the file itself.
3 Likes
Oh so that means renaming and reuploading it fixes the issue altogether?
Maybe consider limiting the filename length then?
No. The result would be the same when done in client.
When you replace the icon with SSH, FTP etc. connection intto the right directoiry and set a number with at least 5 digits this should work yes.
OR better and more supported way!!!
Save the icon in another format or different quality or change the content of it and then upload it again.
3 Likes
Thanks for the suggestion, but since this would require potentially alot of work when dealing with many icons, I will just stick with converting the IDs like this:
var IconID int32 = -947781735
fmt.Printf("%d", uint32(IconID))
(That’s golang, in case you were wondering) Try it on the playground
As far as I can tell, this results in the correct ID all the time.
Anyway, I really appreciated this quick discussion about this issue.
One last question: If I run in such a issue in the future, is there some central, single source of truth about such “special behaviour”, ie an documentation of all the in and outs of the serverquery, since I couldn’t find anything on this in any official or unofficial documentation. If there isn’t, might I kindly suggest adding like a “known issue” section to the serverquery docs shipped with the server? I know about the changelog, but going through all the changelogs ever for every anomaly just sounds very unintuitive to me.
Also just a related question: Do you have a documentation for the types the serverquery has for clients and groups? I think I figured them out
(client:
1 → Query
2 → VoiceClient
group:
servergroups:
0 → Template
1 → Normal
2 → ServerQuery
channelgroups:
0 → Template
1 → Normal)
but it would be nice to have some validation on that.
Hey @TS.ChrisR,
yesterday I read through the Changelog of the server and was reminded of this discussion when I came across the changes of version 3.8.0 - 28.05.2019
Changed: Server / channel icons will not display as negative values anymore in ServerQuery.
This - at least to me - sounds to me like this is a bug then, since you specifically said that this was changed little over 1 1/2 years ago?
Or is this still working as expected?
MfG,
Philipp
Yes since 2019 this is the desired behavior and hasn’t changed.
But after re- reading first post and my reply I found a mistake.
I wrote channel and server groups but did mean Channel or Server Icon.
I made the correction in my first post.
Short Summary (this is how it should be):
- Icon on hard drive is crc32 checksum.
- Icon set as Server or Channel icon will never show the negative value in Server/WebQuery. This was changed and is possible because it’s treated like a property when you request the chanel/server info.
- Icon set in Groups or Clients permission will show the negative value in Server/WebQuery. We did not touch it because overhauling whole permission for this was not worth it.
- Before the change we made in 3.8.0 the ServerQuery did also show the negative value for Channel or Server icon.
- The client has it’s own code to avoid this.
2 Likes