Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Icon ID's are invalid #39

Closed
leapmotiondev opened this issue Mar 9, 2019 · 10 comments

Comments

@leapmotiondev
Copy link

commented Mar 9, 2019

Describe the bug
Some Icon id's are going negative. Pattern unknown. Seems like it's completly random what icons are affected.
Trying to set the obtained icon id to a server/channel-group or server/channel returns "convert error".

I obtain the iconid by getChannelGroupByID() -> object.getCache(), which returns following:
{ cgid: 158, name: 'MyChannelGroup', type: '1', iconid: '-164414261', savedb: '1', sortid: '14500', namemode: '0', n_modifyp: '50', n_member_addp: '75', n_member_removep: '25' }

To Reproduce
g_teamspeak.getChannelGroupByID(client['client_channel_group_id']).then(function(obj) { console(obj.getCache().iconid); // returns -543746121, valid icon id would be 1958946389 });

Expected behavior
Valid channelgroup icon id that I can set as channel icon

Versions used

  • 3.6.0 (16.01.2019 08:50:10)
  • v11.11.0
  • latest (as of 09.03.2019)

Additional context
I'm getting the channelgroup icon of a user, the user creates a channel in a certain area, gets channel admin and the created channel should get the icon that the user had before he created the channel.

@Multivit4min

This comment has been minimized.

Copy link
Owner

commented Mar 9, 2019

TeamSpeak Internally saves them in the permission list as 32 bit signed int which means the numbers can go from −2147483648 to 2147483647 however when used in the icon name it gets converted to an unsigned 32 bit int which goes from 0 to 4294967295

how exactly do you try to set the channel icon in your code?

@leapmotiondev

This comment has been minimized.

Copy link
Author

commented Mar 9, 2019

var icon_id = -1;
g_teamspeak.getChannelGroupByID(client['client_channel_group_id']).then(function(obj) {
	icon_id = obj.getCache().iconid;
});

// i then create a channel, get the promise, .then() this here ..
g_teamspeak.channelEdit(obj['_propcache']['cid'], {
	channel_icon_id: icon_id 
})

@Multivit4min

This comment has been minimized.

Copy link
Owner

commented Mar 9, 2019

This is a problem with the wrong usage of asynchronous functions in NodeJS ;)

ts3.getChannelGroupByID(client['client_channel_group_id'])
  //the "obj" you receive from here is this https://multivit4min.github.io/TS3-NodeJS-Library/#teamspeakchannel
  .then(channel => channel.edit({ channel_icon_id: channel.getCache().iconid }))

//if you would do call the edit here the iconid would still be -1
//the function inside "then" from the getChannelGroupByID Method would be called a few milliseconds later
@leapmotiondev

This comment has been minimized.

Copy link
Author

commented Mar 9, 2019

Mhh, I do get other values than -1 tho.
It's just an issue with converting it to a valid int64.

And shouldn't getChannelGroupByID return https://multivit4min.github.io/TS3-NodeJS-Library/#teamspeakchannelgroup?

see here:

			g_teamspeak.getChannelGroupByID(client['client_channel_group_id']).then(function(obj) {
				icon_id = obj['_propcache']['iconid'];
			});

			g_teamspeak
				.channelCreate("testchannel", {
					cpid: 32,
					channel_codec: 4
				.then(function(obj) {
					console.log(icon_id); // returns int32 iconid
					g_teamspeak
						.channelEdit(obj['_propcache']['cid'], {
							channel_icon_id: icon_id
						})
						.catch(e => {
							console.log(e.message);
						});
				})
				.catch(e => {
					con.error('[TSLIB] ', e.message);
				});
@leapmotiondev

This comment has been minimized.

Copy link
Author

commented Mar 9, 2019

I just compared the icon ids on teamspeak by hovering over those which aren't working and those that are.
And indeed, the ones that aren't working exceed the limit of a int32, therefore setting them as iconid of a channel fails. It has something to do with the return of "convert error". There must be something wrong while updating/converting the icon id back to what teamspeak3 expects.

@Multivit4min

This comment has been minimized.

Copy link
Owner

commented Mar 9, 2019

alright i might get what is wrong, "channel_icon_id" requires a crc32 which is an unsigned int (so only a positive number) however teamspeak internally converts it in the permissions to a signed int (might get converted into a negative number in some cases)

so it will work when using channel.setPerm("i_icon_id", icon_id, true) but the channel edit wants it as valid crc32 name

The iconid which you receive from the getChannelGroupById is exact the response it would give when executed manually within a telnet client

image

so if you want to convert the number you get into a valid unsigned value you would need to do it like that

.channelEdit(obj['_propcache']['cid'], {
  channel_icon_id: icon_id & 0xFFFFFFFF
})

oor use the other example from above to set permissions directly

@Multivit4min

This comment has been minimized.

Copy link
Owner

commented Mar 9, 2019

Here is a perfect example where you can see how it converts them between a negative and a positive value
image

however the fun part is that channelinfo also returns the converted signed int
image

@leapmotiondev

This comment has been minimized.

Copy link
Author

commented Mar 9, 2019

The second you answered, I made it set the permission and it worked.
That's a good info to know cuz I don't like the gibberish teamspeak 3 does sometimes with weird values and all that.

It's solved!

@Multivit4min

This comment has been minimized.

Copy link
Owner

commented Mar 9, 2019

@leapmotiondev

This comment has been minimized.

Copy link
Author

commented Apr 18, 2019

Looks like they fixed it in 3.8.0 beta,

Changelog:

=== Server Release 3.8.0 20 May 2019

Important: This releases requires GNU C library (glibc) 2.17 or later on Linux. If 
           you need to check which version of glibc is installed on your system, You 
           can use `ldd -version`, which usually comes with any glibc installation.
Important: Client badge information is now signed to prevent using fake data. Badges 
           in the old format will not be visible on this server. New clients with 
           support for signed badges will be available soon.

Added: The query command "banlist" now supports pagination parameters. Please refer 
       to the ServerQuery documentation for details.
Added: Temporary passwords are now saved in the database and will load on start.
Added: New command line parameters 'daemon' and 'pid_file'. This makes it possible 
       for the Server to start as a deamon.

Changed: The restart parameter in startscript now allows to use more than one start 
         parameter.
Changed: New server logs are no longer created with a BOM.
Changed: Icons set in Server or Channel will not be negative values any longer when 
         requested in ServerQuery.
Changed: In query commands 'clientlist -ip' and 'clientinfo -ip' the IPv6 of a client 
         won't show brackets any longer.
Changed: Max size of text messages has been increased to improve usability for upcoming
         client releases.

Fixed: In some rare case the server did crash when shutting down a virtual server.
Fixed: The restart parameter in startscript could not be used when performed outside 
       the server directory.
Fixed: Server did send can create channels to the weblist in cases where a client could 
       not create any channel.
Fixed: No more 'Error querying client connection info: 1796' messages in the client log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.